cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad Python API
About automating tasks in Archicad using the Python API.
SOLVED!

Python lines and user input

en1
Contributor

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:

  1. user inputs an adress
  2. GET request using this adress to an API, which returns coordinates
  3. draw lines between the coordinates, or at least plot the points using the coordinates

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

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

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

View solution in original post

5 REPLIES 5
Solution

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

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
en1
Contributor

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

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

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com
en1
Contributor

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.

Unfortunately that's also not possible directly with the Python API.

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com