Skip to content

B Rep3D

Class full path: NemAll_Python_Geometry.BRep3D

Representation class for 3D boundary representation.

Boundary representation is an object used for representing a 3D solid by defining the limits of its volume. A 3D solid is represented as a collection of surface elements, which define the boundary between interior and exterior points.

Attributes

AllFacesFlags: eGeometryErrorCode property writable

Get flags of the all faces.

RefPoint: Point3D property writable

Get the reference point

Functions

AreFacesNaturallyTrimmed()

Find if all faces are naturally trimmed by their surfaces

throw Exception in case of invalid object.

Returns:

Type Description
bool

bool (true = yes)

CreateCone(cone, closed=True) staticmethod

Create BRep3D as cone

Parameters:

Name Type Description Default
cone Cone3D

cone data

required
closed bool

whether to create solid or sheet body

True

Returns:

Type Description
BRep3D

created geometry

CreateCuboid(placement, length, width, height) staticmethod

Create BRep3D as cuboid

Parameters:

Name Type Description Default
placement AxisPlacement3D

cuboid origin

required
length float

length in its x axis

required
width float

width in its y axis

required
height float

height in its z axis

required

Returns:

Type Description
BRep3D

created geometry

CreateCylinder(placement, radius, height, closedTop=True, closedBottom=True) staticmethod

Create Brep as cylinder

Parameters:

Name Type Description Default
placement AxisPlacement3D

axis placement

required
radius float

cylinder radius

required
height float

cylinder height

required
closedTop bool

whether to close top of cylinder

True
closedBottom bool

whether to close bottom of cylinder

True

Returns:

Type Description
BRep3D

created cone

CreateSphere(placement, radius) staticmethod

Create BRep3D as sphere

Parameters:

Name Type Description Default
placement AxisPlacement3D

sphere origin

required
radius float

sphere radius

required

Returns:

Type Description
BRep3D

created geometry

CreateWireBody(icurve_object) staticmethod

Create wire body from the curve as one edge

Parameters:

Name Type Description Default
icurve_object object

curve for edge geometry

required

Returns:

Type Description
BRep3D

created BRep3D element

DeleteFace(faceIndex)

Delete face from brep

Parameters:

Name Type Description Default
faceIndex int

index of face we want to delete

required

Returns:

Type Description
eGeometryErrorCode

error code

DeleteFaces(faceIndices)

Delete faces from brep

Parameters:

Name Type Description Default
faceIndices VecULongList

indices of faces to delete

required

Returns:

Type Description
eGeometryErrorCode

error code

GetAllFacesFlags()

Get flags of the all faces.

Returns:

Type Description
eGeometryErrorCode

Error code

List[int]

flags values

GetEdgeCount()

Get the edges count

Returns:

Type Description
int

size_t count of edges

GetEdgeCurves()

get all edge curves as BSpline3D

Returns:

Type Description
eGeometryErrorCode

error code,

List[BSpline3D]

result edge curves handle vector

GetEdgeFaceIndices(edge)

Get faces containing this edge (if any)

Parameters:

Name Type Description Default
edge int

desired edge index

required

Returns:

Type Description
eGeometryErrorCode

error code

List[int]

face indices

GetEdgeGeometry(edge)

Get (trimmed) edge geometry as BSpline3D

Parameters:

Name Type Description Default
edge int

egde index

required

Returns:

Type Description
BSpline3D

handle to geometry curve

GetEdgeParametricCurves()

get parametric curves of all edges

Returns:

Type Description
eGeometryErrorCode

error code

List[Any]

result edge curves handle vector

GetEdgeParametricGeometry(edge)

Get (trimmed) edge geometry as parametric curves (ex. Line3D or Arc3D)

Parameters:

Name Type Description Default
edge int

egde index

required

Returns:

Type Description
object

handle to geometry curve

GetEdgeVertexIndices(edge)

Get vertex indices of the edge

Parameters:

Name Type Description Default
edge int

edge index

required

Returns:

Type Description
eGeometryErrorCode

error code,

int

start vertex index,

int

end vertex index

GetEdgeVertices(edge)

get edge vertices

Parameters:

Name Type Description Default
edge int

edge index

required

Returns:

Type Description
eGeometryErrorCode

error code

Point3D

start vertex,

Point3D

end vertex)

GetExactTypeIsoCurves(ucount, vcount, planarfaces=False)

Get iso curves from all faces

Parameters:

Name Type Description Default
ucount int

number of u-curves

required
vcount int

number of v-curves

required
planarfaces bool

include planar faces

False

Returns:

Type Description
eGeometryErrorCode

error code

List[Any]

result iso curves handle vector

GetFaceBoundaryCurves(face)

Get face boundary curves, curves are trimmed

Parameters:

Name Type Description Default
face int

face index

required

Returns:

Type Description
eGeometryErrorCode

error code

List[Any]

result geometries

GetFaceCount()

Get the faces count

Returns:

Type Description
int

size_t count of faces

