.. role:: blue :class: blue Constructing a Symmetrical Body ================================ .. _Constructing_a_Symmetrical_Body_: .. версия ядра: 118041 The function .. code-block:: cpp MbResultType SymmetrySolid( MbSolid & solid, MbeCopyMode sameShell, const MbSymmetrySolidParams & symParams, c3d::SolidSPtr & result ); constructs a symmetrical body with a given symmetry plane. The input parameters of the function are: - **solid** -- the original body; - **sameShell** -- the copying mode of the original body; - **symParams** -- the parameters of the operation. The output parameter of the function is the constructed body **result**. The function returns an operation result code from the :blue:`MbResultType` enumeration. The function is declared in the *action_solid.h* file. The parameter **sameShell** can take one of four values: - *cm_Same* = 0 (the shell is not copied); - *cm_KeepHistory* (the original shell and its copy have common base surfaces, vertices and faces unchanged by the operation); - *cm_KeepSurface* (the original shell and its copy have common base surfaces); - *cm_Copy* (the original shell and its copy have no common data). The enumeration :blue:`MbeCopyMode` is described in section :ref:`Copying a Set of Faces MbFaceShell `. In the :blue:`MbSymmetrySolidParams` class, the following constructor is defined to initialize the object **symParams** (see *op_shell_parameter.h*): .. code-block:: cpp MbSymmetrySolidParams( const MbPlacement3D & place, const MbSNameMaker & operNames, ThreeStates side ); where - **place** -- the local coordinate system; - **side** -- the retained part of the original body relative to the symmetry plane (+1 for the part above the plane, -1 for the part below the plane); - **operNames** -- the namer for faces, edges and vertices of the constructed body. If the parameter **symParams**.\ *side* = 1, the function creates a symmetrical body with respect to the specified symmetry plane as follows: the source body is cut by the XY-plane of the local coordinate system, the part of the source body located in the positive direction of the Z-axis from this plane is taken, a mirror copy of the selected part of the source body is constructed and then united with the selected part. If **symParams**.\ *side* = -1, the function unites the part of the source body located in the negative direction of the Z-axis from the XY-plane of the local coordinate system with the mirror copy of this part with respect to the symmetry plane. The parameter **operNames** provides naming for faces, edges and vertices of the constructed body. Fig. 1 shows the original body **solid** and the symmetry plane **place**: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.9.1.png :width: 9cm :align: center Fig. 1 Fig. 2 shows the constructed body **result**: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.9.2.png :width: 11cm :align: center Fig. 2 Fig. 3 shows the constructed body **result** for a symmetry plane with opposite normal: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.9.3.png :width: 9cm :align: center Fig. 3 Fig. 4 shows the original body **solid** and the symmetry plane **place**, which do not intersect: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.16.1.png :width: 9cm :align: center Fig. 4 Fig. 5 shows the original body **solid** and the constructed mirror body **result**: .. figure:: /MODELER/OPERATIONS_ON_BODIES/pictures/M.2.16.2.png :width: 12cm :align: center Fig. 5 The function :blue:`SymmetrySolid`\() adds to the operation log of the constructed body the builder :blue:`MbSymmetrySolid`, which contains all necessary data for performing the operation. The builder :blue:`MbSymmetrySolid` is declared in the file *cr_symmetry_solid.h*. In the test application *test.exe*, constructing a symmetrical body is performed using the menu command "Create→Solid→Based on a solid→Symmetric".