Migrating Python Scripts to Plant 3D 2022+

by 

As covered in a previous post about migrating to 2022, AutoCAD Plant 3D has new behavior with how it handles shared content. In addition to loading the larger files like variants.zip, and the metadata folder from within the installation directory (C:\Program Files\Autodesk\AutoCAD 2022\PLNT3D\ContentScripts), Plant 3D now uses Python 3.7 when running custom scripts.

For companies maintaining installations of 2021 or earlier alongside newer versions, you’ll need to duplicate the shared content folder:

K:\CAD\Plant3D\2021 Catalogs\

K:\CAD\Plant3D\Catalogs\

To get your Python scripts, you’ll need to migrate your existing script to a new Python version (3.7.9).

Plant 3D 2022 What’s New

You can use a tool like the following to convert the scripts: https://docs.python.org/3.7/library/2to3.html

Once you convert the scripts, put them in the CustomScripts folder (like normal), and run PLANTREGISTERCUSTOMSCRIPTS

After PLANTREGISTERCUSTOMSCRIPTS is run, the standard ScriptGroup.xml, variants.map, and variants.xml will be created.

At the same level as your custom scripts, Plant 3D will create a __pycache__ file which stores the compiled Python by version.


If you have questions about using Plant 3D, contact Applied Software today and talk to an industry expert.


New call-to-action