OCC.Extend.ShapeFactory module

assert_isdone(inst, message)
assert_shape_not_null(shp)
center_boundingbox(shape)

compute the center point of a TopoDS_Shape, based on its bounding box

shape : TopoDS_Shape instance or a subclass like TopoDS_Face

gp_Pnt

edge_to_bezier(topods_edge)

take an edge and returns: * a bool is_bezier * the bezier curve * degrees * poles

get_aligned_boundingbox(shape, tol=1e-06, optimal_BB=True)

return the bounding box of the TopoDS_Shape shape

shapeTopoDS_Shape or a subclass such as TopoDS_Face

the shape to compute the bounding box from

tol: float

tolerance of the computed boundingbox

use_triangulationbool, True by default

This makes the computation more accurate

if as_pnt is True, return a tuple of gp_Pnt instances

for the lower and another for the upper X,Y,Z values representing the bounding box

if as_pnt is False, return a tuple of lower and then upper X,Y,Z values

representing the bounding box

get_oriented_boundingbox(shape, optimal_OBB=True)

return the oriented bounding box of the TopoDS_Shape shape

shapeTopoDS_Shape or a subclass such as TopoDS_Face

the shape to compute the bounding box from

optimal_OBBbool, True by default. If set to True, compute the

optimal (i.e. the smallest oriented bounding box). Optimal OBB is a bit longer.

a list with center, x, y and z sizes

a shape

make_edge(*args)
make_edge2d(*args)
make_extrusion(face, length, vector=<class 'gp_Vec'>)

creates a extrusion from a face, along the vector vector. with a distance legnth. Note that the normal vector does not necessary be normalized. By default, the extrusion is along the z axis.

make_face(*args)
make_n_sided(edges, continuity=0)
make_vertex(*args)
make_wire(*args)
measure_shape_mass_center_of_gravity(shape)

Returns the shape center of gravity Returns a gp_Pnt if requested (set as_Pnt to True) or a list of 3 coordinates, by default.

measure_shape_volume(shape)

Returns shape volume

midpoint(pntA, pntB)

computes the point that lies in the middle between pntA and pntB

pntA, pntB : gp_Pnt

gp_Pnt

point_list_to_TColgp_Array1OfPnt(li)
points_to_bspline(pnts)
recognize_face(topods_face)

returns True if the TopoDS_Face is a planar surface

rotate_shape(shape, axis, angle, unite='deg')

Rotate a shape around an axis, with a given angle.

@param shape : the shape to rotate @point : the origin of the axis @vector : the axis direction @angle : the value of the rotation

@return: the rotated shape.

rotate_shp_3_axis(shape, rx, ry, rz, unity='deg')

Rotate a shape around (O,x), (O,y) and (O,z).

@param rx_degree : rotation around (O,x) @param ry_degree : rotation around (O,y) @param rz_degree : rotation around (O,z)

@return : the rotated shape.

scale_shape(shape, fx, fy, fz)

Scale a shape along the 3 directions @param fx : scale factor in the x direction @param fy : scale factor in the y direction @param fz : scale factor in the z direction

@return : the scaled shape

translate_shp(shp, vec, copy=False)