From 700dc62f384a52e1b5f80c7710267a8268f3ca6d Mon Sep 17 00:00:00 2001 From: Dejvino Date: Fri, 25 Dec 2020 00:02:51 +0100 Subject: [PATCH] Extract holodisk frame --- holodisk.scad | 294 ++++++-------------------------------------- holodisk_frame.scad | 268 ++++++++++++++++++++++++++++++++++++++++ holodisk_spec.scad | 3 + tape.scad | 6 +- 4 files changed, 310 insertions(+), 261 deletions(-) create mode 100644 holodisk_frame.scad diff --git a/holodisk.scad b/holodisk.scad index 882f490..3cf62bf 100755 --- a/holodisk.scad +++ b/holodisk.scad @@ -11,265 +11,40 @@ use disk_size = get_holodisk_size(); holodisk_size = get_holodisk_size(); -wall=3; -plate=3; -top_rim=2; -bolt_headtype="hex"; -front_body_depth=12; -front_body_bolt_offset=8; -back_bumpers_radius=5; -back_bumpers_bolt_size=3; -tape_height=5; -tape_thickness=0.2; -spool_tape_tolerance=1; -spool_inner_height=tape_height+spool_tape_tolerance; -spool_inner_radius=4; -spool_outer_radius=18; -spool_plate_height=2; -spool_plate_holes=3; -spool_plate_hole_angle=360/spool_plate_holes * 0.5; -spool_plate_hole_inner_rim=1; -spool_plate_hole_outer_rim=4; -spool_slit_depth=0.8; -spool1_depth=disk_size.y*0.77; -spool2_depth=disk_size.y*0.40; -spool3_depth=(spool1_depth+spool2_depth)/2; -spool4_depth=disk_size.y*0.16; -main_spools_x=disk_size.x*0.45; -aux_spools_right_x=main_spools_x + spool_outer_radius + 1; -aux_spools_left_x=main_spools_x - 13; -middle_spool_in_r=2; -middle_spool_out_r=7; -aux_spool_plate_hole_inner_rim=2; -aux_spool_plate_hole_outer_rim=2; -spindle_diam=2; -spindle_diam_tolerance=0.2; -tape_z=plate+spool_plate_height; -module frame(size) { +use + +module holodisk_mechanism() { + size=get_holodisk_size(); width=size.x; depth=size.y; height=size.z; - tr=top_rim; - tc=tr*1.5; - fbd=front_body_depth; - bbr=back_bumpers_radius; - - walls_height=height-plate*2; - - module back_bumpers() { - module bumper() { back_half() circle(r=bbr); } - back(depth) { - right(bbr) bumper(); - right(width-bbr) bumper(); - } - } - - module bolt() { metric_bolt(size=back_bumpers_bolt_size, headtype=bolt_headtype, l=height, pitch=0); } - module nut() { metric_nut(size=back_bumpers_bolt_size, pitch=0); } - - module back_bolts() { - back(depth) { - right(bbr) { - up(height) bolt(); - nut(); - } - right(width-bbr) { - up(height) bolt(); - nut(); - } - } - } - - module front_bolts() { - bolt_offset=front_body_bolt_offset; - back(front_body_depth/2) { - right(bolt_offset) { - up(height) bolt(); - nut(); - } - right(width-bolt_offset) { - up(height) bolt(); - nut(); - } - } - } - - module top_cover() { - up(height-plate) linear_extrude(height=plate) { - back_bumpers(); - polygon(points=[ - // frame - [0, 0], [0, depth], - [width, depth], [width, 0], - // window - [tr, tr+fbd], [tr, depth-tr-tc], [tr+tc, depth-tr], - [width-tr-tc, depth-tr], [width-tr, depth-tr-tc], [width-tr, tr+fbd] - ], - paths=[ - [0,1,2,3], [4,5,6,7,8,9] - ]); - } - } - - module walls() { - difference() { - up(plate) linear_extrude(height=walls_height) { - //back_bumpers(); - shell2d(thickness=-wall) { - square([width, depth]); - } - } - translate(get_holodisk_laserwindow_pos_center()) cube(get_holodisk_laserwindow_size(), center=true); - } - } - - module front_plates() { - th = get_holodisk_front_plate_thickness(); - slide_pos = get_holodisk_slide_pos(); - offset=4.5; - plate_len_side=slide_pos.y - offset/2; - plate_len_left=plate_len_side/2; - plate_len_right=plate_len_side + 5; - // front - fwd(th) left(th) up(offset) { - cube([plate_len_left + th*2, th, height - offset*2]); - } - fwd(th) right(width-plate_len_right-th) up(offset) { - cube([plate_len_right + th*2, th, height - offset*2]); - } - // left - fwd(th) left(th) up(offset) { - cube([th, plate_len_side, height - offset*2]); - } - // right - fwd(th) right(width) up(offset) { - cube([th, plate_len_side, height - offset*2]); - } - } - - module slides() { - slide_size = get_holodisk_slide_size(); - slide_pos = get_holodisk_slide_pos(); - slide_plate_size = [0.1, slide_size.y, slide_size.z]; - sliding_size = get_holodisk_slide_sliding_size(); - sliding_pos = get_holodisk_slide_sliding_pos(); - - module slide() { - hull() { - translate(sliding_pos) cube(sliding_size); - translate(slide_pos) cube(slide_plate_size); - } - } - - module slider() { - slider_size = get_holodisk_slide_slider_size(); - slider_pos = get_holodisk_slide_slider_pos(); - slider_plate_size = [0.1, slider_size.y, slider_size.z]; - slider_top_size = [slider_size.x, slider_size.y, sliding_size.z]; - hull() { - up((slider_size.z-sliding_size.z)/2) translate(slider_pos) cube(slider_top_size); - translate(slider_pos) cube(slider_plate_size); - } - } - - right(get_holodisk_size().x) { - slide(); - slider(); - } - scale([-1,1,1]) { - slide(); - slider(); - } - - right(get_holodisk_laserwindow_pos_center().x) zrot(-90) { - scale([1, 0.7, 1]) { - slider(); - } - } - } - - module laserwindow_door() { - door_size = [ - get_holodisk_laserwindow_size().x, - 1, - get_holodisk_laserwindow_size().z - ]; - door_pos = [ - get_holodisk_laserwindow_pos_center().x, - get_holodisk_laserwindow_pos_center().y + door_size.y/2, - get_holodisk_laserwindow_pos_center().z - ]; - - translate(door_pos) scale(0.98) down(door_size.z/2) xrot(anim(1,2)*-90) xrot(anim(6,7)*90) up(door_size.z/2) cube(door_size, center=true); - } - - module bottom_cover() { - difference() { - linear_extrude(height=plate) { - back_bumpers(); - square([width, depth]); - } - down(0.1) translate(get_holodisk_laser_cutout_pos()) cube(get_holodisk_laser_cutout_size()); - } - } - - { - overlap=1; - rails_size = [ - get_holodisk_laserwindow_size().x * 2 + overlap*2, - 1, - walls_height - ]; - rail_size = [rails_size.x, rails_size.y, 2]; - rails_pos = [get_holodisk_laserwindow_pos().x - rails_size.x/2, - -rails_size.y, plate]; - rail1_pos = [rails_pos.x, rails_pos.y, rails_pos.z]; - rail2_pos = [rails_pos.x, rails_pos.y, rails_pos.z + rails_size.z - rail_size.z]; - - module laserwindow_slider_rails() { - translate(rail1_pos) cube(rail_size); - translate(rail2_pos) cube(rail_size); - } - - module laserwindow_slider_cover() { - cover_size=[ - get_holodisk_laserwindow_size().x, - get_holodisk_slide_slider_size().x, - get_holodisk_slide_slider_size().z - ]; - cover_plate=[cover_size.x, rail_size.y, cover_size.z]; - cover_top=[cover_size.x - overlap, cover_size.y, cover_size.z - overlap]; - /*cover_pos=[rails_pos.x+overlap, rails_pos.y + rails_size.y, rails_pos.z];*/ - cover_pos=[get_holodisk_laserwindow_pos().x, rails_pos.y + rails_size.y, rails_pos.z]; - left(anim(0,1)*get_holodisk_laserwindow_size().x) - right(anim(len(get_anim_keys())-2,len(get_anim_keys())-1)*get_holodisk_laserwindow_size().x) - translate(cover_pos) - hull() { - fwd(cover_plate.y) cube(cover_plate); - right(overlap/2) fwd(cover_top.y) up((cover_plate.z-cover_top.z)/2) cube(cover_top); - } - } - - color("red") laserwindow_slider_rails(); - color("red") laserwindow_slider_cover(); - } - - color("SaddleBrown") top_cover(); - color("grey") walls(); - color("gold") laserwindow_door(); - color("Silver") slides(); - color("SaddleBrown") bottom_cover(); - color("SaddleBrown") front_plates(); - //color("silver") back_bolts(); - //color("silver") front_bolts(); -} - -module mechanism(size) { - width=size.x; - depth=size.y; - height=size.z; + plate=get_holodisk_bottom_thickness(); + tape_height=get_holodisk_tape_height(); + tape_thickness=get_holodisk_tape_thickness(); + spool_tape_tolerance=1; + spool_inner_height=tape_height+spool_tape_tolerance; + spool_inner_radius=4; + spool_outer_radius=18; + spool_plate_height=2; + spool_plate_holes=3; + spool_plate_hole_inner_rim=1; + spool_plate_hole_outer_rim=4; + spool1_depth=disk_size.y*0.77; + spool2_depth=disk_size.y*0.40; + spool3_depth=(spool1_depth+spool2_depth)/2; + spool4_depth=disk_size.y*0.16; + main_spools_x=disk_size.x*0.45; + aux_spools_right_x=main_spools_x + spool_outer_radius + 1; + aux_spools_left_x=main_spools_x - 13; + middle_spool_in_r=2; + middle_spool_out_r=7; + aux_spool_plate_hole_inner_rim=2; + aux_spool_plate_hole_outer_rim=2; + spindle_diam=2; + spindle_diam_tolerance=0.2; + tape_z=plate+spool_plate_height; module main_spool() { spool(r_in=spool_inner_radius, @@ -327,12 +102,13 @@ module mechanism(size) { tapes(); } -module holodisk(size) { - frame(size); - mechanism(size); +module holodisk() { + holodisk_frame(); + holodisk_mechanism(); } -retraction=holodisk_size.y+10; +// test +retraction=get_holodisk_size().y+10; back((1-anim(1, 2)) * retraction) // anim insert back((anim(len(get_anim_keys())-2, len(get_anim_keys())-1)) * retraction) // anim remove -holodisk(holodisk_size); +holodisk(); diff --git a/holodisk_frame.scad b/holodisk_frame.scad new file mode 100644 index 0000000..6106308 --- /dev/null +++ b/holodisk_frame.scad @@ -0,0 +1,268 @@ +// dependency: https://github.com/revarbat/BOSL +use +//use +use + +use +use + +module holodisk_frame() { + size = get_holodisk_size(); + disk_size = get_holodisk_size(); + holodisk_size = get_holodisk_size(); + width=size.x; + depth=size.y; + height=size.z; + + wall=3; + plate=3; + top_rim=2; + bolt_headtype="hex"; + front_body_depth=12; + front_body_bolt_offset=8; + back_bumpers_radius=5; + back_bumpers_bolt_size=3; + tape_height=5; + tape_thickness=0.2; + spool_tape_tolerance=1; + spool_inner_height=tape_height+spool_tape_tolerance; + spool_inner_radius=4; + spool_outer_radius=18; + spool_plate_height=2; + spool_plate_holes=3; + spool_plate_hole_angle=360/spool_plate_holes * 0.5; + spool_plate_hole_inner_rim=1; + spool_plate_hole_outer_rim=4; + spool_slit_depth=0.8; + spool1_depth=disk_size.y*0.77; + spool2_depth=disk_size.y*0.40; + spool3_depth=(spool1_depth+spool2_depth)/2; + spool4_depth=disk_size.y*0.16; + main_spools_x=disk_size.x*0.45; + aux_spools_right_x=main_spools_x + spool_outer_radius + 1; + aux_spools_left_x=main_spools_x - 13; + middle_spool_in_r=2; + middle_spool_out_r=7; + aux_spool_plate_hole_inner_rim=2; + aux_spool_plate_hole_outer_rim=2; + spindle_diam=2; + spindle_diam_tolerance=0.2; + tape_z=plate+spool_plate_height; + + tr=top_rim; + tc=tr*1.5; + fbd=front_body_depth; + bbr=back_bumpers_radius; + + walls_height=height-plate*2; + + module back_bumpers() { + module bumper() { back_half() circle(r=bbr); } + back(depth) { + right(bbr) bumper(); + right(width-bbr) bumper(); + } + } + + module bolt() { metric_bolt(size=back_bumpers_bolt_size, headtype=bolt_headtype, l=height, pitch=0); } + module nut() { metric_nut(size=back_bumpers_bolt_size, pitch=0); } + + module back_bolts() { + back(depth) { + right(bbr) { + up(height) bolt(); + nut(); + } + right(width-bbr) { + up(height) bolt(); + nut(); + } + } + } + + module front_bolts() { + bolt_offset=front_body_bolt_offset; + back(front_body_depth/2) { + right(bolt_offset) { + up(height) bolt(); + nut(); + } + right(width-bolt_offset) { + up(height) bolt(); + nut(); + } + } + } + + module top_cover() { + up(height-plate) linear_extrude(height=plate) { + back_bumpers(); + polygon(points=[ + // frame + [0, 0], [0, depth], + [width, depth], [width, 0], + // window + [tr, tr+fbd], [tr, depth-tr-tc], [tr+tc, depth-tr], + [width-tr-tc, depth-tr], [width-tr, depth-tr-tc], [width-tr, tr+fbd] + ], + paths=[ + [0,1,2,3], [4,5,6,7,8,9] + ]); + } + } + + module walls() { + difference() { + up(plate) linear_extrude(height=walls_height) { + //back_bumpers(); + shell2d(thickness=-wall) { + square([width, depth]); + } + } + translate(get_holodisk_laserwindow_pos_center()) cube(get_holodisk_laserwindow_size(), center=true); + } + } + + module front_plates() { + th = get_holodisk_front_plate_thickness(); + slide_pos = get_holodisk_slide_pos(); + offset=4.5; + plate_len_side=slide_pos.y - offset/2; + plate_len_left=plate_len_side/2; + plate_len_right=plate_len_side + 5; + // front + fwd(th) left(th) up(offset) { + cube([plate_len_left + th*2, th, height - offset*2]); + } + fwd(th) right(width-plate_len_right-th) up(offset) { + cube([plate_len_right + th*2, th, height - offset*2]); + } + // left + fwd(th) left(th) up(offset) { + cube([th, plate_len_side, height - offset*2]); + } + // right + fwd(th) right(width) up(offset) { + cube([th, plate_len_side, height - offset*2]); + } + } + + module slides() { + slide_size = get_holodisk_slide_size(); + slide_pos = get_holodisk_slide_pos(); + slide_plate_size = [0.1, slide_size.y, slide_size.z]; + sliding_size = get_holodisk_slide_sliding_size(); + sliding_pos = get_holodisk_slide_sliding_pos(); + + module slide() { + hull() { + translate(sliding_pos) cube(sliding_size); + translate(slide_pos) cube(slide_plate_size); + } + } + + module slider() { + slider_size = get_holodisk_slide_slider_size(); + slider_pos = get_holodisk_slide_slider_pos(); + slider_plate_size = [0.1, slider_size.y, slider_size.z]; + slider_top_size = [slider_size.x, slider_size.y, sliding_size.z]; + hull() { + up((slider_size.z-sliding_size.z)/2) translate(slider_pos) cube(slider_top_size); + translate(slider_pos) cube(slider_plate_size); + } + } + + right(get_holodisk_size().x) { + slide(); + slider(); + } + scale([-1,1,1]) { + slide(); + slider(); + } + + right(get_holodisk_laserwindow_pos_center().x) zrot(-90) { + scale([1, 0.7, 1]) { + slider(); + } + } + } + + module laserwindow_door() { + door_size = [ + get_holodisk_laserwindow_size().x, + 1, + get_holodisk_laserwindow_size().z + ]; + door_pos = [ + get_holodisk_laserwindow_pos_center().x, + get_holodisk_laserwindow_pos_center().y + door_size.y/2, + get_holodisk_laserwindow_pos_center().z + ]; + + translate(door_pos) scale(0.98) down(door_size.z/2) xrot(anim(1,2)*-90) xrot(anim(6,7)*90) up(door_size.z/2) cube(door_size, center=true); + } + + module bottom_cover() { + difference() { + linear_extrude(height=plate) { + back_bumpers(); + square([width, depth]); + } + down(0.1) translate(get_holodisk_laser_cutout_pos()) cube(get_holodisk_laser_cutout_size()); + } + } + + { + overlap=1; + rails_size = [ + get_holodisk_laserwindow_size().x * 2 + overlap*2, + 1, + walls_height + ]; + rail_size = [rails_size.x, rails_size.y, 2]; + rails_pos = [get_holodisk_laserwindow_pos().x - rails_size.x/2, + -rails_size.y, plate]; + rail1_pos = [rails_pos.x, rails_pos.y, rails_pos.z]; + rail2_pos = [rails_pos.x, rails_pos.y, rails_pos.z + rails_size.z - rail_size.z]; + + module laserwindow_slider_rails() { + translate(rail1_pos) cube(rail_size); + translate(rail2_pos) cube(rail_size); + } + + module laserwindow_slider_cover() { + cover_size=[ + get_holodisk_laserwindow_size().x, + get_holodisk_slide_slider_size().x, + get_holodisk_slide_slider_size().z + ]; + cover_plate=[cover_size.x, rail_size.y, cover_size.z]; + cover_top=[cover_size.x - overlap, cover_size.y, cover_size.z - overlap]; + /*cover_pos=[rails_pos.x+overlap, rails_pos.y + rails_size.y, rails_pos.z];*/ + cover_pos=[get_holodisk_laserwindow_pos().x, rails_pos.y + rails_size.y, rails_pos.z]; + left(anim(0,1)*get_holodisk_laserwindow_size().x) + right(anim(len(get_anim_keys())-2,len(get_anim_keys())-1)*get_holodisk_laserwindow_size().x) + translate(cover_pos) + hull() { + fwd(cover_plate.y) cube(cover_plate); + right(overlap/2) fwd(cover_top.y) up((cover_plate.z-cover_top.z)/2) cube(cover_top); + } + } + + color("red") laserwindow_slider_rails(); + color("red") laserwindow_slider_cover(); + } + + color("SaddleBrown") top_cover(); + color("grey") walls(); + color("gold") laserwindow_door(); + color("Silver") slides(); + color("SaddleBrown") bottom_cover(); + color("SaddleBrown") front_plates(); + //color("silver") back_bolts(); + //color("silver") front_bolts(); +} + +// test +holodisk_frame(); diff --git a/holodisk_spec.scad b/holodisk_spec.scad index fcad369..ce40384 100644 --- a/holodisk_spec.scad +++ b/holodisk_spec.scad @@ -7,11 +7,14 @@ function get_holodisk_size() = [55, 100, 16]; +function get_holodisk_bottom_thickness() = 3; + function get_holodisk_front_plate_thickness() = 1; // -- tape -- function get_holodisk_tape_height() = 5; +function get_holodisk_tape_thickness() = 0.2; // -- slide -- diff --git a/tape.scad b/tape.scad index cb821f3..4f626e7 100755 --- a/tape.scad +++ b/tape.scad @@ -1,7 +1,9 @@ // dependency: https://github.com/revarbat/BOSL use -module tape(start, end, height = tape_height, thickness = tape_thickness) { +use + +module tape(start, end, height = get_holodisk_tape_height(), thickness = get_holodisk_tape_thickness()) { color("RosyBrown") up(thickness) hull() { translate(start) sphere(thickness); @@ -13,7 +15,7 @@ module tape(start, end, height = tape_height, thickness = tape_thickness) { } } -module tape_spool(r_in, r_out, height = tape_height, thickness = tape_thickness) { +module tape_spool(r_in, r_out, height = get_holodisk_tape_height(), thickness = get_holodisk_tape_thickness()) { color("RosyBrown") up(thickness) minkowski() { difference() {