By David Wolfe (Contributor)
Expansion Joint Script
This article will look at creating a completely new script, an expansion joint.
The script should look like this:
The most interesting part of this script, other than the geometry, is the metadata.
Note that the group defines where the script shows up in the spec editor.
The tooltips show when the dimensions are hovered over in the editor as well.
While creating the script, you must be able to test it to see if your geometry can be generated. Because these scripts are designed to be processed within AutoCAD, currently there is no IDE that you can use to debug the shapes. The process of testing the script looks like this.
- Create your script file at C:\AutoCAD Plant 3D 2016 Content\CPak Common\CustomScripts (or wherever your Shared Content folder is for plant (MODIFYSHAREDCONTENTFOLDER).
- Create your geometry functions, and metadata sections.
- Start Plant 3D
- Use PLANTREGISTERCUSTOMSCRIPTS. If there is an error in the script, you will get a warning at the command line with the line number. For most errors line of the script with the error will be listed. If no errors are shown, the script compiled.
- Load the PnP3dACPAdapter.arx. You can do this by pasting this at the command line (arxload "PnP3dACPAdapter")
- Test the script. You can test with the default parameters by pasting this at the command line: (testacpscript "EXPJOINT1"). Fill in your script function where EXPJOINT1 is.
You can also test the script from one of the other following options:
(TESTACPSCRIPT "CPFLR" "D1" "300.5")
(TESTACPSCRIPT "CPFLR" "L" "40" "D1" "300.5" "D2" "88.9")
(TESTACPSCRIPT1 "CPFLR" "D1=300.5")
(TESTACPSCRIPT1 "CPFLR" "L=40,D1=300.5,D2=88.9")
- If you need to make changes, make them before closing Plant. That was you can try to register the script again to see if you still have breaking code.
- If the script has been changed and registered, you must close Plant 3D in order to test the geometry again. Once the script is registered or run, the Python processor stores that script in memory until Plant 3D is closed, so starting a new session is the only way test new script changes.