When using the Transform Edges to Wire
operation tool, you
must first create a geometry that has some edges. You can create any of the sheet
body or solid body shapes listed in Creating Primitives. Once the primitive is created, you can obtain a wire body from its edges by
defining and applying the Transform Edges to Wire
tool.
In the following example, the function ongenerate()
creates
a polygon sheet body and applies the Transform Edges to Wire
tool.
def Ongenerate(feature,function): length = 0.3 bodies = [] builder = ExtAPI.DataModel.GeometryBuilder polygon = builder.Primitives.Sheet.CreatePolygon([0.,0.,2.*length,0.,0.,1.*length,length,0.,0.7]) polygon_generated = polygon.Generate() body = builder.Operations.Tools.EdgesToWireBody(polygon_generated.Edges); bodies.Add(body) feature.Bodies = bodies feature.MaterialType = MaterialTypeEnum.Add return True
In this example:
The first part of the function creates a polygon sheet body using a process similar to the one used to create a cylinder in Creating a Sheet Body.
With the body function, you use the operations generator
builder.Operations.Tools.EdgesToWireBody
. The methodEdgesToWireBody
specifies that the operation tool is to transform the edges of the sheet body polygon into a wire body.Note: While the variable
Length
is used for both the sheet body and the extrusion definition in this example, you could have used a different variable for each.The new wire body is added to the list
feature.bodies
as described in Applying the Extrude Operation.