// Zebra version of brio-tunnel-block.scad: the block is cut into 8 bands of 5mm // across its 40mm depth (the dimension that is 40mm tall when the block lies on // its side) and the bands alternate black/white, so the stripes run over the arch. // Geometry, chamfering and rounding are identical to brio-tunnel-block.scad; only // the coloring/slicing is added. // Colors show in the preview (F5) and in a 3MF export; a plain STL export drops them. /* https://github.com/BelfrySCAD/BOSL2 */ include cube_h = 80; cube_w = 80; cube_d = 40; rounding = 2; oval_cutout_h = 15; rect_cutout_w = 45; rect_cutout_h = 65-oval_cutout_h; // Zebra striping: stripe_n bands of 5mm across the 40mm depth (cube_d), // alternating between the two stripe colors. stripe_n = 8; stripe_w = cube_d / stripe_n; // 5mm stripe_colors = ["black", "white"]; $fn=150; // The tunnel block, exactly as in brio-tunnel-block.scad // (all chamfering and rounding unchanged). module tunnelblock() { difference() { cuboid([cube_w,cube_d,cube_h], rounding=rounding, anchor=[0,0,-1]); group() { rotate([90,0,0]) difference() { cuboid([rect_cutout_w,rect_cutout_h,cube_d], chamfer=-rounding, anchor=[0,-1,0]); translate([0,rect_cutout_h,0]) cuboid([2*rect_cutout_w,rect_cutout_h,cube_d], anchor=[0,-1,0]); } translate([0,0,rect_cutout_h]) resize([0,0,2*oval_cutout_h]) rotate([90,0,0]) cyl(h=cube_d, d=rect_cutout_w, chamfer=-rounding); } } } // Everything of the block that is *not* between y=y0 and y=y1, as a single // solid. Cutting the block with one difference() of this union (instead of an // intersection() with a slab) is what keeps the rounded/chamfered edges at // y=+/-cube_d/2 intact. module outside(y0, y1) { big = 2 * cube_h; // bigger than the block in every direction union() { translate([0, (y0-big)/2, cube_h/2]) cube([cube_w + 2*big, big + y0, cube_h + 2*big], center=true); translate([0, (y1+big)/2, cube_h/2]) cube([cube_w + 2*big, big - y1, cube_h + 2*big], center=true); } } // The block sliced into stripe_n bands along Y, each band colored alternately. module tunnelblock_striped() { for (i = [0 : stripe_n-1]) { y0 = -cube_d/2 + i*stripe_w; color(stripe_colors[i % len(stripe_colors)]) difference() { tunnelblock(); outside(y0, y0 + stripe_w); } } } tunnelblock_striped(); // To render the plain, unstriped block instead, use: tunnelblock();