MCPcopy
hub / github.com/CadQuery/cadquery / load

Method load

cadquery/assembly.py:643–669  ·  view source on GitHub ↗

Load step, xbf or xml. Only STEP supports unit conversion on loading.

(
        cls,
        path: str,
        importType: Optional[ImportLiterals] = None,
        unit: UnitLiterals = "MM",
    )

Source from the content-addressed store, hash-verified

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]:

Callers 8

importStepMethod · 0.80
test_step_roundtrip_unitFunction · 0.80
test_colors_assy0Function · 0.80
test_colors_assy1Function · 0.80
vtk.jsFile · 0.80

Calls 3

importXmlFunction · 0.85
importXbfFunction · 0.85
splitMethod · 0.45

Tested by 6

test_step_roundtrip_unitFunction · 0.64
test_colors_assy0Function · 0.64
test_colors_assy1Function · 0.64