Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I found a way to import a custom part in a Plant 3D Python script.
I used the post below as a reference, but I’m receiving the following message from Plant:
post:https://forums.autodesk.com/t5/autocad-plant-3d-forum/python-scripting/m-p/6900759#M26125
message:
Command: PLANTREGISTERCUSTOMSCRIPTS
Command: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "varmain\custom.pyc", line 372, in dumpAll
File "varmain\custom.pyc", line 326, in dumpAll
File "varmain\custom.pyc", line 307, in dumpFile
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "t:\plant3d\00 - catalogos\cpak common\customscripts\testes\CPVKSOFL0000.py", line 4, in <module>
from ANEL_SMS import *
ModuleNotFoundError: No module named 'ANEL_SMS'
And now, when I run the test, I get this message:
Command: (testacpscript "CPVKSOFL0000")
Script CPVKSOFL0000 not found...
nil
Here is my Python code:
import os
import sys
sys.path.insert(0, "T:\\Plant3D\\00 - Catalogos\\CPak Common\\CustomScripts")
from ANEL_SMS import *
from varmain.custom import *
from aqa.math import *
import math
@activate(Group="Flange", TooltipShort="SO Flange", TooltipLong="Slip On Flange", FirstPortEndtypes="FL", LengthUnit="mm", Ports="2")
@group("MainDimensions")
@param(D=LENGTH, TooltipShort="Outer Diameter of the Flange", TooltipLong="Outer Diameter of the Flange")
@param(D1=LENGTH, TooltipShort="Pipe Diameter", TooltipLong="Pipe Diameter")
@param(T=LENGTH, TooltipShort="Length of the Flange", TooltipLong="Length of the Flange")
@param(OF=LENGTH, TooltipShort="Thickness offset", TooltipLong="Thickness offset")
#PLANTREGISTERCUSTOMSCRIPTS
#(arxload "PnP3dACPAdapter")
#(testacpscript "CPVKSOFL0000")
def CPVKSOFL0000(s,D=210.0, D1=114.3, T=10.0, OF=-1,**kw):
bla=ANEL_SMS(s, OD1=50.0,ID1=24.0,H=5.5)
return
Solved! Go to Solution.