MCPcopy Index your code
hub / github.com/CadQuery/cadquery / _shape_to_faces_shells

Function _shape_to_faces_shells

cadquery/occ_impl/shapes.py:5374–5409  ·  view source on GitHub ↗

Split a TopoDS_Shape into Faces and Shells. Raise if another type was found.

(
    s: TopoDS_Shape,
)

Source from the content-addressed store, hash-verified

5372
5373
5374def _shape_to_faces_shells(
5375 s: TopoDS_Shape,
5376) -> tuple[list[TopoDS_Face], list[TopoDS_Shell]]:
5377 """
5378 Split a TopoDS_Shape into Faces and Shells. Raise if another type was found.
5379 """
5380
5381 rv_faces = []
5382 rv_shells = []
5383
5384 t = s.ShapeType()
5385
5386 if t == TopAbs_ShapeEnum.TopAbs_COMPOUND:
5387 it = TopoDS_Iterator(s)
5388
5389 while it.More():
5390 el = it.Value()
5391
5392 t = el.ShapeType()
5393
5394 if t == TopAbs_ShapeEnum.TopAbs_FACE:
5395 rv_faces.append(TopoDS.Face(el))
5396 elif t == TopAbs_ShapeEnum.TopAbs_SHELL:
5397 rv_shells.append(TopoDS.Shell(el))
5398 else:
5399 raise ValueError(f"Found unexpected type {t}")
5400
5401 it.Next()
5402 elif t == TopAbs_ShapeEnum.TopAbs_SHELL:
5403 rv_shells.append(TopoDS.Shell(s))
5404 elif t == TopAbs_ShapeEnum.TopAbs_FACE:
5405 rv_faces.append(TopoDS.Face(s))
5406 else:
5407 raise ValueError(f"Found unexpected type {t}")
5408
5409 return rv_faces, rv_shells
5410
5411
5412def _pts_to_harray(pts: Sequence[VectorLike]) -> TColgp_HArray1OfPnt:

Callers 2

shellFunction · 0.85

Calls 2

appendMethod · 0.80
ShapeTypeMethod · 0.45

Tested by 1