From ca9129da342429f21e3c156bd90d47524bd8c317 Mon Sep 17 00:00:00 2001 From: Jennifer Reiber Kyle Date: Thu, 19 Dec 2024 21:41:05 -0800 Subject: [PATCH 1/2] fix beam centering when in_height does not equal cn_lego_pitch_stud --- customizable_straight_beam_v4o.scad | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/customizable_straight_beam_v4o.scad b/customizable_straight_beam_v4o.scad index a04c4f0..16bf4b0 100644 --- a/customizable_straight_beam_v4o.scad +++ b/customizable_straight_beam_v4o.scad @@ -100,7 +100,7 @@ module lego_beam( is_holes, in_height = cn_lego_height_beam, in_margin = 0.0 ) if (in_length > 0) { //Center the beam - translate([0,cn_lego_pitch_stud,0]) + translate([0,in_height,0]) rotate([90,0,0]) difference() { From 182ef74a003c3998b73c8e6a1ef8504dfa1c026d Mon Sep 17 00:00:00 2001 From: Jennifer Reiber Kyle Date: Mon, 23 Dec 2024 14:31:15 -0800 Subject: [PATCH 2/2] move rendering precision to global so it can be overwritten by calling script --- customizable_straight_beam_v4o.scad | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/customizable_straight_beam_v4o.scad b/customizable_straight_beam_v4o.scad index 16bf4b0..77a8bc0 100644 --- a/customizable_straight_beam_v4o.scad +++ b/customizable_straight_beam_v4o.scad @@ -21,7 +21,8 @@ 2024-08-04 there is an asymmetry in the hole, the oPo shows there should be a thin bodred above the hole */ - +$fa = $preview ? 2:.5; +$fs = $preview ? .5:0.35; // user parameters @@ -46,18 +47,18 @@ cn_lego_drill_depth_indent = 0.5; //How steep the transition from big hole to small hole cn_lego_drill_sharpness = 0.5; -module body( in_length_stud, in_height = cn_lego_height_beam, in_precision = 0.5 ) +module body( in_length_stud, in_height = cn_lego_height_beam) { translate([0, cn_lego_width_beam/2, 0]) hull() { - cylinder(r=cn_lego_width_beam/2, h=in_height,$fa = 0.1+in_precision, $fs = 0.1+in_precision/2); + cylinder(r=cn_lego_width_beam/2, h=in_height); translate([(in_length_stud-1)*cn_lego_pitch_stud, 0, 0]) - cylinder(r=cn_lego_width_beam/2, h=in_height,$fa = 0.1+in_precision, $fs = 0.1+in_precision/2); + cylinder(r=cn_lego_width_beam/2, h=in_height); } } -module hole( in_height = cn_lego_height_beam, in_precision = 0.5, in_margin = 0.0 ) +module hole( in_height = cn_lego_height_beam, in_margin = 0.0) { an_cross_section = [ //Bottom @@ -76,11 +77,11 @@ module hole( in_height = cn_lego_height_beam, in_precision = 0.5, in_margin = 0. [(cn_lego_drill_large+in_margin)/2,0] ]; //Rotate the cross section of the hole around its axis, to generate the hole - rotate_extrude($fa = 0.1+in_precision, $fs = 0.1+in_precision/2) - polygon(an_cross_section); + rotate_extrude() + polygon(an_cross_section); } -module plus( in_height = cn_lego_height_beam, in_margin = 0.0 ) +module plus( in_height = cn_lego_height_beam, in_margin = 0.0) { union() { @@ -92,7 +93,7 @@ module plus( in_height = cn_lego_height_beam, in_margin = 0.0 ) } } -module lego_beam( is_holes, in_height = cn_lego_height_beam, in_margin = 0.0 ) +module lego_beam( is_holes, in_height = cn_lego_height_beam, in_margin = 0.0) { //number of studs in_length = len(is_holes);