When creating a sheet body, you have the option of defining it in the shape of a
cone, cylinder, polygon, or sphere. An example follows of using the function
ongenerate()
to define a sheet body cylinder.
def Ongenerate(feature,function): width = 0.015 height = 0.3 sheetBodies = [] primitive = ExtAPI.DataModel.GeometryBuilder.Primitives cylinder = primitive.Sheet.CreateCylinder([0.,0.,0.],[0.,0.,height],width) cylinder_generated = cylinder.Generate() sheetBodies.Add(cylinder_generated) feature.Bodies = sheetBodies feature.MaterialType = MaterialTypeEnum.Freeze return True
In this example:
The variables
width
andheight
are used to define the width and the height of the cylinder.The variable
sheetBodies
specifies the type of primitive to be created.The primitive variable uses the global variable
ExtAPI
, which serves as the ACT entry point into DesignModeler, to access the data model and define the geometry builder.The method
CreateCylinder ()
is used to generate the new body, specifying that it is defined by the following arguments:Coordinates of the center point of the cylinder’s base
Coordinates of the center point of the upper face, which defines the direction of the cylinder
Value of the radius, which is a float.
For example, the integer value << 3 >> is refused, while the value of << 3. >> is accepted.
With the object
cylinder_generated
, you use the methodGenerate ()
to generate the cylinder.With the lines
sheetBodies.Add(cylinder_generated)
andfeature.Bodies = sheetBodies
, you add the sheet body cylinder to the listfeature.bodies
so that it is added to DesignModeler after generation. Bodies not added to this list are not retained.With the line
MaterialType
, you specify a material property ofFreeze
.