We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Consider this example which should produce 3 cubes stacked on top of each other:
import cadquery as Cq def tagged_box(tag=""): result = ( Cq.Workplane('XY') .box(10, 10, 10) ) result.faces("<Z").tag(f"{tag}bot") result.faces(">Z").tag(f"{tag}top") return result def tagged_double_box(): result = ( tagged_box("b1_") .union( tagged_box("b2_") .translate((0, 0, 5)) .rotate((0, 0, 0), (0, 0, 1), 45) ) ) return result result = ( Cq.Assembly() .add(tagged_box(), name="parent", color=Cq.Color("blue1")) .add(tagged_double_box(), name="child", color=Cq.Color("yellow1")) .constrain("parent?bot", "child?b2_top", "Plane") .solve() ) show_object(result)
but instead the mating surface child?b2_top stays in place, despite that the object was moved up by 5mm.
child?b2_top
Is this intended behaviour? How can I get the tag b2_top to move during .translate()?
b2_top
.translate()
One solution here is to use sub-assemblies.
The text was updated successfully, but these errors were encountered:
Methods such as translate create new Workplane objects in the chain.
translate
Workplane
See also docs introspective example for more. It should help with tags usage. https://cadquery.readthedocs.io/en/latest/primer.html#an-introspective-example: Returning a new instance of Workplane is the normal behaviour of most Workplane methods... Tags offer a way to refer back to a previous Workplane
Sorry, something went wrong.
Methods such as translate create new Workplane objects in the chain. See also docs introspective example for more. It should help with tags usage. https://cadquery.readthedocs.io/en/latest/primer.html#an-introspective-example: Returning a new instance of Workplane is the normal behaviour of most Workplane methods... Tags offer a way to refer back to a previous Workplane
Is there a way to move all objects in a workplane while preserving the tags?
Yes, it's possible. There is no built-in method, but can be done as follows:
<the Workplane>.ctx.tags.values()
No branches or pull requests
Consider this example which should produce 3 cubes stacked on top of each other:
but instead the mating surface
child?b2_top
stays in place, despite that the object was moved up by 5mm.Is this intended behaviour? How can I get the tag
b2_top
to move during.translate()
?One solution here is to use sub-assemblies.
The text was updated successfully, but these errors were encountered: