CSPrimitives (Base Class)

class CSXCAD.CSPrimitives.CSPrimitives

Bases: object

AddTransform(transform, *args, **kw)

Add a transformation to this primitive.

GetBoundBox()

Get the bounding box for this primitive

Returns:

(2,3) ndarray – bounding box for this primitive

GetCoordinateSystem()
Returns:

coordinate system (0 : Cartesian, 1 : Cylindrical) or None

GetDimension()

Get the dimension of this primitive

Returns:

int – dimension 0..3

GetID()

Get the ID for this primitive

Returns:

int – ID for this primitive

GetParameterSet()

Get the parameter set assigned to this class

GetPrimitiveUsed()

Get if this primitive has been used (used flag set)

GetPriority()

Get the priority for this primitive

Returns:

int – Priority for this primitive

GetProperty()

Get the property for this primitive

Returns:

CSProperties.CSProperties

GetTransform()

Get the transformation class assigned to this primitive. If this primitve does not have any, it will be created.

Returns:

CSTransform class

GetType()

Get the type as int for this primitive

Returns:

int – Type for this primitive (e.g. 0 –> Point, 1 –> Box, …)

GetTypeName()

Get the type as string (UTF-8) for this primitive

Returns:

str – Type name for this primitive (“Point”, “Box”, …)

HasTransform()

Check if this primitive has a transformation attached. It will not create one if it does not.

Returns:

bool

IsInside(coord, tol=0)

Check if a given coordinate is inside this primitive.

Parameters:

coord – (3,) array – coordinate

Returns:

bool

SetCoordinateSystem(cs_type)

Set the coordinate system type (Cartesian or cylindrical) for this primitive. If set to None, the mesh type of the assigned rect grid will be used.

Parameters:

cs_type – coordinate system (0 : Cartesian, 1 : Cylindrical) or None

SetPrimitiveUsed(val)

Set used flag.

SetPriority(val)

Set the priority for this primitive

Parameters:

val – int – Higher priority values will override primitives with a lower priority

Update()

Trigger an internal update and report success and error message

Returns:

bool, err_msg – success and error message (empty on success)

static fromType(prim_type, pset, prop, no_init=False, **kw)

Create a primtive specified by the prim_type

Parameters:
  • prim_type – Primitive type

  • pset – ParameterSet to assign to the new primitive

  • prop – CSProperty to assign to the new primitive

  • no_init – do not create an actual C++ instance