diff --git a/Makefile b/Makefile index f045e71..3ed30cf 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,8 @@ JSON_DIR = build # Files to include SVG_SRC = $(wildcard $(SVG_DIR)/*.svg) -SCAD_SRC = $(SCAD_DIR)/schlage_classic.scad +SCAD_SRC = $(SCAD_DIR)/schlage_classic.scad \ + $(SCAD_DIR)/kwikset.scad \ # Generated polygon files POLY_OBJ = $(patsubst $(SVG_DIR)/%.svg,$(POLY_DIR)/%.gen.scad,$(SVG_SRC)) diff --git a/resources/kwikset.svg b/resources/kwikset.svg new file mode 100644 index 0000000..6ca0b42 --- /dev/null +++ b/resources/kwikset.svg @@ -0,0 +1,88 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + KW1 + + diff --git a/scad/keygen.scad b/scad/keygen.scad index 8c30e84..1f2fce3 100644 --- a/scad/keygen.scad +++ b/scad/keygen.scad @@ -141,7 +141,7 @@ module key_bitting_cutter(flat, angle, tool_height) { polygon([[-0.5 * flat, 0], [0.5 * flat, 0], [0.5 * flat + tan(0.5 * angle) * tool_height, tool_height], - [0.5 * flat - tan(0.5 * angle) * tool_height, tool_height]]); + [-0.5 * flat - tan(0.5 * angle) * tool_height, tool_height]]); } module key_bitting(heights, diff --git a/scad/kwikset.scad b/scad/kwikset.scad new file mode 100644 index 0000000..f618a2f --- /dev/null +++ b/scad/kwikset.scad @@ -0,0 +1,60 @@ +use +include + +module kwikset(bitting="", + outline_name="KW1", + warding_name="KW1") { + + name = "Kwikset"; + + /* + Bitting is specified from bow to tip, 1-7, with 1 being the shallowest cut and 7 being the deepest. + Example: 25363 + */ + + outlines_k = ["KW1"]; + outlines_v = [[outline_points, outline_paths, + [-outline_points[34][0], -outline_points[26][1]], + engrave_points, + engrave_paths]]; + wardings_k = ["KW1"]; + wardings_v = [warding_kw1_points]; + + outline_param = key_lkup(outlines_k, outlines_v, outline_name); + outline_points = outline_param[0]; + outline_paths = outline_param[1]; + offset = outline_param[2]; + engrave_points = outline_param[3]; + engrave_paths = outline_param[4]; + + warding_points = key_lkup(wardings_k, wardings_v, warding_name); + + cut_locations = [for(i=[.247, .397, .547, .697, .847]) i*25.4]; + // Kwikset starts with 1?? + depth_table = [for(i=[0.329+0.023:-0.023:0.190]) i*25.4]; + + heights = key_code_to_heights(bitting, depth_table); + + difference() { + if($children == 0) { + key_blank(outline_points, + warding_points, + outline_paths=outline_paths, + engrave_right_points=engrave_points, + engrave_right_paths=engrave_paths, + engrave_left_points=engrave_points, + engrave_left_paths=engrave_paths, + offset=offset, + plug_diameter=12.7); + } else { + children(0); + } + key_bitting(heights, cut_locations, 2.1336, 90); + } +} + +// Defaults +bitting=""; +outline="KW1"; +warding="KW1"; +kwikset(bitting, outline, warding);