2023-10-25 04:00 PM - last edited on 2024-09-26 12:18 PM by Doreena Deng
Hi, I'm trying to set up a workflow using Python in Archicad, similar to something I did in Revit. However, I need some guidance on Python in Archicad, since my questions are not answered by the documentation.
My workflow is as follows:
Step 2 is working as expected, but I cannot work out how to handle user input (1) and how to draw the lines or draw the points (3).
Can someone help me? Or lead me to the right documentation?
Thank you!
Solved! Go to Solution.
2023-11-04 09:20 AM
Hi en1,
What do you mean with "address" in your first and second point? Do you mean an element GUID or something else?
About point 3: I assume you mean drawing lines in Archicad? Unfortunately there is no direct way to create any elements in Archicad with the Python API. So no lines or points either. The only way I know of is by creating an Add-On which would enable such commands to the Python API (See these two projects for how to create such an Add-On: https://github.com/tlorantfy/archicad-additional-json-commands and https://github.com/tlorantfy/archicad-additional-json-commands)
Best,
Berntd
2023-11-04 09:20 AM
Hi en1,
What do you mean with "address" in your first and second point? Do you mean an element GUID or something else?
About point 3: I assume you mean drawing lines in Archicad? Unfortunately there is no direct way to create any elements in Archicad with the Python API. So no lines or points either. The only way I know of is by creating an Add-On which would enable such commands to the Python API (See these two projects for how to create such an Add-On: https://github.com/tlorantfy/archicad-additional-json-commands and https://github.com/tlorantfy/archicad-additional-json-commands)
Best,
Berntd
2023-11-06 09:10 AM
Hi Bernd,
Thank you for the reply.
By an "address", I mean a physical address which consists of a street, a housenumber and a postal code.
Thank you for the pointers to the Add-On, I was unsure if it could be done with solely the Python API.
Kind regards
2023-11-06 10:40 AM
Hi en,
Thanks for clarifying! So the 1st point doesn't necessary have to be connected to Archicad.
Anyway you can't really make GUIs with the Archicad Python API. So you'd have to look into something like tkinter or some other GUI framework to create the user input.
Best,
Bernd
2023-11-08 09:55 AM
Thank you for the help Bernd.
Is it possible to read and write files in the (embedded) library using Python? Then I can create a workaround using GDL instead of creating an Add-On.
2023-11-08 03:08 PM
Unfortunately that's also not possible directly with the Python API.