AMCAX Kernel
Geometry kernel for CAD/CAE/CAM
AMCAX Kernel 1.0.0.0
Loading...
Searching...
No Matches
AMCAX::NextMesh::NMAPIModel Class Reference

Class of model in NextMesh. More...

#include <nextmesh/NMAPIModel.hpp>

Public Member Functions

AMCAX_API void ImportModel (const std::string &filePath, const bool replace=true)
 Load a cad file, only support step currently. Note: this import method does not specify any entity tags, which will be generated internally. The tag counts from 1 in each dimension.
 
AMCAX_API void ImportModel (const std::vector< NMShape > &shapes, const bool replace=true)
 Load a cad model represented by AMCAX TopoShape. Note: this import method does not specify any entity tags, which will be generated internally. The tag counts from 1 in each dimension.
 
AMCAX_API void ImportModel (const ShapeData &shape, const bool replace=true)
 Load a cad model with associated tags. Two principles: 1. The tags of different entities in the same dimension must be different; 2. All low dimensional entities contained within high-dimensional entities must be tagged.
 
AMCAX_API void GenerateMesh (const std::string &configJson)
 Generates the mesh for the current model based on provided configuration parameters.
 
AMCAX_API void DeleteMesh ()
 Delete all the generated mesh. All the mesh handles are invalid after deleting mesh.
 
AMCAX_API NMMesh GetMesh ()
 Get the mesh handle. Note one model only holds a unique mesh.
 
AMCAX_API void GetEntities (std::vector< NMEntity > &ents, const DimType dim)
 get all the entities in the specified dim
 
AMCAX_API Indext GetEntityCount (const DimType dim=DimType::DAll)
 get the number of all entities in specified dim
 
AMCAX_API DimType EntityGetDim (const NMEntity &ent)
 get the dimension of the given entity
 
AMCAX_API EntTag EntityGetTag (const NMEntity &ent)
 get the tag of the given entity
 
AMCAX_API NMEntity GetEntity (const DimType dim, const EntTag etag)
 get the entity handle by entity tag and dimension
 
AMCAX_API void GetBBox (NMPoint3 &pmin, NMPoint3 &pmax, const NMEntity &ent=nullptr)
 get the boundingbox of the entity. when ent = nullptr, return the model bbox
 
AMCAX_API void GetEntitiesInBBox (std::vector< NMEntity > &entities, const NMPoint3 &pmin, const NMPoint3 &pmax, const bool isStrict=false, const DimType dim=DimType::DAll)
 get the entities intersected with/enclosed by the given bbox
 
AMCAX_API void GetParentAdjacentEntities (std::vector< NMEntity > &parents, const NMEntity &ent)
 get all the entities in dim+1 that contain the entity
 
AMCAX_API void GetChildAdjacentEntities (std::vector< NMEntity > &children, std::vector< Orientation > &oris, const NMEntity &ent)
 get all the entities in dim-1 contained by the entity
 
AMCAX_API DimType GetModelMaxDim ()
 the maximum dimension of the model
 
AMCAX_API void CreatePhysicalSet (const DimType dim, const std::vector< EntTag > &entTags, const std::string &pName)
 create a new physical set for the specified entities with specified dimension
 
AMCAX_API void AddPhysicalSet (const DimType dim, const std::vector< EntTag > &entTags, const std::string &pName)
 incrementally add entities into the specified physical set
 
AMCAX_API void RemovePhysicalSet (const DimType dim, const std::string &pName)
 remove the specified physical set
 
AMCAX_API void GetEntitiesInPhysicalSet (std::vector< EntTag > &entTags, const DimType dim, const std::string &pName)
 get entities in the specified physical set
 
AMCAX_API void GetPhysicalSets (std::set< std::string > &pNames, const DimType dim)
 get all the physical sets in the specified dim
 
AMCAX_API bool IsFacePairContacted (const NMEntity &face1, const NMEntity &face2, const double tolDist, const double tolAng)
 determine whether two face entities are in contact
 

Static Public Member Functions

