We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
‎2023-03-16 01:22 PM - last edited on ‎2024-09-26 12:11 PM by Doreena Deng
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!
Solved! Go to Solution.
‎2023-03-18 04:19 AM
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
‎2023-03-17 01:47 PM
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.
‎2023-03-17 03:23 PM
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)
‎2023-03-17 03:29 PM
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)
‎2023-03-17 03:32 PM
Hi! Mathias, Thank you very much. Here is the code
‎2023-03-17 03:34 PM
‎2023-03-17 07:01 PM
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.
‎2023-03-17 07:04 PM
Hi Gerry! Thank a lot! 🙂
‎2023-03-17 08:33 PM
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
‎2023-03-17 09:07 PM
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