Convert shapes to Assembly.
(
*objs: ShapeLike,
color: Tuple[float, float, float] = DEFAULT_COLOR,
alpha: float = 1,
)
| 64 | |
| 65 | |
| 66 | def _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 | |
| 90 | def _split_showables( |
no test coverage detected