Run and share scripts with the Tapir palette¶
The Tapir palette lets users choose a Python script from a list and run it inside their Archicad workflow. It is a useful starting point for your own tools and a simple way to give scripts to colleagues.
The script runs as a separate Python process. The palette starts it with uv
and passes the port of the Archicad instance that launched it. Keep
api = UnifiedApi() in your script: MultiConn Archicad reads --port for you.
Add your first script¶
Install the Tapir Add-On and uv as described in the
quick start. Save this complete file as
count_walls.py:
# /// script
# requires-python = ">=3.12,<3.15"
# dependencies = ["multiconn_archicad"]
# ///
from multiconn_archicad import UnifiedApi
from multiconn_archicad.models.official.types import ElementType
api = UnifiedApi()
walls = api.official.element_listing.get_elements_by_type(ElementType.WALL)
print(f"Walls found: {len(walls)}")
The comment block declares the script's Python version and packages. uv uses it to prepare the environment. This is called inline script metadata, or PEP 723 metadata. Keep it with a script you distribute through the palette.
- Put the file in
Documents/Tapir/custom-scripts. - In Archicad, open Tapir → Tapir Palette.
- Choose Reload scripts... at the bottom of the script list.
- Select your script and click Run Script.
The palette reports the script's printed output and exit code. Changes to your local file take effect the next time it runs.
How the right project is selected¶
The palette launch is equivalent to this command, using its own instance's port:
uv run --script count_walls.py --port 19724
Here, 19724 is an example port. The palette supplies the actual value. uv reads the script's dependency block; MultiConn Archicad reads the port argument. You do not need to write an argument parser for these connection options.
Do not hard-code UnifiedApi(port=19723) in a script intended for the palette.
An explicit port takes priority over the palette's argument and can send work
to a different instance.
The palette gives the script a target instance, not a ConnHeader. Use a direct
client for this workflow. Applications that need project discovery or switching
can use the application architecture.
Share the script¶
For a small tool, share the .py file with its inline dependency block.
The recipient adds it to their palette in the same way. Their first run may need
internet access to download Python and packages.
For a team, Tapir also supports configured local/network folders and GitHub
repositories in Documents/Tapir/config.json. Use the
Tapir palette script guide
for configuration, script descriptions, and distribution options.
Inline metadata lists Python dependencies, not the Tapir Add-On itself or any
project files the script needs. Include those requirements when sharing a tool.
For repeatable distribution, test with a specific package version and pin
multiconn_archicad to that version in the dependency block.