Boolean Operation on Extrusion Body

The function

MbResultType ExtrusionResult(       MbSolid &               solid,
                                    MbeCopyMode             sameShell,
                              const MbSweptData &           sweptData,
                              const MbVector3D &            direction,
                              const ExtrusionValues &       params,
                                    OperationType           oType,
                              const MbSNameMaker &          operNames,
                              const RPArray<MbSNameMaker> & contoursNames,
                                    MbSolid *&              result );

constructs an extrusion body and executes a Boolean operation between a specified body and the constructed extrusion body.

The input parameters of the function are:

  • solid – a given body for the Boolean operation;

  • sameShell – the copy mode for the given body;

  • sweptData – data about the generatrix curves for constructing the extrusion body;

  • direction – an extrusion direction;

  • params – an object containing construction parameters that provide information for constructing array operation elements up to the surface;

  • oType – a type of Boolean operation:

    bo_Union – union of bodies,

    bo_Intersect – intersection of bodies,

    bo_Difference – difference of bodies;

  • operNames – an operation name maker;

  • contoursNames – name makers for the generatrix curves.

The output parameter of the function is the object result containing the constructed body.

The function returns a result code from the enumeration MbResultType (see mb_operation_result.h).

The function is declared in the file action_solid.h.

The function is implemented as a sequential combination of two functions: the function ExtrusionSolid(), which constructs a body by extruding the curves sweptData according to the specified parameters params in the direction direction, and the function BooleanResult(), which performs the Boolean operation oType of body solid with the body constructed in the previous step.

The function ExtrusionSolid() is described in Section Constructing an Extrusion Body, the function BooleanResult() is described in Section Boolean Operation on Bodies.

The parameter sameShell controls the transfer of faces, edges, and vertices from the original body solid to the constructed body result and can take one of four values:

  • cm_Same = 0 (the shell is not copied);

  • cm_KeepHistory (the original shell and its copy share common base surfaces, vertices, and faces unchanged by the operation);

  • cm_KeepSurface (the original shell and its copy share common base surfaces);

  • cm_Copy (the original shell and its copy have no shared data).

A detailed description of the enumeration MbeCopyMode is provided in Section Copying a Set of Faces MbFaceShell.

The parameter oType defines the type of Boolean operation and can take three values: bo_Union, bo_Intersect, bo_Difference.

When oType = bo_Union, the function performs a union of bodies solid and the extrusion body.

When oType = bo_Intersect, the function performs an intersection of bodies solid and the extrusion body.

When oType = bo_Difference, the function performs a difference operation, subtracting the extrusion body from body solid.

The parameters operNames and contoursNames provide naming for faces, edges, and vertices of the constructed body.

The function ExtrusionResult() when constructing a body by extruding curves has the same capabilities as the function ExtrusionSolid(): the extruded curves can be located on a plane, a curved surface, or in space. Extrusion can be performed in forward, reverse, or both directions, with or without face tapering. The body can completely fill closed curves or have thin walls.

The following sections focus on selected capabilities of this function related to Boolean operations.

Figure 1 shows body solid, the generatrix curve contained in data sweptData, and the extrusion direction direction:

../../../../_images/M.2.3.1.png

Fig. 1

Figure 2 shows the result of the union Boolean operation of body solid and a thin-walled body obtained by extruding the generatrix curve sweptData in the direction direction shown in Figure 1 by a specified distance:

../../../../_images/M.2.3.2.png

Fig. 2

Figure 3 shows the result of the Boolean union of body solid and the body obtained by extruding the generatrix curve sweptData in the direction direction shown in Figure 1. The extrusion of the generatrix curve was performed in the reverse direction without tapering with the “Up to Nearest Objects” option (params.side2.way = sw_shell):

../../../../_images/M.2.3.3.png

Fig. 3

Figure 4 shows the result of the Boolean difference of subtracting from body solid a body obtained by extruding the generatrix curve sweptData in the direction direction shown in Figure 1:

../../../../_images/M.2.3.4.png

Fig. 4

Figure 5 shows the result of the Boolean difference of subtracting from body solid a body obtained by extruding the generatrix curve sweptData in the direction direction shown in Figure 1. The extrusion of the generatrix curve was performed in the reverse direction without tapering with the “Up to Nearest Objects” option (params.side2.way = sw_shell):

../../../../_images/M.2.3.5.png

Fig. 5

Figure 6 shows the result of the Boolean intersection of body solid and a body obtained by extruding the generatrix curve sweptData in the direction direction shown in Figure 1:

../../../../_images/M.2.3.6.png

Fig. 6

Figure 7 shows the result of the intersection Boolean operation of body solid and a body obtained by extruding the generatrix curve sweptData in the direction direction shown in Figure 1. The extrusion of the generatrix curve was performed in the reverse direction without tapering with the “Up to Nearest Objects” option:

../../../../_images/M.2.3.7.png

Fig. 7

The function ExtrusionResult() adds the builder MbCurveExtrusionSolid to the construction log of the created body, which contains all necessary data for executing the operation. The builder MbCurveExtrusionSolid is declared in the file cr_extrusion_solid.h.

In the test application test.exe, Boolean operations with the constructed extrusion body are executed through the following menu commands:

  • Create→Solid→As union with a solid→Curve extrusion;

  • Create→Solid→As subtraction with a solid→Curve extrusion;

  • Create→Solid→As intersection with a solid→Curve extrusion.