BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad Python API
About automating tasks in Archicad using the Python API.

running Python code externally on multiple opened Archicad files

Ady84a
Booster

Hello everyone,

 

When I have more than one Archicad file open, and I run the python code externally (not in the Python Palette inside Archicad) the code runs on the first file I opened. 

How can I run the code in another opened file? Is there a way in python API to list the opened Archicad files, so that I open my python program externally and then choose in which file the python code runs?

 

best regards

3 REPLIES 3

Question for Graphisoft:  is this due to the same bit of software design that opens a Grasshopper connection on the first AC session opened which may not be the session I want to run the Grasshopper connection in? It sounds eerily similar and both issues need to be fixed.

Think Like a Spec Writer
AC4.55 through 27 / USA AC27-4060 USA
Rhino 8 Mac
MacOS 14.2.1

FYI --- For two running instances of Archicad, Archicad will use separate ports,

 

Set the port for your script manually as in:

conn = ACConnection.connect( 19723 )

 

I believe ports are assigned serially from 19723 - 19744 but another application could take a port # 

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

BTW--- in the Python Palette, if you click on the info icon, it will list the port that the present instance of Archicad is using.

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Learn and get certified!