main
John Lauer Publish 0.1.0 b324771 8d ago
"""Load every shape returned by a STEP import, including separated assembly roots."""
from pathlib import Path
import cadquery as cq

def load_step(path):
    objects=cq.importers.importStep(str(Path(path))).vals()
    if not objects or not all(isinstance(obj,cq.Shape) for obj in objects):
        raise ValueError(f'No complete shape set in STEP: {path}')
    # .val() selects just the first root; assembly files can have several.
    return objects[0] if len(objects)==1 else cq.Compound.makeCompound(objects)