Skip to content

STEP roundtrip does not retain subshape names in some cases #2121

Closed

Description

@adam-urbanczyk

Here is a MRE:

from cadquery.func import box
from cadquery import Assembly
from path import Path


box1 = box(1.0, 1.0, 1.0)
root = Assembly(name="root")

child = Assembly(box1, name="child")
child.addSubshape(box1, name="SOLID_TAG")
child.addSubshape(box1.Faces()[0], name="FACE_TAG")

root.add(child)

step_path = Path("assembly.step")
root.export(str(step_path))
step_text = step_path.read_text()
restored = Assembly().load(str(step_path))

restored_child = restored.children[0]
restored_names = sorted(restored_child._subshape_names.values())

assert "FACE_TAG" in restored_names
assert "SOLID_TAG" in restored_names

NB: it does work for xbf and xml. It also works if child is a compound of two boxes. Seems to be some kind of esoteric OCCT bug. We'll probably need to work around it using StepData_StepModel -it seems that the exported STEP file doe contain the information but it is not properly parsed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions