|To compute the main body of the bottle, you need to create a solid shape.|
|The simplest way is to use the previously created profile and to sweep it along a direction: the Prism functionality of Open CASCADE Technology is the most appropriate. It accepts a shape and a direction as input and generates a new shape according to the following rules:|
Compound of Solid
Your current profile is a wire. Refering to the Shape/Generates table, you need to compute a face out of its wire to generate a solid.
To create a face, you use the BRepBuilderAPI_MakeFace class. As previously explained, a face is a part of a surface bounded by a closed wire. Generally, BRepBuilderAPI_MakeFace computes a face out of a surface and one or more wires.
When the wire lies on a plane, the surface is automatically computed.
TopoDS_Face myFaceProfile = BRepBuilderAPI_MakeFace(myWireProfile);
The BRepPrimAPI package provides all the classes to create topological primitive constructions: boxes, cones, cylinders, spheres, etc. Among them is the BRepPrimAPI_MakePrism class. As specified above, this class is defined by:
- the basis shape to sweep
- a vector for a finite prism or a direction for finite and infinite prisms
You want the solid to be finite, swept along the Z axis and to be myHeight height. The vector, defined with the gp_Vec class on its X, Y and Z coordinates is:
gp_Vec aPrismVec(0 , 0 , myHeight);
All data necessary to create the main body of your bottle is now available. Just apply the BRepPrimAPI_MakePrism class to compute the solid:
TopoDS_Shape myBody = BRepPrimAPI_MakePrism(myFaceProfile , aPrismVec);