Constructing an Extrusion Body
The function
MbSweptData ExtrusionSolid( const MbSweptData & sweptData,
const MbVector3D & direction,
const MbSolid * solid1,
const MbSolid * solid2,
bool checkIntersection,
const ExtrusionValues & params,
const MbSNameMaker & operNames,
PArray<MbSNameMaker> & contoursNames,
MbSolid *& result );
constructs an extrusion body.
The input parameters of the function are:
sweptData – a parameter that contains data about a generatrix curve.
direction – the extrusion direction.
solid1 – used when the MbSweptWay::sw_shell option is selected, for extrusion up to the nearest faces of a given body in the forward direction.
solid2 – used when the MbSweptWay::sw_shell option is selected, for extrusion up to the nearest faces of a given body in the reverse direction.
checkIntersection – a flag for uniting the solid1 and solid2 bodies with intersection checking.
params – an object of the ExtrusionValues class that contains information on how the extrusion magnitude in each direction is defined (by distance, up to a surface, up to a body).
operNames – the operation name maker.
contoursNames – the name makers of the segments of the generatrix contour.
The output parameter of the function is the constructed body result.
The function returns an operation result code from the MbResultType enumeration (see mb_operation_result.h).
The function is declared in the action_solid.h file.
An extrusion body belongs to a type of swept bodies obtained by moving a generatrix curve along a guide curve. The guide curve of an extrusion body is a line segment. The extrusion body is constructed by moving one or several curves along a segment whose direction is defined by the direction vector.
The sweptData parameter contains information about the generatrix curves. The MbSweptData and ExtrusionValues classes are described in the op_swept_parameter.h file.
The generatrix curve of an extrusion, revolution, or kinematic operation may include a set of two-dimensional contours, a set of three-dimensional contours, a wireframe, or a body.
Two-dimensional contours on a surface may intersect. Closed intersecting contours are united using a Boolean operation on regions (Fig. 1).
Fig. 1
In the case of constructing an open shell, if an open contour is among the intersecting contours, then a shell with intersecting parts will be constructed and the function will return an error.
In the case of constructing a closed shell, intersections of shells obtained from open contours are processed by a Boolean operation on shells.
For a set of two-dimensional contours on a surface, the following constraints apply:
There may be one or several contours.
If there are several contours, they must be either all closed or all open.
If the contours are closed, they may be nested inside each other, and the nesting depth is not limited.
For two-dimensional contours on a non-planar surface, there is an additional constraint: all contours must be closed.
Construction of the operation based on two-dimensional contours on a non-planar surface assumes that the user specifies a body face as a generatrix. In this case, data for the generatrix can be obtained using the MbFace::GetSurfaceCurvesData() face method. This method returns a copy of the base surface of the face and a set of two-dimensional contours created from edge loops.
The constraint for three-dimensional contours is that constructing a closed body by extruding a three-dimensional contour is possible only for a thin-walled variant.
When both a body and a surface are specified at the same time, it is assumed that a kinematic operation is performed on the body along a curve on this surface, with the motion being aligned with the normal.
The body construction may be performed in the forward direction relative to the direction vector, in the reverse direction relative to the direction vector, or in both directions. The construction parameters in each direction are defined by MbSweptSide objects.
The params parameter contains information about the extrusion method in the forward direction MbSweptSide side1 and about the extrusion method in the reverse direction MbSweptSide side2. Extrusion in each direction can be carried out in three ways:
If way = sw_scalarValue, the extrusion is performed over the length scalarValue in the side1 or side2 direction.
If way = sw_shell, the extrusion is performed up to the nearest solid1 or solid2 object.
If way = sw_surface, the extrusion is performed up to the side1.surface or side2.surface surface if side1.distance equals zero or side2.distance equals zero, respectively.
If way = sw_surface and distance is not equal to zero, the extrusion is performed up to a surface equidistant from side1.surface or up to a surface equidistant from side2.surface, respectively.
If side1.rake is not equal to zero or side2.rake is not equal to zero, the extrusion is performed with a draft side1.rake or side2.rake in the corresponding direction.
The params.thickness1 parameter defines the offset outward from the generatrix curve, and the params.thickness2 parameter defines the offset inward from the generatrix curve.
The params.shellClosed parameter controls whether the constructed body is closed.
The params.checkSelfInt parameter indicates the need to check the construction result for self-intersection. By default, params.checkSelfInt = false, and the check is not performed.
The mergeFlags control flags manage the merging of similar faces or edges (mergeFaces = true – merge similar faces; mergeEdges = true – merge similar edges).
Fig. 2 shows the data used in construction and the inheritance scheme of extrusion body construction parameters ExtrusionValues & params.
Fig. 2
The operNames parameter provides naming of faces, edges, and vertices of the constructed body.
Fig. 3 shows a two-dimensional contour contour and a planar surface surface (MbPlane).
Fig. 3
Fig. 4 shows a closed body constructed by extrusion using the specified parameters of the contour shown in Fig. 3. Each segment of the contour corresponds to a face of the body, whose name is taken from the respective element of the name generator contoursNames[0].
Fig. 4
Fig. 5 shows a closed thin-walled body constructed by extrusion using the specified parameters of the contour shown in Fig. 3.
Fig. 5
Fig. 6 shows an open body constructed by extrusion using the specified parameters of the contour shown in Fig. 3. The construction parameters of the body shown in Fig. 4 differ from those of the body shown in Fig. 6 only by the params.shellClosed value.
Fig. 6
Fig. 7 shows a two-dimensional contour contour, a planar surface surface (MbPlane), and two bodies solid1 and solid2 that will be used in the extrusion body construction. For the construction, the solid1 and solid2 bodies must completely cover the path of contour motion in the corresponding direction. At the same time, the params.side1.rake, params.side2.rake, params.thickness1, and params.thickness2 parameters must be taken into account.
Fig. 7
Such a construction is performed by extruding the contour to a length exceeding the maximum distance to the specified body, followed by subtracting the specified body from the constructed body.
Fig. 8 shows a body constructed by extruding the contour shown in Fig. 7, with the “Up to nearest objects” options, where the solid1 and solid2 bodies are specified as such objects.
Fig. 8
Fig. 9 shows a thin-walled body with drafted faces constructed by extruding the contour shown in Fig. 7, with the “Up to nearest objects” options, where the solid1 and solid2 bodies are specified as such objects.
Fig. 9
Fig. 10 shows a two-dimensional contour contour, a planar surface surface (MbPlane) and two surfaces surface1 and surface2 that will be used in the extrusion body construction. For the construction, the surface1 and surface2 surfaces must completely cover the path of contour motion in the corresponding direction. At the same time, the params.side1.rake, params.side2.rake, params.thickness1, and params.thickness2 parameters must be taken into account. The extrusion body is cut by the specified surfaces or by surfaces equidistant from them if params.side1.distance or params.side2.distance are not equal to zero.
Fig. 10
Fig. 11 shows a body constructed by extruding the contour shown in Fig. 10, with the “Up to surface” options, where surface1 and surface2 are specified.
Fig. 11
Fig. 12 shows a thin-walled body with drafted faces constructed by extruding the contour shown in Fig. 10, with the “Up to surface” options, where surface1 and surface2 are specified.
Fig. 12
A two-dimensional contour may lie on a planar or a curved surface. For example, a body can be constructed by extruding a contour on a curved surface obtained from a loop of one of the faces of a solid body shown in Fig. 13.
Fig. 13
Fig. 14 shows a body obtained by extruding the contour on the curved surface shown in Fig. 13.
Fig. 14
Fig. 15 shows a thin-walled body obtained by extruding the contour on the curved surface shown in Fig. 13.
Fig. 15
Fig. 16 shows an open body obtained by extruding the contour on the curved surface shown in Fig. 13.
Fig. 16
If multiple non-intersecting two-dimensional contours lie on one surface, the considered function determines outer contours and inner contours nested in them, with potentially multiple nesting levels. Fig. 17 shows multiple non-intersecting two-dimensional contours contours and a planar surface surface (MbPlane).
Fig. 17
Fig. 18 shows a closed body consisting of several parts constructed by extruding the multiple contours shown in Fig. 17.
Fig. 18
Fig. 19 shows a closed body consisting of several parts constructed by extruding with a draft the multiple contours shown in Fig. 17.
Fig. 19
Fig. 20 shows a closed thin-walled body consisting of several parts constructed by extruding the multiple contours shown in Fig. 17.
Fig. 20
Fig. 21 shows two three-dimensional contours:
Fig. 21
Fig. 22 shows a doubly connected thin-walled closed body obtained by extruding the three-dimensional contours shown in Fig. 21.
Fig. 22
Fig. 23 shows two open bodies obtained by extruding the three-dimensional contours shown in Fig. 21. The construction is performed separately for each contour.
Fig. 23
The extrusion body construction function ExtrusionSolid() adds the MbCurveExtrusionSolid builder to the history of the constructed body, which contains all the data required for constructing the body. The MbCurveExtrusionSolid builder is declared in the cr_extrusion_solid.h file.
In the test.exe application, extrusion body construction is performed by the “Create->Body->Based on curves->By surface curve extrusion” and “Create->Body->Based on curves->By three-dimensional curve extrusion” menu commands.