Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assembly save mode=default vs mode=fused #1457

Closed
ZTThomasOberthanner opened this issue Dec 5, 2023 · 3 comments
Closed

Assembly save mode=default vs mode=fused #1457

ZTThomasOberthanner opened this issue Dec 5, 2023 · 3 comments

Comments

@ZTThomasOberthanner
Copy link
Contributor

My goal is to export objects into a stl-file. Afterwards these objects are processed using blender split by loose parts.

When reading the docs cadquery.Assembly.save it is possible to fuse all parts into a single one using mode=fused. But even using mode=default all objects are fused into a single part. Is this a bug or my misunderstanding?

These are 3 different assemblies, all made of two boxes:
image

import cadquery as cq

box = cq.Workplane().box(1, 1, 1)

assy_default = cq.Assembly(name="toplevel")
assy_default.add(box, name="box1")
assy_default.add(box, name="box2", loc=cq.Location((1, 0, 0)))
assy_default.save("boxes_default.stl", exportType='STL', mode='default')

assy_fused = cq.Assembly(name="toplevel")
assy_fused.add(box, name="box1", loc=cq.Location((0, 5, 0)))
assy_fused.add(box, name="box2", loc=cq.Location((1, 5, 0)))
assy_fused.save("boxes_fused.stl", exportType='STL', mode='fused')

assy_split = cq.Assembly(name="toplevel")
assy_split.add(box, name="box1", loc=cq.Location((0, 10, 0)))
assy_split.add(box, name="box2", loc=cq.Location((2, 10, 0)))
assy_split.save("boxes_split.stl", exportType='STL')

PS: I wanted to paste the output using CQ-editor, but got a ValueError: Unknown Format: STL

@jmwright
Copy link
Member

jmwright commented Dec 5, 2023

For STL export the assembly is made into a single compound by calling toCompound() on it.

* Added `Assembly.toCompound()` to enable proper assembly export to formats like STL [#726](https://github.com/CadQuery/cadquery/pull/726)

The notes at the top of the document here explain why we do this with STL files.

The fused mode was added mainly for STEP, which supports multiple parts/colors in the file.

@ZTThomasOberthanner
Copy link
Contributor Author

thank you for the quick reply - I will create a pull request to add this information to the comments/documentation

@ZTThomasOberthanner
Copy link
Contributor Author

#1458

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants