cadquery/canilla/canilla.py

38 lines
898 B
Python
Raw Permalink Normal View History

2022-11-09 10:24:23 -03:00
import cadquery2 as cq
from cadquery2 import exporters
# The hole for the "peg" where this goes
peg_front = 9.5
peg_side = 9
peg_height = 12
# General size of the handle
width = 20
length = 70
height = 16
# General shape of the handle seen from above
handle_shape_top = cq.Sketch().trapezoid(width, length, 85).vertices().fillet(3)
hole_shape = cq.Sketch().trapezoid(peg_front, peg_side, 90)
bottom_cutout = cq.Sketch().trapezoid(width, length - width, 90)
handle = (
cq.Workplane("XY")
.placeSketch(handle_shape_top)
.extrude(height)
.faces("<Z")
.workplane(centerOption="CenterOfBoundBox")
.center(0, length/2 - width/2)
.placeSketch(hole_shape)
.cutBlind(-peg_height)
.faces("<Z")
.workplane(centerOption="CenterOfBoundBox")
.center(0, -width/2)
.placeSketch(bottom_cutout)
.cutBlind(-height/2)
)
exporters.export(handle, "handle.stl")