CSPrimPolyhedron

class CSXCAD.CSPrimitives.CSPrimPolyhedron

Bases: CSPrimitives

Polyhedron Primitive

A polyhedron is a 3D solid with flat polygonal faces (currently only triangles).

AddFace(verts)

Add a face with a given list of vertices. The vertices have to be added already. Currently only triangle faces are possible.

Params verts:

(N,) array – Face with N vericies

AddVertex(x, y, z)

Add a single 3D vertex.

Parameters:

x,y,z – float,float,float – 3D vertex

GetFace(idx)

Get the face vertex indicies for the given face index idx

Parameters:

idx – int – Face index to return

Returns:

(N,) array – Vertices array for face with index idx

GetFaceValid(idx)

Get if face with index “idx” is valid

Parameters:

idx – int – Face index to return

:returns bool – valid face

GetNumFaces()

Get the number of faces.

Return num:

int – number of faces

GetNumVertices()

Get the number of vertices.

Returns num:

int – Number of vertices

GetVertex(idx)

Get the vertex with index idx.

Parameters:

idx – int – Vertex index to return

Returns point:

(3,) array – Vertex coordinate at index idx

Reset()

Reset the polyhedron, that means removeing all faces.