Creating a Wire Body

When creating a wire body, you have the option of defining it in the shape of an arc, curve, ellipse, or polyline. An example follows of using the function ongenerate() to define a wire body polyline.

def Ongenerate(feature,function):
    points_list = [0.,0.,0., 1.,0.,0., 1.,1.,0., 1.,1.,1.]

    wireBodies = []

    primitive = ExtAPI.DataModel.GeometryBuilder.Primitives
    polyline = primitive.Wire.CreatePolyline(points_list)
    polyline_generated = polyline.Generate()
    wireBodies.Add(polyline_generated)

    feature.Bodies = wireBodies
    feature.MaterialType = MaterialTypeEnum.Add

    return True

In this example:

  • The method points_list () is defined for later use in the creation of the polyline body. For arguments, it expects as a list of coordinate points, which are defined by three float values per point.

  • The primitive variable uses the global variable ExtAPI, which serves asthe ACT entry pointinto DesignModeler, to access the data model and define the geometry builder.

  • The method CreatePolyline () is applied to the object Wire to generate the new body. As arguments, this method expects the coordinate points defined by the method points_list.

  • With the object polyline_generated, you use the method Generate () to generate the polyline.

     

  • 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 Add.