瀏覽代碼

More clerance fix and no bottom contour for double side

zinongli 1 年之前
父節點
當前提交
c88e1238d4
共有 2 個文件被更改,包括 27 次插入18 次删除
  1. 13 4
      key_copier.c
  2. 14 14
      key_formats.c

+ 13 - 4
key_copier.c

@@ -330,6 +330,8 @@ static void key_copier_view_measure_draw_callback(Canvas* canvas, void* model) {
     int pre_extra_x_px = 0;
     int bottom_post_extra_x_px = 0; // new
     int bottom_pre_extra_x_px = 0; // new
+    int level_contour_px =
+    (int)round((my_format.last_pin_inch + my_format.elbow_inch) / inches_per_px);
     for(int current_pin = 1; current_pin <= my_model->format.pin_num; current_pin += 1) {
         double current_center_px =
             my_format.first_pin_inch + (current_pin - 1) * my_format.pin_increment_inch;
@@ -461,6 +463,16 @@ static void key_copier_view_measure_draw_callback(Canvas* canvas, void* model) {
                 top_contour_px); // draw top shoulder
             last_depth = 0;
             pre_extra_x_px = max(current_depth_px + pin_half_width_px, 0);
+            if(my_format.sides == 2) {
+                canvas_draw_line(
+                    canvas,
+                    0,
+                    bottom_contour_px,
+                    pin_center_px - pin_half_width_px - current_depth_px,
+                    bottom_contour_px); // draw bottom shoulder (hidden by level contour)
+            } else {
+                canvas_draw_line(canvas, 0, 62, level_contour_px, 62);
+            }
         }
         if(current_pin == my_model->format.pin_num) {
             next_depth = 0;
@@ -525,12 +537,9 @@ static void key_copier_view_measure_draw_callback(Canvas* canvas, void* model) {
         }
     }
 
-    int level_contour_px =
-        (int)round((my_format.last_pin_inch + my_format.elbow_inch) / inches_per_px);
     int elbow_px = (int)round(my_format.elbow_inch / inches_per_px);
-    canvas_draw_line(canvas, 0, 62, level_contour_px, 62);
     canvas_draw_line(canvas, level_contour_px, 62, level_contour_px + elbow_px, 62 - elbow_px);
-
+    canvas_draw_line(canvas, 0, top_contour_px - 6, 0, top_contour_px);
     if(my_format.stop == 2) {
         // Draw a line using level_contour_px if stop equals 2 elbow must be firt pin inch
         canvas_draw_line(canvas, level_contour_px, top_contour_px, level_contour_px, 63);

+ 14 - 14
key_formats.c

@@ -57,7 +57,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 0,
      .max_depth_ind = 9,
      .macs = 6,
-     .clearance = 8},
+     .clearance = 7},
 
     {.manufacturer = "Master Lock",
      .format_name = "M1",
@@ -95,7 +95,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 8,
      .macs = 7,
-     .clearance = 8},
+     .clearance = 5},
 
     {.manufacturer = "Yale",
      .format_name = "Y2",
@@ -113,8 +113,8 @@ const KeyFormat all_formats[] = {
      .depth_step_inch = 0.025,
      .min_depth_ind = 0,
      .max_depth_ind = 9,
-     .macs = 9,
-     .clearance = 1},
+     .macs = 5,
+     .clearance = 4},
 
     {.manufacturer = "Yale",
      .format_name = "Y11",
@@ -133,7 +133,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 5,
      .macs = 7,
-     .clearance = 8},
+     .clearance = 3},
 
     {.manufacturer = "Sargent",
      .format_name = "S22",
@@ -152,7 +152,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 10,
      .macs = 7,
-     .clearance = 8},
+     .clearance = 5},
 
     {.manufacturer = "National",
      .format_name = "NA25",
@@ -262,7 +262,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 6,
      .macs = 5,
-     .clearance = 8},
+     .clearance = 3},
 
     {.manufacturer = "Ford",
      .format_name = "H75",
@@ -284,7 +284,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 5,
      .macs = 5,
-     .clearance = 0},
+     .clearance = 2},
 
     {.manufacturer = "Chevrolet",
      .format_name = "B102",
@@ -306,7 +306,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 4,
      .macs = 5,
-     .clearance = 0},
+     .clearance = 2},
 
     {.manufacturer = "Dodge",
      .format_name = "Y159",
@@ -328,7 +328,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 4,
      .macs = 5,
-     .clearance = 0},
+     .clearance = 1},
 
     {.manufacturer = "Kawasaki",
      .format_name = "KA14",
@@ -349,7 +349,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 4,
      .macs = 4,
-     .clearance = 0},
+     .clearance = 3},
 
     {.manufacturer = "Yamaha",
      .format_name = "YM63",
@@ -370,7 +370,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 4,
      .macs = 4,
-     .clearance = 0},
+     .clearance = 3},
 
     {.manufacturer = "Best (A2)",
      .format_name = "SFIC",
@@ -392,7 +392,7 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 0,
      .max_depth_ind = 9,
      .macs = 5,
-     .clearance = 0},
+     .clearance = 3},
 
     {.manufacturer = "RV (FIC,GL,Bauer)",
      .format_name = "RV",
@@ -413,4 +413,4 @@ const KeyFormat all_formats[] = {
      .min_depth_ind = 1,
      .max_depth_ind = 3,
      .macs = 3,
-     .clearance = 0}};
+     .clearance = 1}};