static AMCAX_API void InitLogger (const std::string &logFileName="", const std::string &logPattern="[%Y-%m-%dT%X%z] [%l] %v", const int64_t logFileSize=20 *1024 *1024, const int maxLogFiles=100)
 set the logger. the logger is closed by default, if this function is not called
 
static AMCAX_API void SetProgressBarCallBack (PBCallBackFunc *cb)
 set the progressbar callback function
 

Detailed Description

Class of model in NextMesh.

Member Function Documentation

◆ AddPhysicalSet()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::AddPhysicalSet ( const DimType dim,
const std::vector< EntTag > & entTags,
const std::string & pName )

incrementally add entities into the specified physical set

Parameters
dimdimension
entTagsentity tags
pNamephysicalset name

◆ CreatePhysicalSet()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::CreatePhysicalSet ( const DimType dim,
const std::vector< EntTag > & entTags,
const std::string & pName )

create a new physical set for the specified entities with specified dimension

Parameters
dimdimension
entTagsentity tags
pNamephysicalset name

◆ EntityGetDim()

AMCAX_API DimType AMCAX::NextMesh::NMAPIModel::EntityGetDim ( const NMEntity & ent)

get the dimension of the given entity

Parameters
ententity
Returns
the dimension of the given entity

◆ EntityGetTag()

AMCAX_API EntTag AMCAX::NextMesh::NMAPIModel::EntityGetTag ( const NMEntity & ent)

get the tag of the given entity

Parameters
ententity
Returns
the tag of the given entity

◆ GenerateMesh()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GenerateMesh ( const std::string & configJson)

Generates the mesh for the current model based on provided configuration parameters.

Parameters
configJsonA JSON-formatted string containing the control parameters for mesh generation

◆ GetBBox()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetBBox ( NMPoint3 & pmin,
NMPoint3 & pmax,
const NMEntity & ent = nullptr )

get the boundingbox of the entity. when ent = nullptr, return the model bbox

Parameters
pminmin point of the boundingbox
pmaxmax point of the boundingbox
ententity

◆ GetChildAdjacentEntities()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetChildAdjacentEntities ( std::vector< NMEntity > & children,
std::vector< Orientation > & oris,
const NMEntity & ent )

get all the entities in dim-1 contained by the entity

Parameters
childrenall the entities in dim-1 contained by the entity
oristhe orientations of all the children
entcurrent entity

◆ GetEntities()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetEntities ( std::vector< NMEntity > & ents,
const DimType dim )

get all the entities in the specified dim

Parameters
entsthe obtained entities
dimdim =0 vertex; dim=1 edge; dim=2 face; dim=3 solid;

◆ GetEntitiesInBBox()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetEntitiesInBBox ( std::vector< NMEntity > & entities,
const NMPoint3 & pmin,
const NMPoint3 & pmax,
const bool isStrict = false,
const DimType dim = DimType::DAll )

get the entities intersected with/enclosed by the given bbox

Parameters
entitiesthe obtained entities
pminmin point of the boundingbox
pmaxmax point of the boundingbox
isStrictif true, enclosed; otherwise, intersected.
dimonly consider the entity in given dim, if dim = -1,take all the shapes into account.

◆ GetEntitiesInPhysicalSet()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetEntitiesInPhysicalSet ( std::vector< EntTag > & entTags,
const DimType dim,
const std::string & pName )

get entities in the specified physical set

Parameters
entTagsentity tags
dimdimension
pNamephysicalset name

◆ GetEntity()

AMCAX_API NMEntity AMCAX::NextMesh::NMAPIModel::GetEntity ( const DimType dim,
const EntTag etag )

get the entity handle by entity tag and dimension

Parameters
dimdimension
etagentity tag
Returns
entity handle

◆ GetEntityCount()

AMCAX_API Indext AMCAX::NextMesh::NMAPIModel::GetEntityCount ( const DimType dim = DimType::DAll)

get the number of all entities in specified dim

Parameters
dimdim =0 vertex; dim=1 edge; dim=2 face; dim=3 solid; dim=-1 all shapes;
Returns
the number of the obtained entities

