From the Graphisoft Instructions:
The Python installation is installed per the normal installation Must be 3.7.? -- not within Graphisoft's directories. The addon is pythonsnippits.apx and added to the addon folder. Remember to set the Path variable to the Python folder. See Below.
Python API
Python API is an Add-On, which can be run inside ARCHICAD. It implements a python wrapper for the existing C/C++ API.
Please note the current state is experimental, this may change in the future. The final choice depends on the real user requirements.
This Add-On provides a palette to run external python scripts and implements an interactive Python console with built-in functions to operate ARCHICAD. The Python Palette can be opened from the Window/Palettes menu.
Each type and function displayed in this documentation is part of the GS module, but the Interpreter automatically imports everything from this module upon startup.
Installation
Step-by-step guide to install Python API Add-On
Python 3.7 must be installed to your machine. ARCHICAD searches for python at your computer. On macOS it searchs at the following fixed path: /Library/Frameworks/Python.framework/Versions. On Windows platform it uses PATH environment variable, so please add the path to the installed python to your PATH environment variable.
You can download Python installer for free from the official site of Python:
Download Python 3.7 installer for macOS:
https://www.python.org/ftp/python/3.7.3/python-3.7.3-macosx10.9.pkg
Download Python 3.7 installer for Windows:
https://www.python.org/ftp/python/3.7.3/python-3.7.3-amd64.exe
Place the PythonSnippets Add-On into the Add-Ons folder next to the ARCHICAD application. This way ARCHICAD will automatically load it upon startup.
Setup Example Scripts
The example scripts can be found inside the PythonSnippets folder.
Copy this folder to your user's Documents folder to make all of those example scripts visible inside ARCHICAD in the Script List.
How To Use
The palette that contains both the Interactive Console and the Script List can be opened through Palettes menu.
The Script List shows the external python scripts (files with .py extension) from the folder named PythonSnippets inside the actual users Documents folder. Of course scripts can be used from any other directory using the Browse button.
By double clicking on a script in the Script List or clicking "Run Selected" button the selected external python script will be executed.
Type single python command into the Interactive Console and press Enter button to execute it.
Errors and the output will be printed to the Interactive Console.
Note, the sys.argv is always filled by the interpreter:
The value of sys.argv[0] is the location of the executed script file.
The value of sys.argv[1] is the location of the PythonSnippets Add-On.
import os
import sys
scriptDir = os.path.dirname (sys.argv[0])
addOnDir = os.path.dirname (sys.argv[1])
Gerry
Windows 11 - Visual Studio 2022; ArchiCAD 27