Creating a Solid Body

When creating a solid body, you have the option of defining it in the shape of a box, cone, cylinder, or sphere. The following example uses the function ongenerate() to define a solid body box.

def Ongenerate(feature,function):
    point1 = [0.,0.,0.]
    point2 = [1.,2.,2.]
    solidBodies = []

    primitive = ExtAPI.DataModel.GeometryBuilder.Primitives
    box1 = primitive.Solid.CreateBox(point1, point2)
    box1_generated = box1.Generate()
    solidBodies.Add(box1_generated)

    feature.Bodies = solidBodies
    feature.MaterialType = MaterialTypeEnum.Freeze

    return True

In this example:

  • The methods point1 () and point2 () are defined for later use in the creation of the solid body. For arguments, they each expect a list of coordinate points, which are defined by three float values per point.

  • 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 CreateBox () is applied to the object Solid to generate the new body. For arguments, this method expects the coordinate points defined by the methods point1 and point2.

  • With the object box1_generated, you use the method Generate () to generate the box.

     

  • The new body is added to the list feature.bodies as described in Creating a Sheet Body.

  • With the line MaterialType, you specify a material property of Freeze.