GetFaceEdgeNaturalTrimming(face, oedge)

get edge trimming on this face

Parameters:

Name Type Description Default
face int

face index

required
oedge OrientedEdge

oriented edge

required

Returns:

Type Description
eGeometryErrorCode

error code

eSurfaceTrimParam

result trimming)

GetFaceEdgeOrientation(face, edge)

Get orientation of the edge in the given face

Parameters:

Name Type Description Default
face int

face index

required
edge int

edge index

required

Returns:

Type Description
eGeometryErrorCode

error code

bool

result orientation (same = true or opposite = false))

GetFaceEdges(faceIndex)

Get face edges together with their orientations

Parameters:

Name Type Description Default
faceIndex int

face index

required

Returns:

Type Description
eGeometryErrorCode

error code

List[OrientedEdge]

result edges)

GetFaceFlags(face)

Get flags of the face.

Parameters:

Name Type Description Default
face int

face index

required

Returns:

Type Description
int

flags value

GetFaceGeometry(face)

Get surface geometry of the face

throw Exception in case of invalid input.

Parameters:

Name Type Description Default
face int

face index

required

Returns:

Type Description
object

surface geometry handle

GetFaceGeometryOrientation(face)

Get surface geometry orientation of the face

Parameters:

Name Type Description Default
face int

face index

required

Returns:

Type Description
bool

surface geometry orientation

GetFaceLoopsCount(face)

Get count of loops of face given by index

Parameters:

Name Type Description Default
face int

index of face

required

Returns:

Type Description
int

count of loops

GetFaceUVBox(face)

Get uv box of the face

Parameters:

Name Type Description Default
face int

selected face

required

Returns:

Type Description
eGeometryErrorCode

error code

MinMax2D

uv box of face)

GetFaceVerticesIndices(faceIndex)

Get indices of vertices for given face index

Parameters:

Name Type Description Default
faceIndex int

index of face

required

Returns:

Type Description
eGeometryErrorCode

error code

List[int]

indices of vertices)

GetIsoCurves(ucount, vcount, planarfaces=False)

Get iso curves from all faces

Parameters:

Name Type Description Default
ucount int

number of u-curves

required
vcount int

number of v-curves

required
planarfaces bool

include planar faces

False

Returns:

Type Description
eGeometryErrorCode

error code

List[Any]

result iso curves handle vector)

GetParts()

Get separated parts (continuos shells)

Returns:

Type Description
eGeometryErrorCode

error code

List[BRep3D]

separated bodies)

GetPartsCount()

Get number of parts in this body

Returns:

Type Description
int

number of parts

GetPlanarFaces()

Get planar faces if this brep contains planar faces

Returns:

Type Description
Tuple[Plane3D, int]

pairs of - surface geometry and surface index

GetRefPoint()

Get the reference point

Returns:

Type Description
Point3D

Constant reference point.

GetSilhouetteCurves(viewMatrix, bPerspective)

Get silhouette curves of Brep

Parameters:

Name Type Description Default
viewMatrix Matrix3D

View matrix

required
bPerspective bool

Flag if it is central projection or not (true / false)

required

Returns:

Type Description
eGeometryErrorCode

error code

List[Any]

silhouette curves)

GetSilhouetteVertices(viewMatrix, bPerspective)

Get vertices (end points) of silhouette curves

Parameters:

Name Type Description Default
viewMatrix Matrix3D

view matrix

required
bPerspective bool

Flag if view is central perspective (true / false)

required

Returns:

Type Description
eGeometryErrorCode

error code

List[Point3D]

output vector of found points)

GetVertex(vertexIndex)

Get vertex geometry

Parameters:

Name Type Description Default
vertexIndex int

vertex index

required

Returns:

Type Description
eGeometryErrorCode

error code

Point3D

vertex point

GetVertexCount()

Get the vertices count

Returns:

Type Description
int

count of vertices

GetVertexEdges(vertex)

Get the edges containing given vertex

Parameters:

Name Type Description Default
vertex int

Index of vertex

required

Returns:

Type Description
eGeometryErrorCode

error code

List[int]

Indices of edges that contains vertex)

GetVertexFaceIndices(vertexIndex)

Get indices of faces for given vertex index

Parameters:

Name Type Description Default
vertexIndex int

index of vertex

required

Returns:

Type Description
eGeometryErrorCode

error code

List[int]

indices of faces)

GetVertices()

Get all vertices from brep

Returns:

Type Description
eGeometryErrorCode

error code

List[Point3D]

vertices of brep)

GetVirtualVertices()

Get vertices from edges without vertex (get start points of edge curves)

Returns:

Type Description
eGeometryErrorCode

error code

List[Point3D]

points (start points of curves),

List[int]

indices of edges without real vertex)

GetVirtualVerticesCount()

Get count of vertices (count of edges without vertex)

Returns:

Type Description
int

count of vertices (edges without vertex)

HasPlanarFaces()

Check if this brep contains planar faces

Returns:

Type Description
bool

bool true = yes

