Custom equipment with Python - nil error (David Wolfe or other)

Custom equipment with Python - nil error (David Wolfe or other)

Anonymous
Not applicable
2,675 Views
4 Replies
Message 1 of 5

Custom equipment with Python - nil error (David Wolfe or other)

Anonymous
Not applicable

Hi All,

 

i'm trying to make custom equipment for plant 3D 2017 using python, but i'm still blocked with a nil error. I have read the blog Custom Python Scripts for autocad plant 3D (great work David Wolfe) and the PD1746 work.

 

This is my step by step work.

 

1) I have write 2 simple script with Komodo Edit took but the above material.

 

Vessel.JPG

 

 

test.JPG

 

2) In Plant as suggested by David Wolfe, I write the macros. The first one load the ACP Adapter (^C^C(arxload "PnP3dACPAdapter.arx")), the second one register the scripts and then I restart plant (^C^CPLANTREGISTERCUSTOMSCRIPTS;(startapp "C:/Program Files/Autodesk/AutoCAD 2017/acad.exe");QUIT). After the restart I load again the ACP adapter and then i call the macros "TESTACPSCRIPT" to load the two scripts (^C^C(TESTACPSCRIPT "SimpleVesselSkirt")) but in both case i have the following error and nothing appear to the windows:

 

(TESTACPSCRIPT "testscript") nil 

 

 

3) From Custom Python Scripts for autocad plant 3D - part 3 and part 5 i have tried with the nozflange and expansion joint scripts and nozflange works instead Expansion Joint not...really I don't understand why...

 

Thanks

0 Likes
Accepted solutions (1)
2,676 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Accepted solution

I have found the solution. It was a problem of uppercase and lower case. The py file was SIMPLEVESSELSKIRT.py, but in Plant I wrote TESTACPSCRIPT "SimpleVesselSkirt". I have modified the command in TESTACPSCRIPT "SIMPLEVESSELSKIRT" and all goes fine.

0 Likes
Message 3 of 5

Anonymous
Not applicable

Hello David Wolfe or others,

 

I have the same problem, I have tried the SimpleVesselSkirt  both in upper and lowercase also the Testscript that I downloaded, I get the same problem.

 

nil error.JPG

 

Can you please advise why this problem might be happening.

Thank you

0 Likes
Message 4 of 5

jpnoronha
Advocate
Advocate

Hi

 

When we use testacpscript in Plant what is in "" is not the name of the file but the description/name of the function.

So, in my code is "SIMPLEVESSELSKIRT" as below.

 

def SIMPLEVESSELSKIRT(s, D=48, L=48,D1=50,L1=.25, OF=0,**kw 😞

After entering "(arxload "PnP3dACPAdapter.arx")" in Plant command line i should use:

(testacpscript "SIMPLEVESSELSKIRT")

Best regards

0 Likes
Message 5 of 5

Anonymous
Not applicable

 

Hi

I am having a script for Clamp Support with Shoe, when I am trying to register the script getting error as below

File "<string>", line 1, in <module>
File "varmain\custom.pyc", line 367, in dumpAll
File "varmain\custom.pyc", line 324, in dumpAll
File "varmain\custom.pyc", line 311, in dumpFile
File "varmain\custom.pyc", line 288, in dumpScript
TypeError: list indices must be integers, not str

 

What is the solution for this? Below is the Script.

 

from aqa.math import *
import math
from varmain.supportssub.csgcsub.csgc002 import *
from varmain.supportssub.csgcsub.csgc001 import *
from varmain.primitiv import *
from varmain.var_basic import *
from varmain.custom import *

@Anonymous(Group="Support", TooltipShort="Shoe clamp", TooltipLong="Clamp with Shoe", LengthUnit="mm", Ports=1)
@group("MainDimensions")
@param(D=LENGTH, Tooltipshort="Clamp Diameter", TooltipLong="Inside Diameter of pipe support")
@param(L=LENGTH0, Tooltipshort="Clamp Length", TooltipLong="Length of Clamp")
@param(W=LENGTH0, Tooltipshort="Clamp Thickness", TooltipLong="Thickness of Clamp")
@param(K=LENGTH0, Tooltipshort="Overall wdith", TooltipLong="Overall wdith of the clamp")
@param(SL=LENGTH0, Tooltipshort="Base Length", TooltipLong="Length of the base plate")
@param(SW=LENGTH0, Tooltipshort="Base Width", TooltipLong="Base plate Width")
@param(ST=LENGTH0, Tooltipshort="Base Thickness", TooltipLong="Thickness of the matel sheets")
@param(SH=LENGTH0, Tooltipshort="Support Height", TooltipLong="Height of the support to the center of the pipe")
@param(E=LENGTH0, Tooltipshort="Clamp location", TooltipLong="Distance of Matel sheet edge to clamp")
#@group(Name="meaningless enum")
#@enum(1, "align X")
#@enum(2, "align Y")
#@enum(3, "align Z")

def CSGB0011(s, D=116.0, L=30.0, W=4.0, K=0.0, SL=180.0, SW=100.0, ST=8.0, SH=150.0, E=50.0, ID = 'CSGB0011', **kw):
R1 = D/2.0
HS = SH-R1

o1 = BOX(s, L=8.0, W=180.0, H=150.0-R1).translate(((HS/2.0)+R1, 0, 0))
o2 = BOX(s, L=100.0, W=180.0, H=8.0).translate((SH-(ST/2.0), 0, 0))

o1.uniteWith[o2]
o2.erase()
if L > 0.0:
if W > 0.0:
LS = SL-L-(E*2.0)
o4 = CSGC002(s, D=116.0, L=30.0, W=4.0, K=0.0, ID = 'CSGC002', **KW).rotateY(-90).translate((0, 0, 0-(LS/2.0)))
o4.rotateZ(30)
o1.uniteWith[o4]
o4.erase()
o5 = CSGC002(s, DD=116.0, L=30.0, W=4.0, K=0.0, ID = 'CSGC002', **KW).rotateY(-90).translate((0, 0, LS/2.0))
o5.rotateZ(30)
o1.uniteWith[o5]
o5.erase()
o1.rotateY(90)

s.setPoint([0.0, 0.0, 0.0], [-1.0, 0.0, 0.0])
s.setLinearDimension(SH, [0,0,0], [0,0,-SH])
s.setPoint([0.0, 0.0, -(LS/2.0)], [0.0, 0.0, 1.0])
s.setPoint([0.0, 0.0, (LS/2.0)], [0.0, 0.0, -1.0])
s.setPoint([0.0, 0.0, (LS/2.0)], [0.0, 0.0, 1.0])

 

 

 

 

0 Likes