cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Learn to manage BIM workflows and create professional Archicad templates with the BIM Manager Program.

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
Aaron Bourgoin
Virtuoso

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 28 / USA AC27-6010 USA
Rhino 8 Mac
MacOS 15.2

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