We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Getting all property values of type 'Door' from Archicad 26 project (python)

noriksaroyan
Booster

Hi everyone! I'm new to both python and archicad API and I'm having troubles with retrieving property values of certain elements(doors, in this case). I would appreciate a little help.

I'm using archicad26 with python 3.8.9. The code I'm using is attached below

 

P.S. By saying properties i mean height, width, type(single-leaf, double-leaf, sliding, and revolving doors), thickness, material(leaf and frame: for example, wood, glass, metal), оperation(swing direction, pivot point  and rotation angle), Hardware(placement of glazing). 

 

Thanks in advance! 


Screenshot 2023-03-16 at 15.20.29.png

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

In reference to including properties in a Json file: I have included an example for anyone interested. It is really just a couple of lines. i did not brother to include all the properties mentioned, I'll leave that to you, as I think there are enough examples out there. I just picked a few from the previous examples. Note that Graphisoft's data availability is so 'screwy' that finding all of the properties is always a chore.

 

Basically one creates a Python dictionary and then converts that to a Json file which is just a one line function. Note that only the standard units can be converted (strings,int,float,arrays,bools, etc.). See the documentation.

This bring up a problem in that, some properties in Archicad return a object not a standard unit. One would have to iterate to the standard unit in those cases. That is why I just converted all the responses to a string-- see the example. If this would not be acceptable, then you would have to dig deeper.

BTW  -- a better route might be to just create a schedule and then dump it to a excel file in Archicad

 

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

View solution in original post

11 REPLIES 11
poco2013
Mentor

Not sure why you need ALL parameters for doors? There are over 170 'normal' parameters for doors and a additional number of 'special' parameters. List all of those parameters is very complicate as each has its own listing format which would make the script long and complicated Better to just list the ones you need and use the standard recover functions. .

I have attached a script to list all the parameters which have a normal status. Looking at that script should get you started.

 

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Hi Gerry!

Thank you very much for your script. I tried to modify it to include only selected properties, but I might be doing some mistakes. Can you please help? Thank you very much. (attached screenshot)


Screenshot 2023-03-17 at 14.16.38.png

I think there is at least a comma at the end of your "propertyIds" thaht should'nt be here. I'm not sure that this is the only problem.

 

(You should share the code and not a screenshot to help to debug it)

Hi! Mathias, Thank you very much. Here is the code

Now with the file..

Line 38 is incorrect since you already defined the property Ids. Delete this section and just set

propIds = propertyIds ---  see attached The function getpropertyIds does not take a element(s) (improper usage)

 

Delete everything after line 69 --- not needed.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

Hi Gerry! Thank a lot! 🙂

Sorry, my bad in describing the problem. I need to open a request to manufacturers after getting the attributes of the doors.

For instance: we have a wooden door, 2,2 meters height and 1.2 meters width. I need to retrieve all these attributes and then I have to insert it to Json file, so I need to get those properties separate(width=1.2 length=2,2, material="Wood") to map it into an object and then convert those objects into a json file

I'm encountering these errors while running your code: 

 

Property definition not found by localized name (groupName: "Calculation data", name : "Doors - frame length

Property definition not found by localized name (groupName: "Calculation data", name : "Doors - interior casing volume
Property definition not found by localized name (groupName: "Calculation data", name : "Doors - exterior casing volume
Property definition not found by localized name (groupName: "Calculation data", name : "Doors - frame area