Work towards auto-generating assembly instructions.

This commit is contained in:
Revar Desmera
2015-09-14 02:33:51 -07:00
parent 8663bbd72c
commit a783fbdbc8
3 changed files with 551 additions and 297 deletions

View File

@@ -43,24 +43,59 @@ module arrow(size=10, headpart=0.4) {
//!arrow(size=200);
module x_sled_end_assembly(explode=0, arrows=false)
{
up(groove_height/2+rail_offset) {
zrot(90) yrot(180) sled();
right(platform_length/2+explode*2) {
zrot(90) xy_joiner();
}
}
// Construction arrows.
if(arrows && explode>20) {
right(platform_length/2+explode*0.75) {
arrow(size=explode/3);
}
}
}
//!x_sled_end_assembly(explode=100, arrows=true);
module x_sled_end_assembly2(explode=0, arrows=false)
{
up(groove_height/2+rail_offset) {
zrot(90) yrot(180) sled();
left(platform_length/2+explode*2) {
zrot(-90) xy_joiner();
}
}
// Construction arrows.
if(arrows && explode>20) {
left(platform_length/2+explode*0.75) {
zrot(180) arrow(size=explode/3);
}
}
}
//!x_sled_end_assembly2(explode=100, arrows=true);
module x_sled_assembly(explode=0, arrows=false)
{
platform_vert_off = groove_height/2+rail_offset;
up(platform_vert_off) {
xspread(platform_length+explode) {
zrot(90) yrot(180) sled();
}
zrot_copies([0,180]) {
right(platform_length+explode*1.5) {
zrot(90) xy_joiner();
}
}
right((platform_length/2+explode/2)) {
x_sled_end_assembly();
}
left((platform_length/2+explode/2)) {
x_sled_end_assembly2();
}
up(groove_height/2+rail_offset) {
children();
}
// Construction arrows.
if(arrows && explode>20) {
zring(r=platform_length+explode*3/4) {
zring(r=explode/6) {
arrow(size=explode/3);
}
}
@@ -68,64 +103,239 @@ module x_sled_assembly(explode=0, arrows=false)
//!x_sled_assembly(explode=100, arrows=true);
module y_sled_endcap_assembly(explode=0, arrows=false)
{
sled_endcap();
fwd(20-joiner_width/2) {
right(platform_width/2+explode*1.5) {
zrot(90) platform_support2();
}
left(platform_width/2+explode*1.5) {
zrot(-90) platform_support1();
}
}
// Construction arrows.
fwd(20-joiner_width/2) {
zring(r=(platform_width+explode*1.5)/2) {
arrow(size=explode/3);
}
}
}
//!y_sled_endcap_assembly(explode=100, arrows=true);
module y_sled_end_assembly(explode=0, arrows=false)
{
up(groove_height/2+rail_offset) {
yrot(180) sled();
fwd(platform_length/2+explode) {
y_sled_endcap_assembly();
}
}
// Construction arrows.
if(arrows && explode>20) {
fwd(platform_length/2+explode*0.5) {
zrot(-90) arrow(size=explode/3);
}
}
}
//!y_sled_end_assembly(explode=100, arrows=true);
module y_sled_end_assembly2(explode=0, arrows=false)
{
up(groove_height/2+rail_offset) {
yrot(180) sled();
back(platform_length/2+explode) {
zrot(180) y_sled_endcap_assembly();
}
}
// Construction arrows.
if(arrows && explode>20) {
back(platform_length/2+explode*0.5) {
zrot(90) arrow(size=explode/3);
}
}
}
//!y_sled_end_assembly2(explode=100, arrows=true);
module y_sled_assembly(explode=0, arrows=false)
{
platform_vert_off = groove_height/2+rail_offset;
up(platform_vert_off) {
yspread(platform_length+explode) {
yrot(180) sled();
}
zrot_copies([0,180]) {
fwd(platform_length+explode*1.5) {
sled_endcap();
fwd(20-joiner_width/2) {
right(platform_width/2+explode*1.5) {
zrot(90) platform_support2();
}
left(platform_width/2+explode*1.5) {
zrot(-90) platform_support1();
}
}
}
}
fwd((platform_length/2+explode/2)) {
y_sled_end_assembly();
}
back((platform_length/2+explode/2)) {
y_sled_end_assembly2();
}
up(groove_height/2+rail_offset) {
children();
}
// Construction arrows.
if(arrows && explode>10) {
zrot(90) zring(r=platform_length+explode) {
if(arrows && explode>20) {
zrot(-90) zring(r=explode/6) {
arrow(size=explode/3);
}
yspread(platform_length*2+3*explode+20-joiner_width/2) {
zring(r=(platform_width+explode*1.5)/2) {
arrow(size=explode/3);
}
}
}
}
//!y_sled_assembly(explode=100, arrows=true);
module z_sled_assembly(explode=0, arrows=false)
module z_sled_top_end_assembly(explode=0, arrows=false)
{
platform_vert_off = groove_height/2+rail_offset;
back(platform_vert_off) {
zspread(platform_length+explode) {
xrot(90) sled();
}
up(platform_length) {
z_joiner() {
right(groove_height/2+rail_offset) {
zrot(-90) xrot(90) sled();
up(platform_length/2+2*explode) {
zrot(-90) z_joiner() {
children();
}
}
down(platform_length) {
xrot(-90) zrot(180) sled_endcap();
}
// Construction arrows.
if(arrows && explode>20) {
up(platform_length/2+explode*0.5) {
yrot(-90) arrow(size=explode/3);
}
}
}
//!z_sled_top_end_assembly(explode=100, arrows=true);
module z_sled_bottom_end_assembly(explode=0, arrows=false)
{
right(groove_height/2+rail_offset) {
zrot(-90) xrot(90) sled();
down(platform_length/2+explode) {
yrot(90) zrot(90) sled_endcap();
}
}
// Construction arrows.
if(arrows && explode>20) {
down(platform_length/2+explode*0.5) {
yrot(90) arrow(size=explode/3);
}
}
}
//!z_sled_bottom_end_assembly(explode=100, arrows=true);
module z_sled_assembly(explode=0, arrows=false)
{
up((platform_length/2+explode/2)) {
z_sled_top_end_assembly() {
children();
}
}
down((platform_length/2+explode/2)) {
z_sled_bottom_end_assembly();
}
// Construction arrows.
if(arrows && explode>20) {
zrot(-90) xring() {
down(explode/6) {
yrot(90) arrow(size=explode/3);
}
}
}
}
//!z_sled_assembly(explode=0, arrows=true);
module motor_assembly(explode=0, arrows=false)
{
nema17_stepper(h=motor_length, shaft_len=motor_shaft_length);
up(gear_base+rack_height/2+2.1+explode) {
drive_gear();
}
// Construction arrow.
if(arrows && explode>10) {
up(explode*0.6) {
yrot(-90) arrow(size=explode/3);
}
}
}
//!motor_assembly(explode=100, arrows=true);
module microswitch()
{
color([0.3, 0.3, 0.3]) {
difference() {
cube([endstop_thick, endstop_length, endstop_depth], center=true);
xrot(-5) {
up(endstop_depth) {
cube([endstop_thick+1, endstop_length, endstop_depth], center=true);
}
}
down(endstop_hole_inset/2-endstop_click_voff/2) {
yspread(endstop_hole_spacing) {
yrot(90) cylinder(h=endstop_thick+1, d=endstop_screw_size, center=true, $fn=12);
}
}
}
}
up(endstop_depth/2) {
color([0.3, 0.3, 0.3]) {
yrot(90) cylinder(h=endstop_thick*0.75, d=1, center=true, $fn=12);
}
color("silver") {
fwd(endstop_length*0.9/2) xrot(5) back(endstop_length*0.9/2) {
cube([endstop_thick, endstop_length*0.9, 0.1], center=true);
back(endstop_length*0.9/2+1) {
top_half() {
yrot(90) {
difference() {
cylinder(h=endstop_thick, r=1, center=true, $fn=12);
cylinder(h=endstop_thick+1, r=0.8, center=true, $fn=12);
}
}
}
}
}
grid_of(ya=[-endstop_length/2+2, -endstop_length/8, endstop_length/2-2]) {
down(endstop_depth+5/2) {
cube([endstop_thick*0.5, 0.2, 5], center=true);
}
}
}
}
}
//!microswitch();
module motor_mount_assembly(explode=0, arrows=false)
{
motor_mount_plate();
up(motor_length/2+2-endstop_depth/2) {
fwd(endstop_hole_hoff) {
right((motor_mount_spacing+joiner_width)/2+endstop_standoff+endstop_thick/2+explode) {
microswitch();
}
}
}
// Construction arrow.
if(arrows && explode>10) {
up(motor_length/2+2-endstop_depth/2) {
fwd(endstop_hole_hoff) {
right((motor_mount_spacing+joiner_width)/2+endstop_standoff+endstop_thick/2+explode/2) {
xrot(-90) arrow(size=explode/3);
}
}
}
}
}
//!motor_mount_assembly(explode=100, arrows=true);
module motor_segment_assembly(explode=0, arrows=false)
{
motor_width = nema_motor_width(17)+printer_slop*2;
@@ -134,12 +344,11 @@ module motor_segment_assembly(explode=0, arrows=false)
// Stepper Motor
up(motor_top_z) {
up(explode*2-motor_length/2) motor_mount_plate();
up(explode) {
nema17_stepper(h=motor_length, shaft_len=motor_shaft_length);
up(gear_base+rack_height/2+2.1+explode*2) {
drive_gear();
}
up(explode*2.2-motor_length/2) {
motor_mount_assembly();
}
up(explode*1.1) {
motor_assembly();
}
}
@@ -147,11 +356,8 @@ module motor_segment_assembly(explode=0, arrows=false)
if(arrows && explode>10) {
up(rail_height+groove_height+explode/8) {
yrot(-90) arrow(size=explode/3);
up(motor_length+explode*7/8) {
up(motor_length+explode) {
yrot(-90) arrow(size=explode/3);
up(5+explode) {
yrot(-90) arrow(size=explode/3);
}
}
}
}
@@ -240,29 +446,30 @@ module y_axis_slider_assembly(slidepos=0, hide_endcaps=false, explode=0, arrows=
module z_tower_assembly(slidepos=0, hide_endcaps=false, explode=0, arrows=false)
{
left(platform_length)
zrot(-90) {
yz_joiner();
fwd(6+explode) {
left(platform_length) {
zrot(-90) yz_joiner();
left(6+explode) {
if ($children > 2) children(2);
}
back(platform_length/3) {
zring(r=rail_width/2+14+explode) {
zrot(-90) support_leg();
right(platform_length/3) {
zrot_copies([0,180]) {
back(rail_width/2+14+explode) {
zrot(0) support_leg();
}
}
}
up(rail_height+groove_height+rail_length/2+explode) {
xrot(-90) zrot(180) rail_segment();
yrot(90) zrot(90) rail_segment();
up(motor_rail_length/2+rail_length/2+explode*1.5) {
xrot(-90) motor_segment_assembly(slidepos=slidepos);
up(motor_rail_length/2+rail_length/2+explode*1) {
yrot(90) zrot(90) motor_segment_assembly(slidepos=slidepos);
up(slidepos) {
back(rail_height+groove_height/2) {
right(rail_height+groove_height/2) {
if ($children > 0) children(0);
}
}
up(motor_rail_length/2+rail_length/2+explode*1.5) {
xrot(-90) rail_segment();
up(motor_rail_length/2+rail_length/2+explode*1) {
yrot(90) zrot(-90) rail_segment();
up(rail_length/2+explode*1.5) {
if (hide_endcaps == false) {
if ($children > 1) children(1);
@@ -275,20 +482,17 @@ module z_tower_assembly(slidepos=0, hide_endcaps=false, explode=0, arrows=false)
// Construction arrows.
if (arrows && explode>10) {
back(rail_height/2+groove_height/2) {
up(rail_height+groove_height+explode/2) {
up(rail_height+groove_height+explode*0.55) {
yrot(-90) arrow(size=explode/3);
up(motor_rail_length+explode) {
up(motor_rail_length+explode*1.5) {
yrot(-90) arrow(size=explode/3);
up(rail_length+explode) {
up(rail_length+explode*0.5) {
yrot(-90) arrow(size=explode/3);
up(rail_length+explode) {
yrot(-90) arrow(size=explode/3);
}
}
}
}
up(rail_height/2+groove_height/2) {
zring(r=rail_width/2+explode/2) {
zring(r=rail_width/2+explode*0.55) {
arrow(size=explode/3);
}
}
@@ -296,7 +500,8 @@ module z_tower_assembly(slidepos=0, hide_endcaps=false, explode=0, arrows=false)
}
}
}
//!z_tower_assembly(slidepos=25.4/8/4, explode=0, arrows=true);
//!z_tower_assembly(slidepos=0, explode=0, arrows=true) z_sled_assembly();
//!z_tower_assembly(explode=100, arrows=true);
module extruder_assembly(explode=0, arrows=false)
@@ -323,13 +528,13 @@ module extruder_assembly(explode=0, arrows=false)
zrot(90) {
up(explode*3) {
extruder_idler();
up(0.1) fwd(0.1) extruder_latch();
up(0.1) fwd(0.1+explode) extruder_latch();
back(extruder_idler_diam/2) {
fwd(explode)
fwd(explode/2)
idler_bearing();
left(extruder_shaft_len/2/2+1+explode)
left(extruder_shaft_len/2/2+1+explode/2)
yrot(90) extruder_idler_axle();
right(extruder_shaft_len/2/2+1+explode)
right(extruder_shaft_len/2/2+1+explode/2)
yrot(-90) extruder_idler_axle_cap();
}
}
@@ -352,7 +557,7 @@ module extruder_assembly(explode=0, arrows=false)
}
}
}
//!extruder_assembly(explode=0);
//!extruder_assembly(explode=100, arrows=true);
module extruder_bridge_assembly(explode=0, arrows=false)
@@ -389,13 +594,11 @@ module extruder_bridge_assembly(explode=0, arrows=false)
module spool_holder_assembly(explode=0, arrows=false)
{
back(rail_height/2) {
zrot(90) {
spool_holder();
up(spool_holder_length-15/2*cos(30)+0.25+explode) {
spool_axle();
down(52.5/2-14) spool();
}
right(rail_height/2) {
spool_holder();
up(spool_holder_length-15/2*cos(30)+0.25+explode) {
spool_axle();
down(52.5/2-14) spool();
}
}
}
@@ -424,8 +627,8 @@ module full_assembly(hide_endcaps=false, explode=0, arrows=false)
z_sled_assembly(explode=explode, arrows=arrows) {
extruder_bridge_assembly(explode=explode, arrows=arrows);
}
xrot(-90) rail_endcap();
ramps_mount();
zrot(-90) xrot(-90) rail_endcap();
zrot(-90) ramps_mount();
}
zrot(180) z_tower_assembly(slidepos=zpos, hide_endcaps=hide_endcaps, explode=explode, arrows=arrows) {
z_sled_assembly(explode=explode, arrows=arrows);

View File

@@ -4,107 +4,118 @@ use <joiners.scad>
use <NEMA.scad>
module rail_motor_segment()
// connectby valid options: "", "fwd", "back"
module rail_motor_segment(explode=0, connectby="")
{
joiner_length = 10;
side_joiner_len = 10;
fillet = 1.5;
motor_width = nema_motor_width(17);
color("SpringGreen")
prerender(convexity=20)
union() {
difference() {
union() {
// Bottom.
up(rail_thick/2) {
difference() {
union() {
yrot(90)
sparse_strut(h=rail_width, l=motor_rail_length, thick=rail_thick, maxang=45, strut=10, max_bridge=500);
up((motor_top_z-motor_length+6-rail_thick)/2) {
cube(size=[motor_mount_spacing+joiner_width, 30+20, motor_top_z-motor_length+6], center=true);
}
}
cube(size=[motor_mount_spacing-joiner_width, 20, motor_length], center=true);
// Clearance for NEMA17 stepper motor
up(motor_top_z-rail_thick/2) {
down(motor_length/2) {
cube(size=[motor_width, motor_width, motor_length], center=true);
cube(size=[20, motor_rail_length/2+10, motor_length], center=true);
}
}
}
}
// Walls.
zring(r=0,n=2) {
up((rail_height+3)/2) {
right((rail_spacing+joiner_width)/2) {
if (wall_style == "crossbeams")
sparse_strut(h=rail_height+3, l=motor_rail_length-2*joiner_length, thick=joiner_width, strut=5);
if (wall_style == "thinwall")
thinning_wall(h=rail_height+3, l=motor_rail_length-2*joiner_length, thick=joiner_width, strut=5, bracing=false);
if (wall_style == "corrugated")
corrugated_wall(h=rail_height+3, l=motor_rail_length-2*joiner_length, thick=joiner_width, strut=5);
}
}
}
// Rail backing.
xspread(rail_spacing+joiner_width)
up(rail_height+groove_height/2-fillet)
rcube(size=[joiner_width, motor_rail_length, groove_height+fillet], r=fillet, center=true, $fn=18);
// Side Supports
up(rail_height/4) {
yspread(motor_rail_length-20) {
cube(size=[rail_width, 5, rail_height/2], center=true);
}
}
// Motor mount joiners.
up(motor_top_z-motor_length/2) {
xrot(90) joiner_pair(spacing=motor_mount_spacing, h=rail_height, w=joiner_width, l=motor_top_z-motor_length/2, a=joiner_angle);
}
}
// Rail grooves.
up(rail_height+groove_height/2) {
xflip_copy() {
left((rail_width-joiner_width)/2) {
xflip_copy() {
right(joiner_width/2) {
// main groove
scale([tan(groove_angle),1,1]) yrot(45) {
cube(size=[groove_height*sqrt(2)/2,motor_rail_length+1,groove_height*sqrt(2)/2], center=true);
up(
(connectby=="fwd")? -rail_height/2 :
(connectby=="back")? -rail_height/2 :
0
) back(
(connectby=="back")? -motor_rail_length/2 :
(connectby=="fwd")? motor_rail_length/2 :
0
) {
color("SpringGreen")
prerender(convexity=20)
union() {
difference() {
union() {
// Bottom.
up(rail_thick/2) {
difference() {
union() {
yrot(90)
sparse_strut(h=rail_width, l=motor_rail_length, thick=rail_thick, maxang=45, strut=10, max_bridge=500);
up((motor_top_z-motor_length+6-rail_thick)/2) {
cube(size=[motor_mount_spacing+joiner_width, 30+20, motor_top_z-motor_length+6], center=true);
}
}
cube(size=[motor_mount_spacing-joiner_width, 20, motor_length], center=true);
// fillets
facelen = groove_height/2/sin(90-groove_angle);
yflip_copy() {
fwd(motor_rail_length/2) {
left(facelen*sin(groove_angle)) {
difference() {
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen*1.5/2) {
cube([fillet*2, fillet*2, facelen*1.5], center=true);
// Clearance for NEMA17 stepper motor
up(motor_top_z-rail_thick/2) {
down(motor_length/2) {
cube(size=[motor_width, motor_width, motor_length], center=true);
cube(size=[20, motor_rail_length/2+10, motor_length], center=true);
}
}
}
}
// Walls.
zring(r=0,n=2) {
up((rail_height+3)/2) {
right((rail_spacing+joiner_width)/2) {
if (wall_style == "crossbeams")
sparse_strut(h=rail_height+3, l=motor_rail_length-2*joiner_length, thick=joiner_width, strut=5);
if (wall_style == "thinwall")
thinning_wall(h=rail_height+3, l=motor_rail_length-2*joiner_length, thick=joiner_width, strut=5, bracing=false);
if (wall_style == "corrugated")
corrugated_wall(h=rail_height+3, l=motor_rail_length-2*joiner_length, thick=joiner_width, strut=5);
}
}
}
// Rail backing.
xspread(rail_spacing+joiner_width)
up(rail_height+groove_height/2-fillet)
rcube(size=[joiner_width, motor_rail_length, groove_height+fillet], r=fillet, center=true, $fn=18);
// Side Supports
up(rail_height/4) {
yspread(motor_rail_length-20) {
cube(size=[rail_width, 5, rail_height/2], center=true);
}
}
// Motor mount joiners.
up(motor_top_z-motor_length/2) {
xrot(90) joiner_pair(spacing=motor_mount_spacing, h=rail_height, w=joiner_width, l=motor_top_z-motor_length/2, a=joiner_angle);
}
}
// Rail grooves.
up(rail_height+groove_height/2) {
xflip_copy() {
left((rail_width-joiner_width)/2) {
xflip_copy() {
right(joiner_width/2) {
// main groove
scale([tan(groove_angle),1,1]) yrot(45) {
cube(size=[groove_height*sqrt(2)/2,motor_rail_length+1,groove_height*sqrt(2)/2], center=true);
}
// fillets
facelen = groove_height/2/sin(90-groove_angle);
yflip_copy() {
fwd(motor_rail_length/2) {
left(facelen*sin(groove_angle)) {
difference() {
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen*1.5/2) {
cube([fillet*2, fillet*2, facelen*1.5], center=true);
}
}
}
}
}
}
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen) {
back(fillet) left(fillet) {
cylinder(r=fillet, h=facelen*3, center=true, $fn=12);
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen) {
back(fillet) left(fillet) {
cylinder(r=fillet, h=facelen*3, center=true, $fn=12);
}
}
}
}
@@ -119,40 +130,51 @@ module rail_motor_segment()
}
}
}
}
// Wiring access holes.
up(rail_height/4) {
xspread(rail_width/3, n=3) {
yspread(motor_rail_length-20) {
cube(size=[16, 11, 11], center=true);
// Wiring access holes.
up(rail_height/4) {
xspread(rail_width/3, n=3) {
yspread(motor_rail_length-20) {
cube(size=[16, 11, 11], center=true);
}
}
}
// access for stepper wires.
up(15/2) {
cube(size=[motor_mount_spacing+joiner_width+1, 20, 15+0.05], center=true);
}
// Clear space for joiners.
up(rail_height/2) {
joiner_quad_clear(xspacing=rail_spacing+joiner_width, yspacing=motor_rail_length, h=rail_height, w=joiner_width, clearance=5, a=joiner_angle);
}
// Side wiring access hole
up(10/2+rail_thick) {
xspread(rail_width-joiner_width) {
yspread(motor_rail_length-2*30) {
cube(size=[joiner_width+1, 16, 10], center=true);
}
}
}
}
// access for stepper wires.
up(15/2) {
cube(size=[motor_mount_spacing+joiner_width+1, 20, 15+0.05], center=true);
}
// Clear space for joiners.
// Snap-tab joiners.
up(rail_height/2) {
joiner_quad_clear(xspacing=rail_spacing+joiner_width, yspacing=motor_rail_length, h=rail_height, w=joiner_width, clearance=5, a=joiner_angle);
}
// Side wiring access hole
up(10/2+rail_thick) {
xspread(rail_width-joiner_width) {
yspread(motor_rail_length-2*30) {
cube(size=[joiner_width+1, 16, 10], center=true);
}
}
joiner_quad(xspacing=rail_spacing+joiner_width, yspacing=motor_rail_length, h=rail_height, w=joiner_width, l=13, a=joiner_angle);
}
}
// Snap-tab joiners.
up(motor_top_z-motor_length/2+explode) {
if ($children > 0) children(0);
}
up(rail_height/2) {
joiner_quad(xspacing=rail_spacing+joiner_width, yspacing=motor_rail_length, h=rail_height, w=joiner_width, l=13, a=joiner_angle);
fwd(motor_rail_length/2+explode) {
if ($children > 1) children(1);
}
back(motor_rail_length/2+explode) {
if ($children > 2) children(2);
}
}
}
}

View File

@@ -3,87 +3,98 @@ use <GDMUtils.scad>
use <joiners.scad>
module rail_segment()
// connectby valid options: "", "fwd", "back"
module rail_segment(explode=0, connectby="")
{
fillet = 1;
side_joiner_len = 2;
color([0.9, 0.7, 1.0])
prerender(convexity=20)
union() {
difference() {
union() {
// Bottom.
up(rail_thick/2) yrot(90)
sparse_strut(h=rail_width, l=rail_length, thick=rail_thick, maxang=45, strut=10, max_bridge=500);
up(
(connectby=="fwd")? -rail_height/2 :
(connectby=="back")? -rail_height/2 :
0
) back(
(connectby=="back")? -rail_length/2 :
(connectby=="fwd")? rail_length/2 :
0
) {
color([0.9, 0.7, 1.0])
prerender(convexity=20)
union() {
difference() {
union() {
// Bottom.
up(rail_thick/2) yrot(90)
sparse_strut(h=rail_width, l=rail_length, thick=rail_thick, maxang=45, strut=10, max_bridge=500);
// Walls.
zrot_copies([0, 180]) {
up((rail_height+3)/2) {
right((rail_spacing+joiner_width)/2) {
if (wall_style == "crossbeams")
sparse_strut(h=rail_height+3, l=rail_length-10, thick=joiner_width, strut=5);
if (wall_style == "thinwall")
thinning_wall(h=rail_height+3, l=rail_length-10, thick=joiner_width, strut=5, bracing=false);
if (wall_style == "corrugated")
corrugated_wall(h=rail_height+3, l=rail_length-10, thick=joiner_width, strut=5);
// Walls.
zrot_copies([0, 180]) {
up((rail_height+3)/2) {
right((rail_spacing+joiner_width)/2) {
if (wall_style == "crossbeams")
sparse_strut(h=rail_height+3, l=rail_length-10, thick=joiner_width, strut=5);
if (wall_style == "thinwall")
thinning_wall(h=rail_height+3, l=rail_length-10, thick=joiner_width, strut=5, bracing=false);
if (wall_style == "corrugated")
corrugated_wall(h=rail_height+3, l=rail_length-10, thick=joiner_width, strut=5);
}
}
}
}
// Rail backing.
xspread(rail_spacing+joiner_width)
up(rail_height+groove_height/2-fillet)
rcube(size=[joiner_width, rail_length, groove_height+fillet], r=fillet, center=true, $fn=12);
// Rail backing.
xspread(rail_spacing+joiner_width)
up(rail_height+groove_height/2-fillet)
rcube(size=[joiner_width, rail_length, groove_height+fillet], r=fillet, center=true, $fn=12);
// Side Supports
up(rail_height/4) {
yspread(rail_length-2*5-5) {
difference() {
cube(size=[rail_width-joiner_width, 4, rail_height/2], center=true);
xspread(rail_width/3, n=3) {
cube(size=[16, 11, 12], center=true);
// Side Supports
up(rail_height/4) {
yspread(rail_length-2*5-5) {
difference() {
cube(size=[rail_width-joiner_width, 4, rail_height/2], center=true);
xspread(rail_width/3, n=3) {
cube(size=[16, 11, 12], center=true);
}
}
}
}
}
}
// Rail grooves.
up(rail_height+groove_height/2) {
xflip_copy() {
left((rail_width-joiner_width)/2) {
xflip_copy() {
right(joiner_width/2) {
// main groove
scale([tan(groove_angle),1,1]) yrot(45) {
cube(size=[groove_height*sqrt(2)/2,rail_length+1,groove_height*sqrt(2)/2], center=true);
}
// Rail grooves.
up(rail_height+groove_height/2) {
xflip_copy() {
left((rail_width-joiner_width)/2) {
xflip_copy() {
right(joiner_width/2) {
// main groove
scale([tan(groove_angle),1,1]) yrot(45) {
cube(size=[groove_height*sqrt(2)/2,rail_length+1,groove_height*sqrt(2)/2], center=true);
}
// fillets
facelen = groove_height/2/sin(90-groove_angle);
yflip_copy() {
fwd(rail_length/2) {
left(facelen*sin(groove_angle)) {
difference() {
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen*1.5/2) {
cube([fillet*2, fillet*2, facelen*1.5], center=true);
// fillets
facelen = groove_height/2/sin(90-groove_angle);
yflip_copy() {
fwd(rail_length/2) {
left(facelen*sin(groove_angle)) {
difference() {
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen*1.5/2) {
cube([fillet*2, fillet*2, facelen*1.5], center=true);
}
}
}
}
}
}
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen) {
back(fillet) left(fillet) {
cylinder(r=fillet, h=facelen*3, center=true, $fn=12);
zflip_copy() {
left(fillet) {
yrot(-groove_angle) {
right(fillet) {
down(facelen) {
back(fillet) left(fillet) {
cylinder(r=fillet, h=facelen*3, center=true, $fn=12);
}
}
}
}
@@ -98,57 +109,75 @@ module rail_segment()
}
}
}
}
// Clear space for joiners.
up(rail_height/2) {
joiner_quad_clear(xspacing=rail_spacing+joiner_width, yspacing=rail_length-0.05, h=rail_height, w=joiner_width, clearance=5, a=joiner_angle);
}
// Clear space for joiners.
up(rail_height/2) {
joiner_quad_clear(xspacing=rail_spacing+joiner_width, yspacing=rail_length-0.05, h=rail_height, w=joiner_width, clearance=5, a=joiner_angle);
}
// Side half joiners
up(rail_height/2/2) {
back(rail_length/2-10) {
zring(r=rail_spacing/2+joiner_width+side_joiner_len-0.05, n=2) {
zrot(-90) {
chamfer(chamfer=3, size=[joiner_width, 2*(side_joiner_len+joiner_width/2), rail_height/2], edges=[[0,0,0,0], [1,1,0,0], [0,0,0,0]]) {
half_joiner_clear(h=rail_height/2, w=joiner_width, a=joiner_angle);
}
}
}
}
}
// Shrinkage stress relief
up(rail_thick/2) {
yspread(17.5, n=7) {
cube(size=[rail_width+1, 1, rail_thick-2], center=true);
}
xspread(22, n=5) {
yspread(rail_length-10) {
cube(size=[1, 17.5*2, rail_thick-2], center=true);
}
}
}
}
// Side half joiners
up(rail_height/2/2) {
back(rail_length/2-10) {
zring(r=rail_spacing/2+joiner_width+side_joiner_len-0.05, n=2) {
zring(r=rail_spacing/2+joiner_width+side_joiner_len, n=2) {
zrot(-90) {
chamfer(chamfer=3, size=[joiner_width, 2*(side_joiner_len+joiner_width/2), rail_height/2], edges=[[0,0,0,0], [1,1,0,0], [0,0,0,0]]) {
half_joiner_clear(h=rail_height/2, w=joiner_width, a=joiner_angle);
half_joiner2(h=rail_height/2, w=joiner_width, l=side_joiner_len+joiner_width/2, a=joiner_angle);
}
}
}
}
}
// Shrinkage stress relief
up(rail_thick/2) {
yspread(17.5, n=7) {
cube(size=[rail_width+1, 1, rail_thick-2], center=true);
}
xspread(22, n=5) {
yspread(rail_length-10) {
cube(size=[1, 17.5*2, rail_thick-2], center=true);
}
}
// Snap-tab joiners.
up(rail_height/2) {
joiner_quad(xspacing=rail_spacing+joiner_width, yspacing=rail_length, h=rail_height, w=joiner_width, l=6, a=joiner_angle);
}
}
up(rail_height/2) {
fwd(rail_length/2+explode) {
if ($children > 0) children(0);
}
back(rail_length/2+explode) {
if ($children > 1) children(1);
}
}
// Side half joiners
up(rail_height/2/2) {
back(rail_length/2-10) {
zring(r=rail_spacing/2+joiner_width+side_joiner_len, n=2) {
zrot(-90) {
chamfer(chamfer=3, size=[joiner_width, 2*(side_joiner_len+joiner_width/2), rail_height/2], edges=[[0,0,0,0], [1,1,0,0], [0,0,0,0]]) {
half_joiner2(h=rail_height/2, w=joiner_width, l=side_joiner_len+joiner_width/2, a=joiner_angle);
}
}
left(rail_spacing/2+joiner_width+side_joiner_len) {
if ($children > 2) children(2);
}
right(rail_spacing/2+joiner_width+side_joiner_len) {
if ($children > 3) children(3);
}
}
}
// Snap-tab joiners.
up(rail_height/2) {
joiner_quad(xspacing=rail_spacing+joiner_width, yspacing=rail_length, h=rail_height, w=joiner_width, l=6, a=joiner_angle);
}
}
}
//!rail_segment();