185 lines
5.1 KiB
OpenSCAD
185 lines
5.1 KiB
OpenSCAD
|
/* PANTOGRAPH BOOKEND */
|
||
|
|
||
|
side_width = 100;
|
||
|
side_height = 150;
|
||
|
thickness = 2;
|
||
|
bar_width = 15;
|
||
|
hole_diameter = bar_width/2;
|
||
|
thread_tolerance = 0.05;
|
||
|
threaded_pins = true;
|
||
|
|
||
|
translate([0, -bar_width, 0])
|
||
|
left_wall2();
|
||
|
right_wall();
|
||
|
//bars(10);
|
||
|
//pins(17);
|
||
|
|
||
|
|
||
|
|
||
|
/******************************************************************/
|
||
|
include <polyScrewThread_r1.scad>
|
||
|
$fn=180;
|
||
|
max=1000; //some high number for diff purposes
|
||
|
hd=hole_diameter;
|
||
|
bw=bar_width;
|
||
|
sw=side_width;
|
||
|
sh=side_height;
|
||
|
t=thickness;
|
||
|
tr=0.85;
|
||
|
|
||
|
module pins(count) {
|
||
|
//2 long pins
|
||
|
translate([-3*bw,bw,0]) pin(true);
|
||
|
translate([-3*bw,2*bw,0]) pin(true);
|
||
|
|
||
|
//rest are short pins
|
||
|
for(i=[3:count])
|
||
|
translate([-3*bw,bw*i,0]) pin(false);
|
||
|
|
||
|
//spacers
|
||
|
for(i=[-1:2:1])
|
||
|
translate([-3*bw+i*bw/2*1.1,0,t/2]) spacer();
|
||
|
}
|
||
|
|
||
|
module spacer() {
|
||
|
difference() {
|
||
|
cylinder(h=t, d=bw, center=true);
|
||
|
cylinder(h=max, d=hd, center=true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module pin(long) {
|
||
|
height = (long?3:2)*t+1;
|
||
|
translate([-bw/2,0,0]) pin_male(height);
|
||
|
translate([bw/2,0,0]) pin_female(height);
|
||
|
}
|
||
|
|
||
|
module pin_female(height) {
|
||
|
if(threaded_pins) {
|
||
|
translate([0,0,.5]) cylinder(h=1, r=bw/2.5, center=true, $fn=6);
|
||
|
translate([0,0,1])
|
||
|
difference() {
|
||
|
translate([0,0,height/2]) cylinder(h=height, d=hd*.95, center=true);
|
||
|
translate([0,0, height+1]) rotate([180,0,0]) screw_thread(hd*tr, 3, 65, height+1, PI/8, 1);
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
difference() {
|
||
|
translate([0,0,1.5]) cylinder(h=3, r=bw/2.5, center=true);
|
||
|
translate([0,0,3]) cylinder(h=4, d=hd*.97, center=true);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module pin_male(height) {
|
||
|
if(threaded_pins) {
|
||
|
translate([0,0,.5]) cylinder(h=1, r=bw/2.5, center=true, $fn=6);
|
||
|
translate([0,0,1]) screw_thread(hd*(tr-thread_tolerance), 3, 65, height, PI/8, 1);
|
||
|
}
|
||
|
else {
|
||
|
translate([0,0,.5]) cylinder(h=1, r=bw/2.5, center=true);
|
||
|
translate([0,0,(height+2)/2+1]) cylinder(h=height+2, d=hd*.95, center=true);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
module bars(count) {
|
||
|
for(i=[1:count])
|
||
|
translate([bw+1.2*bw*i,0,0]) bar();
|
||
|
}
|
||
|
|
||
|
module bar() {
|
||
|
difference() {
|
||
|
plate(bw, sh-bw);
|
||
|
translate([0, sh/2-bw,0])
|
||
|
difference() {
|
||
|
translate([0,max/2,0]) cube([max,max,10], center=true);
|
||
|
cylinder(h=max, d=bar_width, center=true);
|
||
|
}
|
||
|
translate([0, -sh/2+bw,0])
|
||
|
difference() {
|
||
|
translate([0,-max/2,0]) cube([max,max,10], center=true);
|
||
|
cylinder(h=max, d=bar_width, center=true);
|
||
|
}
|
||
|
translate([0,(sh-2*bw)/2,0]) cylinder(h=max, d=hd, center=true);
|
||
|
translate([0,0,0]) cylinder(h=max, d=hd, center=true);
|
||
|
translate([0,-(sh-2*bw)/2,0]) cylinder(h=max, d=hd, center=true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module right_wall() {
|
||
|
translate([-10,0,0]) mirror([1,0,0]) left_wall();
|
||
|
}
|
||
|
|
||
|
module left_wall() {
|
||
|
//side wall
|
||
|
translate([0,0,side_width/2])
|
||
|
rotate([0,270,0])
|
||
|
difference() {
|
||
|
plate(side_width, side_height);
|
||
|
translate([-(side_height-side_width)/2,0,0])
|
||
|
difference() {
|
||
|
translate([500,500,0]) cube([1000,1000,10], center=true);
|
||
|
cylinder(h=1000, d=side_height, center=true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//back
|
||
|
translate([bw/2,0,0])
|
||
|
difference() {
|
||
|
plate(bw, sh);
|
||
|
translate([0, (side_height - bar_width)/2,0])
|
||
|
difference() {
|
||
|
translate([max/2,max/2,0]) cube([max,max,10], center=true);
|
||
|
cylinder(h=max, d=bar_width, center=true);
|
||
|
}
|
||
|
translate([0,(sh-bw)/2,0]) cylinder(h=max, d=hd, center=true);
|
||
|
translate([0,(sh-bw)/2-bw,0]) cylinder(h=max, d=hd, center=true);
|
||
|
translate([0,-bw/2,0]) cube([hd, sh-2*bw, 100],center=true);
|
||
|
translate([0,-(sh-bw)/2,0]) cylinder(h=max, d=hd, center=true);
|
||
|
}
|
||
|
|
||
|
//bottom
|
||
|
translate([bar_width/2,-side_height/2+thickness,side_width/2])
|
||
|
rotate([90,0,0])
|
||
|
plate(bar_width, side_width);
|
||
|
}
|
||
|
|
||
|
module left_wall2() {
|
||
|
//side wall
|
||
|
translate([0,0,side_width/2])
|
||
|
rotate([0,270,0])
|
||
|
difference() {
|
||
|
plate(side_width, side_height);
|
||
|
translate([-(side_height-side_width)/2,0,0])
|
||
|
difference() {
|
||
|
translate([500,500,0]) cube([1000,1000,10], center=true);
|
||
|
cylinder(h=1000, d=side_height, center=true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//back
|
||
|
translate([bw/2,0,0])
|
||
|
difference() {
|
||
|
plate(bw, sh);
|
||
|
translate([0, (side_height - bar_width)/2,0])
|
||
|
difference() {
|
||
|
translate([max/2,max/2,0]) cube([max,max,10], center=true);
|
||
|
cylinder(h=max, d=bar_width, center=true);
|
||
|
}
|
||
|
translate([0,(sh-bw)/2,0]) cylinder(h=max, d=hd, center=true);
|
||
|
translate([0,(sh-bw)/2-bw,0]) cylinder(h=max, d=hd, center=true);
|
||
|
translate([0,-bw/2,0]) cube([hd, sh-2*bw, 100],center=true);
|
||
|
translate([0,-(sh-bw)/2,0]) cylinder(h=max, d=hd, center=true);
|
||
|
}
|
||
|
|
||
|
//bottom
|
||
|
translate([-bar_width,-side_height/2+thickness,side_width/2])
|
||
|
rotate([90,0,0])
|
||
|
plate(bar_width * 4, side_width);
|
||
|
}
|
||
|
|
||
|
|
||
|
module plate(width,height) {
|
||
|
translate([0,0,thickness/2]) cube([width, height, thickness], true);
|
||
|
}
|