Constructing a Patch

The function

MbResultType PatchShell( const MbPatchShellParams & params,
                               c3d::SolidSPtr &     result );

constructs a patch from a set of curves.

A params object of the MbPatchShellParams class is the input parameter of the function and contains the following parameters required for the operation (see op_shell_parameter.h):

  • initCurves – is a set of curves;

  • patchValues – is an object of the PatchValues structure, which contains construction parameters;

  • names – is the operation’s namer.

The MbPatchShellParams class contains three constructors for a set of curves, parameters, and the namer:

MbPatchShellParams( const std::vector<SPtr<MbPatchCurve>> & initCurves,
                    const PatchValues                     & patchValues,
                    const MbSNameMaker                    & names );


MbPatchShellParams( const RPArray<MbPatchCurve> & initCurves,
                    const PatchValues           & patchValues,
                    const MbSNameMaker          & names );


MbPatchShellParams( const RPArray<MbCurve3D> & initCurves,
                    const PatchValues        & patchValues,
                    const MbSNameMaker       & names );

The function output parameter is the result parameter, which contains a 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 formed by a face, the borders of which contain defined curves. The body will be constructed correctly if the curves of initCurves set connect end-to-end and form a closed contour.

If all initCurves in the set lie in a single plane, the patch is a portion of that plane bounded by the contour formed by the curves.

If all initCurves in the curve set lie on a single curved surface, the patch will be a portion of that surface bounded by the contour formed by the specified curves.

If initCurves set contains a single curve, that curve is split into two segments, and the resulting patch surface is a ruled surface with two poles.

A patch is constructed in a similar way when the initCurves set contains two curves: the patch surface will be a ruled surface with two poles.

If the number of initCurves is three, the patch surface will be an MbCornerSurface constructed from the three curves and having a pole.

If the number of initCurves is four, the patch surface will be an MbCoverSurface constructed by the four curves. In other cases, the construction may fail.

The patchValues object contains information about the patch type and the self-intersection check flag. To initialize the object the following constructor of the PatchValues structure is set by default:

PatchValues()
  : type               ( ts_none  )
  , checkSelfInt       ( false    )
  , mergeEdges         ( true     )
  , tolerantData       ( false    )
  , internalMatingType ( pmt_None )
{ }

where

  • type – is the patch type;

  • checkSelfInt – is the intersection check flag;

  • mergeEdges – is the flag for merging similar edges (true – merge similar edges);

  • tolerantData – is the flag for building an inaccurate patch based on inaccurate input data;

  • internalMatingType – is the conjugation type between patch parts. Used for type = ts_byCurves.

The following patch types are defined for the patchValues object (see the SurfaceType enumeration):

  • ts_tang – tangentially;

  • ts_norm – according to a norm;

  • ts_none – not defined;

  • ts_plane – is a flat patch;

  • ts_byCurves – the construction is set by conjugates for each curve.

The ts_tang and ts_norm types are set when constructing a patch tangentially or normally, respectively.

If the patch type ts_plane is set, a patch with flat edges is constructed.

The ts_byCurves type is set if you want to build a patch with conjugation along some boundaries. In this case, for a desired MbPatchCurve boundary, you need to set the conjugation by the SetMating() method.

Fig. 1 shows eight curves on the boundary of the inner face cut. Fig. 2 shows a patch constructed from the curves shown in Fig. 1:

../../../../_images/M.1.12.1.png

Fig. 1

../../../../_images/M.1.12.2.png

Fig. 2

Fig. 3 shows six curves lying on the borders of various faces produced by cutting faces with a common surface.

../../../../_images/M.1.12.3.png

Fig. 3

If the boundary edges retain information about the cutting surface after the cut, that surface can be used to construct the patch. Fig. 4 shows an example of constructing a patch as a part of the cutting surface that formed border edges shown in Fig. 3:

../../../../_images/M.1.12.4.png

Fig. 4

As a rule, the curves for initCurves set are taken from border edges. After construction, the patch is often stiched with other bodies adjacent to its borders.

PatchShell() function adds MbPatchCreator constructor into a log of the newly constructed body. MbPatchCreator constructor is declared in cr_patch_creator.h file.