Returns the right type of wrapper, given a OCCT object
(cls, obj: TopoDS_Shape, forConstruction: bool = False)
| 458 | |
| 459 | @classmethod |
| 460 | def cast(cls, obj: TopoDS_Shape, forConstruction: bool = False) -> Shape: |
| 461 | "Returns the right type of wrapper, given a OCCT object" |
| 462 | |
| 463 | tr = None |
| 464 | |
| 465 | # define the shape lookup table for casting |
| 466 | constructor_LUT = { |
| 467 | ta.TopAbs_VERTEX: Vertex, |
| 468 | ta.TopAbs_EDGE: Edge, |
| 469 | ta.TopAbs_WIRE: Wire, |
| 470 | ta.TopAbs_FACE: Face, |
| 471 | ta.TopAbs_SHELL: Shell, |
| 472 | ta.TopAbs_SOLID: Solid, |
| 473 | ta.TopAbs_COMPSOLID: CompSolid, |
| 474 | ta.TopAbs_COMPOUND: Compound, |
| 475 | } |
| 476 | |
| 477 | t = shapetype(obj) |
| 478 | # NB downcast is needed to handle TopoDS_Shape types |
| 479 | tr = constructor_LUT[t](downcast(obj)) |
| 480 | tr.forConstruction = forConstruction |
| 481 | |
| 482 | return tr |
| 483 | |
| 484 | def exportStl( |
| 485 | self, |