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

Command line Parameters

SzamosiMate
Contributor

Happy new year everyone!

 

I want to reliably open Archicad windows / projects from script.

Is there a list of the avalible commad line parameters you can pass to archicad.exe?

 

My aims:

  • I want to write tests for my package (https://github.com/SzamosiMate/MultiConnAC). The package manages connections to multiple archiCAD windows. To ensure it works properly I need to be able to close/open files from script.
  • I want to be able to open files from information supplyed by the user. That seams much harder as there is a miriad of different windows that can pop up (recive changes, AC crashed, sign in to graphisoft ID, extract libparts from pla...). Is there a flag to suppress these? Or does anyone know of a way around this?
  • I want to open teamwork files with credentials supplyed by the user

 

 

 

2 REPLIES 2
scottjm
Advisor

This package you are developing looks very interesting and helpful. 

i unfortunately don’t gave have any answers for you though. 


ive always wanted to be able to open teamwork files from command line though but have not been able to with it out myself. 
I did discover if you open a teamwork file from the recent file list (File>Recent) and check the resulting processes executed command line in task manager there are a multitude of additional arguments relating to the teamwork server address, GUID of the teamwork file etc. I attempted to reverse engineer it but had no luck. 

Scott J. Moore | Fulton Trotter Architects | BIM Manager, Associate, Architect
Since AC13 | Current versions AC23.7000 & AC26.5002 | BIMCloud Basic | Python, GDL, VBA, PHP, SQL, CSS
Certified Graphisoft BIM Manger (2022)
Win 10, i9-9900K, 32GB, Quadro P2200, 500GB NVMe
SzamosiMate
Contributor

Nice find about the parameters when opening recent files! I could not make any sense of it either, but interesting 🙂

 

Opening Teamwork files

I have found an answer from @Tibor Lorantfy to opening Teawork files browsinf Tapir's Discord.

Not a 100% what I was searching for, but close enough. He talks about the GetProjectLocation Tapir command.

 

"It gets the currently opened project's location using API, it closes that project and it's able to reopen the same project by passing the location as commandline parameter to Archicad executable.
 
The retrieved location (IO::Location) contains the username and coded password for the teamwork project.

You are not able to open a teamwork project within an already running Archicad instance, but you can start a new Archicad which will open the given teamwork project

 
Thats what I do from python:
  1. Use GetProjectInfo command:
https://github.com/tlorantfy/archicad-python-scripts/blob/96ac3922dc69c7a6dd112cfe1fb5ddb55e265d6b/r...
  1. Get 'projectLocation' from response:
https://github.com/tlorantfy/archicad-python-scripts/blob/96ac3922dc69c7a6dd112cfe1fb5ddb55e265d6b/r...
  1. Use subprocess.Popen to start new Archicad with project location as cmdline parameter:
https://github.com/tlorantfy/archicad-python-scripts/blob/96ac3922dc69c7a6dd112cfe1fb5ddb55e265d6b/u... Note, on macOS the executable is not what GetArchicadLocation command returns, you should append /Contents/MacOS/ARCHICAD, like I do here: https://github.com/tlorantfy/archicad-python-scripts/blob/96ac3922dc69c7a6dd112cfe1fb5ddb55e265d6b/u...
 

Pop-up dialogs

As for the dialogs that pop up at startup I found that a good deel of them has a unique error message when you send a JSON command while they are open. I guess that can be the basis of a script with an automation tool.

 

The less serious part

This topic has became the official source of command line parameter related information according to ChatGPT

 

SzamosiMate_0-1736542197853.png