Skip to content

feature request, importers.importStep to return assembly if STEP file contains assembly #1955

@shimwell

Description

@shimwell

Currently i am loading up assembiles using this class method

assembly=cq.Assembly().importStep('assembly_step1.step')

I normally load up step files using this importStep method

workplane = importers.importStep('assembly_step1.step')

I would ideally like to have a single interface that loads the step file and returns an assembly if the STEP is an assembly but returns a workplane if not. Or in other words it would be useful if the following asserts were true.

import cadquery as cq
from cadquery import importers
result = cq.Workplane().sphere(5)
assembly = cq.Assembly()
assembly.add(result)
assembly.export("assembly_step.step")
result.export("workplane_step.step")
loaded_object = importers.importStep('assembly_step1.step')
assert isinstance(loaded_object, cq.Assembly())
loaded_object = importers.importStep('workplane_step.step')
assert isinstance(loaded_object, cq.WorkPlane())

This is because I don't have a good efficient way to tell if the STEP file is an assembly or not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions