Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Changing Length with Python

Dayiz
Booster

Hello everyone,

 

I've been trying to edit walls with the Archicad Python Wrapper and i had success changing the 'General_Height'and 'General_Thickness' of a wall, but 'General_Length' appears to be a read-only property.

It appears as 'General_Width' is tied to 'General_Thickness' and is not the right parameter.

In my example projects the 'General_3DLength' corresponds to the actual length of the wall, but the property is read-only.

 

My question is: Is it possible to change the length of a wall or am i limited to Height and Thickness?

 

My Code (excuse my variable names):

 

from Archicad import ACConnection

conn = ACConnection.connect()
assert conn

acc = conn.commands
act = conn.types
acu = conn.utilities

singleWall = acc.GetElementsByType("Wall")

gHoheId = acu.GetBuiltInPropertyId("General_Height")
gBreiteId = acu.GetBuiltInPropertyId("General_Width")
g3DLangeId = acu.GetBuiltInPropertyId('General_3DLength')
gDickeId = acu.GetBuiltInPropertyId("General_Thickness")


wandHoheWert = act.NormalOrUserUndefinedPropertyValue('length', 'normal', 4.0)
wandBreiteWert = act.NormalOrUserUndefinedPropertyValue('length', 'normal', 4.0)
wand3DLangeWert = act.NormalOrUserUndefinedPropertyValue('length', 'normal', 4.0)
wandDickeWert = act.NormalOrUserUndefinedPropertyValue('length', 'normal', 4.0)
nH = act.ElementPropertyValue(singleWall[0].elementId, gHoheId, wandHoheWert)
nB = act.ElementPropertyValue(singleWall[0].elementId, gBreiteId, wandBreiteWert)
n3 = act.ElementPropertyValue(singleWall[0].elementId, g3DLangeId, wand3DLangeWert)
nD = act.ElementPropertyValue(singleWall[0].elementId, gDickeId, wandDickeWert)
rH = acc.SetPropertyValuesOfElements([nH])
rB = acc.SetPropertyValuesOfElements([nB])
rD = acc.SetPropertyValuesOfElements([nD])
r3 = acc.SetPropertyValuesOfElements([n3])
print(rH)
print(rB)
print(r3)
print(rD)

Console Output:

[SuccessfulExecutionResult {'success': True}]
[FailedExecutionResult {'success': False, 'error': {'code': 6800, 'message': 'Value of property definition is read-only (property definition guid: "3799B10A-61C5-4566-BF9C-EAA9CE49196E")'}}]
[FailedExecutionResult {'success': False, 'error': {'code': 6800, 'message': 'Value of property definition is read-only (property definition guid: "BA0E29BD-A795-4A93-A33F-C2C17B46C33A")'}}]
[SuccessfulExecutionResult {'success': True}]
 
Dear Regards
Dayiz
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
poco2013
Mentor

I believe that width and length are calculated values and can not be changed. Width refers to the set width of a composite or profile and would not make sense to change it. Length is the length of a wall as defined by its neig points Only the elements that these properties refer to can be changed through their info box(s) or the C++ API.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

View solution in original post

2 REPLIES 2
Solution
poco2013
Mentor

I believe that width and length are calculated values and can not be changed. Width refers to the set width of a composite or profile and would not make sense to change it. Length is the length of a wall as defined by its neig points Only the elements that these properties refer to can be changed through their info box(s) or the C++ API.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Thank you. I guess i will start studying C++ or find a work around 😄