Add template for marking bitting positions with a fine point marker

This commit is contained in:
Adam Goldsmith 2022-05-05 17:44:57 -04:00
parent 15e7f52071
commit 85c7dda27c

37
marker_template.py Normal file
View File

@ -0,0 +1,37 @@
#!/usr/bin/env python3
import cadquery as cq
from cadquery import exporters
import key_bittings
from key_bittings import BittingSpecification
extra_key_thickness = 0.8
extra_key_width = 0.2
marker_width = 1.25
def marker_template(spec: BittingSpecification, thickness=1, fillet=0.4):
return (
cq.Workplane()
.box(spec.TFC + spec.positions * spec.BCC,
max(spec.depths.values()) + thickness * 2,
spec.key_thickness + thickness)
.faces(">Z").vertices("<XY").workplane(centerOption="CenterOfMass")
.center(spec.TFC, thickness + max(spec.depths.values())/2)
.rarray(spec.BCC, 1, spec.positions, 1, center=False)
.rect(marker_width, max(spec.depths.values())).cutThruAll()
.edges("not <Z").fillet(fillet)
.faces("<X").workplane(centerOption="CenterOfMass")
.move(0, -thickness)
.rect(max(spec.depths.values()) + extra_key_width,
spec.key_thickness + extra_key_thickness).cutThruAll()
)
result = marker_template(key_bittings.national_disc_tumbler)
exporters.export(result, "national_disc_tumbler_marker_template.stl")