From 3759f8b378f6e02167d5b123239b96160e1f0133 Mon Sep 17 00:00:00 2001 From: Eric Poulsen Date: Tue, 12 Dec 2017 09:50:59 -0800 Subject: [PATCH] increase generation speed, disable 3d render by default --- GenFixture.py | 13 +- openfixture.scad | 336 ++++++++++++++++++++++++----------------------- 2 files changed, 185 insertions(+), 164 deletions(-) diff --git a/GenFixture.py b/GenFixture.py index 670580c..8b42a0c 100755 --- a/GenFixture.py +++ b/GenFixture.py @@ -60,6 +60,7 @@ class GenFixture: nut_th=None pivot_d=None border=None + render=False # Board dimensions min_y = float ("inf") @@ -83,7 +84,7 @@ def __str__(self): self.min_y) def SetOptional(self, rev=None, washer_th=None, nut_f2f=None, nut_c2c=None, nut_th=None, - pivot_d=None, border=None): + pivot_d=None, border=None, render=False): self.rev = rev self.washer_th = washer_th self.nut_f2f = nut_f2f @@ -91,6 +92,7 @@ def SetOptional(self, rev=None, washer_th=None, nut_f2f=None, nut_c2c=None, nut_ self.nut_th = nut_th self.pivot_d = pivot_d self.border = border + self.render = render def SetParams(self, pcb_th, screw_len, screw_d): if pcb_th is not None: @@ -216,11 +218,14 @@ def Generate(self, path): # This will take a while, print something print "Generating Fixture..." + # Create test part os.system ("openscad %s -D\'mode=\"testcut\"\' -o %s openfixture.scad" % (args, testout)) # Create rendering - os.system ("openscad %s -D\'mode=\"3dmodel\"\' --render -o %s openfixture.scad" % (args, pngout)) + if self.render: + os.system ("openscad %s -D\'mode=\"3dmodel\"\' --render -o %s openfixture.scad" % (args, pngout)) + # Create laser cuttable fixture os.system ("openscad %s -D\'mode=\"lasercut\"\' -o %s openfixture.scad" % (args, dxfout)) @@ -335,6 +340,7 @@ def GetOriginDimensions(self): parser.add_argument ('--nut_th', help='hex nut thickness (mm)') parser.add_argument ('--pivot_d', help='Pivot diameter (mm)') parser.add_argument ('--border', help='Board (ledge) under pcb (mm)') + parser.add_argument ('--render', help='Generate a 3d render of the final fixture', action='store_true') # Get args args = parser.parse_args () @@ -377,7 +383,8 @@ def GetOriginDimensions(self): nut_c2c=args.nut_c2c, nut_th=args.nut_th, pivot_d=args.pivot_d, - border=args.border) + border=args.border, + render=args.render) # Generate fixture fixture.Generate (out_dir) diff --git a/openfixture.scad b/openfixture.scad index a5d53ec..e529463 100644 --- a/openfixture.scad +++ b/openfixture.scad @@ -72,10 +72,10 @@ mode = "3dmodel"; //mode = "none"; // Uncomment for laser cuttable dxf -if (mode == "lasercut") projection (cut = false) lasercut (); +if (mode == "lasercut") lasercut (); if (mode == "3dmodel") 3d_model (); if (mode == "validate") validate_testpoints (pcb_outline); -if (mode == "testcut") projection (cut = false) testcut (); +if (mode == "testcut") testcut (); // Smothness function for circles $fn = 15; @@ -188,29 +188,29 @@ module tnut_female (n, length = screw_thr_len) screw_len_pad = 1; // Screw hole - translate ([0, -screw_r - pad/2, 0]) - cube ([length + screw_len_pad, screw_d + pad, mat_th]); + translate ([0, -screw_r - pad/2]) + square ([length + screw_len_pad, screw_d + pad]); // Make space for nut - translate ([mat_th * n + tnut_grip, -nut_od_f2f/2, 0]) - cube ([nut_th, nut_od_f2f, mat_th]); + translate ([mat_th * n + tnut_grip, -nut_od_f2f/2]) + square ([nut_th, nut_od_f2f]); } module tnut_hole () { pad = 0.1; - cylinder (r = screw_r + pad, h = mat_th, $fn = 20); + circle (r = screw_r + pad, $fn = 20); } module tng_n (length, cnt) { tng_y = (length / cnt); - translate ([0, -length / 2, 0]) + translate ([0, -length / 2]) union () { for (i = [0 : 2 : cnt - 1]) { - translate ([0, i * tng_y, 0]) - cube ([mat_th, tng_y, mat_th]); + translate ([0, i * tng_y]) + square ([mat_th, tng_y]); } } } @@ -219,11 +219,11 @@ module tng_p (length, cnt) { tng_y = length / cnt; - translate ([0, -length / 2, 0]) + translate ([0, -length / 2]) union () { for (i = [1 : 2 : cnt - 1]) { - translate ([0, i * tng_y, 0]) - cube ([mat_th, tng_y, mat_th]); + translate ([0, i * tng_y]) + square ([mat_th, tng_y]); } } } @@ -231,7 +231,7 @@ module tng_p (length, cnt) module nut_hole () { pad = 0.05; - cylinder (r = nut_od_c2c/2 + pad, h = mat_th, $fn = 6); + circle (r = nut_od_c2c/2 + pad, $fn = 6); } module testcut () @@ -241,29 +241,29 @@ module testcut () difference () { union () { - cube ([3 * mat_th, y, mat_th]); + square ([3 * mat_th, y]); - translate ([off, 0, 0]) - cube ([screw_thr_len + 2 * mat_th, y - 2 * mat_th, mat_th]); + translate ([off, 0]) + square ([screw_thr_len + 2 * mat_th, y - 2 * mat_th]); } // Remove tng slot - translate ([mat_th, y/2, 0]) + translate ([mat_th, y/2]) tng_n (y - 2 * mat_th, 3); // Remove tnut hole - translate ([mat_th * 3/2, y/2, 0]) + translate ([mat_th * 3/2, y/2]) tnut_hole (); // Remove tng from male side - translate ([off, y/2 - mat_th, 0]) + translate ([off, y/2 - mat_th]) tng_p (y - 2 * mat_th, 3); // Remove tnut - translate ([off, y/2 - mat_th, 0]) + translate ([off, y/2 - mat_th]) tnut_female (1); // Remove nut hole - translate ([off + nut_od_c2c / 2 + screw_thr_len - mat_th, nut_od_f2f / 2 + 2, 0]) + translate ([off + nut_od_c2c / 2 + screw_thr_len - mat_th, nut_od_f2f / 2 + 2]) nut_hole (); } } @@ -277,31 +277,31 @@ module head_side () difference () { union () { hull () { - translate ([0, y, 0]) - cube ([x, 0.01, mat_th]); + translate ([0, y]) + square ([x, 0.01]); // Add pivot point - translate ([r, y + pivot_support_r, 0]) - cylinder (r = pivot_support_r, h = mat_th, $fn = 20); + translate ([r, y + pivot_support_r]) + circle (r = pivot_support_r, $fn = 20); } - cube ([x, y, mat_th]); + square ([x, y]); } // Remove pivot - translate ([r, y + r, 0]) - cylinder (r = pivot_r, h = mat_th, $fn = 20); + translate ([r, y + r]) + circle (r = pivot_r, $fn = 20); // Remove slots - translate ([0, y / 2, 0]) + translate ([0, y / 2]) tng_n (y, 3); - translate ([x - mat_th, y / 2, 0]) + translate ([x - mat_th, y / 2]) tng_n (y, 3); // Remove lincoln log slots - translate ([0, mat_th, 0]) - cube ([x / 2, mat_th, mat_th]); - translate ([0, y - 3 * mat_th, 0]) - cube ([x / 2, mat_th, mat_th]); + translate ([0, mat_th]) + square ([x / 2, mat_th]); + translate ([0, y - 3 * mat_th]) + square ([x / 2, mat_th]); } } @@ -311,30 +311,30 @@ module head_front_back () y = head_z; difference () { - cube ([x, y, mat_th]); + square ([x, y]); // Remove grooves - translate ([x / 2, 0, 0]) + translate ([x / 2, 0]) rotate ([0, 0, 90]) tng_n (x, 3); - translate ([x / 2, y - mat_th, 0]) + translate ([x / 2, y - mat_th]) rotate ([0, 0, 90]) tng_n (x, 3); // Remove assembly slots - translate ([mat_th, y / 2, 0]) - cube ([mat_th, y / 2, mat_th]); - translate ([x - 2 * mat_th, y / 2, 0]) - cube ([mat_th, y / 2, mat_th]); + translate ([mat_th, y / 2]) + square ([mat_th, y / 2]); + translate ([x - 2 * mat_th, y / 2]) + square ([mat_th, y / 2]); } } module lock_tab () { - translate ([-tab_length/2, 0, 0]) - cube ([tab_length, tab_width, mat_th]); - translate ([-tab_length/2, tab_width/2, 0]) - cylinder (r = tab_width / 2, h = mat_th, $fn = 20); + translate ([-tab_length/2, 0]) + square ([tab_length, tab_width]); + translate ([-tab_length/2, tab_width/2]) + circle (r = tab_width / 2, h = mat_th, $fn = 20); } module head_base () @@ -348,37 +348,36 @@ module head_base () head_base_common (); // Add lock tabs - translate ([0, head_y / 12 - tab_width / 2, 0]) + translate ([0, head_y / 12 - tab_width / 2]) lock_tab (); - translate ([head_x, head_y / 12 - tab_width / 2, 0]) - mirror ([1, 0, 0]) + translate ([head_x, head_y / 12 - tab_width / 2]) + mirror ([1, 0]) lock_tab (); } // Remove back cutout - translate ([2 * mat_th, head_y - mat_th, 0]) - cube ([head_x - 4 * mat_th, mat_th, mat_th]); + translate ([2 * mat_th, head_y - mat_th]) + square ([head_x - 4 * mat_th, mat_th]); // Remove holes for hex nuts - translate ([nut_offset, nut_offset, 0]) + translate ([nut_offset, nut_offset]) tnut_hole (); - translate ([head_x - nut_offset, nut_offset, 0]) + translate ([head_x - nut_offset, nut_offset]) tnut_hole (); // Offset these +1 mat_th to allow cutout for swivel - translate ([nut_offset, head_y - nut_offset - mat_th, 0]) + translate ([nut_offset, head_y - nut_offset - mat_th]) tnut_hole (); - translate ([head_x - nut_offset, head_y - nut_offset - mat_th, 0]) + translate ([head_x - nut_offset, head_y - nut_offset - mat_th]) tnut_hole (); // Take 1/3 mouse bit out of front of tabs - translate ([-2 * mat_th - washer_th, head_y / 12 - tab_width / 2, 0]) - cube ([mat_th, tab_width / 3, mat_th]); - translate ([head_x + mat_th + washer_th, head_y / 12 - tab_width / 2, 0]) - cube ([mat_th, tab_width / 3, mat_th]); + translate ([-2 * mat_th - washer_th, head_y / 12 - tab_width / 2]) + square ([mat_th, tab_width / 3]); + translate ([head_x + mat_th + washer_th, head_y / 12 - tab_width / 2]) + square ([mat_th, tab_width / 3]); // Add revision backwards and upside down - translate ([head_x / 2, head_y - 25, 0]) - linear_extrude (height = mat_th) + translate ([head_x / 2, head_y - 25]) rotate ([0, 0, 180]) mirror ([1, 0, 0]) text (rev, font = FONTNAME, halign = "center", valign = "center", size = 6); @@ -386,7 +385,6 @@ module head_base () } module osh_logo () { - linear_extrude (height = mat_th) scale ([0.15, 0.15, 1]) translate ([-72, -66, 0]) import (osh_logo); @@ -403,17 +401,17 @@ module head_top () head_base_common (); // Remove holes for hex nuts - translate ([hole_offset, hole_offset, 0]) - cylinder (r = screw_r + pad, h = mat_th); - translate ([hole_offset, head_y - hole_offset - mat_th, 0]) - cylinder (r = screw_r + pad, h = mat_th); - translate ([head_x - hole_offset, head_y - hole_offset - mat_th, 0]) - cylinder (r = screw_r + pad, h = mat_th); - translate ([head_x - hole_offset, hole_offset, 0]) - cylinder (r = screw_r + pad, h = mat_th); + translate ([hole_offset, hole_offset]) + circle (r = screw_r + pad); + translate ([hole_offset, head_y - hole_offset - mat_th]) + circle (r = screw_r + pad); + translate ([head_x - hole_offset, head_y - hole_offset - mat_th]) + circle (r = screw_r + pad); + translate ([head_x - hole_offset, hole_offset]) + circle (r = screw_r + pad); // Add osh logo - translate ([head_x / 2, head_y - 30, 0]) + translate ([head_x / 2, head_y - 30]) osh_logo (); // Remove cable relief holes @@ -430,14 +428,14 @@ module cable_retention () difference () { hull () { - cylinder (r=screw_d, h=mat_th); - translate ([x, 0, 0]) - cylinder (r=screw_d, h=mat_th); + circle (r=screw_d); + translate ([x, 0]) + circle (r=screw_d); } // Remove holes tnut_hole (); - translate ([x, 0, 0]) + translate ([x, 0]) tnut_hole (); } } @@ -446,18 +444,18 @@ module head_base_common () { difference () { - // Base cube - cube ([head_x, head_y, mat_th]); + // Base square + square ([head_x, head_y]); // Remove slots - translate ([mat_th, head_y / 2, 0]) + translate ([mat_th, head_y / 2]) tng_p (head_y, 3); - translate ([head_x - 2 * mat_th, head_y / 2, 0]) + translate ([head_x - 2 * mat_th, head_y / 2]) tng_p (head_y, 3); - translate ([head_x / 2, head_y - 3 * mat_th, 0]) + translate ([head_x / 2, head_y - 3 * mat_th]) rotate ([0, 0, 90]) tng_p (head_x + mat_th, 3); - translate ([head_x / 2, mat_th, 0]) + translate ([head_x / 2, mat_th]) rotate ([0, 0, 90]) tng_p (head_x + mat_th, 3); @@ -469,8 +467,8 @@ module head_base_common () for ( i = [0 : len (test_points) - 1] ) { // Drop pins for test points - translate ([origin_x + test_points[i][0], origin_y - test_points[i][1], 0]) - cylinder (r = pogo_r, h = mat_th); + translate ([origin_x + test_points[i][0], origin_y - test_points[i][1]]) + circle (r = pogo_r, h = mat_th); } } } @@ -480,18 +478,18 @@ module latch_support () y = latch_support_y; difference () { - cube ([x, y, mat_th]); + square ([x, y]); // Remove tng - translate ([0, y / 2, 0]) + translate ([0, y / 2]) tng_p (y, 3); - translate ([x - mat_th, y / 2, 0]) + translate ([x - mat_th, y / 2]) tng_p (y, 3); // Remove tnut captures - translate ([0, y/2, 0]) + translate ([0, y/2]) tnut_female (1); - translate ([x, y/2, 0]) + translate ([x, y/2]) rotate ([0, 0, 180]) tnut_female (1); } @@ -504,28 +502,28 @@ module latch () difference () { hull () { - cylinder (r = tab_width / 2, h = mat_th, $fn = 20); - translate ([0, y + screw_d, 0]) - cylinder (r = tab_width / 2, h = mat_th, $fn = 20); + circle (r = tab_width / 2, $fn = 20); + translate ([0, y + screw_d]) + circle (r = tab_width / 2, $fn = 20); // Cross support - translate ([-screw_d - support_x, 0, 0]) - cube ([support_x, y, mat_th]); + translate ([-screw_d - support_x, 0]) + square ([support_x, y]); } // Remove screw hole - cylinder (r = screw_r, h = mat_th, $fn = 20); + circle (r = screw_r, $fn = 20); // Remove slot translate ([-screw_r, y, 0]) - cube ([(3 * tab_width) / 4, mat_th + pad, mat_th]); + square ([(3 * tab_width) / 4, mat_th + pad]); // Remove tng - translate ([-support_x - nut_pad, y / 2, 0]) + translate ([-support_x - nut_pad, y / 2]) tng_n (y - 2 * mat_th, 3); // Remove support hole - translate ([-support_x + mat_th / 2 - nut_pad, y / 2, 0]) + translate ([-support_x + mat_th / 2 - nut_pad, y / 2]) tnut_hole (); } } @@ -536,29 +534,29 @@ module base_side () difference () { union () { - cube ([x, y, mat_th]); + square ([x, y]); // Add pivot structure hull () { - translate ([x + base_pivot_offset, y - pivot_support_d / 2, 0]) - cylinder (r = pivot_support_d / 2, h = mat_th, $fn = 20); - translate ([0, y - pivot_support_d, 0]) - cube ([1, pivot_support_d, mat_th]); + translate ([x + base_pivot_offset, y - pivot_support_d / 2]) + circle (r = pivot_support_d / 2, $fn = 20); + translate ([0, y - pivot_support_d]) + square ([1, pivot_support_d]); } } // Remove pivot hole - translate ([x + base_pivot_offset, y - pivot_support_d / 2, 0]) - cylinder (r = pivot_r, h = mat_th, $fn = 20); + translate ([x + base_pivot_offset, y - pivot_support_d / 2]) + circle (r = pivot_r, $fn = 20); // Remove carrier slots - translate ([x - mat_th, head_y / 2, 0]) + translate ([x - mat_th, head_y / 2]) tng_p (head_y, 7); - translate ([x - 2 * mat_th, head_y / 2, 0]) + translate ([x - 2 * mat_th, head_y / 2]) tng_p (head_y, 7); // Remove tnut slot - translate ([x, head_y / 2, 0]) + translate ([x, head_y / 2]) rotate ([0, 0, 180]) tnut_female (2); @@ -566,23 +564,23 @@ module base_side () support_offset = 2 * mat_th; // Cross bar support - translate ([support_offset, head_y / 6, 0]) - mirror ([0, 1, 0]) + translate ([support_offset, head_y / 6]) + mirror ([0, 1 ,0]) tng_n (head_y / 3, 2); translate ([support_offset + mat_th / 2, head_y / 12, 0]) tnut_hole (); // Second cross bar support - translate ([support_offset, head_y - (head_y / 6 + mat_th), 0]) + translate ([support_offset, head_y - (head_y / 6 + mat_th)]) tng_n (head_y / 3, 3); - translate ([support_offset + mat_th / 2, head_y - (head_y / 6 + mat_th), 0]) + translate ([support_offset + mat_th / 2, head_y - (head_y / 6 + mat_th)]) tnut_hole (); // Back support - translate ([x / 2 + mat_th, y - pivot_support_d / 2 - (mat_th / 2), 0]) + translate ([x / 2 + mat_th, y - pivot_support_d / 2 - (mat_th / 2)]) rotate ([0, 0, 90]) tng_n (x, 3); - translate ([x / 2 + mat_th, y - pivot_support_d / 2, 0]) + translate ([x / 2 + mat_th, y - pivot_support_d / 2]) tnut_hole (); } } @@ -593,14 +591,14 @@ module base_front_support () y = head_y/3; difference () { - // Base cube - cube ([x, y, mat_th]); + // Base square + square ([x, y]); // Remove slots - translate ([0, y / 2, 0]) + translate ([0, y / 2]) mirror ([0, 1, 0]) tng_p (y, 2); - translate ([x - mat_th, y / 2, 0]) + translate ([x - mat_th, y / 2]) mirror ([0, 1, 0]) tng_p (y, 2); @@ -619,19 +617,19 @@ module base_support (length) y = length; difference () { - // Base cube - cube ([x, y, mat_th]); + // Base square + square ([x, y]); // Remove slots - translate ([0, y / 2, 0]) + translate ([0, y / 2]) tng_p (y, 3); - translate ([x - mat_th, y / 2, 0]) + translate ([x - mat_th, y / 2]) tng_p (y, 3); // Remove female tnuts - translate ([0, y / 2, 0]) + translate ([0, y / 2]) tnut_female (1); - translate ([x, y / 2, 0]) + translate ([x, y / 2]) rotate ([0, 0, 180]) tnut_female (1); } @@ -642,18 +640,18 @@ module base_back_support () difference () { union () { base_support (base_z); - + // Add additional support to receive pivot screw and nut - translate ([3 * mat_th, base_z, 0]) - cube ([base_x - 6 * mat_th, base_pivot_offset + mat_th + 1.5, mat_th]); + translate ([3 * mat_th, base_z]) + square ([base_x - 6 * mat_th, base_pivot_offset + mat_th + 1.5]); } // Remove tnut supports - translate ([0, base_z + base_pivot_offset - mat_th, 0]) + translate ([0, base_z + base_pivot_offset - mat_th]) tnut_female (3); // Remove tnut supports - translate ([base_x, base_z + base_pivot_offset - mat_th, 0]) + translate ([base_x, base_z + base_pivot_offset - mat_th]) rotate ([0, 0, 180]) tnut_female (3); } @@ -662,8 +660,8 @@ module base_back_support () module spacer () { difference () { - cylinder (r = pivot_support_r, h = mat_th, $fn = 20); - cylinder (r = pivot_r, h = mat_th, $fn = 20); + circle (r = pivot_support_r, $fn = 20); + circle (r = pivot_r, $fn = 20); } } @@ -677,37 +675,35 @@ module carrier (dxf_filename, pcb_x, pcb_y, border) scale_y = 1 - ((2 * border) / pcb_y); difference () { - cube ([x, y, mat_th]); + square ([x, y]); // Get scale_offset sx_offset = (pcb_x - (pcb_x * scale_x)) / 2; sy_offset = (pcb_y - (pcb_y * scale_y)) / 2; - // Import dxf, extrude and translate + // Import dxf, translate translate ([mat_th + active_x_offset + tp_correction_offset_x, - work_area_y + active_y_offset + tp_correction_offset_y, 0]) - translate ([sx_offset, -sy_offset, 0]) + work_area_y + active_y_offset + tp_correction_offset_y]) + translate ([sx_offset, -sy_offset]) hull () { - linear_extrude (height = mat_th) - scale ([scale_x, scale_y, 1]) + scale ([scale_x, scale_y]) import (dxf_filename); } // Remove slots - translate ([0, y/2, 0]) + translate ([0, y/2]) tng_n (y, 7); - translate ([x - mat_th, y/2, 0]) + translate ([x - mat_th, y/2]) tng_n (y, 7); // Remove holes - translate ([mat_th / 2, y / 2, 0]) + translate ([mat_th / 2, y / 2]) tnut_hole (); - translate ([x - mat_th / 2, y / 2, 0]) + translate ([x - mat_th / 2, y / 2]) tnut_hole (); // Add revision ID, also allows to determine which side is top - translate ([x / 2, y - 25, 0]) - linear_extrude (height = mat_th) + translate ([x / 2, y - 25]) text (rev, font = FONTNAME, halign = "center", valign = "center", size = 6); } } @@ -719,54 +715,70 @@ module 3d_head () { head_top_offset = head_z - mat_th; + linear_extrude(height = mat_th) head_base (); translate ([2 * mat_th, 0, 0]) rotate ([0, -90, 0]) + linear_extrude(height = mat_th) head_side (); translate ([head_x - mat_th, 0, 0]) rotate ([0, -90, 0]) + linear_extrude(height = mat_th) head_side (); translate ([0, 0, head_top_offset]) + linear_extrude(height = mat_th) head_top (); translate ([0, head_y - 2 * mat_th, 0]) rotate ([90, 0, 0]) + linear_extrude(height = mat_th) head_front_back (); translate ([0, 2 * mat_th, 0]) rotate ([90, 0, 0]) + linear_extrude(height = mat_th) head_front_back (); translate ([mat_th * 3 + screw_d, head_y - (5 * mat_th) - screw_r, head_top_offset + mat_th + 1]) + linear_extrude(height = mat_th) cable_retention (); } module 3d_base () { // Base sides rotate ([0, -90, 0]) + linear_extrude(height = mat_th) base_side (); translate ([head_x + mat_th, 0, 0]) rotate ([0, -90, 0]) + linear_extrude(height = mat_th) base_side (); // Supports translate ([-mat_th, 0, 2 * mat_th]) + linear_extrude(height = mat_th) base_front_support (); translate ([-mat_th, head_y - (head_y / 3) - mat_th, 2 * mat_th]) + linear_extrude(height = mat_th) base_support (head_y / 3); translate ([-mat_th, base_y - pivot_support_r + mat_th/2, mat_th]) rotate ([90, 0, 0]) + linear_extrude(height = mat_th) base_back_support (); // Add spacers translate ([0, base_y - pivot_support_r, base_z + base_pivot_offset]) rotate ([0, 90, 0]) + linear_extrude(height = mat_th) spacer (); translate ([base_x - 3 * mat_th, base_y - pivot_support_r, base_z + base_pivot_offset]) rotate ([0, 90, 0]) + linear_extrude(height = mat_th) spacer (); // Add carrier blank and carrier translate ([-mat_th, 0, base_z - (2 * mat_th)]) + linear_extrude(height = mat_th) carrier (pcb_outline, pcb_x, pcb_y, pcb_support_border); translate ([-mat_th, 0, base_z - mat_th]) + linear_extrude(height = mat_th) carrier (pcb_outline, pcb_x, pcb_y, 0); } @@ -774,11 +786,14 @@ module 3d_latch () { // Add latches translate ([-mat_th * 2 - washer_th, 0, 0]) rotate ([0, 90, 0]) + linear_extrude(height = mat_th) latch (); translate ([base_x - mat_th + washer_th, 0, 0]) rotate ([0, 90, 0]) + linear_extrude(height = mat_th) latch (); translate ([-2 * mat_th - washer_th, latch_z_offset / 4, support_x - mat_th + nut_pad]) + linear_extrude(height = mat_th) latch_support (); } @@ -797,7 +812,6 @@ module 3d_model () { module validate_testpoints (dxf_filename) { hull () { - linear_extrude (height = mat_th) import (dxf_filename); } // Loop over test points @@ -805,8 +819,8 @@ module validate_testpoints (dxf_filename) // Drop pins for test points color ([1, 0, 0]) - translate ([test_points[i][0], -test_points[i][1], 0]) - cylinder (r = pogo_r, h = mat_th); + translate ([test_points[i][0], -test_points[i][1]]) + circle (r = pogo_r); } } @@ -815,36 +829,36 @@ module lasercut () // Add carrier panels carrier (pcb_outline, pcb_x, pcb_y, pcb_support_border); xoffset1 = base_x + laser_pad; - translate ([xoffset1, 0, 0]) + translate ([xoffset1, 0]) carrier (pcb_outline, pcb_x, pcb_y, -0.05); // Add head top xoffset2 = xoffset1 + base_x + laser_pad; - translate ([xoffset2, 0, 0]) + translate ([xoffset2, 0]) head_top (); // Add head base, flip to take advantage of kerf securing nuts xoffset3 = xoffset2 + 2 * head_x + tab_length + laser_pad; - translate ([xoffset3, 0, 0]) - mirror ([1, 0, 0]) + translate ([xoffset3, 0]) + mirror ([1, 0]) head_base (); // Add base sides xoffset4 = xoffset3 + tab_length + laser_pad; - translate ([xoffset4, 0, 0]) + translate ([xoffset4, 0]) base_side (); xoffset5 = xoffset4 + 2 * base_z + base_pivot_offset + pivot_support_r + laser_pad; - translate ([xoffset5, base_y, 0]) + translate ([xoffset5, base_y]) rotate ([0, 0, 180]) base_side (); // Add spacer in center xoffset6 = xoffset4 + (2 * base_z + base_pivot_offset) / 2 + laser_pad; yoffset1 = 2 * pivot_support_d + laser_pad; - translate ([xoffset6, yoffset1, 0]) + translate ([xoffset6, yoffset1]) spacer (); yoffset2 = yoffset1 + pivot_support_d + laser_pad; - translate ([xoffset6, yoffset2, 0]) + translate ([xoffset6, yoffset2]) spacer (); // Add base supports @@ -852,7 +866,7 @@ module lasercut () translate ([xoffset7, 0, 0]) base_front_support (); yoffset3 = head_y / 3 + laser_pad; - translate ([xoffset7, yoffset3, 0]) + translate ([xoffset7, yoffset3]) base_support (head_y / 3); yoffset4 = yoffset3 + head_y / 3 + laser_pad; translate ([xoffset7, yoffset4, 0]) @@ -860,28 +874,28 @@ module lasercut () // Add head sides xoffset8 = xoffset7 + base_x + laser_pad; - translate ([xoffset8, 0, 0]) + translate ([xoffset8, 0]) head_side (); xoffset9 = xoffset8 + head_z + laser_pad; - translate ([xoffset9, 0, 0]) + translate ([xoffset9, 0]) head_side (); // Add front latch support xoffset10 = xoffset9 + head_z + laser_pad; - translate ([xoffset10, 0, 0]) + translate ([xoffset10, 0]) latch_support (); // Add head front/back yoffset5 = latch_support_y + laser_pad; - translate ([xoffset10, yoffset5, 0]) + translate ([xoffset10, yoffset5]) head_front_back (); yoffset6 = yoffset5 + head_z + laser_pad; - translate ([xoffset10, yoffset6, 0]) + translate ([xoffset10, yoffset6]) head_front_back (); // Add cable retention yoffset7 = yoffset6 + head_z + laser_pad + screw_d; - translate ([xoffset10 + screw_d, yoffset7, 0]) + translate ([xoffset10 + screw_d, yoffset7]) cable_retention (); // Add latches @@ -891,6 +905,6 @@ module lasercut () translate ([xoffset11, yoffset8, 0]) latch (); xoffset12 = xoffset11 + screw_d + support_x + tab_width / 2 + laser_pad; - translate ([xoffset12, yoffset8, 0]) + translate ([xoffset12, yoffset8]) latch (); }