Construction of Equidistant Body

The function

MbResultType OffsetShell(       MbSolid &              solid,
                                MbeCopyMode            sameShell,
                                RPArray<MbFace> &      initFaces,
                                bool                   checkFacesConnection,
                                SweptValues &          p,
                          const MbSNameMaker &         operNames,
                                bool                   copyFaceAttrs,
                                MbSolid *&             result );

constructs an equidistant body for a set of faces.

Input parameters of the function are as follows:

  • solid is an original body;

  • sameShell is the copy mode of an original body;

  • initFaces are faces of an original body;

  • checkFacesConnection is the flag that checks the connection of selected faces:

    true – the operation checks that all faces in initFaces form a single connected region; if the connectivity is violated, an error code is returned and the equidistant body is not constructed;

    false – the check is not performed, which may lead to several disconnected parts of the result or to a failure of the operation;

  • p is an object containing construction parameters;

  • operNames is the operation namer;

  • copyFaceAttrs is the flag for copying attributes from original faces to equidistant faces.

The function output parameter is the result parameter, which contains the constructed body.

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

The function is declared in action_shell.h file.

The function constructs a body, the faces of which are equidistant to initFaces of the solid original body.

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

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

  • cm_KeepHistory (an original shell and its copy have the same basic surfaces, vertices, and faces unchanged by the operation);

  • cm_KeepSurface (the original shell and its copy have the same basic surfaces);

  • cm_Copy (the original shell and its copy do not have the same data).

The detailed description of the MbeCopyMode enumeration is located in section Copying a Set of Faces.

The p parameter contains information about the distance between constructed faces and the original body faces. The distance can be equal to p.thickness1 in positive direction or to p.thickness2 in negative direction of the normal of the original body faces.

If p.shellClosed = false, then a non-closed body will be constructed.

The p.checkSelfInt parameter indicates the need to check a construction result for self-intersection. By default, p.checkSelfInt = false – the check is not performed.

The p.mergeFlags flags control the merging of similar faces and edges (true – merge similar elements).

The operNames parameter is used to name faces, edges and vertices of the constructed body.

Fig. 1 shows a body, its selected faces will be used to construct an equidistant body:

../../../../_images/M.1.15.1.png

Fig. 1

Fig. 2 shows the constructed equidistant body:

../../../../_images/M.1.15.2.png

Fig. 2

If the initFaces set contains all faces of the solid original body, the result constructed body will be equidistant to the solid.

The function OffsetShell() adds MbShellSolid builder containing all construction data required into the body log. MbShellSolid constructor is declared in cr_thin_shell_solid.h file.

Test.exe test application allow to construct an equidistant non-closed body using «Create→Solid→Based on a solid→Offset solid» menu.