GRAPHISOFT®

Python APIVersion: 0.23 Beta

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 not be the final solution. 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 builtin 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

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:

import os
import sys
scriptDir = os.path.dirname (sys.argv[0])
addOnDir = os.path.dirname (sys.argv[1])

Functions

Types