| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import cadquery as cq
- from cadquery.occ_impl.exporters import *
- from ocp_vscode import show
- attach_hole_diam = 5.1
- attach_hole_dist = 50
- thick = 3
- flap_width = 15
- flap_len = attach_hole_dist + 2 * attach_hole_diam
- holder_width = 26.2
- holder_depth = 10.5 + thick
- bl_hole_diam = 3.85
- bl_hole_dist = 21.4 - bl_hole_diam
- flap = (
- cq.Workplane("XY")
- .workplane()
- .rect(flap_len, flap_width)
- .extrude(thick)
- )
- flap = (
- flap.faces(">Z")
- .workplane()
- .center(attach_hole_dist/2, 0)
- .circle(attach_hole_diam/2)
- .center(-attach_hole_dist, 0)
- .circle(attach_hole_diam/2)
- .cutThruAll()
- # .edges("|Z")
- # .fillet(2)
- )
- angle = (
- flap.faces(">X")
- .workplane(centerOption="CenterOfBoundBox")
- .center(0, -thick/2)
- .rect(holder_width, holder_depth, centered=(True,False))
- .extrude(thick)
- .faces(">X")
- .workplane(centerOption="CenterOfBoundBox")
- .center(-bl_hole_dist/2, 0)
- .circle(bl_hole_diam/2)
- .center(bl_hole_dist,0)
- .circle(bl_hole_diam/2)
- .cutThruAll()
- .edges("|X")
- .fillet(1)
- .faces("<X")
- .fillet(1)
- )
- show(angle)
- # export the box as a STEP file
- with open("/home/sgruen/Dokumente/cadquery/bltouch_holder.step", "w") as fp:
- cq.exporters.exportShape(angle, ExportTypes.STEP, fp)
|