2020-01-07 11:09:34 -05:00
|
|
|
use <PolyGear/PolyGear.scad>
|
2020-02-04 09:31:52 -05:00
|
|
|
include <PolyGear/PolyGearBasics.scad>
|
2020-01-07 11:09:34 -05:00
|
|
|
use <PolyGear/shortcuts.scad>
|
|
|
|
|
|
2020-02-04 09:31:52 -05:00
|
|
|
chamfer=30;
|
|
|
|
|
axis_angle=0;
|
|
|
|
|
helix_angle = [ for (x=linspace(-1,1,11)) exp(-abs(x))*10*sign(x) ];
|
|
|
|
|
|
|
|
|
|
//helix_angle = constant(axis_angle/2);
|
|
|
|
|
//width = 100;
|
|
|
|
|
width=18;
|
2020-01-07 15:14:09 -05:00
|
|
|
N = 9;
|
|
|
|
|
// Force same number of teeth
|
|
|
|
|
N1=N;
|
|
|
|
|
N2=N;
|
2020-02-04 09:31:52 -05:00
|
|
|
Module=1.45;
|
2020-01-07 11:09:34 -05:00
|
|
|
|
2020-01-07 15:14:09 -05:00
|
|
|
ShaftD=4.5;
|
|
|
|
|
MeshD=Module*(N1+N2)/2;
|
2020-01-07 11:09:34 -05:00
|
|
|
|
2020-01-07 15:14:09 -05:00
|
|
|
SwingAdd = 1;
|
|
|
|
|
Swing = MeshD/2 + Module + SwingAdd;
|
|
|
|
|
|
|
|
|
|
// RefD = M*N ; Default M=1
|
|
|
|
|
tol=.2;
|
|
|
|
|
BackW=Swing+Module;
|
|
|
|
|
SideW=tol+BackW;
|
2020-01-07 11:09:34 -05:00
|
|
|
|
|
|
|
|
echo("Reference Diameter (MeshD): ", MeshD);
|
|
|
|
|
//rot=360/N1*$t;
|
2020-02-04 09:31:52 -05:00
|
|
|
// rot=90-90*$t;
|
2021-01-08 00:37:44 -05:00
|
|
|
rot=45;
|
2021-01-08 15:40:23 -05:00
|
|
|
rot=0;
|
2020-01-07 11:09:34 -05:00
|
|
|
//axis_angle = -50;
|
2020-04-30 13:53:32 -04:00
|
|
|
|
|
|
|
|
//meshed(rot=rot);
|
2020-01-10 14:31:21 -05:00
|
|
|
|
2020-04-30 13:53:32 -04:00
|
|
|
$fa = ($preview) ? 12 : .01;
|
|
|
|
|
$fs = ($preview) ? 2 : .01;
|
2020-04-30 15:33:48 -04:00
|
|
|
$incolor = false;
|
2020-01-10 14:31:21 -05:00
|
|
|
|
2021-01-08 15:40:23 -05:00
|
|
|
gear_hinge(rot=rot, box=false, rounded_case=true);
|
2020-03-15 20:39:44 -04:00
|
|
|
//translate([50,0,0]) gear_hinge(rot=rot, box=false, box_top=true);
|
|
|
|
|
|
2020-01-10 14:31:21 -05:00
|
|
|
|
|
|
|
|
module gear_sector() {
|
|
|
|
|
CyS(r=MeshD, h=width, w1=215, w2=20);
|
|
|
|
|
CyS(r=MeshD/2 - 2, h=width, w1=20, w2=90);
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-30 15:33:48 -04:00
|
|
|
module gear_hinge(
|
|
|
|
|
box=true,
|
2021-01-08 00:37:44 -05:00
|
|
|
rounded_case=false,
|
2020-04-30 15:33:48 -04:00
|
|
|
box_top=true,
|
|
|
|
|
box_color="green",
|
|
|
|
|
left_gear_color="blue",
|
|
|
|
|
right_gear_color="red",
|
|
|
|
|
rot=0) {
|
2020-01-10 14:31:21 -05:00
|
|
|
//offex=tol;
|
2020-04-30 15:33:48 -04:00
|
|
|
bc = $incolor ? box_color : undef;
|
|
|
|
|
lgc = $incolor ? left_gear_color : undef;
|
|
|
|
|
rgc = $incolor ? right_gear_color : undef;
|
|
|
|
|
|
2020-01-10 14:31:21 -05:00
|
|
|
offex=0;
|
2020-04-30 15:33:48 -04:00
|
|
|
color(lgc) translate([-MeshD/2 - offex,0]) rotate([0,0,rot]) blue_gear();
|
|
|
|
|
color (rgc) translate([offex + MeshD/2,0]) rotate([0,0,-rot]) red_gear();
|
2020-01-10 14:31:21 -05:00
|
|
|
if (box) {
|
2021-01-08 00:37:44 -05:00
|
|
|
color(bc) box(full = true, top=box_top, tol=tol);
|
|
|
|
|
} else if (rounded_case) {
|
|
|
|
|
round_case(full=true, tol=tol);
|
2020-01-07 11:09:34 -05:00
|
|
|
}
|
2020-01-10 14:31:21 -05:00
|
|
|
}
|
2020-01-07 11:09:34 -05:00
|
|
|
|
2020-01-10 14:31:21 -05:00
|
|
|
module gear_track_block() {
|
|
|
|
|
difference() {
|
2020-02-04 09:31:52 -05:00
|
|
|
CyS(r=MeshD/2 + Module/2, h=width/2, w1=245, w2=250);
|
2021-01-08 00:37:44 -05:00
|
|
|
CyS(r=ShaftD+1, h=width, w1=244, w2=271);
|
2020-01-10 14:31:21 -05:00
|
|
|
}
|
2020-01-07 11:09:34 -05:00
|
|
|
}
|
|
|
|
|
|
2020-01-10 14:31:21 -05:00
|
|
|
module blue_gear() {
|
2020-04-30 15:33:48 -04:00
|
|
|
render() {
|
|
|
|
|
intersection() {
|
|
|
|
|
spur_gear(n=N1, w=width, m=Module, chamfer=30, helix_angle = helix_angle );
|
|
|
|
|
difference() {
|
|
|
|
|
gear_sector();
|
2020-01-10 14:31:21 -05:00
|
|
|
|
2020-04-30 15:33:48 -04:00
|
|
|
// Shaft Hole
|
|
|
|
|
cylinder(d=ShaftD, h=width+2, center=true);
|
2020-01-10 14:31:21 -05:00
|
|
|
|
2020-04-30 15:33:48 -04:00
|
|
|
// Block limit - back
|
|
|
|
|
translate([-BackW+2*tol,-MeshD/2,0]) cube([MeshD,MeshD,width], center=true);
|
|
|
|
|
// Block limit - front
|
|
|
|
|
translate([0,0,-width/2]) cube([1,MeshD/2,width]);
|
|
|
|
|
}
|
2020-01-10 14:31:21 -05:00
|
|
|
}
|
2020-04-30 15:33:48 -04:00
|
|
|
// Rear Block
|
|
|
|
|
gear_track_block();
|
2020-01-10 14:31:21 -05:00
|
|
|
}
|
|
|
|
|
// leaf arm
|
2020-02-04 09:31:52 -05:00
|
|
|
//translate([MeshD/2 - 2*Module,11,0]) cube([4,20,width+1], center=true);
|
2021-01-08 15:40:23 -05:00
|
|
|
translate([2,11.6,0]) rotate([0,0,0]) leaf_arm(left=true);
|
2020-01-10 14:31:21 -05:00
|
|
|
}
|
|
|
|
|
|
2020-02-04 09:31:52 -05:00
|
|
|
module red_gear()
|
|
|
|
|
{
|
2020-03-15 20:39:44 -04:00
|
|
|
render() difference() {
|
2020-02-04 09:31:52 -05:00
|
|
|
union() {
|
|
|
|
|
CyS(r=MeshD/2 - 2, h=width, w1=90, w2=160);
|
|
|
|
|
intersection() {
|
|
|
|
|
spur_gear(n=N2, w=width, m=Module, chamfer=30, helix_angle=-helix_angle);
|
|
|
|
|
CyS(r=MeshD, h=width, w1=150, w2=-30);
|
2020-01-07 11:09:34 -05:00
|
|
|
}
|
2020-02-04 09:31:52 -05:00
|
|
|
|
|
|
|
|
// leaf arm
|
2021-01-08 15:40:23 -05:00
|
|
|
translate([-2,11.6,0]) leaf_arm(left=false);
|
2020-02-04 09:31:52 -05:00
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Shaft Hole
|
2020-04-30 13:53:32 -04:00
|
|
|
cylinder(d=ShaftD, h=width+2, center=true);
|
2020-02-04 09:31:52 -05:00
|
|
|
// Block limit -front
|
2021-01-08 15:40:23 -05:00
|
|
|
//translate([-Module/2,1,-width/2]) cube([Module,MeshD/2,width]);
|
2020-02-04 09:31:52 -05:00
|
|
|
// Block limit
|
|
|
|
|
translate([BackW-2*tol,-MeshD/2,0]) cube([MeshD,MeshD,width+1], center=true);
|
2020-01-07 11:09:34 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-08 15:40:23 -05:00
|
|
|
module leaf_arm(left=true) {
|
|
|
|
|
dx = 7.51;
|
2020-03-15 20:39:44 -04:00
|
|
|
difference() {
|
2021-01-08 15:40:23 -05:00
|
|
|
//cube([4,20,width+1], center=true);
|
|
|
|
|
translate([0,-9.5+dx/2,0]) cube([4,dx,width], center=true);
|
|
|
|
|
rot = left ? 270 : 90;
|
|
|
|
|
rotate([0,rot,0]) {
|
|
|
|
|
for (i = [-1, 1]) { // M2.5 insert
|
|
|
|
|
$fn = 11;
|
|
|
|
|
translate([i*(width/2-5.25),5,1.6])
|
|
|
|
|
cylinder(d=5, h=1, center=true); // rim
|
|
|
|
|
translate([i*(width/2-5.25),5,0])
|
|
|
|
|
cylinder(d=3.8, h=20, center=true); // body
|
|
|
|
|
|
2020-03-15 20:39:44 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-08 00:37:44 -05:00
|
|
|
module round_case(
|
|
|
|
|
d=ShaftD,
|
|
|
|
|
tol=.25,
|
|
|
|
|
top=true,
|
|
|
|
|
MeshD=MeshD,
|
|
|
|
|
Module=Module,
|
|
|
|
|
SwingAdd=1,
|
|
|
|
|
WallD=1.5,
|
|
|
|
|
full=true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Swing = MeshD/2 + Module + SwingAdd;
|
|
|
|
|
BackW=WallD/2 + Swing+Module+1;
|
|
|
|
|
SideW=tol -1 + BackW-MeshD/2;
|
|
|
|
|
|
|
|
|
|
difference() {
|
|
|
|
|
intersection() {
|
|
|
|
|
hull() {
|
|
|
|
|
for (x = [-MeshD/2, MeshD/2] )
|
|
|
|
|
translate([x,0])
|
|
|
|
|
cylinder(d=18.5, h=width+4, center=true);
|
|
|
|
|
}
|
2021-01-08 15:40:23 -05:00
|
|
|
translate([-15,-12,-15]) cube([30,12,30]);
|
2021-01-08 00:37:44 -05:00
|
|
|
}
|
|
|
|
|
hull() {
|
|
|
|
|
for (xi = [-1, 1] )
|
|
|
|
|
translate([xi*MeshD/2,0]) difference() {
|
2021-01-08 15:40:23 -05:00
|
|
|
cylinder(d=16.5, h=width+2*tol, center=true);
|
|
|
|
|
cylinder(d=d-2*tol, h=width+2*tol, center=true);
|
2021-01-08 00:37:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (xi = [-1, 1]) {
|
|
|
|
|
translate([xi*MeshD/2,0]) {
|
|
|
|
|
// Shaft
|
|
|
|
|
cylinder(d=d-2*tol, h=width+2, center=true);
|
|
|
|
|
// Shaft Bottom/top
|
|
|
|
|
for (s = [-1,1]) {
|
|
|
|
|
translate([0,0,s*(width/2 + WallD/2 + 1.5*tol)])
|
|
|
|
|
cylinder(d=d+3*tol, h=WallD+tol, center=true);
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-08 15:40:23 -05:00
|
|
|
translate([xi*(BackW/2 - SideW +4),-WallD/2]) cube([SideW+1+tol,WallD,width+3+2*tol], center=true);
|
2021-01-08 00:37:44 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-01-07 15:14:09 -05:00
|
|
|
module box(
|
|
|
|
|
d=ShaftD,
|
2020-01-10 14:31:21 -05:00
|
|
|
tol=.25,
|
|
|
|
|
top=true,
|
2020-01-07 15:14:09 -05:00
|
|
|
MeshD=MeshD,
|
|
|
|
|
Module=Module,
|
|
|
|
|
SwingAdd=1,
|
|
|
|
|
WallD=1.5,
|
|
|
|
|
full=true)
|
|
|
|
|
{
|
2020-04-30 13:53:32 -04:00
|
|
|
|
2020-01-07 15:14:09 -05:00
|
|
|
Swing = MeshD/2 + Module + SwingAdd;
|
|
|
|
|
BackW=WallD/2 + Swing+Module+1;
|
|
|
|
|
SideW=tol -1 + BackW-MeshD/2;
|
|
|
|
|
if (full == true) {
|
2020-04-30 13:53:32 -04:00
|
|
|
mirror([1,0,0]) box(d=d, tol=tol, top=top, full=false);
|
2020-01-07 15:14:09 -05:00
|
|
|
}
|
|
|
|
|
|
2020-01-07 11:09:34 -05:00
|
|
|
translate([MeshD/2,0]) {
|
2020-01-07 15:14:09 -05:00
|
|
|
// Shaft
|
2020-04-30 13:53:32 -04:00
|
|
|
cylinder(d=d-2*tol, h=width+2, center=true);
|
2020-02-04 09:31:52 -05:00
|
|
|
// Shaft Bottom/top
|
|
|
|
|
for (s = [-1,1]) {
|
|
|
|
|
translate([0,0,s*(width/2 + WallD/2 + 1.5*tol)])
|
2020-04-30 13:53:32 -04:00
|
|
|
cylinder(d=d+3*tol, h=WallD+tol, center=true);
|
2020-02-04 09:31:52 -05:00
|
|
|
}
|
|
|
|
|
|
2020-01-10 14:31:21 -05:00
|
|
|
translate([BackW/2 - SideW +1,0]) cube([SideW+tol,WallD,width+1+2*tol], center=true);
|
2020-01-07 15:14:09 -05:00
|
|
|
// Side Wall
|
2020-01-10 14:31:21 -05:00
|
|
|
translate([SideW,-Swing/2]) cube([WallD,Swing+WallD,width+1+2*tol], center=true);
|
2020-01-07 11:09:34 -05:00
|
|
|
}
|
2020-01-07 15:14:09 -05:00
|
|
|
// Back Wall
|
2020-01-10 14:31:21 -05:00
|
|
|
translate([BackW/2,-Swing,0]) cube([BackW,WallD,width+1+2*tol],center=true);
|
2020-01-07 15:14:09 -05:00
|
|
|
// Bottom/Top
|
2020-01-10 14:31:21 -05:00
|
|
|
if (top) {
|
|
|
|
|
translate([BackW/2,-(Swing)/2,+width/2 + WallD/2 + 2*tol])
|
|
|
|
|
cube([BackW,Swing+WallD,WallD], center=true);
|
|
|
|
|
}
|
|
|
|
|
translate([BackW/2,-(Swing)/2,-width/2 - WallD/2 - 2*tol])
|
2020-01-07 15:14:09 -05:00
|
|
|
difference() {
|
|
|
|
|
cube([BackW,Swing+WallD,WallD], center=true);
|
2020-01-07 11:09:34 -05:00
|
|
|
}
|
2020-01-07 15:14:09 -05:00
|
|
|
|
2020-02-04 09:31:52 -05:00
|
|
|
}
|