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.

Automatic file conversion

RapidImages
Participant

Hi,

 

We are setting up a file conversion service and would like to support Archicad file format. 
 
I would like to set up a service that opens a .dwg file and saves it as .pln. Preferably, I would call Archicad from the command line with the input and output files as arguments. However, if it is possible to start Archicad with a script, from command line, that opens and re-saves a file it would also be a viable option.
 
As I have not been able to find an existing solution to the issue, I have been looking at the documentation, and examples, for scripting AC with python. 
 
It seems straight forward to 
1. open a connection
2. open a file
3. save the file  
 
However, when running the script from VS code, as suggested in the article, I am unable to connect without specifying a port number to connect to

 

 

from Archicad import ACConnection

# create connection
conn = ACConnection.connect()
assert conn

acc = conn.commands
act = conn.types
acu = conn.utilities

# open file 
acc.OpenFile(r"C:\temp\box1.dwg")​

 

 

 

python "C:\temp\export.py"
Traceback (most recent call last):
  File "C:\temp\export.py", line 10, in <module>
    conn = ACConnection.connect()
TypeError: connect() missing 1 required positional argument: 'port'

 

 

 

Furthermore, when running it from the 'Python palette' inside AC it does not find the open file command from 
http://archicadapi.graphisoft.com/archicadPythonPackage/Archicad.releases.ac24.html

 
Is there a way to adjust the script to work from command line, and add the saving of the file?
 
Thank you in advance
0 REPLIES 0