From fe1cfa45f443fd06068941ed647a81b001c9d7c9 Mon Sep 17 00:00:00 2001 From: Paul H Date: Tue, 14 Apr 2020 18:00:10 +0200 Subject: [PATCH 1/4] added connectors parameter to wood_track so tracks now have connectors by default --- tracklib.scad | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tracklib.scad b/tracklib.scad index 15ae307..f609ec4 100644 --- a/tracklib.scad +++ b/tracklib.scad @@ -179,8 +179,10 @@ module wood_rails_2d() { * Individual piece of wooden track. Same gauge as Trackmaster but not the same shape. * @param int length Length of track to render. Standard short wooden length is 53.5mm. * @param bool rails False if you do not want to include rails (wheel wells). + * @param bool bevel_ends True if you want the ends to be beveled. + * @param bool connectors False if you don't want connectors. */ -module wood_track(length=53.5, rails=true, bevel_ends=true) { +module wood_track(length=53.5, rails=true, bevel_ends=true, connectors=true) { bevel_pad = bevel_width*sqrt(.5)*($o/2); difference() { rotate([90,0,90]) linear_extrude(length, convexity = 10) wood_track_2d(); @@ -198,7 +200,16 @@ module wood_track(length=53.5, rails=true, bevel_ends=true) { } } } + if (connectors) { + if (length>(wood_plug_radius()*2+wood_plug_neck_length())) { + translate([0,wood_width()/2,0]) wood_cutout(); + } + } + } + if (connectors) { + translate([length,wood_width()/2,0]) wood_plug(); } + } /** From 9e9dd6a69b47523001d87f06f69d83cbe5a0160a Mon Sep 17 00:00:00 2001 From: Paul H Date: Tue, 14 Apr 2020 18:05:28 +0200 Subject: [PATCH 2/4] updated example --- tracklib.scad | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tracklib.scad b/tracklib.scad index f609ec4..b5d2a3c 100644 --- a/tracklib.scad +++ b/tracklib.scad @@ -64,9 +64,11 @@ use ; tracklib_example(); module tracklib_example($fn=25) { // Wood pieces + translate([0,50,0]) + wood_track(100); wood_track(10); - translate([15,30,0]) wood_plug(); - translate([15,10,0]) difference() { + translate([30,30,0]) wood_plug(); + translate([30,10,0]) difference() { translate([0,-wood_plug_radius()-2]) cube([wood_plug_neck_length() + wood_plug_radius() + 2, wood_plug_radius() * 2 + 4, wood_height()]); wood_cutout(); } @@ -74,8 +76,8 @@ module tracklib_example($fn=25) { translate([-14,-3,0]) rotate([0,0,90+25]) wood_track_slope(25, 30, $fn=120); #translate([-29,-10,6]) rotate([30,0,90+25]) wood_track_slope(25, -30, $fn=120); // Trackmaster pieces - translate([40,30,0]) trackmaster_plug(); - translate([40,10,0]) difference() { + translate([55,30,0]) trackmaster_plug(); + translate([55,10,0]) difference() { translate([0,-trackmaster_plug_radius()-2]) cube([trackmaster_plug_neck_length() + trackmaster_plug_radius() + 2, trackmaster_plug_radius() * 2 + 4, trackmaster_height()]); trackmaster_cutout(); } From 1620fadb0ce9231a929cbf0165b99d177d8b211b Mon Sep 17 00:00:00 2001 From: Paul H Date: Tue, 14 Apr 2020 18:24:32 +0200 Subject: [PATCH 3/4] add connectors parameter to wood_track_arc() so curved tracks now have connecters by default --- tracklib.scad | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tracklib.scad b/tracklib.scad index b5d2a3c..f016f1d 100644 --- a/tracklib.scad +++ b/tracklib.scad @@ -66,18 +66,17 @@ module tracklib_example($fn=25) { // Wood pieces translate([0,50,0]) wood_track(100); + translate([0,10,0]) + rotate([0,0,45]) + wood_track_arc(); + wood_track(10); - translate([30,30,0]) wood_plug(); - translate([30,10,0]) difference() { - translate([0,-wood_plug_radius()-2]) cube([wood_plug_neck_length() + wood_plug_radius() + 2, wood_plug_radius() * 2 + 4, wood_height()]); - wood_cutout(); - } - translate([-5,-10,0]) rotate([0,0,90]) wood_track_arc(10, 25, $fn=120); + translate([-5,-10,0]) rotate([0,0,90]) wood_track_arc(10, 25, $fn=120, true, false); translate([-14,-3,0]) rotate([0,0,90+25]) wood_track_slope(25, 30, $fn=120); #translate([-29,-10,6]) rotate([30,0,90+25]) wood_track_slope(25, -30, $fn=120); // Trackmaster pieces - translate([55,30,0]) trackmaster_plug(); - translate([55,10,0]) difference() { + translate([35,30,0]) trackmaster_plug(); + translate([35,10,0]) difference() { translate([0,-trackmaster_plug_radius()-2]) cube([trackmaster_plug_neck_length() + trackmaster_plug_radius() + 2, trackmaster_plug_radius() * 2 + 4, trackmaster_height()]); trackmaster_cutout(); } @@ -248,8 +247,9 @@ module wood_rails(length=53.5, bevel_ends=true) { * @param int radius Radius of inner edge of the trac arc. Standard track curves are 36cm and 17.5cm diameter. * @param int angle Angle of track to render. Standard track angle is 45 degrees. * @param bool rails False if you do not want to include rails (wheel wells). + * @param bool connectors False if you don't want connectors. */ -module wood_track_arc(radius = 245/2, angle=45, rails=true) { +module wood_track_arc(radius = 245/2, angle=45, rails=true, connectors=true) { difference() { intersection() { pie(radius + wood_width(), angle, wood_height()); @@ -260,6 +260,13 @@ module wood_track_arc(radius = 245/2, angle=45, rails=true) { if (rails) { wood_rails_arc(radius,angle); } + if (connectors) { + translate([radius+wood_width()/2,0,0]) rotate([0,0,90]) wood_cutout(); + } + } + if (connectors) { + rotate([0,0,angle]) translate([radius+wood_width()/2,0,0]) + rotate([0,0,90]) wood_plug(); } } From 036a9ddd722b36bd60cb0c8aeb30213392d9026c Mon Sep 17 00:00:00 2001 From: Paul H Date: Tue, 14 Apr 2020 18:00:10 +0200 Subject: [PATCH 4/4] add connectors parameter to wood_track_arc() and wood_track() so tracks have connecters by default And update example --- tracklib.scad | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/tracklib.scad b/tracklib.scad index 15ae307..f016f1d 100644 --- a/tracklib.scad +++ b/tracklib.scad @@ -64,18 +64,19 @@ use ; tracklib_example(); module tracklib_example($fn=25) { // Wood pieces + translate([0,50,0]) + wood_track(100); + translate([0,10,0]) + rotate([0,0,45]) + wood_track_arc(); + wood_track(10); - translate([15,30,0]) wood_plug(); - translate([15,10,0]) difference() { - translate([0,-wood_plug_radius()-2]) cube([wood_plug_neck_length() + wood_plug_radius() + 2, wood_plug_radius() * 2 + 4, wood_height()]); - wood_cutout(); - } - translate([-5,-10,0]) rotate([0,0,90]) wood_track_arc(10, 25, $fn=120); + translate([-5,-10,0]) rotate([0,0,90]) wood_track_arc(10, 25, $fn=120, true, false); translate([-14,-3,0]) rotate([0,0,90+25]) wood_track_slope(25, 30, $fn=120); #translate([-29,-10,6]) rotate([30,0,90+25]) wood_track_slope(25, -30, $fn=120); // Trackmaster pieces - translate([40,30,0]) trackmaster_plug(); - translate([40,10,0]) difference() { + translate([35,30,0]) trackmaster_plug(); + translate([35,10,0]) difference() { translate([0,-trackmaster_plug_radius()-2]) cube([trackmaster_plug_neck_length() + trackmaster_plug_radius() + 2, trackmaster_plug_radius() * 2 + 4, trackmaster_height()]); trackmaster_cutout(); } @@ -179,8 +180,10 @@ module wood_rails_2d() { * Individual piece of wooden track. Same gauge as Trackmaster but not the same shape. * @param int length Length of track to render. Standard short wooden length is 53.5mm. * @param bool rails False if you do not want to include rails (wheel wells). + * @param bool bevel_ends True if you want the ends to be beveled. + * @param bool connectors False if you don't want connectors. */ -module wood_track(length=53.5, rails=true, bevel_ends=true) { +module wood_track(length=53.5, rails=true, bevel_ends=true, connectors=true) { bevel_pad = bevel_width*sqrt(.5)*($o/2); difference() { rotate([90,0,90]) linear_extrude(length, convexity = 10) wood_track_2d(); @@ -198,7 +201,16 @@ module wood_track(length=53.5, rails=true, bevel_ends=true) { } } } + if (connectors) { + if (length>(wood_plug_radius()*2+wood_plug_neck_length())) { + translate([0,wood_width()/2,0]) wood_cutout(); + } + } } + if (connectors) { + translate([length,wood_width()/2,0]) wood_plug(); + } + } /** @@ -235,8 +247,9 @@ module wood_rails(length=53.5, bevel_ends=true) { * @param int radius Radius of inner edge of the trac arc. Standard track curves are 36cm and 17.5cm diameter. * @param int angle Angle of track to render. Standard track angle is 45 degrees. * @param bool rails False if you do not want to include rails (wheel wells). + * @param bool connectors False if you don't want connectors. */ -module wood_track_arc(radius = 245/2, angle=45, rails=true) { +module wood_track_arc(radius = 245/2, angle=45, rails=true, connectors=true) { difference() { intersection() { pie(radius + wood_width(), angle, wood_height()); @@ -247,6 +260,13 @@ module wood_track_arc(radius = 245/2, angle=45, rails=true) { if (rails) { wood_rails_arc(radius,angle); } + if (connectors) { + translate([radius+wood_width()/2,0,0]) rotate([0,0,90]) wood_cutout(); + } + } + if (connectors) { + rotate([0,0,angle]) translate([radius+wood_width()/2,0,0]) + rotate([0,0,90]) wood_plug(); } }