AlToolMeshFromNurbs
Class for creation of mesh objects from NURBS objects.
Synopsis
Encapsulates the algorithm for the creation of meshes from NURBS.
#include <AlToolMeshFromNurbs.h>Description
This is an algorithmic tool class used for creating data model mesh nodes by tessellating surface and shell nodes. The tool object is constructed with the tessellation options and mesh creation options:
- tessParams - controls the surface tessellation, see AlTessParams.
- keepExisting - use the existing tessellations, stored in the nodes.
- tesselateShells - tessellates the shell inputs.
- mergeVertices - Coincident vertices are merged and normals are averaged at the merged vertices.
- keepOriginals - Keep the original surfaces after the mesh creation.
The input surfaces and shells can be set with the base class AlModelTool::setNodes() or added with AlModelTool::addNode(). After the algorithm execution, the resulting mesh nodes are added to the model.
To access the results, use the base class AlModelTool::getResult() for AlDagNode objects, or getMeshes() for AlMeshNode objects.
Example:
AlTessParams params;
params.setTolerance( 0.01 );
params.setMaxEdgeLength( 1 );
params.setTessellateShells( true );
AlToolMeshFromNurbs tool( params, true, true, true, false );
auto& nodes = getSomeSurfaceAndShells();
tool.setNodes( nodes );
//or:
for( auto dagNode; nodes )
meshFromNurbsTool.add( dagNode );
if( tool.execute() == sSuccess )
{
auto& result = tool.getResult();
nextTool.setNodes( result );
or
auto meshes = tool.getMeshes();
for( auto mesh = meshes.first(); mesh; mesh = mesh->next() )
{
}
}
#ifndef _AlToolMeshFromNurbs
#define _AlToolMeshFromNurbs
#include <AlStudioAPIDecl.h>
#include <AlModelTool.h>
#include <statusCodes.h>
#include <AlLinkListT.h>
class AlMeshNode;
class AlTessParams;
class STUDIOAPI_DECL AlToolMeshFromNurbs : public AlModelTool
{
public:
using AlNodeList = AlListT<AlMeshNode>;
AlToolMeshFromNurbs( const AlTessParams& tessParams,
bool keepExisting,
bool tesselateShells,
bool mergeVertices,
bool keepOriginal );
~AlToolMeshFromNurbs();
statusCode execute() override;
AlNodeList getMeshes() const;
private:
AlToolMeshFromNurbs( const AlToolMeshFromNurbs& ) = delete;
AlToolMeshFromNurbs( const AlToolMeshFromNurbs&& ) = delete;
AlToolMeshFromNurbs& operator=( const AlToolMeshFromNurbs& ) = delete;
struct Impl;
Impl* m_impl{ nullptr };
};
#endif
