chiark / gitweb /
pattress-boxes-3-cover: Sort out toplevels
[reprap-play.git] / pattress-boxes-3-cover.scad
index 9e3ab2dc03b29429212a1ff00e4df2321b9e96de..5b8dc780e57e42d583c4f86c8efc1d48302690b0 100644 (file)
@@ -16,6 +16,8 @@ lid_switches_y_slop = 3;
 total_len = 260;
 thinbox_len = 87;
 
+rail_overlap = 8;
+
 lid_top_wall = 1.5;
 lid_front_wall = 1.5;
 lid_side_wall = 1.5;
@@ -59,6 +61,8 @@ echo(peg_main_height);
 
 thinbox_front_z = lid_fatbox_switches_h + lid_fatbox_h - lid_thinbox_h;
 
+raillen = patbox_side/2 + rail_overlap;
+
 module LidSideProfile(){
   polygon([[-lid_top_wall,     lid_inner_max_h],
           [lid_inner_kink[0], lid_inner_max_h],
@@ -68,15 +72,15 @@ module LidSideProfile(){
           [-lid_top_wall,     -lid_front_wall]]);
 }
 
-module RailProfile(){
+module RailProfile(lslop=0.1){
   yt_base = thinbox_front_z;
   yt = yt_base - lid_rail_behindslop;
   pegx = (lid_inner_w_nom - patbox_centres)/2;
   
-  polygon([[-0.1,                  yt],
+  polygon([[-lslop,                  yt],
           [pegx - peg_main_dia/2, yt],
           [pegx - peg_main_dia/2, yt_base - peg_straight_len],
-          [-0.1,
+          [-lslop,
            yt_base - peg_straight_len - (pegx - peg_main_dia/2)/peg_slope
           -0.1]]);
 }
@@ -104,8 +108,23 @@ module LidSide(){
   // rail
   rotate([90,0,90])
     translate([0,0,-0.1])
-    linear_extrude(height=100.1) //todo
+    linear_extrude(height=raillen+0.1) //todo
     RailProfile();
+
+  // rail end
+  translate([raillen, 0,0])
+    intersection(){
+      rotate_extrude($fn=50)
+       RailProfile(lslop=0);
+      translate([0, 25-0.1, 0])
+       cube(50, center=true);
+    }
+}
+
+module Lid(){ ////toplevel
+  for (m=[0,1])
+    mirror([0,m,0])
+      translate([0, -lid_inner_w/2, 0]) LidSide();
 }
 
 module PegProfile(){
@@ -119,7 +138,7 @@ module PegProfile(){
           [-peg_engage_depth,  (peg_inner_dia + peg_inner_slop)/2]]);
 }
 
-module Peg(){
+module Peg(){ ////toplevel
   rotate_extrude($fn=50)
     rotate([0,0,-90])
     PegProfile();
@@ -145,7 +164,7 @@ module TopPattressBox(){
 }
 
 module Demo(){
-  translate([0, -lid_inner_w/2, 0]) LidSide();
+  Lid();
   translate([0,0, thinbox_front_z])
     rotate([0,180,0]) translate([0, -patbox_side/2, 0])
     rotate([0,0,90]) union(){
@@ -161,4 +180,5 @@ module Demo(){
 //Peg();
 //TopPattressBox();
 //RailProfile();
-Demo();
+//Demo();
+//Lid();