2024-01-29 02:44 PM - last edited on 2024-09-26 12:17 PM by Doreena Deng
Hi All,
i wrote a script to change the layer-values of elements in the model.
But i got the result
FailedExecutionResult {'success': False, 'error': {'code': 6800, 'message': 'Value of property definition is read-only (property definition guid: "812CD483-40FB-4E75-966F-E76C3E68B9F7")'}}
for every element.
What is wrong?
Thanks in advance
# get list with Element-Layers
#create list with new values
TestValue = "10 WAND - innen.Wand"
NewPropertyValues = []
for i in range(len(elements)) :
NewPropertyValues.append(act.ElementPropertyValue(elements[i].elementId,propertyId,act.NormalStringPropertyValue(TestValue)))
# sent changes to Archicad
result = acc.SetPropertyValuesOfElements(NewPropertyValues)
print(result)
2024-01-29 07:47 PM
Hi smathiebe,
As far as I know, currently you can only check the layer name (property value) of an element and use it as one condition inside a script to delimit a group of elements, for example.
But moving an element completely to another layer is unfortunately not possible with the python API. This is why the script returns a "Value of property definition is read-only" -error.
-JT
2024-01-29 10:15 PM
FYI: a layer is a fundamental built in property, created by Graphisoft, which controls a attribute of the plan. It is hard coded by Archicad which is why it is read only (at least at this time?). However, you can change the layer through the API function: ACAPI_Element_Change( ). You can also reach and program this function from a Python script by using the Python function ExecuteAddOnCommand and passing the appropriate parameters. But this would also involve creating and installing the relative specific AddOn. The developer's Kit has examples for both the interface and Element Change.