CadQuery / CadQuery/cadquery

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

Open
#1,955 2 comments 0 reactions 0 assignees View on GitHub
STEP
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Currently i am loading up assembiles using this class method
```python
assembly=cq.Assembly().importStep('assembly_step1.step')
```
I normally load up step files using this importStep method
```python
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.

```python
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.