Holodisk/reader.scad

155 lines
4.5 KiB
OpenSCAD
Raw Normal View History

2020-12-22 13:05:47 +00:00
// dependency: https://github.com/revarbat/BOSL
use <BOSL/transforms.scad>
2020-12-22 19:38:48 +00:00
use <holodisk_spec.scad>
include <anim.scad>
2020-12-22 13:05:47 +00:00
// outside config
tape_height=5;
tape_z=4;
2020-12-22 19:38:48 +00:00
module reader(disk_size) {
width=disk_size.x;
depth=disk_size.y;
height=disk_size.z;
laser_cutout_size = get_holodisk_laser_cutout_size();
laser_cutout_pos = get_holodisk_laser_cutout_pos_center();
frame=5;
head_frame=2;
head_size=[14, 10, tape_height+head_frame*2];
head_pos=[laser_cutout_pos.x, -frame+2, tape_z-head_frame];
laser_size=[10, 2, tape_height];
laser_offset=3;
laser_pos=[laser_cutout_pos.x, laser_cutout_pos.y + laser_offset, tape_z];
laser_tower_size=[laser_cutout_size.x - 1, laser_cutout_size.y - 1 - laser_offset, 15];
2020-12-22 13:05:47 +00:00
module laser(corner=0.1) {
up(laser_size.z/2)
up(corner)
color("Red")
2020-12-22 19:38:48 +00:00
fwd(laser_cutout_size.y/3) cube(laser_size, center=true);
beam_anim=anim(ANIM_PLAYING(), ANIM_PLAYING()+1);
if (beam_anim > 0 && beam_anim < 1) {
color("red")
up(get_holodisk_laserwindow_size().x/4)
yrot(beam_anim*1234)
xrot(90)
cylinder(h=get_holodisk_laserwindow_size().y, d=get_holodisk_laserwindow_size().x/4, $fn=3);
}
2020-12-22 13:05:47 +00:00
}
2020-12-22 19:38:48 +00:00
module laser_tower(corner=1) {
2020-12-22 13:05:47 +00:00
color("DarkSlateBlue")
difference() {
2020-12-22 19:38:48 +00:00
up(laser_size.z/2)
fwd(laser_offset/2) scale(0.99) cube(laser_tower_size, center=true);
fwd(laser_size.y/3) scale(1.1) laser();
2020-12-22 13:05:47 +00:00
}
}
module laser_space() {
translate(get_holodisk_laser_cutout_pos_center()) cube(get_holodisk_laser_cutout_size(), center=true);
}
2020-12-22 13:05:47 +00:00
module head_space() {
2020-12-22 19:38:48 +00:00
/*stube=[head_size.x-head_frame*2, head_size.y+head_frame*3, head_size.z-head_frame*2];
2020-12-22 13:05:47 +00:00
up(head_size.z/4 + head_frame)
2020-12-22 19:38:48 +00:00
cube(stube, center=true);*/
translate(get_holodisk_laserwindow_pos_center()) cube(get_holodisk_laserwindow_size(), center=true);
2020-12-22 13:05:47 +00:00
}
module head(corner=0.5) {
up(corner)
back(head_size.y/2)
color("DarkSlateBlue")
minkowski() {
s=[head_size[0], head_size[1] + frame, head_size[2]-corner*2];
difference() {
2020-12-22 19:38:48 +00:00
translate(head_pos) up(head_size.z/2) cube(s, center=true);
2020-12-22 13:05:47 +00:00
head_space();
}
sphere(corner);
}
}
spindle_driver_shaft_diam = get_holodisk_spool_spindle_connection_driver_size().x;
module spindle_driver_shaft() {
h=10; // TODO
down(h) cylinder(d=spindle_driver_shaft_diam, h=h, $fn=100);
}
module spindle_driver() {
union() {
holodisk_spool_spindle_connection_driver();
spindle_driver_shaft();
}
}
module spindle_driver_space() {
s=get_holodisk_spool_spindle_connection_driver_size();
down(0.01) scale(1.01) cylinder(d=s.x, h=s.z, $fn=100);
}
anim_spindle_rot=100;
module spindle1_driver() {
translate(get_holodisk_spool1_socket_pos_center())
zrot(anim(ANIM_PLAYING(), ANIM_PLAYING()+1)*anim_spindle_rot)
spindle_driver();
}
module spindle1_driver_space() {
translate(get_holodisk_spool1_socket_pos_center())
spindle_driver_space();
}
module spindle2_driver() {
translate(get_holodisk_spool2_socket_pos_center())
zrot(anim(ANIM_PLAYING(), ANIM_PLAYING()+1)*anim_spindle_rot)
spindle_driver();
}
module spindle2_driver_space() {
translate(get_holodisk_spool2_socket_pos_center())
spindle_driver_space();
}
//head();
2020-12-22 19:38:48 +00:00
retraction=laser_tower_size.z;
down(retraction)
up(anim(ANIM_RAISING(), ANIM_RAISING()+1)*retraction)
down(anim(ANIM_LOWERING(), ANIM_LOWERING()+1)*retraction)
union() {
translate(laser_pos) {
laser();
laser_tower();
}
color("yellow") {
spindle1_driver();
spindle2_driver();
}
2020-12-22 13:05:47 +00:00
}
color("DarkSlateBlue") {
difference() {
fwd(frame) cube([width, frame, height]);
2020-12-22 19:38:48 +00:00
head_space();
2020-12-22 13:05:47 +00:00
}
down(frame) difference() {
fwd(frame) cube([width, depth + frame, frame]);
scale(1.01) down(0.01) laser_space();
scale([1,1,5]) spindle1_driver_space();
scale([1,1,5]) spindle2_driver_space();
}
2020-12-22 13:05:47 +00:00
}
}
2020-12-22 19:38:48 +00:00
holodisk_size = is_undef(disk_size) ? [50, 100, 20] : disk_size;
reader(holodisk_size);