Reflection

Complex geometric objects are composed of simpler ones. This group of functions and methods allows you to decompose complex objects into their constituent components.

To work with these functions, it is recommended to study the topological structure of models in the OpenCascade kernel. (You can get started with the section Introduction to BREP Representation of Geometric Models)


Empty object

Returns true if the object is empty, false otherwise.

Signature:

shp.is_nullshape()

Example:

a = box(10, center=True)
b = sphere(r=10)
(a - b).is_nullshape() # True

Arrays of base objects

This family of methods allows you to retrieve and filter the underlying objects you need.

All methods have the same signature and return an array of objects of the corresponding type. The optional filter option allows you to filter the selection by a necessary condition.

shape.vertices(filter=None) # -> [point3]
shape.solids(filter=None) # -> [Shape; future:Solid]
shape.faces(filter=None) # -> [Face]
shape.edges(filter=None) # -> [Edge]
shape.wires(filter=None) # -> [Shape; future:Wire]
shape.shells(filter=None) # -> [Shape; future:Shell]
shape.compounds(filter=None) # -> [Shape; future:Compound]
shape.compsolids(filter=None) # -> [Shape; future:Compsolid]

Taking a base object using the closest point method

Sometimes you want to extract a specific base object from a complex object. In this case, you can use the base point method.

The following functions implement the closest point method and return the closest base object of the corresponding type to pnt belonging to the complex shp object.

near_edge(shp, pnt) # -> Edge
near_face(shp, pnt) # -> Face
near_vertex(shp, pnt) # -> point3

Type restoration

zencad displays the type of object and the operations applicable to it based on the build tree, which in some cases may give incorrect results.

The restore_shapetype function restores the type based on the analysis of the object's real representation.

original_shp = restore_shapetype(shp)