Holodisk/reader.scad
2020-12-31 14:15:57 +01:00

91 lines
2.4 KiB
OpenSCAD
Executable File

// dependency: https://github.com/revarbat/BOSL
use <BOSL/transforms.scad>
use <holodisk_spec.scad>
include <anim.scad>
// outside config
tape_height=5;
tape_z=4;
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];
module laser(corner=0.1) {
up(laser_size.z/2)
up(corner)
color("Red")
fwd(laser_cutout_size.y/3) cube(laser_size, center=true);
}
module laser_tower(corner=1) {
color("DarkSlateBlue")
difference() {
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();
}
}
module head_space() {
/*stube=[head_size.x-head_frame*2, head_size.y+head_frame*3, head_size.z-head_frame*2];
up(head_size.z/4 + head_frame)
cube(stube, center=true);*/
translate(get_holodisk_laserwindow_pos_center()) cube(get_holodisk_laserwindow_size(), center=true);
}
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() {
translate(head_pos) up(head_size.z/2) cube(s, center=true);
head_space();
}
sphere(corner);
}
}
head();
retraction=laser_tower_size.z;
down(retraction)
up(anim(2, 3)*retraction)
down(anim(5, 6)*retraction)
translate(laser_pos) {
laser();
laser_tower();
}
color("DarkSlateBlue") {
difference() {
fwd(frame) cube([width, frame, height]);
head_space();
}
fwd(frame) down(frame) cube([width, depth + frame, frame]);
}
}
holodisk_size = is_undef(disk_size) ? [50, 100, 20] : disk_size;
reader(holodisk_size);