Load step, xbf or xml. Only STEP supports unit conversion on loading.
(
cls,
path: str,
importType: Optional[ImportLiterals] = None,
unit: UnitLiterals = "MM",
)
| 641 | |
| 642 | @classmethod |
| 643 | def load( |
| 644 | cls, |
| 645 | path: str, |
| 646 | importType: Optional[ImportLiterals] = None, |
| 647 | unit: UnitLiterals = "MM", |
| 648 | ) -> Self: |
| 649 | """ |
| 650 | Load step, xbf or xml. Only STEP supports unit conversion on loading. |
| 651 | """ |
| 652 | |
| 653 | if importType is None: |
| 654 | t = path.split(".")[-1].upper() |
| 655 | if t in ("STEP", "XML", "XBF"): |
| 656 | importType = cast(ImportLiterals, t) |
| 657 | else: |
| 658 | raise ValueError("Unknown extension, specify import type explicitly") |
| 659 | |
| 660 | assy = cls() |
| 661 | |
| 662 | if importType == "STEP": |
| 663 | _importStep(assy, path, unit) |
| 664 | elif importType == "XML": |
| 665 | importXml(assy, path) |
| 666 | elif importType == "XBF": |
| 667 | importXbf(assy, path) |
| 668 | |
| 669 | return assy |
| 670 | |
| 671 | @property |
| 672 | def shapes(self) -> List[Shape]: |