38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
#!/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")
|