Plant 3D – Adding Custom Components – Part 3 – Building the Code.

SHARE
Share on email
Share on linkedin
Share on facebook
Share on whatsapp

In the previous blog,

we looked at the structure of the code,

now we will look closer at the contents,

 

 

 

 

 

 

 

 

 

 

 

 

 

We already went over the import side,

there is an extensive list of imports that can be used,  that can be found online.

under the @activate, we define the scripts metadata.

the next thing is @group, this defines groups of parameters.

 @param defines the parameters in the metadata.

 

def SO_Flange, is the Metadata,

Basically how everything comes together,

We firstly assign preliminary values to the parameters we set up previously,

then we setup the shapes and define the math, based on our shapes selected,

In the example above a single shape or primitive is used

You can even combine, subtract or intersect bodies to create more complex primitives.

 

Below are the following primitive and options currently available to us to use:

ARC3D
A normal elbow

s=ARC3D(s, D, R, A)

ARC3D2
Reduced elbow

s=ARC3D2(s, D, D2, R, A)

 

ARC3DS
Segmented elbow

s=ARC3DS(s, D, D2, R, A, S)

BOX

Rectangular Cube

s=BOX(s, L, W, H)

 

CONE
Tapered Cone and/or frustum

s=CONE(s, R1, R2, H, E)

 

CYLINDER
Normal or Elliptical Cylinder

s=CYLINDER(s, R, H, O)
or
s=CYLINDER(s, R1, R2, H, O)

 

ELLIPSOIDHEAD

Normalized ellipsoid head

s=ELLIPSOIDHEAD(s, R)

 

ELLIPSOIDHEAD2
defines an ellipsoid head (0.5 * R)

s=ELLIPSOIDHEAD2(s, R)

 

ELLIPSOIDSEGMENT
An Ellipsoid – Rugby ball shape

s=ELLIPSOIDSEGMENT(s, RX, RY, A1, A2, A3, A4)

 

HALFSPHERE
half a sphere

s=HALFSPHERE(s, R)

 

PYRAMID
Square Pyramid with frustum option

s=PYRAMID(s, L, W, H, HT)

 

ROUNDRECT
Transition from rectangular to circle shape

s=ROUNDRECT(s, L, W, H, R2, E)

 

SPHERESEGMENT
Sphere segment

s=SPHERESEGMENT(s, R, P, Q)

 

TORISPHERICHEAD
Normalized torispheric head

s=TORISPERICHEAD(s, R)

 

TORISPHERICHEAD2
Torispheric head – small radius = 25

s=TORISPERICHEAD2(s, R)

 

TORISPHERICHEADH
defines a normalized torispheric head with height

s=TORISPERICHEADH(s, R, H)

 

TORUS
defines a torus

s=TORUS(s, R1, R2)

 

 

RECENT ARTICLES