Share

AlToolStitch

Class for stitching data model surface nodes and creating shells.

Synopsis

This is an algorithmic tool class used for stitching data model surface nodes and creating shells.

#include <AlToolStitch.h>

Description

The tool object is constructed with stitching options, used to control the stitching algorithm:

  • keepOriginals - Keep the original surfaces after the shell is created.
  • detachSingleCurves - Detach trim edges made from single curves on surface (such as a round hole in the middle of a plane).
  • detachPeriodics - Detach the seam of periodic surfaces (that is, closed surfaces such as cylinders and surfaces created with the Revolve tool) before stitching them into a shell.
  • tol - If the gap between two edges is within this tolerance, the edges are joined. The input surfaces can be set with the base class AlModelTool::setNodes() or added with AlModelTool::addNode() functions.

After the execution, the resulting shell nodes are added to the model.The inputs are cleared and the tool is ready for reuse.

To access the results, use the base class AlModelTool::getResult() for AlDagNode objects, or getShells() for AlShellNode objects.

Example:

     AlListT<AlDagNode> nodes = getSomeNodes();

     double stitch_tol = 0.01;
     AlToolStitch tool( false, true, true, false, stitch_tol );

     tool.setNodes( nodes );
     // or:
     for( auto dagNode : nodes )
         tool.addNode( dagNode );

     if( tool.execute() == sSuccess )
     {
         auto& result = tool.getResult();
         nextTool.setNodes( result );
         nextTool.execute();
         // or:
         auto shells = tool.getShells();
         for( auto shell = shells.first(); shell; shell = shell->next() )
         {
         }
     }

#ifndef _AlToolStitch

#define _AlToolStitch

#include <AlStudioAPIDecl.h>

#include <AlModelTool.h>

#include <statusCodes.h>

#include <AlLinkListT.h>

class AlShellNode;

class STUDIOAPI_DECL AlToolStitch : public AlModelTool
{
public:
    using AlNodeList = AlListT<AlShellNode>;

    AlToolStitch( bool keepOriginals,
                  bool detachSingleCurves,
                  bool detachPeriodics,
                  double tol );
    ~AlToolStitch();

    statusCode execute() override;
    AlNodeList getShells() const;

private:
    AlToolStitch( const AlToolStitch& ) = delete;
    AlToolStitch( const AlToolStitch&& ) = delete;
    AlToolStitch& operator=( const AlToolStitch& ) = delete;

    struct Impl;
    Impl* m_impl;
};
#endif

Was this information helpful?