Python Equipment Tutorial

Python Equipment Tutorial

csvensrudMarchConsult
Participant Participant
728 Views
2 Replies
Message 1 of 3

Python Equipment Tutorial

csvensrudMarchConsult
Participant
Participant

I am struggling to finish the equipment tutorial at Autodesk University.

Scripting-Components-AutoCADR-Plant-3D-2012 

 

My problems parameters not being displayed, and picture not being shown.

 

First seems to be a typo in the script

4. skirt.uniteWith(b)    this should be s

 

I have the skirt inserting into a blank drawing. I am then struggling to get the paramaters to come in from the peqx file. Hoping someone can help.

 

First file name SimpleVesselSkirt.py *** all formatted in Visual Studio 

from varmain.primitiv import *
from varmain.custom import *
from math import *

@Anonymous(Group="Vessel", TooltipShort="Skirt", TooltipLong="A skirt with a base", LengthUnit="in")
@group("MainDimensions")
@Anonymous(D=LENGTH, TooltipShort="Skirt OD")
@Anonymous(L=LENGTH, TooltipLong="Length of the Skirt")
@Anonymous(D1=LENGTH, TooltipShort="Base OD")
@Anonymous(L1=LENGTH, TooltipShort="Base Thickness")
@Anonymous(OF=LENGTH, TooltipShort="Skirt Thickness")

def SIMPLEVESSELSKIRT(s, D=48, L=48,D1=50,L1=.25, OF=0,**kw 😞
#create the base shape of the skirt
thck = OF
if thck <= 0:
thck = .05*D
s = CYLINDER(s, R=D/2,H=L,O=(D-thck)/2)
#create the base of the skirt
Base = CYLINDER(s, R=D1/2,H=L1)
#union the two pieces together
s.uniteWith(Base)
#release the secondary object
Base.erase()

 

Peqx file named SimpleVesselSkirt.peqx in the equipment folder

[Content Types].xml

<?xml version="1.0" encoding="utf-8"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="xml" ContentType="text/xml" />
<Default Extension="png" ContentType="image/png" />
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" />
</Types>

 

preview folder

SimpleVesselSkirt_200.png

 

_rels folder

<?xml version="1.0" encoding="UTF-8"?>

-<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">

<Relationship Id="PlantEquipmentType" Target="/content/EquipmentType.xml" Type="Plant/Equipment/EquipmentType"/>

<Relationship Id="SIMPLEVESSELSKIRT" Target="/preview/SimpleVesselSkirt_200.png" Type="Plant/Equipment/Preview"/>

</Relationships>

 

content folder/ EquipmenType.xml

<?xml version="1.0" encoding="utf-8"?>
<EquipmentType
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Name="SIMPLEVESSELSKIRT"
Type="C"
SubType="V"
PartSubType="GeneralVessel"
GUID="{5B3698B3-9F6C-4893-8BF9-A47604CF70FD}"
PartType="Vessel">
<DisplayName>Simple Vessel Skirt</DisplayName>
<PartProperties>
   <PropertyInfo Name="PartSizeLongDesc" DefaultValue="Vessel Skirt" />
</PartProperties>
<Parameters>
   <ParamaterInfo Name="D" DefaultValue="48" Type="d"/>
   <ParamaterInfo Name="OF" DefaultValue="0.25" Type="d"/>
</Parameters>
<Categories>
   <CategoryInfo Name="Base">
      <Parameters>
         <ParamaterInfo Name="D1" DefaultValue="50"/>
     </Parameters>
   </CategoryInfo>
   <CategoryInfo Name="Length">
     <Parameters>
        <ParamaterInfo Name="L" DefaultValue="36"/>
        <ParamaterInfo Name="L1" DefaultValue="1.25"/>
     </Parameters>
   </CategoryInfo>
</Categories>
</EquipmentType>

 

 

 

0 Likes
729 Views
2 Replies
Replies (2)
Message 2 of 3

nghiabt04
Advocate
Advocate

Hi @csvensrudMarchConsult ,

Could you attach your script file here

0 Likes
Message 3 of 3

csvensrudMarchConsult
Participant
Participant

Thanks for having a look. 

I attached the zip files

0 Likes