Apply some normalizations: - Shell with only one Face -> Face. - Compound with only one element -> element.
(s: Shape)
| 5327 | |
| 5328 | |
| 5329 | def _normalize(s: Shape) -> Shape: |
| 5330 | """ |
| 5331 | Apply some normalizations: |
| 5332 | - Shell with only one Face -> Face. |
| 5333 | - Compound with only one element -> element. |
| 5334 | """ |
| 5335 | |
| 5336 | t = s.ShapeType() |
| 5337 | rv = s |
| 5338 | |
| 5339 | if t == "Shell": |
| 5340 | faces = s.Faces() |
| 5341 | if len(faces) == 1 and not BRep_Tool.IsClosed_s(s.wrapped): |
| 5342 | rv = faces[0] |
| 5343 | elif t == "Compound": |
| 5344 | objs = list(s) |
| 5345 | if len(objs) == 1: |
| 5346 | rv = objs[0] |
| 5347 | |
| 5348 | return rv |
| 5349 | |
| 5350 | |
| 5351 | def _compound_or_shape(s: TopoDS_Shape | Sequence[TopoDS_Shape]) -> Shape: |
no test coverage detected