We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
on 2021-01-06 03:51 PM - edited on 2023-05-15 05:15 PM by Emoke Csikos
If you've ever spent hours doing repetitive tasks - like assigning numbers to parking spaces one-by-one, finding any unused items in the View Map, or editing each element ID due to multiplying - you know how tedious and error-prone these tasks can be. What if we could have those tasks automatically done?
In Archicad 24, we release the Archicad - Python connection add-on to the public as an experimental feature. With Python, such tasks can be done fast, automatically, and precisely. Python offers excellent readability and approachable syntax, similar to plain English.
If you do not know the Python language, fear not! You will still be able to enjoy the benefits of Python. At the moment, there are some example scripts available at https://graphisoft.com/downloads/python.
Archicad - Python Connection requires only the installed Python environment (version 3.7 or above) and a running Archicad instance (version 24 or above).
There are various methods to install Python. The easiest way is to download the latest Python version directly from here and run the installer. We recommend installing with the default options.
Although we can run a Python script without Archicad, the Python Palette will provide a more user-friendly way to manage and run the scripts. To open it, the Python Palette Experimental Feature must be enabled via the Work Environment dialog.
|
The Python Palette will notify you if something is missing from your computer. If Python is not installed, then the Install Python button will open Python's official web page for downloading the latest version of Python.
|
|
If the Archicad - Python connection is not yet installed, the Install Connection button automatically installs the missing package. |
Once the connection with Python is made, we are ready to run some scripts via the Python Palette.
To know which version of the Python environment is being used, click the button. The button will let us choose different versions if we have more than one installed.
The Python Palette contains some basic functions to manage and run Python scripts.
It can show the scripts stored in multiple places on your computer. Click the button to add a folder. The palette will list all runnable scripts inside the main folder (it cannot look into any sub-folder).
The button will refresh the list: the palette will check if there is any new script in the added folders, or if a script is moved/deleted.
While a folder is selected, clicking will remove it from the palette. A dialog appears to confirm the action.
To run a script in the Python Palette, you can either
The events will be shown one by one at the Console field of the palette. Once the process is finished, the palette will present the result with notification of whether the script ran successfully or not.
If the script makes changes that are not undoable in Archicad (for example, moving or renaming items on View Map of the Navigator), we will not be able to undo those changes.
Chair numbering
We usually use the Multiply tool to arrange the chairs inside an area (i.e., auditorium). However, when the chairs are multiplied, the original object's element ID is also transferred to all new objects. To quickly re-number them by changing the element ID, we created a demo script called Chair numbering.
When the script is executed, the IDs of all objects classified as Chair placed in all stories will be modified. Hidden objects are not affected by this.
The following requirements must be met to execute the script successfully without any customization:
The script uses the Z coordinates of the objects to identify the rows. By default, chairs are grouped into rows if the maximum difference between the Z coordinates of the chairs in the same row is less than 0.25m.
To learn more about customization options, please follow the attached PDF guide inside the downloaded package.
Move unused items in View Map
The following requirements must be met to execute the script successfully without any customization:
This script does not require anything from the currently opened Archicad project.
Please note that we can use the Archicad Python API without the Python Palette. If you already have the Archicad pypi package (Python Wrapper) installed, then you can execute your python script anywhere (in Terminal or in your favorite integrated development environment, for example, in Visual Studio Code).