Selecting the face of a small object on top of the stack #1942
Unanswered
ervandarnell
asked this question in
Q&A
Replies: 1 comment
-
|
With the current API I'd do it like so: import cadquery as cq
res = (
cq.Workplane()
.box(5,5,1, centered=(1,1,0))
.faces(">Z")
.workplane()
.center(-1,0)
.box(2,2,2, centered=(1,1,0))
.faces(">Z").siblings('Edge').faces('>X').workplane(centerOption='CenterOfMass')
.box(1,1,1, centered=(1,1,0))
) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm just getting started on cadquery as an upgrade to openscad. I want to create this cleanly:
It's trivial like so:
cq.Workplane("XY")
.box(2,2,2).faces(">X").workplane()
.box(1,1,1,centered=(1,1,0)).faces("<Z").workplane()
.box(5,5,1, centered=(1,1,0))
But the problem here is the box222 is first in the chain. This won't work for a bigger design. The box551 is a platform to build multiple things on, thus it really needs to be first in the chain:
.box(5,5,1, centered=(1,1,0)).faces(">Z").workplane().center(1,1)
.box(2,2,2, centered=(1,1,0)).faces(">X").workplane()
.box(1,1,1, centered=(1,1,0))
But this does not work, the .faces(">X") applies to the whole object, not the box222 on the top. I get this:
Ultimately, I want something like the following with multiple objects built on the platform:
.box(5,5,1, centered=(1,1,0)).faces(">Z").workplane().tag("platform").center(1,1)
.invoke(add_canon())
.workplaneFromTag("platform").center(-1,-1).invoke(a_different_canon()).
I don't see any way to do this without just calculating positions and putting hard numbers into .transformed().
Seems like this should work (with a call to .end()) but it doesn't:
.box(5,5,1, centered=(1,1,0)).faces(">Z").workplane().center(1,1)
.box(2,2,2, centered=(1,1,0)).end().faces(">X").workplane()
.box(1,1,1, centered=(1,1,0))
Also notice I'm not building on top of the box222 but in front of it, so faces(">Z") is definitely not the right answer.
Is there some useful selector or tag I'm overlooking? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions