Skip to content

Getting started

1. Get Allplan

You will need Allplan to work with its API. You can download it from Allplan Connect upon prior registration. If you are a professional developer, who wants to develop plugins for Allplan, contact us to get a license to a pre-release Allplan version.

Download Allplan Apply for a license

2. Get the SDK

Download SDK

The PythonPart SDK is a collection of tools designed to aid programmers in developing their own PythonParts. Here are the tools that you get:

Tool Description
Start Python Debug Enables you to connect your IDE with Allplan in order to debug your code. Learn more about debugging .
Install Python Package Allow you to install a site package from Python Package Index locally on your machine. Learn more below .
Encrypt PythonPart Script Tool to encrypt and thereby protect your python source code. Learn more .
Download PythonPart examples Tool to download the latest examples from the github repository. Learn more below
Create VS-Code Workspace With this tool you can pre-configure the workspace for VS-Code. Learn more below .

Beside that, the SDK will also install some python site-packages on your PC that are relevant for PythonParts development. Here's the overview:

Package Description
reloader Enables you to try out changes in your code without having to restart Allplan Learn more below .
debugpy Needed for debugging. Learn more here .
graphviz Needed for profiling. Learn more here .

Installation

  1. Use the link above and download the SDK.
  2. Drag-and-drop the downloaded .allep file to Allplan to install it.
  3. Restart Allplan.
  4. The SDK can be found on the Actionbar in the tab Plugins.

    SDK on Actionbar

3. Get the examples

For better understanding of PythonParts framework, we offer a repository on GitHub with example PythonParts. You can access it anytime by clicking the Git symbol in the navigation bar. Every time you browse this documentation and see an admonition like this:

Example on GitHub

Have a look at the example LoftedBRep ( PYP | PY).

... there is a complete, ready-to-use implementation example of a certain feature. Clicking on PYP will bring you directly to the PYP file. Clicking on PY you bring you the python script.

The examples are grouped into following subdirectories:

Folder Description
BasisExamples contains examples from Allplan BasisElements library
ContentExamples contains complex PythonPart examples
GeometryExamples contains examples from the Allplan Geometry library
InteractorExamples contains examples from the Allplan IFW_Input library
PaletteExamples contains examples demonstrating the palette functionalities
ReinforcementExamples contains examples with special reinforcement functionalities
StructuralFramingExamples contains examples with special structural framing functionalities
ToolsAndStartExamples contains helpful start examples

Tip

Download PythonParts Examples

The examples are fully functional PythonParts and you can try them out in Allplan. To get them, use the tool Download PythonPart Examples that we provide in our SDK. It will download the examples directly to Allplan and you can try them yout by going to
Library -> Private -> Examples -> PythonParts

4. Configure your IDE

Info

We recommend VS-Code as IDE. Feel free to choose another IDE (VisualStudio, pycharm, etc...). If you decide to do so, jump over to the 5th step.

Here is how you can configure your workspace in Visual Studio Code :

  1. Run the tool Create Visual Studio Code Workspace from the SDK

    Create Visual Studio Code Workspace in the library

  2. Specify, where to save the workspace file by pressing Search...

    Create Visual Studio Code Workspace

  3. Open the created .code-workspace file by double-click or run Visual Studio Code, and go to
    File -> Open workspace from file

  4. Recommended extensions

    Install extensions recommended by us. VS-Code will ask you to do so directly after opening the workspace with a prompt like this. Here's what you get, when you click Install::

    • Python: extension for code formatting, refactoring, debugging, unit test and more. Installing it, will also include following extensions:

      • Pylance: a performant, feature-rich language server for Python.

      • Python debugger: a debugger extension, based on debugpy.

    • Pylint: tool for linting your python code. Learn more below

    • Better align: tool for vertical alignment of code in any language for better readability

    • PythonPartTools: tool offering helpful functionalities specific for PythonParts framework

    Tip

    You don't have to install all of them. You can go to the tab Extensions (Ctrl+Shift+X) and type @recommended into the search field to get an overview of them and install only what you need.


After these steps you are ready to go. Here is a checklist for you so you can make sure you have configured your IDE correctly:

  • Folder structure

    Your folder structure includes path to the examples (provided you downloaded the examples as described in the 3rd step). PythonParts folder contains the PYP files whereas PythonPartsScripts contains the PY files. It is just a starting point: reorganize the folders as you need them to.

  • You get auto-completion suggestions of Allplan Python API members, as shown on th eGIF below. By default by pressing Ctrl+Space.

  • You get parameter hints containing the documentation of the current member, as shown below. By default by pressing Ctrl+Shift+Space.

    Autocompletion + hints

  • Type checking points out wrong variable types in your code:

    Type checking

  • You can jump to the member definition by pressing F12 or clicking its name while holding Ctrl

  • VS-Code lints your code and checks for convention violations, missing documentation, etc. Learn more below .

    Linting

5. Attend the PythonParts course

First steps are always difficult. Therefore, before you start coding, we recommend you to have a look on the course for beginners: Allplan start now - PythonParts.

Start course

Tips

Trace window

Trace

The Allplan trace window is a useful tool for the PythonPart development and we strongly recommend enabling it. This can be done directly in Allplan application by pressing Ctrl+F3. A dialog as shown on the right will pop-up. Check the box Write into window.

Warning

After turning trace window on, you have to restart Allplan! The python related output is not printed directly after activating the window, but only after restarting Allplan.

When an error occurs in the Python script, it is reported in the trace window. In addition, a lot of information reported by the PythonParts framework is displayed.

If Allplan crashes, the trace window gets closed. To be able to investigate the reason of the crash, the trace output should be saved into a file, which can be achieved by checking the box Write into file. Now, the output is saved to allplan_python.out, located in the TMP directory of Allplan. The TMP path can be obtained in Allmenu under
Service -> File explorer -> My own temporary CAD data (TMP)

Allmenu TMP path

Lint your code

Linting code means checking for errors, enforcing coding standards and looking for code smells or type errors. Pylint is the tool that does exactly this. When you use VS-Code and you have configured your workspace as described above, this tool will should run in the background and try to enforce coding standards by providing you hints like this:

Linting

The coding guidelines are defined in the file pylintrc, delivered with Allplan and located under
...\Etc\PythonPartsFramework\pylintrc

Info

If you want to use your own guidelines, provide the path to your own pylintrc file in the workspace settings:

"settings": {
    "pylint.args": [
        "--rcfile=X:\\Here\\provide\\the\\path\\to\\your\\pylintrc"
    ],
}

Reloader

Our SDK includes a python module called reloader. It is the module from PyPI , but with little modifications so not exactly the same. It is important to know, what is its purpose and what troubles it may cause.

When a PythonPart is started, the python script with its logic also gets loaded. When the PythonPart is started for the second time, it's not loaded again to ensure performance. It stays in the memory until Allplan is closed. This behavior is OK, as long as you don't want to modify the script very often.

While developing PythonParts, you change the script constantly and test it in Allplan all over again. Having to restart Allplan each time would be extremely annoying. Reloader solves this problem: it reloads the script every time the PythonPart is started.

Bug

Reloader may cause problems with some dependency packages, like numpy or requests. When your PythonPart works well for the first time, but breaks when starting for the second and consecutive time, it's likely the reloader that causes the problem.

In this case, deactivate the reloader by renaming the file reloader.py to something else. After installing the SDK, the file is located in:
...\usr\__your_username__\PythonPartsScripts\AllepPlugins\AllplanGmbH\PythonPartSDK\reloader.py

Info

In the versions prior to 2025, the reloader was delivered with Allplan. If you migrated from past versions, make sure the file reloader.py is present neither in your etc nor in prg directory.

Installing site packages

If your PythonPart depends on another package from the Python Package Index you can install this package in the Python environment of ALLPLAN using InstallPythonPackage. This tool is included in the SDK.

Install python package

To install a site-package, follow these steps:

  1. Run the tool
  2. Type in the name of the package you want to install, e.g. numpy
  3. Select the desired location(1)

    1. Option Actual path
      std ...path\to\std\PythonParts-site-packages
      usr ...path\to\usr\__username__\PythonParts-site-packages
      etc ...path\to\etc\PythonParts-site-packages
  4. Click Install

  5. Check the log printed in ALLPLAN trace window

Info

It it possible to have two packages with the same name in two different locations. When this package gets imported with import ... statement, python looks for it in the environment paths according to the import resolution. Here is the search order:

  1. ...\std\PythonParts-site-packages
  2. ...\usr\__yourusername__\PythonParts-site-packages
  3. ...\etc\PythonParts-site-packages

Package that first gets found will be used.


For example: numpy 1.23.4 is installed in usr and another numpy 2.0.1 is installed in std. Python will first search the std path, find the version 2.0.1 and load it. The version 1.23.4 found in usr will not overload the already loaded 2.0.1.

Note

Please note that this tool only installs the site-package on your PC. When your PythonPart needs to be delivered to the users, the site-packages must also be installed on their PCs. It is the Allep installer that will take care of this.