summaryrefslogtreecommitdiff
authorMichael Krelin <hacker@klever.net>2018-08-02 11:23:57 (UTC)
committer Michael Krelin <hacker@klever.net>2018-08-02 11:23:57 (UTC)
commit290784caf892a0bbea84332ff4ae6767b0fcddd1 (patch) (side-by-side diff)
tree1e167203f6a8227ae3f868471032b7127274f9d2
parent62df5d5cfcaa6ede9f3b6441de8a0a3a963d9d97 (diff)
downloadextrudery-290784caf892a0bbea84332ff4ae6767b0fcddd1.zip
extrudery-290784caf892a0bbea84332ff4ae6767b0fcddd1.tar.gz
extrudery-290784caf892a0bbea84332ff4ae6767b0fcddd1.tar.bz2
another: adjust and prettify $fn calculations
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--another.scad61
1 files changed, 31 insertions, 30 deletions
diff --git a/another.scad b/another.scad
index 302e314..872ff33 100644
--- a/another.scad
+++ b/another.scad
@@ -58,12 +58,14 @@ module the_extruder(
left=false,
vitamins = true,
supports = false,
tensioner = true,
debug = false
) {
+ fnd = 2*PI; fnr = 2*fnd;
+
lever_shell = mount_screwhead_h+0.5;
lever_thickness=max(spring_d+spring_d_clearance+layer_height*8,idler_h+idler_v_tolerance+2*lever_shell);
lsd = idler_d-idler_clearance*2;
longwing=gearbox_d/2+spring_d/2+lsd/2;
h_ = (pulley_d+idler_d)/(2*sqrt(2));
ri = sqrt( pow(h_,2) + pow(mount_d/2-h_,2) );
@@ -83,16 +85,16 @@ module the_extruder(
children();
}
module finger_indent(d=lever_thickness,depth/*=1*/,r/*=15*/) {
if(depth) {
hh = (-4*pow(depth,2)+pow(d,2))/(8*depth);
rr = depth+hh;
- translate([0,0,hh]) sphere(r=rr,$fn=2*PI*rr);
+ translate([0,0,hh]) sphere(r=rr,$fn=fnr*rr);
}else if(r) {
hh=sqrt(pow(r,2)-pow(d,2)/4);
- translate([0,0,hh]) sphere(r=r,$fn=2*PI*r);
+ translate([0,0,hh]) sphere(r=r,$fn=fnr*r);
}
}
% if(vitamins) mirrorleft() {
translate([0,0,-epsilon]) mirror([0,0,1]) cylinder(d=gearbox_d,h=1,$fn=60);
for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0])
@@ -155,26 +157,26 @@ module the_extruder(
if(supports) for(y=[-lsd/2+extrusion_width:(lsd-2*extrusion_width)/3:lsd/2-extrusion_width])
translate([-lsd/2-1,y-extrusion_width/2,-idler_h/2-idler_v_tolerance/2-1])
cube(size=[lsd+2,extrusion_width,idler_h+idler_v_tolerance+2]);
}
cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=30);
translate([0,0,lever_thickness/2-mount_screwhead_h])
- cylinder(d=mount_screwhead_d,h=mount_screwhead_h+1,$fn=2*PI*mount_screwhead_d);
+ cylinder(d=mount_screwhead_d,h=mount_screwhead_h+1,$fn=fnd*mount_screwhead_d);
}
// mounting screw hole
translate([mount_d/2,0,0])
- cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=2*PI*mount_screw_d);
+ cylinder(d=mount_screw_d+mount_screw_d_tolerance,h=lever_thickness+2,center=true,$fn=fnd*mount_screw_d);
// lever end
translate([mount_d/2,0,0]) rotate([0,90,0]) {
translate([0,-longwing,lsd/2]) finger_indent(d=lever_thickness-1,r=15);
translate([0,-longwing,0])
mirror([0,0,1])
difference() {
- cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=2*PI*spring_d);
- sphere(d=spring_d*3/4,$fn=PI*spring_d);
+ cylinder(d=spring_d+spring_d_clearance,h=lsd,$fn=fnd*(spring_d+spring_d_clearance));
+ sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
}
}//rotate-translate
}//difference
// bridging patch
place_idler()
translate([0,0,lever_thickness/2-mount_screwhead_h])
@@ -183,21 +185,21 @@ module the_extruder(
}//translate
}//lever module
module body() {
difference() {
union() {
- cylinder(d=gearbox_d,h=body_h,$fn=2*PI*gearbox_d);
+ cylinder(d=gearbox_d,h=body_h,$fn=fnd*gearbox_d);
// finger and spring support
fsw = gearbox_d/2+mount_screwhead_d/2;
translate([-gearbox_d/2,0,0]) difference() {
union() {
hull() {
translate([0,-longwing,ls_z])
rotate([0,90,0])
- cylinder(d=max(lever_thickness,spring_d+spring_d_clearance+2*extrusion_width),h=fsw,$fn=2*PI*lever_thickness);
+ cylinder(d=lever_thickness,h=fsw,$fn=fnd*lever_thickness);
hh=body_h-ls_z;
translate([0,0,ls_z-lever_thickness/2])
mirror([0,1,0]) cube(size=[fsw,longwing-hh+lever_thickness/sqrt(2),hh+lever_thickness/2]);
hhh=ls_z;
translate([0,0,0])
mirror([0,1,0]) cube(size=[fsw,longwing-hhh+lever_thickness/sqrt(2),hhh+lever_thickness/2]);
@@ -208,20 +210,20 @@ module the_extruder(
if(debug) translate([0,-gearbox_d,-gearbox_d]) cube(size=[body_h/2+1,gearbox_d,gearbox_d+2]);
mirror([0,0,1]) {
translate([0,0,st_shell])
hull() for(o=[0,spring_d]) translate([0,-o,0])
rotate([0,0,30])
cylinder(d=st_nut_d,h=st_nut_h,$fn=6);
- translate([0,0,-1]) cylinder(d=st_screw_d,h=fsw+2,$fn=st_screw_d*PI*2);
+ translate([0,0,-1]) cylinder(d=st_screw_d,h=fsw+2,$fn=fnd*st_screw_d);
bigd = spring_d+spring_d_clearance;
hf = (bigd-st_screw_d)/2;
translate([0,0,st_shell+st_nut_h+st_shell-epsilon])
cylinder(d1=st_screw_d,d2=bigd,
- h=hf+epsilon, $fn=bigd*PI*2 );
+ h=hf+epsilon, $fn=fnd*bigd);
translate([0,0,st_shell+st_nut_h+st_shell+hf-epsilon])
- cylinder(d=bigd,h=fsw+1,$fn=bigd*PI*2);
+ cylinder(d=bigd,h=fsw+1,$fn=fnd*bigd);
}
}
}
} // translate
// pushfit bracket
@@ -230,42 +232,42 @@ module the_extruder(
rotate([-90,0,0])
translate([0,0,mount_d/sqrt(2)/2+mount_screw_d-gearbox_d/2/*TODO:*/])
cylinder(r=min(body_h-filament_elevation,filament_elevation)/sin(60)-epsilon,h=pf_h(pf)+gearbox_d/2/*TODO:*/,$fn=6);
}//union (first child of difference)
// protrusion
translate([0,0,-1])
- cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=2*PI*protrusion_d);
+ cylinder(d=protrusion_d+protrusion_tolerance_h,h=protrusion_h+protrusion_tolerance_v+1,$fn=fnd*(protrusion_d+protrusion_tolerance_h));
// mount screw holes
for(zr=[0:90:359]) rotate([0,0,zr]) translate([mount_d/2,0,0]) {
translate([0,0,mount_screw_l-mounthole_depth/2-layer_height-1])
mirror([0,0,1])
cylinder(d=mount_screw_d+mount_screw_d_tolerance,
h=mount_screw_l-mounthole_depth/2-layer_height+1,
- $fn=2*PI*mount_screw_d);
+ $fn=fnd*(mount_screw_d+mount_screw_d_tolerance));
translate([0,0,mount_screw_l-mounthole_depth/2])
- cylinder(d=mount_screwhead_d,h=body_h+1,$fn=2*PI*mount_screwhead_d);
+ cylinder(d=mount_screwhead_d,h=body_h+1,$fn=fnd*mount_screwhead_d);
}//for
// pushfit
translate([0,0,filament_elevation])
rotate([0,0,45]) translate([pulley_d/2,0,0])
rotate([-90,0,0])
translate([0,0,mount_d/sqrt(2)/2+mount_screw_d+epsilon])
rotate([0,0,180]) {
pushfit(pf);
- cylinder(d=filament_guide_d,h=gearbox_d,center=true,$fn=2*PI*filament_guide_d);
+ cylinder(d=filament_guide_d,h=gearbox_d,center=true,$fn=fnd*filament_guide_d);
translate([0,-filament_guide_d/2/sqrt(2),0])
rotate([0,0,45])
cube(size=[filament_guide_d/2,filament_guide_d/2,gearbox_d],center=true);
}
// pulley
- cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=2*PI*(pulley_d+pulley_clearance));
+ cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_clearance));
// leverspace
hull() for(x=[0,gearbox_d])
rotate([0,0,45])
translate([x,0,ls_z-ls_h/2])
- cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=2*PI*idler_d);
+ cylinder(d=idler_d+idler_clearance,h=ls_h,$fn=fnd*(idler_d+idler_clearance));
a=cos(45)*(pulley_d+idler_d)/2;
b=mount_d/2-a;
x=sqrt(pow(a,2)+pow(b,2));
translate([mount_d/2,0,ls_z])
intersection() {
@@ -282,24 +284,23 @@ module the_extruder(
mirror([0,1,0])
cube(size=[gearbox_d,gearbox_d/2+1,lever_thickness+lever_v_clearance]);
}
//translate([-mount_d/2,-longwing,filament_elevation])
if(!tensioner) translate([mount_d/2,-longwing,filament_elevation])
rotate([0,-90,0]) difference() {
- cylinder(d=spring_d+spring_d_clearance,h=spring_lc+spring_dl,$fn=PI*spring_d);
- translate([0,0,spring_lc+spring_dl]) sphere(d=spring_d*3/4,$fn=PI*spring_d);
- }
+ cylinder(d=spring_d+spring_d_clearance,h=spring_lc+spring_dl,$fn=fnd*(spring_d+spring_d_clearance));
+ translate([0,0,spring_lc+spring_dl]) sphere(d=spring_d*3/4,$fn=fnd*spring_d*3/4);
}
}//difference
if(supports) intersection() {
difference() {
translate([0,0,ls_z-ls_h/2-epsilon])
- cylinder(d=gearbox_d,h=ls_h+2*epsilon,$fn=2*PI*gearbox_d);
- cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=2*PI*(pulley_d+pulley_clearance));
+ cylinder(d=gearbox_d,h=ls_h+2*epsilon,$fn=fnd*gearbox_d);
+ cylinder(d=pulley_d+pulley_clearance,h=body_h+1,$fn=fnd*(pulley_d+pulley_clearance));
}
// supports
// TODO: hardcoded stuff below…
if(false) { // parallel
for(y=[-gearbox_d:4:gearbox_d])
translate([0,y-extrusion_width/2,0])
@@ -317,45 +318,45 @@ module the_extruder(
smalld=st_screw_d+2*extrusion_width;
bigd = spring_d+spring_d_clearance/2;
hf = (bigd-smalld)/2;
translate([-gearbox_d/2+st_shell+st_nut_h+st_shell+smalld,-longwing,filament_elevation])
rotate([0,90,0]) difference() {
union() {
- cylinder(d1=smalld,d2=bigd,h=hf,$fn=bigd*PI*2);
+ cylinder(d1=smalld,d2=bigd,h=hf,$fn=fnd*bigd);
translate([0,0,hf-epsilon])
- cylinder(d=bigd,h=hf*2,$fn=bigd*PI*2);
+ cylinder(d=bigd,h=hf*2,$fn=fnd*bigd);
}
translate([0,0,-epsilon])
- cylinder(d=st_screw_d,h=2*hf+epsilon,$fn=st_screw_d*PI*2);
+ cylinder(d=st_screw_d,h=2*hf+epsilon,$fn=fnd*st_screw_d);
}
}
module knob() {
ch = knob_indent_d/2;
translate([0,0,body_h+epsilon]) {
mirror([0,0,1]) translate([0,0,-epsilon]) {
difference() {
- cylinder(d=pulley_d,h=knob_bore_l,$fn=pulley_d*PI*2);
+ cylinder(d=pulley_d,h=knob_bore_l,$fn=fnd*pulley_d);
translate([0,0,-1]) difference() {
cylinder(d=bore_d+knob_bore_d_tolerance,h=knob_bore_l+2);
translate([-bore_d/2-1,bore_dd-bore_d/2+knob_bore_d_tolerance/2,-1])
cube([bore_d+2,bore_d/2,knob_bore_l+4]);
}
}
}
difference() {
union() {
- cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=PI*gearbox_d*2);
+ cylinder(d1=gearbox_d-2*ch,d2=gearbox_d,h=ch+epsilon,$fn=fnd*gearbox_d);
translate([0,0,ch])
- cylinder(d=gearbox_d,h=knob_h-2*ch+epsilon,$fn=PI*gearbox_d*2);
+ cylinder(d=gearbox_d,h=knob_h-2*ch+epsilon,$fn=fnd*gearbox_d);
translate([0,0,knob_h-ch])
- cylinder(d1=gearbox_d,d2=gearbox_d-2*ch,h=ch,$fn=PI*gearbox_d*2);
+ cylinder(d1=gearbox_d,d2=gearbox_d-2*ch,h=ch,$fn=fnd*gearbox_d);
}
for(a=[0:360/knob_indents:359]) rotate([0,0,a])
translate([0,gearbox_d/2,-1])
- cylinder(d=knob_indent_d,h=knob_h+2,$fn=knob_indent_d*PI*2);
+ cylinder(d=knob_indent_d,h=knob_h+2,$fn=fnd*knob_indent_d);
}
}
}//knob module
mirrorleft()
if(what=="lever") color("green",0.7) lever();