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

change element property values using python API

Biniyam
Participant

Hello everyone, I have extracted property values of elements using python API.  I made some changes on both numeric and non-numeric values, and now I want to insert new modified element property values back to the elements in archicad. I would appriciate it very much if there is any advise on how to do it, if possible,  using python API. 

 

Biniyam

5 REPLIES 5

Hi Biniyam,

 

I think the function SetPropertyValuesOfElements would do what you need.

 

Best, Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

Thank you BerndSchwarzenbacher,

I was able to modify some properties and insert them back to the model. Is there any way to creat new element in archicad using python Api? I was wandering if i could use the extracted property values in the new element?  

Unfortunately it's not possible to create new elements with the Python API out of the box. You'll need to employ some Add-On similar to this: https://github.com/tlorantfy/archicad-additional-json-commands This one has functions to create slabs and columns that you can use. For other elements you would need to adapt the Add-On.

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
LINKArno
Participant

Thank you! Does the python API has functionalies to extract dimentions of an element? or alternatively the x,y,z coordinates of a line, box or any element? The bounding boxes command is not that helpful for my purpose. Is there any logic or method in python API to extract model's geometry? 

There are some built in properties which should give you some geometry information about elements.
You can run code like the following to see all available properties:

from archicad import ACConnection

conn = ACConnection.connect()
acc = conn.commands

propertyNames = acc.GetAllPropertyNames()
for propName in propertyNames:
    print(propName)

Typically you get stuff like height offsets, thickness, length etc. But I couldn't see anything giving x,y locations.

Hope that helps

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com