Open julianstirling opened 4 months ago
Both the short and long term options should be possible. The explode_assembly
method does not currently use CadQuery's traverse
method for assemblies because that method did not yet exist when I established this project. explode_assembly
needs to be refactored to use that, which will handle arbitrarily deeply nested assemblies and will allow filtering by name
, assuming that an assembly name is set (it is not required and CadQuery will use a generated UUID if it is not set).
It should also be easy to accommodate the recursive
argument, but I should probably refactor the code for traverse
first since that will change how the recursive
argument is handled.
I am just starting to have a play with assemblies and cq-annotate.
One thing I am delighted about is that I can assemble assemblies. This way we can have a complex nested object.
I made this code by modifying your example:
When I explode, it nests and explodes all of the sub-assemblies as well. I can see this being needed in some cases (making big explosions of the whole assembly), but I can also see times when it only one layer of explosion is needed. When explaining a specific assembly step.
Short term suggestion
I think a short term and easy fix is probably to do something like
def explode_assembly(assy, recursive=True):
and then if recursive is false it doesn't traverse children.Longer term suggestion
Have some way to identify sub-assemblies and explode identified ones. Perhaps via name?