Skip to content

Enabling build123d support in cq-editor #547

@deuxcents

Description

@deuxcents

I think build123d is getting more stable

Could we please have native support in cq-editor ?

That is in cq_utils.py, to_compound function add the conditions:

elif hasattr(obj, "wrapped") and isinstance(obj.wrapped, TopoDS_Shape):
    vals.append(cq.Shape.cast(obj.wrapped))
elif hasattr(obj, "_obj") and hasattr(obj._obj, "wrapped") and isinstance(obj._obj.wrapped, TopoDS_Shape):
    vals.append(cq.Shape.cast(obj._obj.wrapped))

For list of build123d objects, support can be added as well with the additionnal lines:

elif isinstance(obj, list) and hasattr(obj[0], "wrapped") and isinstance(obj[0].wrapped, TopoDS_Shape):
    vals.extend(cq.Shape.cast(o.wrapped) for o in obj)
elif isinstance(obj, list) and hasattr(obj[0], "_obj") and hasattr(obj[0]._obj, "wrapped") and isinstance(obj[0]._obj.wrapped, TopoDS_Shape):
    vals.extend(cq.Shape.cast(o._obj.wrapped) for o in obj)

These work in the latest cq-editor / build123d versions, for reference it comes from:
gumyr/build123d#54

Cheers

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