◆ GetMesh()

AMCAX_API NMMesh AMCAX::NextMesh::NMAPIModel::GetMesh ( )

Get the mesh handle. Note one model only holds a unique mesh.

Returns
mesh handle

◆ GetModelMaxDim()

AMCAX_API DimType AMCAX::NextMesh::NMAPIModel::GetModelMaxDim ( )

the maximum dimension of the model

Returns
max dim of the model

◆ GetParentAdjacentEntities()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetParentAdjacentEntities ( std::vector< NMEntity > & parents,
const NMEntity & ent )

get all the entities in dim+1 that contain the entity

Parameters
parentsall the entities in dim+1 that contain the entity
entcurrent entity

◆ GetPhysicalSets()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::GetPhysicalSets ( std::set< std::string > & pNames,
const DimType dim )

get all the physical sets in the specified dim

Parameters
pNamesthe physical set names
dimdimension

◆ ImportModel() [1/3]

AMCAX_API void AMCAX::NextMesh::NMAPIModel::ImportModel ( const ShapeData & shape,
const bool replace = true )

Load a cad model with associated tags. Two principles: 1. The tags of different entities in the same dimension must be different; 2. All low dimensional entities contained within high-dimensional entities must be tagged.

Parameters
shapeThe CAD shape, considered from a decomposition perspective.
replaceA flag indicating whether to replace the existing model. If set to true, the existing model is replaced; if false, the shapes are merged with the existing model. In either case, the two principles must be strictly followed.
Returns

◆ ImportModel() [2/3]

AMCAX_API void AMCAX::NextMesh::NMAPIModel::ImportModel ( const std::string & filePath,
const bool replace = true )

Load a cad file, only support step currently. Note: this import method does not specify any entity tags, which will be generated internally. The tag counts from 1 in each dimension.

Parameters
filePathThe cad file path to be imported
replaceIf true, the existing model is replaced; otherwise, the shapes are added to the existing model

◆ ImportModel() [3/3]

AMCAX_API void AMCAX::NextMesh::NMAPIModel::ImportModel ( const std::vector< NMShape > & shapes,
const bool replace = true )

Load a cad model represented by AMCAX TopoShape. Note: this import method does not specify any entity tags, which will be generated internally. The tag counts from 1 in each dimension.

Parameters
shapesThe shapes generated by AMCAX-Kernel
replaceIf true, the existing model is replaced; otherwise, the shapes are added to the existing model

◆ InitLogger()

static AMCAX_API void AMCAX::NextMesh::NMAPIModel::InitLogger ( const std::string & logFileName = "",
const std::string & logPattern = "[%Y-%m-%dT%X%z] [%l] %v",
const int64_t logFileSize = 20 *1024 *1024,
const int maxLogFiles = 100 )
static

set the logger. the logger is closed by default, if this function is not called

Parameters
logFileNameif set, then output log to the file
logPatternlog pattern
logFileSizethe maximum size of a single file
maxLogFilesthe maximum number of files to keep
Returns

◆ IsFacePairContacted()

AMCAX_API bool AMCAX::NextMesh::NMAPIModel::IsFacePairContacted ( const NMEntity & face1,
const NMEntity & face2,
const double tolDist,
const double tolAng )

determine whether two face entities are in contact

Parameters
face1face-entity-1
face2face-entity-2
tolDistdistance tolerance between two faces
tolAngangle tolerances between the normals of two faces
Returns
true if in contact, otherwise false

◆ RemovePhysicalSet()

AMCAX_API void AMCAX::NextMesh::NMAPIModel::RemovePhysicalSet ( const DimType dim,
const std::string & pName )

remove the specified physical set

Parameters
dimdimension
pNamephysicalset name

◆ SetProgressBarCallBack()

static AMCAX_API void AMCAX::NextMesh::NMAPIModel::SetProgressBarCallBack ( PBCallBackFunc * cb)
static

set the progressbar callback function

Parameters
cbcallback function
Returns

The documentation for this class was generated from the following file: