<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Automatic file conversion in Archicad Python API</title>
    <link>https://community.graphisoft.com/t5/Archicad-Python-API/Automatic-file-conversion/m-p/320422#M839</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;We are setting up a file conversion service and would like to support Archicad file format.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would&amp;nbsp;like&amp;nbsp;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.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;As I have not been&amp;nbsp;able to find an existing solution to the issue, I have been looking at the documentation, and examples, for scripting AC with python.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;From the example at :&amp;nbsp;&lt;BR /&gt;&lt;A href="https://archicadapi.graphisoft.com/getting-started-with-Archicad-python-connection" target="_blank" rel="noopener noreferrer"&gt;https://archicadapi.graphisoft.com/getting-started-with-Archicad-python-connection&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;It seems straight forward to&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. open a connection&lt;/DIV&gt;&lt;DIV&gt;2. open a file&lt;/DIV&gt;&lt;DIV&gt;3. save the file&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;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&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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")​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;python "C:\temp\export.py"
Traceback (most recent call last):
  File "C:\temp\export.py", line 10, in &amp;lt;module&amp;gt;
    conn = ACConnection.connect()
TypeError: connect() missing 1 required positional argument: 'port'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Furthermore, when running it from the 'Python palette' inside AC it does not find the open file command from&amp;nbsp;&lt;BR /&gt;&lt;A href="http://archicadapi.graphisoft.com/archicadPythonPackage/Archicad.releases.ac24.html" target="_blank" rel="noopener noreferrer"&gt;http://archicadapi.graphisoft.com/archicadPythonPackage/Archicad.releases.ac24.html&lt;/A&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there a way to adjust the script to work from command line, and add the saving of the file?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you in advance&lt;/DIV&gt;</description>
    <pubDate>Wed, 10 Nov 2021 11:38:46 GMT</pubDate>
    <dc:creator>RapidImages</dc:creator>
    <dc:date>2021-11-10T11:38:46Z</dc:date>
    <item>
      <title>Automatic file conversion</title>
      <link>https://community.graphisoft.com/t5/Archicad-Python-API/Automatic-file-conversion/m-p/320422#M839</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;We are setting up a file conversion service and would like to support Archicad file format.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would&amp;nbsp;like&amp;nbsp;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.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;As I have not been&amp;nbsp;able to find an existing solution to the issue, I have been looking at the documentation, and examples, for scripting AC with python.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;From the example at :&amp;nbsp;&lt;BR /&gt;&lt;A href="https://archicadapi.graphisoft.com/getting-started-with-Archicad-python-connection" target="_blank" rel="noopener noreferrer"&gt;https://archicadapi.graphisoft.com/getting-started-with-Archicad-python-connection&lt;/A&gt;&lt;/DIV&gt;&lt;DIV&gt;It seems straight forward to&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. open a connection&lt;/DIV&gt;&lt;DIV&gt;2. open a file&lt;/DIV&gt;&lt;DIV&gt;3. save the file&amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;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&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;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")​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;python "C:\temp\export.py"
Traceback (most recent call last):
  File "C:\temp\export.py", line 10, in &amp;lt;module&amp;gt;
    conn = ACConnection.connect()
TypeError: connect() missing 1 required positional argument: 'port'&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Furthermore, when running it from the 'Python palette' inside AC it does not find the open file command from&amp;nbsp;&lt;BR /&gt;&lt;A href="http://archicadapi.graphisoft.com/archicadPythonPackage/Archicad.releases.ac24.html" target="_blank" rel="noopener noreferrer"&gt;http://archicadapi.graphisoft.com/archicadPythonPackage/Archicad.releases.ac24.html&lt;/A&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Is there a way to adjust the script to work from command line, and add the saving of the file?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you in advance&lt;/DIV&gt;</description>
      <pubDate>Wed, 10 Nov 2021 11:38:46 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-Python-API/Automatic-file-conversion/m-p/320422#M839</guid>
      <dc:creator>RapidImages</dc:creator>
      <dc:date>2021-11-10T11:38:46Z</dc:date>
    </item>
  </channel>
</rss>

