mirror of
https://github.com/ervanalb/keygen.git
synced 2025-12-16 13:25:25 +00:00
add incomplete schlage primus, and string split function
This commit is contained in:
1
Makefile
1
Makefile
@@ -12,6 +12,7 @@ JSON_DIR = build
|
||||
SVG_SRC = $(wildcard $(SVG_DIR)/*.svg)
|
||||
SCAD_SRC = $(SCAD_DIR)/schlage_classic.scad \
|
||||
$(SCAD_DIR)/kwikset.scad \
|
||||
$(SCAD_DIR)/best.scad \
|
||||
|
||||
# Generated polygon files
|
||||
POLY_OBJ = $(patsubst $(SVG_DIR)/%.svg,$(POLY_DIR)/%.gen.scad,$(SVG_SRC))
|
||||
|
||||
@@ -135,7 +135,7 @@ module key_blank(outline_points,
|
||||
}
|
||||
}
|
||||
|
||||
function key_code_to_heights(code, depth_table) = [for(i=key_enum(code)) depth_table[search(code[i], "0123456789")[0]]];
|
||||
function key_code_to_heights(code, depth_table) = [for(i=_enum(code)) depth_table[search(code[i], "0123456789")[0]]];
|
||||
|
||||
module key_bitting_cutter(flat, angle, tool_height) {
|
||||
polygon([[-0.5 * flat, 0],
|
||||
@@ -155,7 +155,7 @@ module key_bitting(heights,
|
||||
// Union together a handful of trapezoids
|
||||
// that comprise the cuts
|
||||
union() {
|
||||
for(i=key_enum(heights)) {
|
||||
for(i=_enum(heights)) {
|
||||
// Move to the proper location and height
|
||||
translate([locations[i], heights[i]])
|
||||
linear_extrude(height=cutter_width, center=true)
|
||||
@@ -166,4 +166,16 @@ module key_bitting(heights,
|
||||
|
||||
function key_lkup(ks, vs, k) = vs[search([k], [for(ki=ks) [ki]])[0]];
|
||||
|
||||
function key_enum(l) = len(l) > 0 ? [for(i=[0:len(l)-1]) i] : [];
|
||||
function _enum(l) = len(l) > 0 ? [for(i=[0:len(l)-1]) i] : [];
|
||||
|
||||
function _strcat(v, i, car, s) = (i==s ? v[i] : str(_strcat(v, i-1, car, s), str(car,v[i]) )); // from https://www.thingiverse.com/thing:202724
|
||||
|
||||
function _strslice(l, start, stop) =
|
||||
stop > start
|
||||
? _strcat([for(i=[start:stop]) l[i]], stop-start, "", 0)
|
||||
: "";
|
||||
|
||||
function key_split_on_dash(s) = [
|
||||
for(i=[0:len(search("-", s, 0)[0])])
|
||||
_strslice(s, search("-", str("-", s), 0)[0][i], search("-", str(s, "-"), 0)[0][i]-1)
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user