RWMesh
OCCT package RWMesh: RWMesh, RWMesh_CafReader, RWMesh_CafReaderStatusEx, RWMesh_CoordinateSystem, and 11 more bound classes.
RWMesh
Auxiliary tools for RWMesh package.
Constructors(1)
Static methods(2)
- ReadNameAttribute(theLabel: TDF_Label): TCollection_AsciiString
Read name attribute from label.
Parameters (1)theLabel
- FormatName(theFormat: RWMesh_NameFormat, theLabel: TDF_Label, theRefLabel: TDF_Label): TCollection_AsciiString
Generate name for specified labels.
Parameters (3)theFormat—name format to applytheLabel—instance labeltheRefLabel—product label
RWMesh_CafReader
The general interface for importing mesh data into XDE document.
The tool implements auxiliary structures for creating an XDE document in two steps: 1) Creating TopoDS_Shape hierarchy (myRootShapes) and Shape attributes (myAttribMap) separately within performMesh(). Attributes include names and styles. 2) Filling XDE document from these auxiliary structures. Named elements are expanded within document structure, while Compounds having no named children will remain collapsed.
In addition, unnamed nodes can be filled with generated names like "Face", "Compound" via generateNames() method, and the very root unnamed node can be filled from file name like "MyModel.obj".
Static methods(2)
- get_type_name(): string
Instance methods(29)
Return target document.
- SetDocument(theDoc: TDocStd_Document): void
Set target document. Set system length unit according to the units of the document.
Parameters (1)theDoc
Return prefix for generating root labels names.
- SetRootPrefix(theRootPrefix: TCollection_AsciiString): void
Set prefix for generating root labels names.
Parameters (1)theRootPrefix
- ToFillIncompleteDocument(): boolean
Flag indicating if partially read file content should be put into the XDE document, TRUE by default.
Partial read means unexpected end of file, critical parsing syntax errors in the middle of file, or reached memory limit indicated byperformMesh()returning FALSE. Partial read allows importing a model even in case of formal reading failure, so that it will be up to user to decide if processed data has any value.
In case of partial read (performMesh()returns FALSE, but there are some data that could be put into document),Perform()will return TRUE and result flag will have failure bit set.See alsoMemoryLimitMiB()ExtraStatus()
- SetFillIncompleteDocument(theToFillIncomplete: boolean): void
Set flag allowing partially read file content to be put into the XDE document.
Parameters (1)theToFillIncomplete
- MemoryLimitMiB(): number
Return memory usage limit in MiB, -1 by default which means no limit.
- SetMemoryLimitMiB(theLimitMiB: number): void
Set memory usage limit in MiB; can be ignored by reader implementation!
Parameters (1)theLimitMiB
Return coordinate system converter.
- SetCoordinateSystemConverter(theConverter: RWMesh_CoordinateSystemConverter): void
Set coordinate system converter.
Parameters (1)theConverter
- SystemLengthUnit(): number
Return the length unit to convert into while reading the file, defined as scale factor for m (meters); -1.0 by default, which means that NO conversion will be applied.
- SetSystemLengthUnit(theUnits: number): void
Set system length units to convert into while reading the file, defined as scale factor for m (meters).
Parameters (1)theUnits
- HasSystemCoordinateSystem(): boolean
Return TRUE if system coordinate system has been defined; FALSE by default.
Return system coordinate system; UNDEFINED by default, which means that no conversion will be done.
- SetSystemCoordinateSystem(theCS: gp_Ax3): void
Set system origin coordinate system to perform conversion into during read.
Parameters (1)theCS
- SetSystemCoordinateSystem(theCS: RWMesh_CoordinateSystem): void
Set system origin coordinate system to perform conversion into during read.
Parameters (1)theCS
- FileLengthUnit(): number
Return the length unit to convert from while reading the file, defined as scale factor for m (meters). Can be undefined (-1.0) if file format is unitless.
- SetFileLengthUnit(theUnits: number): void
Set (override) file length units to convert from while reading the file, defined as scale factor for m (meters).
Parameters (1)theUnits
- HasFileCoordinateSystem(): boolean
Return TRUE if file origin coordinate system has been defined.
Return file origin coordinate system; can be UNDEFINED, which means no conversion will be done.
- SetFileCoordinateSystem(theCS: gp_Ax3): void
Set (override) file origin coordinate system to perform conversion during read.
Parameters (1)theCS
- SetFileCoordinateSystem(theCS: RWMesh_CoordinateSystem): void
Set (override) file origin coordinate system to perform conversion during read.
Parameters (1)theCS
- Perform(theFile: TCollection_AsciiString, theProgress: Message_ProgressRange): boolean
Open stream and pass it to Perform method. The Document instance should be set beforehand.
Parameters (2)theFiletheProgress
- ExtraStatus(): number
Return extended status flags.
See also Return result as a single shape.
Return the list of complementary files - external references (textures, data, etc.).
- Metadata(): any
Return metadata map.
- ProbeHeader(theFile: TCollection_AsciiString, theProgress: Message_ProgressRange): boolean
Open stream and pass it to ProbeHeader method.
Parameters (2)theFiletheProgress
RWMesh_CafReaderStatusEx
Properties(2)
RWMesh_CoordinateSystem
Properties(7)
RWMesh_CoordinateSystemConverter
Coordinate system converter defining the following tools:
- Initialization for commonly used coordinate systems Z-up and Y-up.
- Perform length unit conversion (scaling).
- Conversion of three basic elements: a) mesh node Positions, b) mesh node Normals, c) model nodes Transformations (locations).
RWMesh_CoordinateSystemenumeration is used for convenient conversion between two commonly used coordinate systems, to make sure that imported model is oriented up. Butgp_Ax3can be used instead for defining a conversion between arbitrary systems (e.g. including non-zero origin).
The converter requires defining explicitly both input and output systems, so that if either input or output is undefined, then conversion will be skipped. Length units conversion and coordinate system conversion are decomposed, so that application might specify no length units conversion but Y-up to Z-up coordinate system conversion.
Class defines dedicated methods for parameters of input and output systems. This allows passing tool through several initialization steps, so that a reader can initialize input length units (only if file format defines such information), while application specifies output length units, and conversion will be done only when both defined.
Constructors(1)
Empty constructor.
Static methods(1)
Return a standard coordinate system definition.
Parameters (1)theSys
Instance methods(16)
- IsEmpty(): boolean
Return TRUE if there is no transformation (target and current coordinates systems are same).
- InputLengthUnit(): number
Return source length units, defined as scale factor to m (meters). -1.0 by default, which means that NO conversion will be applied (regardless output length unit).
- SetInputLengthUnit(theInputScale: number): void
Set source length units as scale factor to m (meters).
Parameters (1)theInputScale
- OutputLengthUnit(): number
Return destination length units, defined as scale factor to m (meters). -1.0 by default, which means that NO conversion will be applied (regardless input length unit).
- SetOutputLengthUnit(theOutputScale: number): void
Set destination length units as scale factor to m (meters).
Parameters (1)theOutputScale
- HasInputCoordinateSystem(): boolean
Return TRUE if source coordinate system has been set; FALSE by default.
Source coordinate system; UNDEFINED by default.
- SetInputCoordinateSystem(theSysFrom: gp_Ax3): void
Set source coordinate system.
Parameters (1)theSysFrom
- SetInputCoordinateSystem(theSysFrom: RWMesh_CoordinateSystem): void
Set source coordinate system.
Parameters (1)theSysFrom
- HasOutputCoordinateSystem(): boolean
Return TRUE if destination coordinate system has been set; FALSE by default.
Destination coordinate system; UNDEFINED by default.
- SetOutputCoordinateSystem(theSysTo: gp_Ax3): void
Set destination coordinate system.
Parameters (1)theSysTo
- SetOutputCoordinateSystem(theSysTo: RWMesh_CoordinateSystem): void
Set destination coordinate system.
Parameters (1)theSysTo
- Init(theInputSystem: gp_Ax3, theInputLengthUnit: number, theOutputSystem: gp_Ax3, theOutputLengthUnit: number): void
Initialize transformation.
Parameters (4)theInputSystemtheInputLengthUnittheOutputSystemtheOutputLengthUnit
- TransformTransformation(theTrsf: gp_Trsf): void
Transform transformation.
Parameters (1)theTrsf—Mutated in place; read the updated value from this argument after the call.
- TransformPosition(thePos: gp_XYZ): void
Transform position.
Parameters (1)thePos—Mutated in place; read the updated value from this argument after the call.
RWMesh_EdgeIterator
Auxiliary class to iterate through edges. Provides functionality to iterate through the edges of a shape. It inherits from RWMesh_ShapeIterator and implements methods to access and manipulate edge data.
Constructors(2)
- constructor(theShape: TopoDS_Shape, theStyle?: XCAFPrs_Style): RWMesh_EdgeIterator
Auxiliary constructor.
Parameters (2)theShape—The shape to iterate.theStyle—The style of the shape.
- constructor(theLabel: TDF_Label, theLocation: TopLoc_Location, theToMapColors?: boolean, theStyle?: XCAFPrs_Style): RWMesh_EdgeIterator
Main constructor.
Parameters (4)theLabel—The label of the shape.theLocation—The location of the shape.theToMapColors—Flag to indicate if colors should be mapped.theStyle—The style of the shape.
Instance methods(12)
- More(): boolean
Return true if iterator points to the valid triangulation.
- Next(): void
Find next value.
- Edge(): TopoDS_Edge
Return current edge.
Return current edge.
Return current edge data.
- IsEmpty(): boolean
Return true if geometry data is defined.
- ElemLower(): number
Lower element index in current triangulation.
- ElemUpper(): number
Upper element index in current triangulation.
- NbNodes(): number
Return number of nodes for the current edge.
- NodeLower(): number
Lower node index in current triangulation.
- NodeUpper(): number
Upper node index in current triangulation.
Return the node with specified index with applied transformation.
Parameters (1)theNode
RWMesh_FaceIterator
Auxiliary class to iterate through triangulated faces. Class is designed to provide an interface for iterating over the faces of a shape, specifically focusing on triangulated faces. It inherits from the RWMesh_ShapeIterator base class and extends its functionality to handle faces with triangulation data.
Constructors(2)
- constructor(theShape: TopoDS_Shape, theStyle?: XCAFPrs_Style): RWMesh_FaceIterator
Auxiliary constructor.
Parameters (2)theShape—Shape containing the face datatheStyle—Style information for the face
- constructor(theLabel: TDF_Label, theLocation: TopLoc_Location, theToMapColors?: boolean, theStyle?: XCAFPrs_Style): RWMesh_FaceIterator
Main constructor.
Parameters (4)theLabel—Label containing the face datatheLocation—Location of the facetheToMapColors—Flag to indicate if colors should be mappedtheStyle—Style information for the face
Instance methods(24)
- More(): boolean
Return true if iterator points to the valid triangulation.
- Next(): void
Find next value.
- Face(): TopoDS_Face
Return current face.
Return current face.
Return current face triangulation.
- IsEmptyMesh(): boolean
Return true if mesh data is defined.
- IsEmpty(): boolean
Return true if mesh data is defined.
Return face material.
- HasFaceColor(): boolean
Return TRUE if face color is set.
Return face color.
- NbTriangles(): number
Return number of elements of specific type for the current face.
- ElemLower(): number
Lower element index in current triangulation.
- ElemUpper(): number
Upper element index in current triangulation.
- TriangleOriented(theElemIndex: number): Poly_Triangle
Return triangle with specified index with applied Face orientation.
Parameters (1)theElemIndex
- HasNormals(): boolean
Return true if triangulation has defined normals.
- HasTexCoords(): boolean
Return true if triangulation has defined normals.
- NormalTransformed(theNode: number): gp_Dir
Return normal at specified node index with face transformation applied and face orientation applied.
Parameters (1)theNode
- NbNodes(): number
Return number of nodes for the current face.
- NodeLower(): number
Lower node index in current triangulation.
- NodeUpper(): number
Upper node index in current triangulation.
- NodeTexCoord(theNode: number): gp_Pnt2d
Return texture coordinates for the node.
Parameters (1)theNode
Return the node with specified index with applied transformation.
Parameters (1)theNode
Return normal at specified node index without face transformation applied.
Parameters (1)theNode
- triangle(theElemIndex: number): Poly_Triangle
Return triangle with specified index.
Parameters (1)theElemIndex
RWMesh_MaterialMap
Material manager. Provides an interface for collecting all materials within the document before writing it into file, and for copying associated image files (textures) into sub-folder near by exported model.
Static methods(1)
Instance methods(8)
Return default material definition to be used for nodes with only color defined.
- SetDefaultStyle(theStyle: XCAFPrs_Style): void
Set default material definition to be used for nodes with only color defined.
Parameters (1)theStyle
- FindMaterial(theStyle: XCAFPrs_Style): TCollection_AsciiString
Find already registered material.
Parameters (1)theStyle
- AddMaterial(theStyle: XCAFPrs_Style): TCollection_AsciiString
Register material and return its name identifier.
Parameters (1)theStyle
- CreateTextureFolder(): boolean
Create texture folder "modelName/textures"; for example: MODEL: Path/ModelName.gltf IMAGES: Path/ModelName/textures/ Warning! Output folder is NOT cleared.
- DefineMaterial(theStyle: XCAFPrs_Style, theKey: TCollection_AsciiString, theName: TCollection_AsciiString): void
Virtual method actually defining the material (e.g. export to the file).
Parameters (3)theStyletheKeytheName
- IsFailed(): boolean
Return failed flag.
RWMesh_NameFormat
Properties(7)
RWMesh_NodeAttributes
Attributes of the node.
Constructors(1)
Properties(4)
RWMesh_ShapeIterator
This is a virtual base class for other shape iterators. Provides an abstract interface for iterating over the elements of a shape. It defines a set of pure virtual methods that must be implemented by derived classes to handle specific types of shapes and their elements.
Instance methods(14)
Return explored shape.
Return shape.
- More(): boolean
Return true if iterator points to the valid triangulation.
- Next(): void
Find next value.
- IsEmpty(): boolean
Return true if mesh data is defined.
Return shape material.
- HasColor(): boolean
Return TRUE if shape color is set.
Return shape color.
- ElemLower(): number
Lower element index in current triangulation.
- ElemUpper(): number
Upper element index in current triangulation.
- NbNodes(): number
Return number of nodes for the current shape.
- NodeLower(): number
Lower node index in current shape.
- NodeUpper(): number
Upper node index in current shape.
- NodeTransformed(theNode: number): gp_Pnt
Return the node with specified index with applied transformation.
Parameters (1)theNode
RWMesh_TriangulationReader
Interface for reading primitive array from the buffer.
Static methods(1)
Instance methods(14)
Returns file name for reporting issues.
- SetFileName(theFileName: TCollection_AsciiString): void
Sets file name for reporting issues.
Parameters (1)theFileName
Returns coordinate system converter using for correct data loading.
- SetCoordinateSystemConverter(theConverter: RWMesh_CoordinateSystemConverter): void
Sets coordinate system converter.
Parameters (1)theConverter
- IsDoublePrecision(): boolean
Returns flag to fill in triangulation using double or single precision; FALSE by default.
- SetDoublePrecision(theIsDouble: boolean): void
Sets flag to fill in triangulation using double or single precision.
Parameters (1)theIsDouble
- ToSkipDegenerates(): boolean
Returns TRUE if degenerated triangles should be skipped during mesh loading (only indexes will be checked).
- SetToSkipDegenerates(theToSkip: boolean): void
Sets flag to skip degenerated triangles during mesh loading (only indexes will be checked).
Parameters (1)theToSkip
- ToPrintDebugMessages(): boolean
Returns TRUE if additional debug information should be print.
- SetToPrintDebugMessages(theToPrint: boolean): void
Sets flag to print debug information.
Parameters (1)theToPrint
- StartStatistic(): void
Starts and reset internal object that accumulates nodes/triangles statistic during data reading.
- StopStatistic(): void
Stops and nullify internal object that accumulates nodes/triangles statistic during data reading.
- PrintStatistic(): void
Prints loading statistic. This method should be used between
StartStatistic()andStopStatistic()calls for correct results.
RWMesh_TriangulationReader_LoadingStatistic
Constructors(1)
Instance methods(2)
- Reset(): void
- PrintStatistic(thePrefix?: TCollection_AsciiString): voidParameters (1)
thePrefix
Properties(5)
RWMesh_TriangulationSource
Mesh data wrapper for delayed triangulation loading. Class inherits Poly_Triangulation so that it can be put temporarily into TopoDS_Face within assembly structure.
Constructors(1)
Constructor.
Static methods(1)
Instance methods(15)
Returns reader allowing to read data from the buffer.
- SetReader(theReader: RWMesh_TriangulationReader): void
Sets reader allowing to read data from the buffer.
Parameters (1)theReader
- DegeneratedTriNb(): number
Returns number of degenerated triangles collected during data reading. Used for debug statistic purpose.
- ChangeDegeneratedTriNb(): number
Gets access to number of degenerated triangles to collect them during data reading.
- HasGeometry(): boolean
Returns TRUE if triangulation has some geometry.
- NbEdges(): number
Returns the number of edges for this triangulation.
- Edge(theIndex: number): number
Returns edge at the given index.
Parameters (1)theIndex—edge index within [1,NbEdges()] range
Returnsedge node indices, with each node defined within [1,
NbNodes()] range - SetEdge(theIndex: number, theEdge: number): void
Sets an edge.
Parameters (2)theIndex—edge index within [1,NbEdges()] rangetheEdge—edge node indices, with each node defined within [1,NbNodes()] range
- NbDeferredNodes(): number
- SetNbDeferredNodes(theNbNodes: number): voidParameters (1)
theNbNodes
- NbDeferredTriangles(): number
- SetNbDeferredTriangles(theNbTris: number): voidParameters (1)
theNbTris
- ResizeEdges(theNbEdges: number, theToCopyOld: boolean): voidParameters (2)
theNbEdgestheToCopyOld
RWMesh_VertexIterator
Auxiliary class to iterate through vertices. Provides functionality to iterate through the vertices of a shape. It inherits from RWMesh_ShapeIterator and implements methods to access and manipulate vertex data.
Constructors(2)
- constructor(theShape: TopoDS_Shape, theStyle?: XCAFPrs_Style): RWMesh_VertexIterator
Auxiliary constructor.
Parameters (2)theShape—The shape to iterate.theStyle—The style of the shape.
- constructor(theLabel: TDF_Label, theLocation: TopLoc_Location, theToMapColors?: boolean, theStyle?: XCAFPrs_Style): RWMesh_VertexIterator
Main constructor.
Parameters (4)theLabel—The label of the shape.theLocation—The location of the shape.theToMapColors—Flag to indicate if colors should be mapped.theStyle—The style of the shape.
Instance methods(12)
- More(): boolean
Return true if iterator points to the valid triangulation.
- Next(): void
Find next value.
Return current edge.
Return current vertex.
Return current vertex data.
- IsEmpty(): boolean
Return true if geometry data is defined.
- ElemLower(): number
Lower element index in current triangulation.
- ElemUpper(): number
Upper element index in current triangulation.
- NbNodes(): number
Return number of nodes for the current edge.
- NodeLower(): number
Lower node index in current triangulation.
- NodeUpper(): number
Upper node index in current triangulation.
Return the node with specified index with applied transformation.
Parameters (1)argNo0