MCPcopy
hub / github.com/CadQuery/cadquery / _to_assy

Function _to_assy

cadquery/vis.py:66–87  ·  view source on GitHub ↗

Convert shapes to Assembly.

(
    *objs: ShapeLike,
    color: Tuple[float, float, float] = DEFAULT_COLOR,
    alpha: float = 1,
)

Source from the content-addressed store, hash-verified

64
65
66def _to_assy(
67 *objs: ShapeLike,
68 color: Tuple[float, float, float] = DEFAULT_COLOR,
69 alpha: float = 1,
70) -> Assembly:
71 """
72 Convert shapes to Assembly.
73 """
74
75 assy = Assembly(color=Color(*color, alpha))
76
77 for obj in objs:
78 if isinstance(obj, (Shape, Workplane, Assembly)):
79 assy.add(obj)
80 elif isinstance(obj, Sketch):
81 assy.add(Compound.makeCompound(obj))
82 elif isinstance(obj, TopoDS_Shape):
83 assy.add(Shape(obj))
84 else:
85 raise ValueError(f"{obj} has unsupported type {type(obj)}")
86
87 return assy
88
89
90def _split_showables(

Callers 2

_to_vtk_shapesFunction · 0.85
showFunction · 0.85

Calls 5

addMethod · 0.95
AssemblyClass · 0.85
ColorClass · 0.85
ShapeClass · 0.85
makeCompoundMethod · 0.80

Tested by

no test coverage detected