We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2022-01-19 08:56 AM
Dear community,
I have (I imagine) a very simple issue that I am trying to resolve in python. I am trying to select for example all walls which have composite structure type, and then change id of each wall to the name of the composite which is assigned to that wall.
I managed to select
2022-01-20 12:43 AM
Changing the "element ID" is fairly straight forward in Python. It involves getting the property ID, the Guid of the element to be changed and then using:
acc.GetBuiltInPropertyId('General_ElementId) to get the property identifiers,
acc.SetPropertyValuesOfElements(Array) to reset the value of the ID's.
All of this is explained in the python API documentation referenced on their pypi site:
Unfortunately, the Python API does not presently have access to the Wall element Composite Names, so using that to Alter the ID's is not possible now with just Python.
However I have extended Python's access to allow this through a AddOn that uses the Execute Command Handler Function . The AddOn permits access to the AutoText properties of the element, which in this case, would be "Composite Structure". Relatively straightforward and just adds a additional step or so to a short Python Script. You would also have to add the logic to select only composite Walls
I Demo the procedure(s) in a YouTube video(s) if your interested.
I believe the procedure is self explanatory, but if you have further questions, i can make an additional specific video.
However, i am guessing that it might be easier for you to just use the interactive schedules and perhaps Excel, all of which is explained in the Archicad help Documentation.
If you have any specific questions, just comment below. Good Luck.
2022-01-20 02:16 PM
python has access to the custom properties. so you can create a custom property for walls and select any type of data you want like structure type. then use this custom property in your python script and change the ID.
2022-01-22 12:41 PM - edited 2022-01-22 12:42 PM
Ady84a, thank you for your suggestion. This seems to be a usable workaround.
2022-01-22 12:42 PM
Thank you very much for the time and effort to explain the process. Also, after little reading and going through your youtube channel, it does seems to me that your addon expands the capability of native python significantly (bears the question of why it was not yet implemented by graphisoft).
I will give it a go, and post results here, maybe it will be useful to other users as well. I would like to see some beginner-oriented tutorials regarding python and Archicad, just to demonstrate what is possible, not necessarily going deep into python as a programming language.
Would it be possible to access composites via python and change their names for example? This could be useful in terms of sorting and name coding composites inside a file (which I personally leave to do at the end of the project). For example, one could sort composites based on the total thickness or something like that.
2023-05-01 01:44 PM
Hi Gerry, any chance you could make your video public? I am trying to do something similar - overwrite all Element IDs with a value of another property. I guess that video would be very helpful.
Thanks!