Hello,
we recommend using Visual Studio Code as editor and debugging tool for PythonParts in Allplan-2021. Visual Studio Code is a lightweight but powerful source code editor and can be installed from
https://code.visualstudio.com/
Before the installation of Visual Studio Code, it's necessary to install Python 3.8.8 (64-bit) from
https://www.python.org/downloads/release/python-388/
After the installation of Visual Studio Code it is useful to install the following extensions:
- Python: Python extension
- Pylance: feature-rich language support for Python
- Python Indent
- Studio Icons
This can be executed by
- starting Visual Studio Code
- clicking the "Extensions" button
- typing the name of the extensions in the input field
- selecting the extension from the list
The preparation of the PythonParts editing with Visual Studio Code can be done by executing the PythonPart “CreateVisualStudioCodeWorkspace” in Allplan (located in the directory …\etc\Examples\PythonParts\ToolsAndStartExamples). This PythonPart creates the file “PythonParts_VsCode.code-workspace” in the …\etc directory. By clicking this file Visual Studio Code will be started.
For preparing the PythonPart debugging with Visual Studio Code the following steps are necessary (if the files currently not installed):
- download PTVSD 4.3.2 from https://pypi.python.org/pypi/ptvsd.
- unzip the file ptvsd-4.3.2.zip and copy the ptvsd folder under the Allplan Python folder …\prg\Python\ptvsd
A new debug session can start by the following steps
- executing the PythonPart “StartPythonDebug” in Allplan (located in the drectory …\etc\Examples\PythonParts\ToolsAndStartExamples)
- clicking the button “Run and Debug” in Visual Studio Code
- selecting “Attach to Allplan” in the “RUN AND DEBUG” selection control
- clicking “Start Debugging”
Best regards
Horst