Skip to main content

Brep

The Brep class provides a comprehensive interface for loading, saving, editing, and optimizing 3D brep data. It supports operations on brep components such as nodes, geometries, and bounding boxes. The class enables loading from file names or streams with optional asynchronous processing. It offers methods to validate brep structure, set coordinate system bases, and manage transformation hierarchies.

#include <format/TellusimBrep.h>

Constructors

Brep()

Methods

Clear brep.

void clear()

Check brep.

bool isLoaded() const

Info brep.

bool info(const char *name, Flags flags = FlagNone, Async *async = nullptr)
bool info(const String &name, Flags flags = FlagNone, Async *async = nullptr)
bool info(Stream &stream, Flags flags = FlagNone, Async *async = nullptr)
bool info(const char *name, Async *async)
bool info(const String &name, Async *async)
bool info(Stream &stream, Async *async)

Load brep.

bool load(const char *name, Flags flags = FlagNone, Async *async = nullptr)
bool load(const String &name, Flags flags = FlagNone, Async *async = nullptr)
bool load(Stream &stream, Flags flags = FlagNone, Async *async = nullptr)
bool load(const char *name, Async *async)
bool load(const String &name, Async *async)
bool load(Stream &stream, Async *async)

Save brep.

bool save(const char *name, Flags flags = FlagNone) const
bool save(const String &name, Flags flags = FlagNone) const
bool save(Stream &stream, Flags flags = FlagNone) const

Brep name.

void setName(const char *name)
String getName() const

Brep basis.

bool setBasis(Axis front, Axis right, Axis up)
bool setBasis(Basis basis)
Axis getFrontAxis() const
Axis getRightAxis() const
Axis getUpAxis() const
Basis getBasis() const
const char *getFrontAxisName() const
const char *getRightAxisName() const
const char *getUpAxisName() const
String getBasisName() const

Brep nodes.

void clearNodes()
void reserveNodes(uint32_t num_nodes)
uint32_t addNode(BrepNode &node, bool check = true)
bool removeNode(BrepNode &node)
uint32_t findNode(const BrepNode &node) const
uint32_t findNode(const char *name) const
uint32_t getNumNodes() const
const Array<BrepNode> getNodes() const
Array<BrepNode> getNodes()
const BrepNode getNode(uint32_t index) const
BrepNode getNode(uint32_t index)

Create node transformations.

void createLocalTransforms(Matrix4x3d itransform = Matrix4x3d::identity)
void createGlobalTransforms(Matrix4x3d transform = Matrix4x3d::identity)
TypeNameDescription
Matrix4x3ditransformGlobal to Local transformation matrix
Matrix4x3dtransformLocal to Global transformation matrix

Brep geometries.

void clearGeometries()
void reserveGeometries(uint32_t num_geometries)
uint32_t addGeometry(BrepGeometry &geometry, bool check = true)
uint32_t addGeometry(BrepGeometry &geometry, BrepNode &node, bool check = true)
bool removeGeometry(BrepGeometry &geometry)
bool replaceGeometry(BrepGeometry &old_geometry, BrepGeometry &geometry)
uint32_t findGeometry(const BrepGeometry &geometry) const
uint32_t findGeometry(const char *name) const
uint32_t getNumGeometries() const
const Array<BrepGeometry> getGeometries() const
Array<BrepGeometry> getGeometries()
const BrepGeometry getGeometry(uint32_t index) const
BrepGeometry getGeometry(uint32_t index)

Brep bound box.

BoundBoxd getBoundBox() const
BoundBoxd getBoundBox(const BrepNode &node) const
BoundBoxd getBoundBox(const BrepGeometry &geometry) const

Create bounds.

bool createBounds(bool force, Async *async = nullptr)
bool createBounds(Async *async = nullptr)

Optimize materials remove duplicates.

void optimizeMaterials()

Optimize geometries remove duplicates.

void optimizeGeometries(float64_t threshold = 1e-6, uint32_t depth = 16)
TypeNameDescription
float64_tthresholdCompare threshold.
uint32_tdepthNumber of geometries to compare.

Optimize node and geometry order.

bool optimizeOrder()

Apply transform.

void setTransform(float64_t scale)

Memory usage.

size_t getMemory() const

Enums

Flags

Brep flags.

NameValueDescription
FlagNone0
FlagCurveDegree2(1 << 0)Maximum curve degree is 2.
FlagCurveDigits1(1 << 1)One digit curve precision.
FlagCurveDigits2(1 << 2)Two digits curve precision.
FlagCurveDigits3(1 << 3)Three digits curve precision.
FlagCurveDigits4(1 << 4)Four digits curve precision.
FlagCurveDigits5(1 << 5)Five digits curve precision.
FlagSurfaceDegree2(1 << 6)Maximum surface degree is 2.
FlagSurfaceDigits1(1 << 7)One digit surface precision.
FlagSurfaceDigits2(1 << 8)Two digits surface precision.
FlagSurfaceDigits3(1 << 9)Three digits surface precision.
FlagSurfaceDigits4(1 << 10)Four digits surface precision.
FlagSurfaceDigits5(1 << 11)Five digits surface precision.
FlagEmbed(1 << 12)Embed resources.
Flag32Bit(1 << 13)32-bit precision.

Basis

Brep basis.

NameValueDescription
BasisUnknown0Front right up.
BasisXUpRight1+Y +Z +X.
BasisYUpRight2+Z +X +Y.
BasisZUpRight3+X +Y +Z.
BasisXUpLeft4+Y -Z +X.
BasisYUpLeft5+Z -X +Y.
BasisZUpLeft6+X -Y +Z.
BasisZUpMaya7-Y +X +Z.
NumBases8

Axis

NameValue
AxisUnknown0
AxisPX1
AxisPY2
AxisPZ3
AxisNX4
AxisNY5
AxisNZ6
NumAxes7