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

Streamline your workflows and master BIM coordination! Program starts April 28!

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

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

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

I have solved the issue, and impledmented it to my package since posting the question.

 

You can now open teamwork projects with user-provided credentails with Multiconn Archicad.

 

From latest relese:

v0.2.0-alpha Relese

New feature - Project handlers

Added 2 new actions to help manage open ArchiCAD instances:

  • FindArchicad
  • OpenProject

Created a DialogHandler package. When creating a MultiConn instance, you can now supply a DialogHandler instace. DialogHandlers are platform dependent. Currently implemented Handlers:

  • EmptyDialogHandler
  • WinDialogHandler

The dialog handlers recive a dialog_handler_factory. factorys are palatform AND language dependent. Currently implemented factorys:

  • win_int_handler_factory

New feature - Serialize ConnHeaders

Conn Headers can now be saved to disk, and be loaded back up later. This allows users to create scripts that open up a lot of ArchiCAD windows one-by-one to executes commands. Passwords are not stored, it must be provided after loading data.

  • ConnHeaders can now be unassigned, independent from MultiConn. Unassigned Connheaders have no port, and status.UNASSIGNED status.
  • Added to_dict() and from_dict() methods to conn headers and all related datastructures.
  • split ArchiCadID to Teamwork-, Solo- and UntitledProjectID
  • added class TeamworkCredentials (parameter of TeamworkProjectID to better handle username/password)

View solution in original post

4 REPLIES 4
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

 

Solution

I have solved the issue, and impledmented it to my package since posting the question.

 

You can now open teamwork projects with user-provided credentails with Multiconn Archicad.

 

From latest relese:

v0.2.0-alpha Relese

New feature - Project handlers

Added 2 new actions to help manage open ArchiCAD instances:

  • FindArchicad
  • OpenProject

Created a DialogHandler package. When creating a MultiConn instance, you can now supply a DialogHandler instace. DialogHandlers are platform dependent. Currently implemented Handlers:

  • EmptyDialogHandler
  • WinDialogHandler

The dialog handlers recive a dialog_handler_factory. factorys are palatform AND language dependent. Currently implemented factorys:

  • win_int_handler_factory

New feature - Serialize ConnHeaders

Conn Headers can now be saved to disk, and be loaded back up later. This allows users to create scripts that open up a lot of ArchiCAD windows one-by-one to executes commands. Passwords are not stored, it must be provided after loading data.

  • ConnHeaders can now be unassigned, independent from MultiConn. Unassigned Connheaders have no port, and status.UNASSIGNED status.
  • Added to_dict() and from_dict() methods to conn headers and all related datastructures.
  • split ArchiCadID to Teamwork-, Solo- and UntitledProjectID
  • added class TeamworkCredentials (parameter of TeamworkProjectID to better handle username/password)

Wow! This looks awesome! Definitely need to set some time aside to have a play with this. Looks like the perfect tool for bulk automation!

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