InvertAllFacesFlags()

Invert flags for the all faces

IsClosed()

Check whether the B-rep is closed (closed shells)

Returns:

Type Description
bool

bool true = yes

IsCone()

Check if the b-rep is a cone

Returns:

Type Description
bool

bool true = yes,

AxisPlacement3D

result axis placement (cone bottom center, axis orientation),

float

cone bottom radius,

float

cone top radius,

float

cone height)

IsEmpty()

Returns true if the body is empty

Returns:

Type Description
bool

bool

IsFaceNaturallyTrimmed(face)

Find if the face is naturally trimmed by its surface

throw Exception in case of invalid input.

Parameters:

Name Type Description Default
face int

face index

required

Returns:

Type Description
bool

bool (true = yes)

IsPolyhedron()

Check if the b-rep is a polyhedron

Returns:

Type Description
bool

bool true = yes

IsSphere()

Check if the b-rep is a sphere

Returns:

Type Description
bool

bool true = yes,

AxisPlacement3D

result axis placement (sphere center, axis orientation),

float

sphere radius)

IsValid()

check whether data is valid

Returns:

Type Description
bool

bool true = is valid

IsWire()

Check if BRep is wire body. If has only edges.

Returns:

Type Description
bool

true if BRep is wire.

PickEdge(rayPoint, rayVector, searchRadius)

Pick the edge under cursor

Parameters:

Name Type Description Default
rayPoint Point3D

ray point

required
rayVector Vector3D

ray vector

required
searchRadius float

search radius

required

Returns:

Type Description
bool

true if any edge under cursor found,

int

index of found edge,

float

minimal distance between edge and ray,

Point3D

nearest point on ray from edge

PickEdges(rayPoint, rayVector, searchRadius)

Pick the edges under cursor

Parameters:

Name Type Description Default
rayPoint Point3D

ray point

required
rayVector Vector3D

ray vector

required
searchRadius float

search radius

required

Returns:

Type Description
bool

true if any edge under cursor found,

List[int]

index of found edge,

List[float]

minimal distance between edge and ray,

List[Point3D]

nearest point on ray from edge)

PickFace(rayPoint, rayVector)

Pick the face under cursor

Parameters:

Name Type Description Default
rayPoint Point3D

ray point

required
rayVector Vector3D

ray vector

required

Returns:

Type Description
bool

true if any face under cursor found,

int

index of found face,

Point3D

nearest point on ray from face (intersection point))

PickVertex(rayPoint, rayVector, searchRadius)

Pick the vertex under cursor

Parameters:

Name Type Description Default
rayPoint Point3D

ray point

required
rayVector Vector3D

ray vector

required
searchRadius float

search radius

required

Returns:

Type Description
bool

true if any vertex under cursor found,

int

index of found vertex,

float

minimal distance between vertex and ray,

Point3D

nearest point on ray from vertex)

ReadFromStream overload

ReadFromStream(sstream_str, transformationMatrix)

Read BRep3D from string

Parameters:

Name Type Description Default
sstream_str str

input string

required
transformationMatrix Matrix3D

Matrix to use for BRep transformation

required

Returns:

Type Description
object

error code

ReadFromStream(sstream_str, scale, translation, spaceminmax, visibleminmax)

Read BRep3D from the string

Parameters:

Name Type Description Default
sstream_str str

string to read brep data from

required
scale float

transformation scale

required
translation Vector3D

translation vector

required
spaceminmax MinMax3D

space minmax (including control points

required
visibleminmax MinMax3D

visible minmax of the body

required

Returns:

Type Description
object

error code

Reverse()

Reverse the orientation of BRep

Returns:

Type Description
object

error code

SetAllFacesFlags(flags)

Set flags to the all faces.

Parameters:

Name Type Description Default
flags int

flags value

required

SetFaceFlags(face, flags)

Set flags to the face.

Parameters:

Name Type Description Default
face int

face index

required
flags int

flags value

required

SetRefPoint(refPoint)

Set the reference point

Parameters:

Name Type Description Default
refPoint Point3D

New reference point.

required

WriteToStream()

Write BRep3D to the text

Returns:

Type Description
eGeometryErrorCode

error code

str

output string,

Matrix3D

Matrix used to transform BRep

WriteToStreamSplitTransform()

Write BRep3D to the text, get transform parameters and minmax

Returns:

Type Description
eGeometryErrorCode

error code

str

output string,

float

transform scale,

Vector3D

translation vector,

MinMax3D

space minmax (including control points),

MinMax3D

visible minmax of the body

__eq__(brep)

Comparison of breps without tolerance.

Be careful, this method work without tolerance!

Parameters:

Name Type Description Default
brep BRep3D

Compared brep.

required

Returns:

Type Description
object

True when breps are equal, otherwise false.

__init__ overload

__init__()

initialize

__init__(brep)

Copy constructor

Parameters:

Name Type Description Default
brep BRep3D

BRep3D which will be copied.

required

__repr__()

Convert to string