Allow passing in a key profile to lishi_template
This commit is contained in:
parent
dcab806632
commit
428f5f03be
@ -32,7 +32,7 @@ notch_height = 1.5
|
|||||||
notch_depth = 0.5
|
notch_depth = 0.5
|
||||||
|
|
||||||
|
|
||||||
def lishi_template(spec: BittingSpecification, name: str, depth: float):
|
def lishi_template(spec: BittingSpecification, name: str, depth: float, profile: cq.Sketch):
|
||||||
key_guide_width = lishi_width/2 + side_thickness + spec.TFC - spec.BCC/2
|
key_guide_width = lishi_width/2 + side_thickness + spec.TFC - spec.BCC/2
|
||||||
|
|
||||||
result = (
|
result = (
|
||||||
@ -66,8 +66,7 @@ def lishi_template(spec: BittingSpecification, name: str, depth: float):
|
|||||||
.tag("key_guide")
|
.tag("key_guide")
|
||||||
.edges("not <Y").fillet(corner_radius)
|
.edges("not <Y").fillet(corner_radius)
|
||||||
.faces(">X", tag="key_guide").vertices("<Z and <Y").workplane(centerOption="CenterOfMass").center(0, bottom_thickness + lishi_cutter_offset - depth)
|
.faces(">X", tag="key_guide").vertices("<Z and <Y").workplane(centerOption="CenterOfMass").center(0, bottom_thickness + lishi_cutter_offset - depth)
|
||||||
# ideally, the key profile would be passed in as an argument
|
.placeSketch(profile).cutThruAll()
|
||||||
.rect(spec.key_thickness + extra_key_thickness, depth, centered=False).cutThruAll()
|
|
||||||
.union(result) # this seems like a fairly bad way to do this, but it does work
|
.union(result) # this seems like a fairly bad way to do this, but it does work
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -86,5 +85,18 @@ def lishi_template(spec: BittingSpecification, name: str, depth: float):
|
|||||||
|
|
||||||
spec = key_bittings.national_disc_tumbler
|
spec = key_bittings.national_disc_tumbler
|
||||||
for name, depth in spec.depths.items():
|
for name, depth in spec.depths.items():
|
||||||
result = lishi_template(spec, name, depth)
|
profile = (
|
||||||
|
cq.Sketch()
|
||||||
|
.push([((spec.key_thickness + extra_key_thickness)/2, depth/2)])
|
||||||
|
.rect(spec.key_thickness + extra_key_thickness, depth)
|
||||||
|
|
||||||
|
# notch to hold key straight
|
||||||
|
.push([(spec.key_thickness + extra_key_thickness - 0.5, 0.5 + 0.5)])
|
||||||
|
.rect(1, 1, mode="s")
|
||||||
|
|
||||||
|
# fillet inner corners
|
||||||
|
.reset().vertices("not(>X or <X)") .fillet(0.3)
|
||||||
|
)
|
||||||
|
|
||||||
|
result = lishi_template(spec, name, depth, profile)
|
||||||
exporters.export(result, f'national_disc_tumbler_{name}.stl')
|
exporters.export(result, f'national_disc_tumbler_{name}.stl')
|
||||||
|
Loading…
Reference in New Issue
Block a user