I am trying to create an angled bracket to be mounted onto a surface such that the counter-bored holes are normal to the back face, but start at the proper location on the front face.
I have this code:
backing = (
housing_back_plane # this is just a workplane
.rect(height,width).extrude(50, combine=False)
.faces(">Y[-2]").workplane(invert=True).tag("front")
.transformed(offset=cq.Vector(-height/2, -width/2, thickness),rotate=cq.Vector(5, -5, 0))
.split(keepBottom=True)
# Now lets try and put some holes in
.workplaneFromTagged("front").workplane(invert=True)
.rect(height - padding/1.5,width - padding/1.5,forConstruction=True)
.vertices()
.cboreHole(3.6, 5.5, 3)
)
Which generates the shape below. Note that while the holes are located correctly, the are normal to the front face, and I need them normal to the back face.
I am not sure how to combine the intended vertices with the angle of the back plane.
I found that the
cboreHole()
function had an variable calledboreDir
that was not exposed. I duplicated the function and exposedboreDir
as a parameter like this:Then I found the example code here:
https://github.com/CadQuery/cadquery/issues/357#issuecomment-670009050
And used it to figure out how which normal I wanted to use (in my case the Y direction).
For now I manually hardcoded the values, so its:
The only problem here is that I still don't understand how the stack works, so I get and print the directions after the plane is generated, which forces me to hard code the
yDir
for now.