Allplan is installed, your IDE is ready… perfect, let’s see in detail how PythonParts work.
1) Files’ Description
To work, a PythonPart needs at least 2 files :
-
GUI File
The interface file corresponds to what the user will see from the Allplan palette, this will be our user interface.
It’s in XML format (extensible markup language) and has the .pyp extension.
In this file we will place texts, input fields, checkboxes, images, … everything the end user will need for the proper understanding and execution of the script.
-
Main Script
On the other hand, the main script contains the major elements of the script.
Written in Python, it has the .py extension.
In this file, we will place our different functions, variables, loops, … in short, all our instructions.
-
(Optional) Icon
Non-mandatory, but not to be overlooked, this is an image of your choice that best represents the script.
This image will be in PNG format (Portable Network Graphics) and will therefore naturally have the .png extension.
Please note : its name must be the same as the GUI file and it must be placed in the same folder ; the recommended size is 128×128 px.
2) Files’ location
Although it can be placed anywhere, it’s highly recommended to place the GUI file in the Allplan library folder.
For the main script, it will be dropped into a PythonPartsScripts folder ; itself in one of these 3 available slots :
- *.PRJ (current project folder) ;
- USR (user’s folder) ;
- STD (agency’s folder).
It’s the latter that I recommend because it guarantees access to the scripts on all your projects and it’s shared throughout your company.
Please note : …\ETC\PythonPartsScripts\… folder contains the scripts provided by default with Allplan. Be careful not to use it.
0 Comments