We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-04-27 08:57 AM - last edited on 2024-09-26 12:20 PM by Doreena Deng
Hello,
is somehow possible to get/set gdl parameters of an object using Python?
Specifically, I am trying to set Zones, deep parameters from a localised object (German).
thank you
2023-04-27 08:40 PM
The present Python API can not address GDL parameters. Since, it appears that Python development has been put on 'hold' --( correct me if I am wrong ) -- it is not known if this requested feature will ever be added.
However the C++API can address GDL parameters - see the Element_Test example in the developers examples. Therefore, using the ExecuteCommand function in Python, one can communicate with a AddOn to get this information, assuming the AddOn has been properly configured to receive the request.
I have created such a Addon, and a Python example script -- if interested. Because of the lack of interest, it has not been thoroughly tested, but i offer it here. Used at your own risk and be sure to test it first.
The AddOn runs only on Windows OS, and Archicad 26 with Python 2.7 and above and the latest Python API. It returns only a single selected object, but the script could be revised as needed.
I believe the script is self explanatory but leave any comments or questions here.
2023-04-28 06:07 AM
Grazie Gerry,
I am ever thankful for all your input and work. Yes, I am definitely interested and please let me know how can reward your kindness.
I fail to understand how can Python be put on hold.
What can be more important than allowing automatisation? In the age of "BIM"?
2023-05-22 01:46 PM - last edited on 2023-05-22 11:34 PM by Laszlo Nagy
Dear Gerry,
I have created a python code to change the GDL parameter for all Zones at once.
the problem is, it takes time to load the Addon for each change. Is there a way to load the Addon one time and change all the values at once?
a building with around 200 zones takes very long time to excute the Addon for each zone.
Here is the Code:
from archicad import ACConnection
conn = ACConnection.connect()
acc = conn.commands
act = conn.types
acu = conn.utilities
# get all zones
elements = acc.GetElementsByType('Zone')
# set all values of GDL parameter to "Test"
parameter_GDL = "Test"
for index,element in enumerate(elements):
obj_GUID = str(element.elementId.guid)
print (obj_GUID)
parameters = {}
parameters["command"] = "ChangeLibPart"
parameters["inParams"] = [obj_GUID,'GDLparameter',parameter_GDL]
response = acc.ExecuteAddOnCommand(act.AddOnCommandId('AdditionalJSONCommands','LibPart'),parameters)
2023-05-22 05:53 PM
Yes. Python is quite slow. But in this instance, 200 iterations is not significant. The problem is on the C++ end, in the manner in which Graphisoft organizes their database. AFAIK-- to find a zone, Graphisoft iterates through all objects (zones) than iterates through all parameters of those objects. Plus the call(s) through a port can be slow depending on what the computer is doing at the time.
I assume. therefore, that the process could be sped up by passing all of the zone ids at once and revising the AddOn to accept those commands "in mass". But there would be so many variations, that I doubt if there would be that much demand to do so.
I believe Graphisoft is now reviewing its C++API, so a more direct method of searching through Objects would be helpful. You may want to contact Graphisoft directly, but as I understand, they are probably going to deprecate Python or, at least, put it on the back burner for some time,--- so good luck with that.
2023-07-06 12:09 PM
Hi Poco,
I sent you a message on Discord relating to get/set GDL parameters. I comprehend that python API cannot directly address GDL parameters. I have placed requests with Archiframe and soon with Eptar to push Graphisoft for more access to Archicad Library parameters. I want to be able to map GDL parameters to Archicad properties so that I can utilise them in the expression editor before mapping them for export to IFC and then for use is NovaBIM. I am going to contact my good mate Kristian Bursell at Cadswift to review the work you have already undertaken with the LibPart to see if we can push the progression of your API. Thank you very much for your dedication working out and implementing API add-ons and python. I would be happy if you have time to do a screenshare with you to help in any way I can to push this forward.
2023-07-06 02:48 PM
Basically i am trying to expand the Python API as it is much easier to work with than the C++ compile route. Since it appears now that Graphisoft will deprecate the Python API and stay with C++, this may be futile. In, my LibPart AddOn, it just copies the DevKit example to transfer the GDL parameters to a Python script. In the reverse direction, it easy enough to change the parameter values by essentially using the same code in reverse. Does not work for Arrays.
Note, that I recently had a hard disk failure and lost all of my 26 AddOns including LibPart. So just moved on to 27. I will assist in any way I can, but without Graphisoft support, not much is possible in this area. And Graphisoft seems determined not to provide support?
2023-07-06 03:04 PM
Gerry,
Like my response on Discord, I am learning python and C++ so when I am more confident, if possible I will lend a hand. Many levels of government here, especially Victoria, Australia are pushing for implementation of OpenBIM digital delivery of all forms of infrastructure from transport, industrial and residential. There is a lack of labour across Australia and we have to become as efficient as possible to head of a housing crisis.
2023-07-06 03:38 PM
This is just crazy.
How can Python for AC be deprecated?
Given that this application is very agreeable for generating plans and sections, anything else is just all too error prone. Let's not speak about index and names of attributes, it's insane. How can this be around in this form?
Above all, a true BIM project with extensive semantic to be kept in sync across multiple files is just insanely repetitive, without any facility to store sets of properties in form of styles/families/types, call them as you want AND no automatisation.
Does Graphisoft have something else brewing up? Looking at the roadmap it doesn't seem so.
I can't recommend Archicad for anything larger than one file. It isn't efficient, not by far.
2023-07-06 09:12 PM
Graphisoft has been repeatably asked about the future of the Python API by myself and others. They always dodge the question, just saying that they are exploring other languages now. And that they are not going to abandon the C++ API. I think this is a dodge to say they intend to do nothing. The last thing we need in Archicad is another language to worry about and less access to the data More complaints need be registered with Management about this..