Boolean Operation on Extrusion Body ===================================== .. _Boolean_Operation_on_Extrusion_Body_: .. role:: blue :class: blue .. версия ядра: 118056 The function .. code-block:: cpp MbResultType ExtrusionResult( MbSolid & solid, MbeCopyMode sameShell, const MbSweptData & sweptData, const MbVector3D & direction, const ExtrusionValues & params, OperationType oType, const MbSNameMaker & operNames, const RPArray & 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 :blue:`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 :blue:`ExtrusionSolid`\(), which constructs a body by extruding the curves **sweptData** according to the specified parameters **params** in the direction **direction**, and the function :blue:`BooleanResult`\(), which performs the Boolean operation **oType** of body **solid** with the body constructed in the previous step. The function :blue:`ExtrusionSolid`\() is described in Section :ref:`Constructing an Extrusion Body `, the function :blue:`BooleanResult`\() is described in Section :ref:`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 :blue:`MbeCopyMode` is provided in Section :ref:`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 :blue:`ExtrusionResult`\() when constructing a body by extruding curves has the same capabilities as the function :blue:`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**: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.1.png :width: 12cm :align: center 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: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.2.png :width: 12cm :align: center 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): .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.3.png :width: 12cm :align: center 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: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.4.png :width: 12cm :align: center 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): .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.5.png :width: 12cm :align: center 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: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.6.png :width: 12cm :align: center 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: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.3.7.png :width: 12cm :align: center Fig. 7 The function :blue:`ExtrusionResult`\() adds the builder :blue:`MbCurveExtrusionSolid` to the construction log of the created body, which contains all necessary data for executing the operation. The builder :blue:`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.