Compare commits
2 commits
5d5649ab48
...
64f75f21a7
Author | SHA1 | Date | |
---|---|---|---|
|
64f75f21a7 | ||
|
386ecc79fb |
14
README.md
14
README.md
|
@ -14,13 +14,13 @@ Copyright © Simon Brooke, 2024-2025; may be used and modified under [Creat
|
|||
|
||||
#### Parts of the following libraries are incorporated into this model
|
||||
|
||||
| Library | Author | Licence |
|
||||
| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| [BentSim](https://github.com/PRouzeau/BentSim) | [Pierre Rouzeau](https://rouzeau.net/) | [GPL](https://github.com/PRouzeau/BentSim/blob/master/LICENSE) |
|
||||
| [Sprocket Generator V2](https://www.thingiverse.com/thing:3059422) | [Hampus Andersson](https://www.thingiverse.com/haand001/designs) | [Creative Commons Attribution](https://creativecommons.org/licenses/by/4.0/) |
|
||||
| [NACA Airfoils - 4 digit fully parametric](https://www.thingiverse.com/thing:898554)] | [Rudolf Huttary](https://www.thingiverse.com/parkinbot/designs) | [Creative Commons - Attribution - Non-Commercial](https://creativecommons.org/licenses/by-nc/4.0/) |
|
||||
| | | |
|
||||
| | | |
|
||||
| Library | Referenced as | Author | Licence |
|
||||
| ------------------------------------------------------------ | ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
|
||||
| [BentSim](https://github.com/PRouzeau/BentSim) | BentSim | [Pierre Rouzeau](https://rouzeau.net/) | [GPL](https://github.com/PRouzeau/BentSim/blob/master/LICENSE) |
|
||||
| [Sprocket Generator V2](https://www.thingiverse.com/thing:3059422) | SprocketGenerator2 | [Hampus Andersson](https://www.thingiverse.com/haand001/designs) | [Creative Commons Attribution](https://creativecommons.org/licenses/by/4.0/) |
|
||||
| [NACA Airfoils - 4 digit fully parametric](https://www.thingiverse.com/thing:898554)] | | [Rudolf Huttary](https://www.thingiverse.com/parkinbot/designs) | [Creative Commons - Attribution - Non-Commercial](https://creativecommons.org/licenses/by-nc/4.0/) |
|
||||
| | | | |
|
||||
| | | | |
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,926 +0,0 @@
|
|||
//Seats, lights, Bike wheel and fenders modelisation are extracted from Velassi simulation (Velassi not published)
|
||||
// Copyright 2018-2020 Pierre ROUZEAU AKA PRZ
|
||||
// Program license GPL 4.0
|
||||
// documentation licence cc BY-SA 3 and GFDL 1.2
|
||||
// First version: 0.0 - November 2018
|
||||
//Feb 2020: Add ICE mesh seat, Hardshell seat, corrected Rans seat frame width
|
||||
//Dec 2020: Corrected hardshell viewing artifacts
|
||||
// To work, this module requires my OpenSCAD library, attached, but you can find details here:
|
||||
// https://github.com/PRouzeau/OpenScad-Library
|
||||
|
||||
//dcheck = false;
|
||||
|
||||
include <Z_library.scad>
|
||||
|
||||
//== Test of the accessories ============
|
||||
//Testing seat
|
||||
test_seat = 0; //[0:no seat view, 1:Rans mesh, 2:ICE mesh, 3: Hardshell, 9:Saddle]
|
||||
//Seat angle
|
||||
seat_a = 50; // [15:85]
|
||||
//Flag attached to seat
|
||||
seat_f=true;
|
||||
//Rear light attached to seat
|
||||
seat_l=true;
|
||||
|
||||
//Testing wheel
|
||||
test_wheel = 0; //[0:no wheel, 1:Symetrical wheel, 2:Wheel hub offset, 3:Radial spokes, 4:Disc wheel, 5:Wheel with fender]
|
||||
spoke_test = 32; // [0,3,4,5,6,8,20,24,28,32,36,42]
|
||||
|
||||
//Testing fork
|
||||
test_fork = 0; //[0:No fork, 1:Rigid fork, 2:Suspended fork, 3:Experimental Lefty, 4:User fork]
|
||||
//test viewing handlebar
|
||||
|
||||
//Testing handlebar
|
||||
test_hdl = 0; // [0:none, 1:Trike direct, 2:Cruiser 400mm long, 6:Cruiser flat 80 mm, 3:Hamster, 4:U Bar, 5:Underseat U bar with center bend]
|
||||
|
||||
if (test_seat)
|
||||
b_seat(test_seat,seat_a,0,seat_f?1000:0, seat_l?"black":"");
|
||||
|
||||
if (test_wheel==1)
|
||||
wheel(spoke_nbr=spoke_test);
|
||||
else if (test_wheel==2)
|
||||
wheel(hub_offset=10, hubdia=28, spa=10);
|
||||
else if (test_wheel==3)
|
||||
wheel(hub_offset=0, hubdia=28, spa=0, spoke_nbr=28, tire=25);
|
||||
else if (test_wheel==4)
|
||||
wheel(spoke_nbr=0);
|
||||
else if (test_wheel==5) {
|
||||
wheel(hub_offset=0, hubdia=60, spa=10.6, spoke_nbr=32);
|
||||
fender(wire_space=110, rear_angle=195, front_angle=75);
|
||||
}
|
||||
|
||||
//test viewing wheel
|
||||
if(test_fork) {
|
||||
caster_angle=12;
|
||||
perp_axis_offset=40;
|
||||
fwheel_hdia=320;
|
||||
steerer_tube_length=200;
|
||||
|
||||
fork(test_fork-1,0,400,fwheel_hdia,caster_angle,perp_axis_offset,100,steerer_tube_length,clrf="#404040");
|
||||
}
|
||||
//Test handlebar
|
||||
hdla = test_hdl==5?-110:test_hdl==4?40:test_hdl==1?10:50;
|
||||
hdl_typ = test_hdl==6?1:test_hdl==5?3:test_hdl-1;
|
||||
if(test_hdl)
|
||||
handlebar(hdl_typ, stem_length=test_hdl==1?90:test_hdl==4?-80:40,stem_ang=test_hdl==4?-15:15, hdl_ang=hdla, hdl_lg=test_hdl==6?80:400, hdl_centbend=test_hdl==5?30:0,hdl_centor=test_hdl==5?60:0);
|
||||
|
||||
//Transparent color
|
||||
glass_color = [128,128,128,32]/256;
|
||||
|
||||
|
||||
flag_img = "Library/flag_image.dxf";
|
||||
flag_scale = 3.2;
|
||||
|
||||
function tire_diam (rim=559, tire=40) = rim+2*tire+4;
|
||||
//-- spoked wheel ---------------------
|
||||
//add parameter to simulate single and double spoke crossing for small wheels
|
||||
module wheel (rim=559, tire=40, hubdia=60, hubwidth=60, spa=7.5, spoke_nbr=36, shaft_width = 140, clr_rim= [0.8,0.8,0.8], clr_tire=[0.4,0.4,0.4], hub_offset=0) {
|
||||
wh_d=rim+2*tire+4;
|
||||
//becho("wheel diam",wh_d);
|
||||
spd = 2.2; // spoke diameter
|
||||
//spokes faces
|
||||
spf = 6;
|
||||
spr = hubdia/2+5; // spoke radius
|
||||
//becho("spoke_nbr", spoke_nbr);
|
||||
rpt_spoke = spoke_nbr/4;
|
||||
spoke_ang = 360/rpt_spoke;
|
||||
radial = (spa==0) || (spoke_nbr<20);
|
||||
check()
|
||||
diff() {
|
||||
cyly(-(rim-65),78, 0,0,0,48);
|
||||
cyly(-(rim-66),122,0,0,0,48);
|
||||
}
|
||||
//tire
|
||||
color(clr_tire)
|
||||
r(90)
|
||||
rotate_extrude(convexity = 10, $fn=48)
|
||||
t(wh_d/2-tire/2, 0, 0)
|
||||
circle(r = tire/2, $fn=24);
|
||||
//rim
|
||||
color(clr_rim) {
|
||||
//rim
|
||||
diff(){
|
||||
cyly(-(wh_d-tire*2+10),0.6*tire,0,0,0, 48);
|
||||
cyly(-(wh_d-tire*2-25),60, 0,0,0, 48);
|
||||
}
|
||||
// shaft
|
||||
cyly(-9,shaft_width);
|
||||
if(spoke_nbr) {
|
||||
//hub
|
||||
cyly(-hubdia,hubwidth, 0,hub_offset);
|
||||
t(0,hub_offset)
|
||||
//flanges
|
||||
if(spoke_nbr>=20)
|
||||
dmirrory()
|
||||
cyly(hubdia+20,3, 0,hubwidth/2-3);
|
||||
//spokes
|
||||
lgspoke = rim/2-(spa?10:hubdia/2+15);
|
||||
spangle = atan((hubwidth/2+2+hub_offset)/lgspoke);
|
||||
spangle2 = atan((hubwidth/2-5+hub_offset)/lgspoke);
|
||||
spangle3= atan((hubwidth/2+2-hub_offset)/lgspoke);
|
||||
spangle4 = atan((hubwidth/2-5-hub_offset)/lgspoke);
|
||||
t(0,hub_offset)
|
||||
if(!radial)
|
||||
droty(spoke_ang,rpt_spoke-1){
|
||||
// first side
|
||||
r(0,-spa) rotz(-spangle)
|
||||
cylx(spd, lgspoke, 0,hubwidth/2+1,spr,spf);
|
||||
r(0,spa+30) rotz(-spangle2)
|
||||
cylx(spd, lgspoke, 0,hubwidth/2-5,-spr,spf);
|
||||
// other side
|
||||
r(0,360/spoke_nbr) {
|
||||
r(0,-spa) rotz(spangle3)
|
||||
cylx(spd, lgspoke, 0,-hubwidth/2-1,spr,spf);
|
||||
r(0,spa+30) rotz(spangle4)
|
||||
cylx(spd, lgspoke, 0,-hubwidth/2+5,-spr,spf);
|
||||
}
|
||||
}
|
||||
else //radial spokes
|
||||
if(spoke_nbr>=20)
|
||||
droty(spoke_ang*0.5,rpt_spoke*2-1){
|
||||
t(0,hubwidth/2+1,spr)
|
||||
rot(spangle)
|
||||
cylz(spd, lgspoke, 0,0,0, spf);
|
||||
r(0,360/spoke_nbr)
|
||||
t(0,-hubwidth/2-1,spr)
|
||||
rot(-spangle)
|
||||
cylz(spd, lgspoke, 0,0,0, spf);
|
||||
}
|
||||
else
|
||||
droty(spoke_ang*0.25,spoke_nbr-1)
|
||||
hull() {
|
||||
cylz(45,0.01);
|
||||
scale([1,0.3,1])
|
||||
cylz(60*pow(0.9,spoke_nbr),0.01, 0,0,lgspoke+spr);
|
||||
}
|
||||
}
|
||||
else
|
||||
// no spoke gives plain wheel
|
||||
hull() {
|
||||
cyly(-hubdia-35,hubwidth+12, 0,hub_offset,0, 48);
|
||||
cyly(-rim-30,35, 0,0,0, 48);
|
||||
}
|
||||
}
|
||||
} //wheel
|
||||
|
||||
//- Fenders / Mudguards ------
|
||||
//if front_angle = 0, no mudguard
|
||||
//angle 0 = horizontal
|
||||
//w_width is width of attach point of wire supports, if 0, there is no support, which is located on rear, at 8 deg from start
|
||||
module fender (wheel_rim = 559, tire_w = 47, front_angle=8, rear_angle=170, wire_space=110, clr_fender="black") {
|
||||
fender_dia = tire_w+26;
|
||||
angtot = rear_angle-front_angle;
|
||||
//becho("fender angtot",angtot);
|
||||
wheel_dia = tire_diam (wheel_rim, tire_w);
|
||||
if(front_angle!=0) {
|
||||
color(clr_fender)
|
||||
r(90, -front_angle)
|
||||
rotate_extrude(angle=angtot, convexity = 10, $fn=48)
|
||||
diff() {
|
||||
t(wheel_rim/2+tire_w/2, 0, 0)
|
||||
circle(r=fender_dia/2, $fn=48);
|
||||
//::::::::::
|
||||
t(wheel_rim/2+tire_w/2, 0, 0)
|
||||
circle(r=(fender_dia/2-1), $fn=16);
|
||||
square ([wheel_rim+tire_w,100], center=true);
|
||||
//side cut, width 10mm more than tire
|
||||
dmirrory()
|
||||
t(0,tire_w/2+5)
|
||||
square ([wheel_rim+tire_w+100,100]);
|
||||
}
|
||||
// wire supports
|
||||
supy = wire_space/2;
|
||||
ags = -atan((supy-tire_w/2-3)/(wheel_dia/2-20));
|
||||
if(wire_space)
|
||||
silver()
|
||||
r(0,-rear_angle+20)
|
||||
dmirrory()
|
||||
t(15,supy,-4)
|
||||
rotz(ags)
|
||||
cylx(4,wheel_dia/2-16, 0,0,0, 6);
|
||||
}
|
||||
}
|
||||
|
||||
module seat_light (x=-70,z=515,s_ang, light_color, vert_ext = 80) {
|
||||
if(light_color)
|
||||
mirrorx()
|
||||
t(x,0,z+42) {
|
||||
if(light_color)
|
||||
t(-75)
|
||||
r(0,79-s_ang) t(-10,0,vert_ext){
|
||||
rear_light(light_color);
|
||||
dmirrory()
|
||||
silver()
|
||||
cubez(3,15,-20-vert_ext, 10,25,20);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*/-- seat tests
|
||||
b_seat(1);
|
||||
b_seat(2);
|
||||
b_seat(3);
|
||||
*projection() r(90) b_seat(2,55,0,false,"");
|
||||
cyly (-50,380,350,0,400); // width test
|
||||
//*/
|
||||
|
||||
//== Rans recumbent mesh seat ======
|
||||
module rans_seat (s_ang=45, fold=0, width=400, sflag=true, light_color="black"){
|
||||
//Width at base, top of seat have less width than the base (~ 30mm)
|
||||
prec = 12;
|
||||
dt = 22; // frame tube diameter
|
||||
//cubez (500,500,1,0,0,700);
|
||||
//check height
|
||||
cx=-6; cz=112; // rotation centre at hip
|
||||
//---------------------------
|
||||
t(cx,0,cz) {
|
||||
//cyly(-5,600);
|
||||
//nominal width of 380 will give bottom width of 400
|
||||
mirrorx()
|
||||
r(0,s_ang)
|
||||
t(cz,0,-cx)
|
||||
t(30,0,10) r(0,-79) {
|
||||
|
||||
scale ([1,width/400,1]) {
|
||||
black()
|
||||
hull() {
|
||||
cylz (20,1, 85,0,0, prec);
|
||||
cylz (30,1, 85,0,-10, prec);
|
||||
dmirrory()
|
||||
cylz (20,10, 0,28,0, prec);
|
||||
}
|
||||
t(-174,0,155) {
|
||||
red()
|
||||
cyly(-3,420, 0,0,0, prec);
|
||||
r(0,-fold) {
|
||||
mirrorx()
|
||||
seat_light(-60,455,s_ang,light_color, 60);
|
||||
//flag
|
||||
if(sflag) t(-110,-175,540)
|
||||
r(0,50-s_ang) flag();
|
||||
// width check
|
||||
//cyly(-20,372,-106,0,535, 6);
|
||||
//cyly(-20,400,10,0,-40, 4);
|
||||
}
|
||||
}
|
||||
gray()
|
||||
dmirrory()
|
||||
tb_yx(dt,-75,48, prec)
|
||||
cyly(dt,84, 0,0,0, prec)
|
||||
r(0,-90)
|
||||
tb_yx(dt,75,45, prec)
|
||||
cyly(dt,57.6, 0,0,0,prec) {
|
||||
r(28,26)
|
||||
cylz(15,150, 0,0,0, prec)
|
||||
tb_zx(15,250,6, prec);
|
||||
tb_yx(dt,75,45, prec)
|
||||
cyly(dt,40, 0,0,0, prec)
|
||||
r(0,41.8)
|
||||
rotz(fold) r(1.5){
|
||||
//back
|
||||
cyly(dt,40, 0,0,0, prec) {
|
||||
tb_yx(dt,-500,20, prec)
|
||||
cyly(dt,30, 0,0,0, prec)
|
||||
tb_yx(dt,500,3, prec) {
|
||||
//medium transversal bar
|
||||
r(-5,69.5)
|
||||
t(0,0,-4)
|
||||
tb_xz(12,500,21.6, prec);
|
||||
tb_yx(dt,500,17, prec)
|
||||
cyly(dt,30, 0,0,0, prec)
|
||||
tb_yx(dt,-120,30, prec)
|
||||
cyly(dt,20, 0,0,0, prec){
|
||||
cyly(dt,20, 0,0,0, prec);
|
||||
//top transversal bar
|
||||
r(-5,70)
|
||||
t(0,0,-4)
|
||||
tb_xz(12,500,20.9, prec);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module flag (lg=1000, imgfile=flag_img, imgscale=flag_scale, fclr = ["orangered","lime"]) {
|
||||
|
||||
module imp_img(imgfile) {
|
||||
linear_extrude(height=2, center=true)
|
||||
import(file=imgfile);
|
||||
}
|
||||
//pole
|
||||
silver() {
|
||||
cyly(-22,10, 0,0,0, 12);
|
||||
cylz(6,lg, 0,0,0, 6);
|
||||
}
|
||||
//flag
|
||||
t(12,0,lg){
|
||||
color(fclr[0])
|
||||
hull() {
|
||||
cylz(2,-160, -12,0,0,4);
|
||||
cylz(2,2, -250,0,0, 4);
|
||||
}
|
||||
//Image set on flag
|
||||
t(-108,2, -88)
|
||||
r(90) color(fclr)
|
||||
scale([imgscale,imgscale,1]) {
|
||||
imp_img(imgfile);
|
||||
t(0,0,4)
|
||||
imp_img(imgfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//== ICE recumbent mesh seat ======
|
||||
//ICE frame designed from photo, so accuracy may be limited
|
||||
module ICE_seat (seat_angle=45,width=380, sflag=true, light_color="black") {
|
||||
prec= 12;
|
||||
dt = 25.4;
|
||||
wd = width-dt;
|
||||
module cxl(d,l) {
|
||||
cylx (d,l,0,0,0,prec)
|
||||
children();
|
||||
}
|
||||
module transv(dx=0) {
|
||||
t(dx)
|
||||
//render()
|
||||
r(45)
|
||||
cyly(dt-1,-60, 0,0,0, prec)
|
||||
tb_yz(dt,-50,-45, prec)
|
||||
//t(0,0.1) // stop CGAL error
|
||||
cyly(dt,-wd/2+50, 0,0,0, prec)
|
||||
children();
|
||||
}
|
||||
cx=-6; //cx, cz rotation center coord
|
||||
cz=112;
|
||||
t(cx,0,cz) {
|
||||
//red()cyly(-5,600);
|
||||
r(0,-seat_angle+52.8,0)
|
||||
t(-cx,0,-cz) {
|
||||
//-- rear light ---------------
|
||||
seat_light(-370,375,seat_angle+26,light_color, 60);
|
||||
//-- seat -------------------
|
||||
color("gray")
|
||||
mirrorx()
|
||||
//render()
|
||||
dmirrory()
|
||||
t(185,wd/2,10)
|
||||
r(0,24)
|
||||
tb_xz(dt,-200,40, prec)
|
||||
cxl(dt,-50){
|
||||
transv(15);
|
||||
//back bend
|
||||
tb_xz(dt,100,78, prec)
|
||||
cxl(dt,-100){
|
||||
transv(65);
|
||||
tb_xz(dt,-200,14, prec)
|
||||
cxl(dt,-190){
|
||||
transv(60);
|
||||
tb_xz(dt,200,20, prec)
|
||||
cxl(dt,-150)
|
||||
transv(80);
|
||||
}
|
||||
}
|
||||
}
|
||||
//flag
|
||||
if(sflag) t(410,-wd/2,525)
|
||||
r(0,-25+seat_angle,0) rotz(180) flag();
|
||||
} //r, t
|
||||
} // -t
|
||||
}
|
||||
|
||||
module hardshell_seat (seat_angle=45,wd=300, sflag=true, light_color="black", thk = 16) {
|
||||
$wd = wd;
|
||||
$prec=64;
|
||||
reinf_dist = 80;
|
||||
|
||||
module shape (wd=$wd,mirr=true) {
|
||||
u() {
|
||||
hull() {
|
||||
dmirrory(mirr)
|
||||
t(0,wd/2-thk/2)
|
||||
circle (d=thk, $fn=12);
|
||||
if(!mirr)
|
||||
square([thk,thk],center=true);
|
||||
}
|
||||
dmirrory(mirr)
|
||||
hull() {
|
||||
t(25,reinf_dist)
|
||||
circle (d=25, $fn=12);
|
||||
t(5,reinf_dist)
|
||||
square ([25,25],center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module rshp (radius=100,ang=90, wd=$wd,mirr=true) {
|
||||
sang = radius<0?ang:-ang;
|
||||
dx = (1-cos(sang))*radius;
|
||||
dy = sin(sang)*-radius;
|
||||
t(radius)
|
||||
rotate_extrude(angle=sang, $fn=$prec, convexity=4)
|
||||
translate([-radius,0,0])
|
||||
shape(wd,mirr);
|
||||
t(dx,dy-0.1)
|
||||
rotz(sang)
|
||||
mirrorz()children();
|
||||
}
|
||||
|
||||
module srt (a=-25,wd=$wd) {
|
||||
diff() {
|
||||
tslz(-sign(a)*wd/2)
|
||||
r(a)
|
||||
tslz(sign(a)*wd/2)
|
||||
children();
|
||||
//::::::::::::
|
||||
cubey(99,-199,999);
|
||||
cubez(99,399,sign(a)*399, 0,99);
|
||||
}
|
||||
}
|
||||
//Convexity 4 required to eliminate viewing artifacts
|
||||
module tshp (lg,wd=$wd,mirr=true) {
|
||||
r(-90)
|
||||
linear_extrude(height=lg,center=false, convexity=4)
|
||||
shape(wd,mirr);
|
||||
t(0,lg-0.1)
|
||||
children();
|
||||
}
|
||||
//------------------
|
||||
cx=-6; cz=112; // rotation centre at hip
|
||||
//---------------------------
|
||||
|
||||
t(cx,0,cz) {
|
||||
//red() cyly(-5,600);
|
||||
|
||||
r(0,-seat_angle+60)
|
||||
t(-cx,0,-cz)
|
||||
t(-130,0,-10) {
|
||||
//-- rear light ---------------
|
||||
seat_light(-415,540,seat_angle+19,light_color, 25);
|
||||
//-- flag ----
|
||||
if(sflag)
|
||||
mirrorx()
|
||||
t(-492,-97,590)
|
||||
r(0,-seat_angle+32) flag();
|
||||
// shell
|
||||
gray()
|
||||
r(90,90)
|
||||
rotz(32+5) diff() {
|
||||
rshp(100,40)
|
||||
tshp(55)
|
||||
rshp(-150,70)
|
||||
tshp(100)
|
||||
rshp(200,14)
|
||||
tshp(100)
|
||||
rshp(-400,42)
|
||||
;
|
||||
//:::::::::::
|
||||
//headrest cut
|
||||
dmirrorz()
|
||||
t(-200,680,100)
|
||||
rotz(60)
|
||||
r(-21)
|
||||
cubez(199,399,399);
|
||||
//Base nose cut
|
||||
dmirrorz()
|
||||
t(40,60,90)
|
||||
rotz(-30)
|
||||
r(40)
|
||||
cubez(88,255,99, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module b_seat (type=2,s_ang=55,fold=0, sflag=1000, light_color="black", wd=380){
|
||||
if(type==1) //rans mesh
|
||||
rans_seat(s_ang, fold, wd, sflag, light_color);
|
||||
else if(type==2) //ICE mesh
|
||||
ICE_seat(s_ang, wd, sflag, light_color);
|
||||
else if(type==3) //Hard shell
|
||||
hardshell_seat(s_ang, 300, sflag,light_color);
|
||||
else if (type==9) //saddle
|
||||
tslz(15)
|
||||
mirrorx()
|
||||
saddle("saddlebrown", light_color);
|
||||
}
|
||||
//-- Saddle ------------------------
|
||||
|
||||
module saddle(seat_color="saddlebrown", light_color="black") {
|
||||
color(seat_color)
|
||||
hull() {
|
||||
dmirrory()
|
||||
t(-80,60)
|
||||
sphere (r=25, $fn=24);
|
||||
t(115,0,3)
|
||||
sphere (r=20, $fn=24);
|
||||
}
|
||||
if(light_color)
|
||||
t(-100,0,-60) {
|
||||
rear_light(light_color);
|
||||
black()
|
||||
dmirrory() {
|
||||
cubez(2.5,15,25, 9,25,10);
|
||||
cubex(20,15,2.5, 9,25,34);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//== SHOCK with eyes ==============
|
||||
//Dist = length eye to eye without compression, travel = compression travel, sag = compression at nominal load {~20% of travel)
|
||||
module shock (dist = 190, travel=50, sag=10) {
|
||||
gray() {
|
||||
duplx(dist-sag) {
|
||||
diff() {
|
||||
u(){
|
||||
cyly(-23,14);
|
||||
cyly(-18,24);
|
||||
}//::::::::::
|
||||
cyly(-8,99);
|
||||
}
|
||||
cyly(-8,55);
|
||||
}
|
||||
cylx(15,dist-sag-16, 8);
|
||||
cylx(28,dist-sag-30, 15);
|
||||
cylx(48,20, 20);
|
||||
cylx(47,dist*0.5, 18);
|
||||
}
|
||||
}
|
||||
|
||||
//== FORK ===========================
|
||||
//Fork parameters:style= fork type, stro = steering rotation angle, flg = perpendicular distance between bearing bottom and wheel axis, casta = caster_angle, pao = perpendicular axis offset, fwhd = wheel hald diameter, stl= steerer tube length, stb = steering bottom bearing height space, htb = header tube height, clrf= fork color
|
||||
|
||||
module fork (style=0, stro=0, flg=380, fwhd=325, casta=18, pao=47, OLD=100, stl = 180, stb=5, htb=115, clrf = "black") {
|
||||
steerdia = 28.6;
|
||||
rad = 125; //dropout bend radius
|
||||
toprad = 100; //top bend radius
|
||||
//pao = perp_axis_offset;
|
||||
sgn = sign(pao);
|
||||
fang = acos((rad-abs(pao))/rad);
|
||||
//fwhd = fwheel_hdia;
|
||||
//move to wheel center and tilt of caster_angle value
|
||||
t(0,0,fwhd)
|
||||
r(0,casta)
|
||||
t(pao) rotz(stro) t(-pao){
|
||||
if (style==3) //User programmed fork
|
||||
user_fork1();
|
||||
else if (style==2) //Experimental lefty
|
||||
xlefty();
|
||||
else if (style==1) //suspended fork
|
||||
stsusp();
|
||||
else
|
||||
st();
|
||||
//steerer tube
|
||||
gray()
|
||||
cylz(steerdia,stl, pao,0,flg);
|
||||
}
|
||||
//rigid fork - bent dropout style
|
||||
module st () {
|
||||
lgstr = flg-88-rad*sin(fang);
|
||||
hhang = atan((8+OLD/2-50)/lgstr);
|
||||
color(clrf)
|
||||
mirrorx(pao<0)
|
||||
dmirrory() {
|
||||
t(0,OLD/2+4,0)
|
||||
diff() {
|
||||
r(hhang)
|
||||
r(0,fang-90)
|
||||
tb_xz(24,rad,-fang)
|
||||
cylx(24,lgstr)
|
||||
tb_xy(24,-toprad,-60);
|
||||
//:::::::::::::
|
||||
cyly(-24,66);
|
||||
}
|
||||
cyly(-32,8, 0,OLD/2+4);
|
||||
}
|
||||
color(clrf)
|
||||
cylz(steerdia+5,-40, pao,0,flg);
|
||||
}
|
||||
//suspended fork
|
||||
module stsusp () {
|
||||
tubsp = 106;
|
||||
tubdia = 28;
|
||||
postube = pao-sign(pao)*20;
|
||||
dmirrory() {
|
||||
color(clrf) {
|
||||
cylz(tubdia+15,250, postube,tubsp/2,5);
|
||||
hull() {
|
||||
cylz(steerdia+15,-40, pao,0,flg);
|
||||
cylz(tubdia+12,-40, postube,tubsp/2,flg-20);
|
||||
}
|
||||
hull() {
|
||||
cyly(-32,8, 0,OLD/2+4);
|
||||
cylz (12,50, postube,tubsp/2,5);
|
||||
}
|
||||
}
|
||||
silver()
|
||||
cylz(tubdia,flg-60, postube,tubsp/2,20);
|
||||
}
|
||||
}
|
||||
// Experimental 'lefty' fork
|
||||
module xlefty (sideoff=-60, shock_ang=-38) {
|
||||
//stb = steer_bbht==undef?5:steer_bbht;
|
||||
//htb = head_tube_height==undef?stl-50:head_tube_height;
|
||||
harm_ang = 15; // articulated arm angle from horizontal
|
||||
hang = -casta+harm_ang;
|
||||
bang=32;
|
||||
armlg = -220; // axis to axis arm length
|
||||
sa = sign(armlg);
|
||||
vrad = 200;
|
||||
vdia=50;
|
||||
// first length segment calc
|
||||
xar = armlg*cos(hang);
|
||||
xb=(1-cos(bang))*vrad*sa;
|
||||
stlg = (xar-xb-pao)/sin(bang);
|
||||
//top segment
|
||||
yar = armlg*sin(hang);
|
||||
yb = sin(bang)*vrad;
|
||||
vlgb = flg+yar-yb-sa*stlg*cos(bang);
|
||||
vlg = vlgb+2*stb+htb+20;
|
||||
//Attach to pivot
|
||||
module side_plate () {
|
||||
hull() {
|
||||
cylz(vdia+12,-8, pao);
|
||||
cylz(40,-8, pao,-sideoff);
|
||||
}
|
||||
}
|
||||
|
||||
//Bottom tube segment
|
||||
silver()
|
||||
cylz(28.6,-10, pao,0,flg-8);
|
||||
// fork
|
||||
t(0, sideoff) {
|
||||
color(clrf) {
|
||||
cyly(-18,60);
|
||||
r(0,hang) {
|
||||
//arm
|
||||
cylx(50,armlg+sa*40,-sa*20)
|
||||
cyly(-18,60,-sa*20);
|
||||
//support tube
|
||||
t(armlg) {
|
||||
diff() {
|
||||
r(0,-sa*bang-hang-90)
|
||||
cylx(vdia,sa*stlg-30,30)
|
||||
tb_xz(vdia,-sa*vrad,-bang)
|
||||
cylx(vdia,vlg)
|
||||
;
|
||||
//:::::::::::::::
|
||||
r(0,sa*15)
|
||||
cylx(-80,166);
|
||||
}
|
||||
//arm axis fork
|
||||
mirrorx (sa<0)
|
||||
hull() {
|
||||
cyly(-30,80);
|
||||
r(0,15)
|
||||
diff() {
|
||||
cylx(-80,87, -35);
|
||||
//::::::::::::
|
||||
cubez(222,111,-111, 0,0,10);
|
||||
r(0,40)
|
||||
cubez(222,111,-111, 0,0,-20);
|
||||
cylx(-70,222);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//shafts
|
||||
gray() {
|
||||
cyly(-14,70);
|
||||
r(0,hang)
|
||||
cyly(-14,90, armlg);
|
||||
}
|
||||
// Attach plates
|
||||
color(clrf) {
|
||||
tslz(flg)
|
||||
side_plate();
|
||||
tslz(flg+2*stb+htb)
|
||||
mirrorz()
|
||||
side_plate();
|
||||
}
|
||||
//shock
|
||||
r(0,hang)
|
||||
t(armlg*0.6,0,40) {
|
||||
r(0,-90+sa*harm_ang+sa*shock_ang) {
|
||||
shock(190,50,15);
|
||||
color(clrf)
|
||||
mirrorz(sa<0)
|
||||
dmirrory()
|
||||
t(190-15)
|
||||
hull() {
|
||||
cyly(28,5, 0,12);
|
||||
cubey(60,5,1, 16,12,-45);
|
||||
}
|
||||
}
|
||||
color(clrf)
|
||||
dmirrory()
|
||||
hull() {
|
||||
cyly(28,5, 0,12);
|
||||
cubey(60,5,1, 0,12,-30);
|
||||
}
|
||||
}
|
||||
} // sideoff
|
||||
} //xlefty
|
||||
} //fork
|
||||
|
||||
//== Handlebar ======================
|
||||
module handlebar (hdl_type=0, stem_length=40,stem_height=40,stem_ang=15,hdl_ang=60,hdl_lg=400,hdl_bend=37.5, hdl_width_central_extent=0,
|
||||
hdl_centbend=0,hdl_centor=0,hdl_lg2=200, dcheck=false, d_line=1) {
|
||||
//sgo = sign(stem_length);
|
||||
sgo = stem_length>0?1:-1;
|
||||
//stem_ang = OSS_handlebar?20:0;
|
||||
sto = sign(stem_height)*27; // stem shaft axis offset
|
||||
//depending its length 'cruiser' handlebar go from chopper type to near flat mountain bike bar through town type.
|
||||
crui_a = hdl_lg>150?90:20+(hdl_lg-50)*0.70;
|
||||
if (dcheck)
|
||||
red()
|
||||
cubez(d_line,666,555);
|
||||
silver() {
|
||||
//stem pivot shaft
|
||||
cylz(25,-stem_height-sto, 0,0,sto);
|
||||
cylz(-36,40);
|
||||
r(0,-stem_ang) {
|
||||
//stem
|
||||
cylx(32,sgo*(abs(stem_length)+40),-sgo*20);
|
||||
//handlebar
|
||||
t(stem_length)
|
||||
r(0,hdl_ang+stem_ang)
|
||||
dmirrory()
|
||||
if(hdl_type==0){ //trike direct
|
||||
cylz(22,10)
|
||||
cylz(30,120);
|
||||
}
|
||||
else if(hdl_type==1){ //cruiser
|
||||
cyly(22,40)
|
||||
tb_yz(22,-70,crui_a)
|
||||
r(0,-20)
|
||||
cyly(22,abs(hdl_lg-140))
|
||||
tb_yz(22,70,crui_a)
|
||||
cyly(22,10)
|
||||
cyly(32,120);
|
||||
}
|
||||
else if(hdl_type==2) { // Hamster
|
||||
cylz(22,hdl_lg)
|
||||
tb_yx(22,80,18)
|
||||
cyly(22,40)
|
||||
cyly(30,120);
|
||||
}
|
||||
else if(hdl_type==3) { //U Bar
|
||||
// if handlebar length = 420, this is a metabike Ubar
|
||||
centpart = hdl_width_central_extent>0||hdl_centbend; // if true, central bent part
|
||||
cyly(25,30)
|
||||
cyly(25,hdl_width_central_extent/2)
|
||||
r(0,hdl_centor)
|
||||
tb_yx(25,50,hdl_centbend/2)
|
||||
r(0,-hdl_centor)
|
||||
cyly(25,centpart?120:0)
|
||||
cyly(22,centpart?27:147)
|
||||
tb_yx(22,50,80)
|
||||
cyly(22,hdl_lg-270)
|
||||
r(0,90)
|
||||
tb_yx(22,50,hdl_bend)
|
||||
cyly(22,(hdl_lg2-120)/2)
|
||||
cyly(30,120)
|
||||
cyly(22,(hdl_lg2-120)/2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//== Lighting ======================
|
||||
module rear_light (clr="black", z=15) {
|
||||
//light
|
||||
tslz(z) {
|
||||
color(clr)
|
||||
hull() dmirrory() {
|
||||
cylx(45,-10, 0,30);
|
||||
cylx(30,8, 0,30);
|
||||
}
|
||||
red()
|
||||
hull() dmirrory()
|
||||
cylx(44,10, -20,30);
|
||||
color(glass_color)
|
||||
hull() dmirrory()
|
||||
cylx(44,2, -22,30);
|
||||
}
|
||||
}
|
||||
|
||||
//front_light (-20, false);
|
||||
|
||||
module front_light (st_ang=0, steer_bracket=0, clr = "black"){
|
||||
//support (normal type on fork)
|
||||
if(steer_bracket==1) {
|
||||
t(25)
|
||||
r(0,st_ang)
|
||||
flight();
|
||||
//steering bracket
|
||||
silver() {
|
||||
hull(){
|
||||
cylz(34,2.5, 0,0,-1);
|
||||
cyly(-2.5,26, 25);
|
||||
}
|
||||
t(25)
|
||||
r(0,st_ang)
|
||||
hull() {
|
||||
cyly(-2.5,26);
|
||||
cylx (-12,2.5, 0,0, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
//on top of fork
|
||||
else if(steer_bracket==2) {
|
||||
tslz (-10-20)
|
||||
flight(st_ang);
|
||||
}
|
||||
//above boom
|
||||
else if(steer_bracket==3) {
|
||||
silver() {
|
||||
cubez(3,20,60, 22);
|
||||
dmirrory()
|
||||
cubez(10,3,60, 22-5,8.5);
|
||||
}
|
||||
t(22,0,42) flight();
|
||||
}
|
||||
else // simple light
|
||||
flight();
|
||||
//-- light with own bracket --------
|
||||
module flight(an=0) {
|
||||
//light bracket
|
||||
silver()
|
||||
hull() {
|
||||
cyly(-14,10, 20,0,35);
|
||||
cylx(-12,2.5, 3,0, 10);
|
||||
}
|
||||
//light
|
||||
t(33,0,40) r(0,an) {
|
||||
color(clr)
|
||||
hull() {
|
||||
cylx(50,20,0,0,15);
|
||||
cylx(30,-20,0,0,15);
|
||||
}
|
||||
silver()
|
||||
cylx(48,1, 20,0,15);
|
||||
color (glass_color)
|
||||
cylx(48,2, 22,0,15);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=== Miscellaneous utilities ===
|
||||
//tube bend AND displacement
|
||||
module tb_yx (dtube=25,radius=100,ang=90, prec=24) {
|
||||
sang = radius<0?ang:-ang;
|
||||
dx=-(1-cos(sang))*-radius;
|
||||
dy=sin(sang)*-radius;
|
||||
t(radius)
|
||||
rotate_extrude(angle=sang, $fn=64, convexity=10)
|
||||
t(-radius)
|
||||
circle(d=dtube, $fn=prec);
|
||||
t(dx,dy)
|
||||
rotz(sang)
|
||||
children();
|
||||
}
|
||||
|
||||
module tb_xy (dtube=25,radius=100,ang=90, prec=24) {
|
||||
rotate([0,0,90])
|
||||
tb_yx(dtube,radius,ang, prec)
|
||||
rotate([0,0,-90]) children();
|
||||
}
|
||||
|
||||
module tb_xz (dtube=25,radius=100,ang=90, prec=24) {
|
||||
r(90) rotz(90)
|
||||
tb_yx(dtube,radius,ang, prec)
|
||||
r(-90,0,-90) children();
|
||||
}
|
||||
|
||||
module tb_yz (dtube=25,radius=100,ang=90, prec=24) {
|
||||
rotate([0,90,0])
|
||||
tb_yx(dtube,radius,ang, prec)
|
||||
rotate([0,-90,0])
|
||||
children();
|
||||
}
|
||||
|
||||
module tb_zx (dtube=25,radius=100,ang=90, prec=24) {
|
||||
r(90)
|
||||
tb_yx(dtube,radius,ang, prec)
|
||||
rotate([-90,0,0]) children();
|
||||
}
|
||||
|
||||
module tb_zy (dtube=25,radius=100,ang=90, prec=24) {
|
||||
r(0,90) rotz(90)
|
||||
tb_yx(dtube,radius,ang, prec)
|
||||
rotate ([0,0,-90])
|
||||
rotate([0,-90,0])
|
||||
children();
|
||||
}
|
||||
|
||||
//------------------------------
|
||||
module check () {
|
||||
if(dcheck)
|
||||
red()
|
||||
children();
|
||||
}
|
Binary file not shown.
|
@ -1,171 +0,0 @@
|
|||
//*******************************
|
||||
include <Z_library.scad>
|
||||
//Mid Drive bike motors
|
||||
mpart = 0; // [0:None, 1:TSDZ2, 2: Bikee Lightest, 3: Both, 4:Frame battery]
|
||||
Bikee_x = 0;
|
||||
Bikee_z = 0;
|
||||
Bikee_ang = 0;
|
||||
Bikee_idler= -10;
|
||||
|
||||
//Battery
|
||||
mpart2=0; // [0:None, 1:frame battery, 2:frame ht 90, 3:rack , 4:Prismatic]
|
||||
|
||||
if (mpart2)
|
||||
t(0,0,400)
|
||||
battery (mpart2-1);
|
||||
|
||||
if(mpart==1 || mpart==3)
|
||||
TSDZ2();
|
||||
else if(mpart==2 || mpart==3)
|
||||
bikee_lt();
|
||||
else if (mpart==4)
|
||||
frame_batt();
|
||||
|
||||
$fn=36;
|
||||
//cyly(-52,68, 0,0,0, 64); // Check BB
|
||||
//reference is BB shaft axis. Positioned for 68 BB. shall be moved sideway by 2.5mm for BB of 73mm width
|
||||
|
||||
//-- Mid drive motor TSDZ2 ------------
|
||||
module TSDZ2 (yoffset=0, clr="gray") {
|
||||
t(0,-yoffset-7) {
|
||||
color(clr) {
|
||||
cyly(-33.5,100, 0,0,0, 24);
|
||||
cyly(-80,105, 28,14.5,-60, 32);
|
||||
cyly(130,16, 0,-43,0, 36);
|
||||
hull() {
|
||||
cyly(-50,100, 21,12,-52, 24);
|
||||
duplz(-30)
|
||||
cyly(-50,100, -21,12,-52, 24);
|
||||
diff() {
|
||||
cyly(-215,100, -5,12,0, 64);
|
||||
//:::::::::::::
|
||||
cubez(222,333,222,0,0,-52);
|
||||
r(0,-75)
|
||||
cubez(222,333,222);
|
||||
r(0,60)
|
||||
cubez(222,333,222);
|
||||
}
|
||||
}
|
||||
//Anchor
|
||||
diff() {
|
||||
hull() {
|
||||
cyly(-16,30, -60,5,-32, 16);
|
||||
cyly(-20,30, -30,5,-37, 16);
|
||||
}
|
||||
cyly(-7,99, -60,0,-32, 12);
|
||||
}
|
||||
}
|
||||
silver() {
|
||||
cyly (-176,2.2, 0,-50.2+7);
|
||||
cyly (-18,150, 0,-5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Italian company 'Bikee' designed a mid-drive they called modestly "The lightest". It is positioned in front of the chainring. This is an interesting design as it doesn't need a special frame and its installation is cleaner than others second mount mid-drives. Though they did not invent the system well proved before by the 'powerplay' motor sold by Canadian 'Rocky mountain' company and designed by 'Propulsion Powercycle company'. Uuuh, seems that some mid-drive sellers have difficulties to create discriminating names, just to make web search the most difficult possible ?
|
||||
//Could be found here:
|
||||
module bikee_lt (x=Bikee_x, y=0, z=Bikee_z, ang=Bikee_ang, idler_ang=Bikee_idler) {
|
||||
//cyly (-3,300);
|
||||
t(x,y,z) r(0,-ang-29)
|
||||
t(-63)r(0,18) { // move to sprocket axis
|
||||
gray() {
|
||||
// motor ??
|
||||
hull() {
|
||||
cyly(72,-35);
|
||||
cyly(65,-40);
|
||||
}
|
||||
hull() {
|
||||
cyly(88,70, 44,-25);
|
||||
cyly(72,55, 0,-25);
|
||||
}
|
||||
//sprocket bearing holder
|
||||
r(0,-18)
|
||||
t(63,-35)
|
||||
r(0,18) {
|
||||
hull()
|
||||
duplx(-60)
|
||||
cyly(33,25);
|
||||
cyly(32,25, 0,-5);
|
||||
}
|
||||
// bearing holders
|
||||
hull() {
|
||||
cyly(25,52, 44);
|
||||
cyly(25,52, 0);
|
||||
}
|
||||
//attachs
|
||||
dmirrorz()
|
||||
diff() {
|
||||
hull() {
|
||||
r(0,34)
|
||||
cyly(11,-20, -41,10);
|
||||
cyly(40,-20, 0,10,16);
|
||||
} //::::::::::
|
||||
r(0,34)
|
||||
cyly(-5.2,111, -41,10,0, 12);
|
||||
}
|
||||
diff() {
|
||||
hull() {
|
||||
r(0,9.7)
|
||||
cyly(11,-20, 93,10);
|
||||
cyly(40,-20, 60,10,-5);
|
||||
} //::::::::::
|
||||
r(0,9.7)
|
||||
cyly(-5.2,111, 93,10,0, 12);
|
||||
}
|
||||
}
|
||||
//Sprocket
|
||||
silver() {
|
||||
r(0,-18)
|
||||
t(63) {
|
||||
cyly(15,-75, 0,20);
|
||||
cyly(-50,2, 0,-50);
|
||||
r(0,idler_ang)
|
||||
t(-48,-50) {
|
||||
cyly(-35,2);
|
||||
cyly(-20,12);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module battery (type,x=0,z=0,ang=0,ht=111, rev=true, clr="#606060") {
|
||||
color(clr)
|
||||
t(x,0,z)
|
||||
r(0,ang)
|
||||
mirrorx(rev)
|
||||
if(!type)
|
||||
frame_batt(111);
|
||||
else if(type==1)
|
||||
frame_batt(90);
|
||||
else if(type==2)
|
||||
rack_batt(lg=440);
|
||||
else if(type==3)
|
||||
prism_batt(lg=370);
|
||||
}
|
||||
//Frame batterie, Hailong style
|
||||
module frame_batt (ht=111) {
|
||||
lg = 368;
|
||||
hull() {
|
||||
dmirrory() {
|
||||
duplx(lg-70-16) {
|
||||
cylz(16,1, 16,30);
|
||||
cylz(32,4, 16,30, 12);
|
||||
cyly(40,-5, 20,30,ht-20);
|
||||
cyly(16,-1, 16,45,ht-20);
|
||||
}
|
||||
cylz(16,50, lg-16,22);
|
||||
cylz(32,50, lg-16,22,12);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Rack type battery
|
||||
module rack_batt (lg=440, ht=75, wd = 150) {
|
||||
hull()
|
||||
duplx(lg-ht)
|
||||
cyly(-ht,wd, ht/2, 0, ht/2);
|
||||
}
|
||||
//Prismatic battery
|
||||
module prism_batt (lg=370, ht=85, wd=61) {
|
||||
cubex(lg,wd,ht, 0,0,ht/2);
|
||||
}
|
|
@ -1,414 +0,0 @@
|
|||
//Deeply modified from OpenBike rider, which was itself got from http://www.thingiverse.com/thing:3495
|
||||
// Modifs 2018-2020 by Pierre ROUZEAU AKA PRZ
|
||||
// License GPL V3
|
||||
//Revised: Dec 2018, Nov 2019, Dec 2019, Feb 2020, Dec 2020
|
||||
//Feb. 2020 Improved torso with proper camber, shoulder blades protrusion and better neck junction, more leg parameters (to view amplitude in a fairing), removed pedalling animation.
|
||||
//Jan 2021, neck and head bending
|
||||
|
||||
//while the 'reference head size is fixed, now head have some proportionality to size,say head size is sizeRatio^0.4
|
||||
//Limb and body size are sizeRatio^0.6
|
||||
//This improved proportions on all sizes and small sizes resemble more children than dwarf
|
||||
//Children are not reduced adults, they have different proportions
|
||||
//Feet size is proportional to leg length
|
||||
//Unfortunately, this did increased the calculation time, now around 5 seconds on an old desktop
|
||||
//You can adjust the height (without helmet and shoes).
|
||||
//Leg/torso proportion is now adjustable
|
||||
//More realistic shoe shape
|
||||
//The rider is not completely accurate on anthropometric viewpoint as his/her articulations are in the middle of the limbs, which is far from the reality and troubles dimensions whith folded limbs, which is a common problem in posable models. Very surprisingly, this is the only posable model I found on OpenSCAD. This model was taken from the openbike site (http://en.openbike.org/wiki/OpenSCAD), with corrections of angles errors sign and foot articulation center. I did extended modifications to improve the anthropometric proportions. His/her dimensions are now proportional to head size as common practice. It can be taller or smaller with a fixed head size and articulation are repositioned based upon that.
|
||||
//There is some unchecked attempt to correct the misplaced hip articulation (modified leg length when rotating it)
|
||||
//Also, its design is now adimensional and you can use whatever unit you wish, just giving reference head size and whole size in these units.
|
||||
//This model was itself got from thingiverse model designed as a groom of a wedding cake topper, so no surprise this was not the most accurate human proportions! The initial author may be surprised by what we made from its 3D printed model even if few (if any) of the original code survived the evolution.
|
||||
//There was a very detailed and accurate project for human models (based on bones), but unfortunately not finished here: https://github.com/davidson16807/relativity.scad/wiki/Human-Body
|
||||
//Basing articulations on skeleton is the only way to have accurate dimensions when flexing limbs, but you shall fill in flesh after and that is complex with OpenScad.
|
||||
//you can find information on anthropometry here:
|
||||
//https://design.tutsplus.com/articles/human-anatomy-fundamentals-basic-body-proportions--vector-18254
|
||||
//in french : http://villemin.gerard.free.fr/Biologie/CorpsPro.htm
|
||||
//An interesting program to design models (not tested): http://terawell.net/terawell/
|
||||
|
||||
/*[Hidden]*/
|
||||
$fn = 24;
|
||||
// Rider was originally based on groom from http://www.thingiverse.com/thing:3495 now hugely modified.
|
||||
//rider types
|
||||
r_none=0;
|
||||
r_pedal=1;
|
||||
r_groundleg=2;
|
||||
r_seated=3;
|
||||
r_stood=4;
|
||||
r_noleg=5;
|
||||
|
||||
/*[Display]*/
|
||||
//Rider type
|
||||
r_type = 0; //[0:None, 1:Pedalling, 2:Foot on ground, 3:Seated, 4: Stood, 5:No leg]
|
||||
rider_check=false;
|
||||
//test seat angle (from horizontal)
|
||||
test_seat_ang = 62;
|
||||
test_leg_ang = -30;
|
||||
test_head_ang = 0;
|
||||
|
||||
/*[Sizes]*/
|
||||
//head reference size, all body proportional to this, 225mm or 8.9 inches, rider design is adimensional
|
||||
head = 225;
|
||||
//Actual height without shoes and helmet, use same units as head
|
||||
r_height = 1700;
|
||||
|
||||
//Foot extend below foot reference plane to take into account shoes. Head reference plane is below ovoid as a real head is not that pointy, so real height is an approximation.
|
||||
//calculations
|
||||
//reference size, for internal calculation only
|
||||
//below ref_height is traditional body reference, size equal to eight time the head
|
||||
//Note that the ovoid head is taller than this dimensions as a real head is not ovoid
|
||||
ref_height = 8*head;
|
||||
hd = head/2; //half head height
|
||||
|
||||
//Attempt (rough and experimental) to take into account that the hip articulation is above the model hip center, which position the knee farther than a centered model when upper leg goes horizontal.
|
||||
//When leg is extended, the correction of hip and knee uncentered articulation may give the foot 40 to 50 mm farther than the model.
|
||||
//This is better than nothing, but shall be checked
|
||||
|
||||
hip_Voffset = hd*0.39; //~40mm
|
||||
|
||||
// --------- Modules -------------
|
||||
//leg position index from animation time
|
||||
function lidx()
|
||||
= round(($t*4-floor($t*4))*8);
|
||||
function pleg(i) = $rider_t==r_stood?stood_a[i]:
|
||||
a_legs[i][lidx()];
|
||||
|
||||
//colors
|
||||
c_skin=[0.95,0.75,0.55];
|
||||
|
||||
//Last term of third array : left foot angle
|
||||
//Last term of sixth : right foot angle
|
||||
//animation not used yet
|
||||
//Positive angle modification rotate limb in counter-clockwise direction
|
||||
//arm position modification
|
||||
arm_open = 5;
|
||||
|
||||
//leg angle when stood
|
||||
stood_a = [5,12,-7,5,12,-7];
|
||||
|
||||
//Array(vector) for animation
|
||||
//yet only first parameter is used
|
||||
a_legs =
|
||||
[[73.5,80,69,56,42,42,63,78], //left leg angle
|
||||
[104,96,88,68,30,20,52,74], //left knee angle
|
||||
[-27,0,0,0,45,35,20,0], //left foot angle
|
||||
[32,43,63,78,86,80,69,57], //right leg angle
|
||||
[6,20,52,74,92,96,88,62], //right knee angle
|
||||
[8,45,22,0,10,0,0,20]]; //right foot angle
|
||||
|
||||
//long legs : 1.2, short legs : 0
|
||||
l_prop = 0.5; // [0:0.1:1.2]
|
||||
|
||||
/*[Hidden] */
|
||||
//leg proportionality coeff: 0.45 oct 2019
|
||||
lpcoef = 0.45;
|
||||
//Head size proportional power (say head = size_coef^head_prop_power
|
||||
hdpow = 0.4;
|
||||
//Limb and body size proportional power
|
||||
szpow = 0.6;
|
||||
|
||||
//function prop_rider (rsize) = (rsize-head)/7/head;
|
||||
function in_seam (rsize,lprop) = 3.6*(rsize-head)/7+lprop*lpcoef*head/2;
|
||||
//== COMPLETE RIDER ==================
|
||||
if (r_type) {
|
||||
prop = (r_height-head)/(ref_height-head);
|
||||
$hdprop = pow(((r_height/hd)/15),hdpow);
|
||||
$hdr = $hdprop*hd;
|
||||
top = 5.4*hd*prop+$hdr-lpcoef*hd*l_prop;
|
||||
bot = top-r_height;
|
||||
inseam = in_seam (r_height,l_prop);
|
||||
rotate([0,0,-90])
|
||||
veloRider(s_ang=test_seat_ang,l_ang=test_leg_ang, h_ang = test_head_ang);
|
||||
if (r_type==r_stood) { // level planes
|
||||
t(-2.5*hd,-2.5*hd,bot)
|
||||
cube([5*hd,5*hd,0.05]);
|
||||
t(-2.5*hd,-2.5*hd,bot+inseam)
|
||||
cube([5*hd,5*hd,0.05]);
|
||||
t(-2.5*hd,-2.5*hd,top)
|
||||
cube([5*hd,5*hd,0.05]);
|
||||
}
|
||||
}
|
||||
|
||||
function body_height (prop, leg_prop) = 4.45*hd*prop-0.45*hd*leg_prop;
|
||||
//==================================
|
||||
module veloRider (rh=r_height, rcolor=["red","yellow","darkblue","brown","gray"], s_ang=70, l_ang=-30, left_fold=0, h_ang=-2, leg_prop=l_prop, vfold=0, lfolda=10, rfolda=10, legspread=3, rt=r_type, lgra = -20, armp =[0,0,0,0]) {
|
||||
|
||||
$torsocolor = rcolor[0];
|
||||
$armcolor = rcolor[1];
|
||||
$legcolor = rcolor[2];
|
||||
$shoecolor = rcolor[3];
|
||||
$helmetcolor = rcolor[4];
|
||||
$vfold = vfold;
|
||||
$lfolda = lfolda;
|
||||
$rfolda = rfolda;
|
||||
$legspread = legspread;
|
||||
$rider_t = rt;
|
||||
//real head half height, partly proportional to size
|
||||
$hdprop = pow(((r_height/hd)/15),hdpow);
|
||||
$hdr = $hdprop*hd;
|
||||
seat_ang = rt==r_stood?90:s_ang; //3: stood
|
||||
leg_ang = rt==r_stood?-90:l_ang; //3: stood
|
||||
head_ang = rt==r_stood?5:h_ang; //3: stood
|
||||
|
||||
//(right) leg position modifications
|
||||
//hip angle modifier
|
||||
$legmodr=rt==r_stood?0:rt==r_groundleg?lgra:-6;
|
||||
//knee angle modifier
|
||||
$kneemodr=rt==r_stood?0:rt==r_groundleg?50:12;
|
||||
//foot angle modifier
|
||||
$footmodr=rt==r_stood?0:rt==r_groundleg?-3:-5;
|
||||
|
||||
//arm lifting angle
|
||||
$arm_lift = armp[0];
|
||||
//Arm pinching angle
|
||||
$arm_pinch = armp[1];
|
||||
//forearm lifting angle
|
||||
$farm_lift = armp[2];
|
||||
//forearm pinching angle
|
||||
$farm_pinch = armp[3];
|
||||
|
||||
//moved to have the reference level at butt
|
||||
rad_ankle = 1.3*0.83*hd;
|
||||
rda = rt==r_stood?-180:rad_ankle;
|
||||
//echo(rad_ankle=rad_ankle);
|
||||
//calculate a coefficient to adjust size
|
||||
//echo("Rider height",rh);
|
||||
prop = (rh-head)/(ref_height-head);
|
||||
//echo(prop=prop);
|
||||
$sz = hd*pow(prop,szpow);
|
||||
//echo($sz =$sz);
|
||||
inseam = in_seam(rh,leg_prop);
|
||||
riderdxz = 0.8*(hd-$sz); // correction for body size
|
||||
//echo(riderdxz =riderdxz);
|
||||
//echo($sz=$sz);
|
||||
|
||||
//if (rider_check)
|
||||
//echo("Rider inseam", round(inseam));
|
||||
//bot=-9.4*hd*prop-0.18*hd;
|
||||
//move rider to have the reference point at the butt bottom
|
||||
t(0,0,rda)
|
||||
rotate([90-seat_ang,0,90])
|
||||
t(0,-riderdxz,body_height(prop, leg_prop)/2-hd*0.42-riderdxz)
|
||||
vRider(prop, seat_ang,leg_ang, left_fold, head_ang, leg_prop);
|
||||
}
|
||||
|
||||
module vRider (prop, seat_ang, leg_ang, left_fold, head_ang, leg_prop) {
|
||||
// Proportions
|
||||
bodyHeight=body_height(prop, leg_prop);
|
||||
if(rider_check)
|
||||
echo(bodyHeight=bodyHeight);
|
||||
//armLength = 8;
|
||||
hand=[0.6,0.8,1.7]; //orientation vector
|
||||
legLength = hd*3.84*prop+leg_prop*lpcoef/2*hd; //Thigh length, equal to lower leg
|
||||
armLength = hd*3.2*prop; //
|
||||
|
||||
color($torsocolor) {
|
||||
// go to top hip
|
||||
t(0,-0.08*hd,-bodyHeight/2+0.5*hd) {
|
||||
//belly
|
||||
rshape(3.33*$sz,2*$sz,2*$sz,bodyHeight*0.4, 0.8*$sz,bodyHeight*0.04);
|
||||
//Lower rib cage
|
||||
t(0,bodyHeight*0.04,bodyHeight*0.4)
|
||||
rshape(3.5*$sz,2*$sz,2.2*$sz,bodyHeight*0.45, 0.8*$sz,-bodyHeight*0.04);
|
||||
//Top rib cage and shoulders
|
||||
t(0,0,bodyHeight*0.85)
|
||||
rshape(3.8*$sz,2.2*$sz,1.6*$sz,bodyHeight*0.15+hd*0.08, 0.8*$sz,0);
|
||||
//ref axis
|
||||
*rotate([0,90])
|
||||
cylinder(r1=0.1*hd,r2=0.1*hd,h=hd*8, center=true);
|
||||
}
|
||||
} // torso
|
||||
//----------------------------
|
||||
t(0,0,bodyHeight/2+0.21*hd) {
|
||||
// arms
|
||||
t(0,-0.08*hd,0.42*hd){
|
||||
mirror([1,0,0]) rotate([-6,0,0])
|
||||
arm(165+$arm_pinch,-15-$arm_lift,-12-$farm_pinch,25+$farm_lift,hand);
|
||||
rotate([-6,0,0])
|
||||
arm(165+$arm_pinch,-15-$arm_lift,-12-$farm_pinch,25+$farm_lift,hand);
|
||||
}
|
||||
head_ang = seat_ang-head_ang-90;
|
||||
t(0,-0.15*$sz-head_ang*$sz*0.012,1.4*$sz) {
|
||||
rotate([head_ang*0.8,0,0]) {
|
||||
// neck
|
||||
color(c_skin)
|
||||
t(0,0,0.1*$sz)
|
||||
cylinder(r1=0.54*$hdr,r2=0.58*$hdr,h=$hdr*1.8, center=true);
|
||||
}
|
||||
t(0,-0.0015*head_ang*$sz,0.004*head_ang*$sz)
|
||||
rotate([head_ang,0,0]) {
|
||||
// head
|
||||
color(c_skin)
|
||||
t(0,0,0.4*hd*prop+hd)
|
||||
rotate([-4,-1,0]) scale($hdr) scale([1,1,1.33]) sphere($fn=30);
|
||||
// helmet
|
||||
if(!rider_check)
|
||||
color($helmetcolor)
|
||||
t(0,-2.08*hd,(0.85-1.4)*$hdr)
|
||||
helmet();
|
||||
}
|
||||
}
|
||||
//LEGS
|
||||
if ($rider_t!=r_noleg)
|
||||
t(0,-0.08*hd,-bodyHeight+0.21*hd) {
|
||||
//left
|
||||
mirror([1,0,0]) leg(
|
||||
$legspread+1,
|
||||
($rider_t==r_seated?42:pleg(0)+left_fold)+seat_ang+leg_ang,
|
||||
($rider_t==r_seated?70:pleg(1))+left_fold,
|
||||
[$rider_t==r_seated?10:pleg(2),3,0]
|
||||
);
|
||||
//right
|
||||
leg(
|
||||
$rider_t==r_groundleg?7:$legspread-0.5,
|
||||
($rider_t==r_seated?42:pleg(3)+$legmodr)+seat_ang+leg_ang,
|
||||
($rider_t==r_seated?70+left_fold:pleg(4)+$kneemodr),
|
||||
[$rider_t==r_seated?10:pleg(5)+$footmodr,3,0]
|
||||
);
|
||||
//2nd leg set
|
||||
//echo($vfold=$vfold);
|
||||
if($vfold!=0) {
|
||||
$shoecolor="yellow";
|
||||
//left
|
||||
mirror([1,0,0])
|
||||
leg($legspread,$lfolda+seat_ang+leg_ang, $vfold,[3,3,0]);
|
||||
//right
|
||||
leg($legspread,$rfolda+seat_ang+leg_ang, $vfold-10,[3,3,0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------
|
||||
module helmet () {
|
||||
// FreeCAD not ok with scale parameter but work with 'hull()'
|
||||
t(0,2.08*hd,2.3*$hdr){
|
||||
hull() {
|
||||
difference() {
|
||||
sphere(1.25*$hdr, $fn=36);
|
||||
t(0,0,-2.3*$hdr)
|
||||
rotate([10,0,0])
|
||||
cube(4.2*hd,center=true);
|
||||
}
|
||||
t(0,1.5*$hdr,0.155*$hdr)
|
||||
cube([1.4*$hdr, 0.1*hd, 0.1*hd], center = true);
|
||||
}
|
||||
}
|
||||
} //helmet
|
||||
//------------------------------------
|
||||
module leg (legSpread,kneeLift,kneeBend,footPos) {
|
||||
thickness= 0.8*$sz;
|
||||
hipWidth = 0.8*$sz;
|
||||
//hip correction attempt
|
||||
lgext = sin(kneeLift)*hip_Voffset;
|
||||
if (rider_check) {
|
||||
echo(kneeLift=kneeLift);
|
||||
echo(lgext=lgext);
|
||||
}
|
||||
llg = legLength + lgext;
|
||||
// upper leg
|
||||
t(hipWidth)
|
||||
rotate([-kneeLift,180-legSpread,-3]) {
|
||||
color($legcolor) {
|
||||
sphere(r=thickness*1.25);
|
||||
cylinder(r1=thickness*1.2,r2=thickness*0.75,h=llg);
|
||||
}
|
||||
// joint
|
||||
t(0,0,llg) { // lower leg
|
||||
color($legcolor)
|
||||
sphere(r=thickness*0.75);
|
||||
rotate([kneeBend,0,0]) {
|
||||
color($legcolor)
|
||||
cylinder(r1=thickness*0.75,r2=thickness*0.55,h=legLength);
|
||||
// foot
|
||||
color($shoecolor)
|
||||
t(0,0,0.01*hd+legLength)
|
||||
rotate([footPos[0],footPos[1],footPos[2]])
|
||||
foot(legLength*0.41);
|
||||
//echo("prop leg",prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}// leg
|
||||
//------------------------------------
|
||||
module foot (length= hd*1.48) {
|
||||
d=length/1.48;
|
||||
hull() {
|
||||
t(0,0,-0.3*d)
|
||||
cylinder(r=d*0.45,h=0.7*d);
|
||||
t(0,length,0.05*d)
|
||||
cylinder(r=d*0.5,h=0.35*d);
|
||||
}
|
||||
}
|
||||
//------------------------------------
|
||||
module arm (armBend,armBendForward,elbowBend,elbowBendForward,hand) {
|
||||
thickness=0.58*$sz;
|
||||
shoulderWidth=1.46*$sz;
|
||||
// upper arm
|
||||
t(shoulderWidth)
|
||||
rotate([armBendForward,armBend,-arm_open]){
|
||||
color($armcolor){
|
||||
sphere(r=thickness*1.2);
|
||||
cylinder(r1=thickness*1.2,r2=thickness*0.8,h=armLength);
|
||||
}
|
||||
//joint
|
||||
t(0,0,armLength) {
|
||||
color($armcolor)
|
||||
sphere(r=thickness*0.8);
|
||||
rotate([-elbowBendForward,-elbowBend,0]) {
|
||||
color($armcolor)
|
||||
cylinder(r1=thickness*0.8,r2=thickness*0.6,h=armLength*0.8);
|
||||
// hand
|
||||
color(c_skin)
|
||||
t(0,0,armLength*0.8)
|
||||
scale([hand[0],hand[1],hand[2]]) sphere(r=thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
} // arm
|
||||
//----------------------------------
|
||||
//Torso rounded shape
|
||||
module rshape (wd,p,p2,ht,r1,dp,shift=0.25*$sz) {
|
||||
/*
|
||||
y1 = ((p/2-r1)^2+shift/2^2)^0.5;
|
||||
y2 = ((p2/2-r1)^2+shift/2^2)^0.5;
|
||||
a1 = atan(shift/2/(p/2-r1));
|
||||
a2 = atan(shift/2/(p2/2-r1));*/
|
||||
hull() {
|
||||
t(0,p/2-r1,-shift/2)
|
||||
dsph();
|
||||
t(0,-p/2+r1,shift/2)
|
||||
dsph();
|
||||
//rotate([-a1,0,0]) dmy(y1)dsph();
|
||||
//t(0,dp,ht) rotate([-a2,0,0]) dmy(y2) dsph();
|
||||
|
||||
t(0,dp,ht) {
|
||||
t(0,p2/2-r1,-shift/2)
|
||||
dsph();
|
||||
t(0,-p2/2+r1,shift/2)
|
||||
dsph();
|
||||
}
|
||||
}
|
||||
module dsph() {
|
||||
hull() //reduce calc time
|
||||
dmx(wd/2-r1)
|
||||
sphere(r1, $fn=20);
|
||||
}
|
||||
}
|
||||
|
||||
} //veloRider()
|
||||
|
||||
//translate module
|
||||
module t (x=0,y=0,z=0) {
|
||||
translate([x,y,z])
|
||||
children();
|
||||
}
|
||||
//mirror modules
|
||||
module dmx (x=0) { // duplicate and mirror
|
||||
t(x) children();
|
||||
mirror([1,0,0])
|
||||
t(x) children();
|
||||
}
|
||||
|
||||
module dmy (y=0) { // duplicate and mirror
|
||||
t(0,y) children();
|
||||
mirror([0,1,0])
|
||||
t(0,y) children();
|
||||
}
|
|
@ -1,890 +0,0 @@
|
|||
//OpenSCAD library modules - written from scratch -
|
||||
// (c) Pierre ROUZEAU(aka PRZ)2015-2021 Licence: LGPL V3
|
||||
// Rev. 7 may 2017 : corrected ldupln function, which was making wrong count, so wrong tenons/slots
|
||||
// Rev 2021: Add profiles, misc. modifications, add 'dark' color.
|
||||
/*OpenSCAD primitives gives a priority to z axis, which needs a lot of subsequent rotations. So, you quickly find yourself lost between your axis, which have been swapped by the rotations. That drive for complex objects to build them on a X/Y plane, then to rotate the ensemble. It is tedious and unpractical.
|
||||
Also, OpenSCAD is using a lot of brackets, which are hard to get on some non-QWERTY keyboards.
|
||||
This library is aimed to ease openSCAD programming and improve readability. Also, primitive names are short. This is not the todays trend, but I find it useful, whithout real penalty.
|
||||
So in the proposed library:
|
||||
a) Nearly all primitives could be used for all three axis. This is simply done by having the axis name being the last letter of the primitive (primx, primy, primz...).
|
||||
b) The translation parameters are part of most primitive (not all)
|
||||
c) You could use negative extrusion and where physically sound, negative dimensions.
|
||||
d) Setting the main dimension parameter negative will center the extrusion, saving the 'CENTER' parameter - for dimensions which could not be physically negative (a diameter...)
|
||||
e) No vector use, so no brackets
|
||||
With that, you have the primitive and associated movements done in one go. Designed for my own purpose, I find that useful and a wrist saver.
|
||||
*/
|
||||
//== PART I : PRIMITIVES : Cylinders, rounded cubes
|
||||
//== PART II : DEVELOPPED PRIMITIVES Bolt, extruded profiles, text display, partial tores
|
||||
//== PART III : OPERATORS Rotation, translation, mirrors, quad multipliers, line multipliers
|
||||
//== PART IV : MISCELLANEOUS
|
||||
|
||||
/* [Computation] */
|
||||
// Circle smoothness
|
||||
$fn=24; // [4:6:8:24:48]
|
||||
// final smoothness - reduced for visualisation
|
||||
//Below is hole play to take into account manufacturing. Note that this is for diameter, not radius (or for complete sides).
|
||||
// Play for hole (+ for printing, - for laser cut)
|
||||
holeplay=0; // [0:0.025:0.25]
|
||||
|
||||
/* [Hidden] */
|
||||
// Play for routing opening (+)
|
||||
bithole=0; // [0:0.025:0.25]
|
||||
|
||||
//holeplay = (holeplay)?holeplay:0; //diameter play for holes- applies for 'cyl' primitives and others hole primitives. This means that the diameter of a solid cylinder will also be affected, as the system cannot distinguish a hole from a solid.
|
||||
// The play shall be positive for additive manufacturing (FDM). - value 'addplay' shall be defined
|
||||
// shall be negative for laser cut (~ -0.2) - value 'cutplay' shall be defined.
|
||||
// This play is also used by the slotting system.
|
||||
// There are (globally positive) side-effects for primitives using cyl primitives (like 'rcube')
|
||||
//!WARNING!: to have the possibility to override this parameter from your configuration file, you shall <include> the utility file, and not <use> it.
|
||||
|
||||
//next defines cube type in mcube module
|
||||
solidxy = [1,1,0];
|
||||
solidxz = [1,0,1];
|
||||
solidyz = [0,1,1];
|
||||
|
||||
//== Legacy ================================
|
||||
//When a duplicate mirror is neutralised, simple mirror (if set to false, do nothing)
|
||||
//It is recommended to have the below variable false, but the legacy behaviour was always mirroring
|
||||
dmirr_s = false;
|
||||
|
||||
//== PART I : PRIMITIVES ==================
|
||||
// cylinder, first parameter is diameter, then extrusion length
|
||||
// Negative Diameter CENTER extrusion, Negative extrusions are Ok
|
||||
// usage: cyly (12,-40); -- cyly (12,-40, 8, 10, 9, 6); (hexagon)
|
||||
module cylx (diam,length,x=0,y=0,z=0,div=$fn, fh=1) {//Cylinder on X axis
|
||||
// fh is a coefficient for holeplay - default 1 for cylinders
|
||||
if (fh==false)
|
||||
echo ("cyly : change holeplay parameter to numeric");
|
||||
mv=(length<0)?length:0; // not ok if diam AND length are negative. who cares ?
|
||||
center=(diam<0)?true:false;
|
||||
if(length && diam) //avoid warning when h==0
|
||||
translate([x+mv,y,z])
|
||||
rotate([0,90,0])
|
||||
cylinder (d=(abs(diam)+fh*holeplay), h=abs(length), $fn=div, center=center);
|
||||
//next to allow sequential operations
|
||||
translate([x+(diam<0?0:length),y,z])
|
||||
children();
|
||||
}
|
||||
|
||||
module cyly (diam,length,x=0,y=0,z=0,div=$fn, fh=1) {//Cylinder on Y axis
|
||||
// fh is a coefficient for holeplay - default 1 for cylinders
|
||||
if (fh==false)
|
||||
echo ("cyly : change holeplay parameter to numeric");
|
||||
mv=(length<0)?length:0; // accept negative height
|
||||
center=(diam<0)?true:false;
|
||||
if(length && diam)
|
||||
translate([x,y+mv,z])
|
||||
rotate([-90,0,0])
|
||||
cylinder (d=(abs(diam)+fh*holeplay),h=abs(length), $fn=div, center=center);
|
||||
//next to allow sequential operations
|
||||
translate([x,y+(diam<0?0:length),z])
|
||||
children();
|
||||
}
|
||||
|
||||
module cylz (diam,height,x=0,y=0,z=0,div=$fn, fh=1) { // Cylinder on Z axis
|
||||
// fh is a coefficient for holeplay - default yes for cylinders
|
||||
if (fh==false)
|
||||
echo ("cyly : change holeplay parameter to numeric");
|
||||
mv=(height<0)?height:0; // accept negative height
|
||||
center=(diam<0)?true:false;
|
||||
if(height && diam)
|
||||
translate([x,y,mv+z])
|
||||
cylinder (d=(abs(diam)+fh*holeplay), h=abs(height), $fn=div, center=center);
|
||||
//next to allow sequential operations
|
||||
translate([x,y,z+(diam<0?0:height)])
|
||||
children();
|
||||
}
|
||||
|
||||
module mcube (sx,sy,sz,center=false,x=0,y=0,z=0, solid=[-1,-1,-1]) { // accept negative coordinates but only if center==false else result is wrong
|
||||
// take into account holeplay according to solid vector (default is a hole)
|
||||
cfc=(center)?0:1; // no play movement if centered
|
||||
mx=(sx<0)?cfc*(sx+solid[0]*holeplay/2):solid[0]*cfc*holeplay/2;
|
||||
my=(sy<0)?cfc*(sy+solid[1]*holeplay/2):solid[1]*cfc*holeplay/2;
|
||||
mz=(sz<0)?cfc*(sz+solid[2]*holeplay/2):+solid[2]*cfc*holeplay/2;
|
||||
dx = abs(sx)-solid[0]*holeplay;
|
||||
dy = abs(sy)-solid[1]*holeplay;
|
||||
dz = abs(sz)-solid[2]*holeplay;
|
||||
tsl(x+mx,y+my,z+mz)
|
||||
cube ([dx,dy,dz], center=center);
|
||||
} //*/
|
||||
|
||||
//holeplay=2;
|
||||
//mcube (20,30,40,false,0,0,0,[1,1,0]);
|
||||
|
||||
module cuben (sx,sy,sz,x=0,y=0,z=0, center=false) { // same as mcube, but with center after position, for homogeneity with cuben modules - NO holeplay so NO solid
|
||||
cfc=(center)?0:1; // no play movement if centered
|
||||
mx=(sx<0)?cfc*sx:0;
|
||||
my=(sy<0)?cfc*sy:0;
|
||||
mz=(sz<0)?cfc*sz:0;
|
||||
tsl(x+mx,y+my,z+mz)
|
||||
cube ([abs(sx),abs(sy),abs(sz)], center=center);
|
||||
}
|
||||
|
||||
module cubex (xd,yd,zd,x=0,y=0,z=0, fh=0) { // centered on y anz z, not centered on x, negative extrusion possible
|
||||
// fh is a coefficient for holeplay - default 0 for cubes
|
||||
if (fh==true)
|
||||
echo ("cubex : change holeplay parameter to numeric");
|
||||
cfh = (xd<0)?-1:1;
|
||||
mx=(xd<0)?xd:0;
|
||||
tsl(mx+x,y-yd/2-fh*holeplay/2,z-zd/2-fh*holeplay/2)
|
||||
cube ([abs(xd),abs(yd)+fh*holeplay,abs(zd)+fh*holeplay]);
|
||||
}
|
||||
|
||||
module cubey (xd,yd,zd,x=0,y=0,z=0, fh=0) { // centered on x anz z, not centered on y
|
||||
// fh is a coefficient for holeplay - default 0 for cubes
|
||||
if (fh==true)
|
||||
echo ("cubey : change holeplay parameter to numeric");
|
||||
cfh = (yd<0)?-1:1;
|
||||
my=(yd<0)?yd:0;
|
||||
tsl(x-xd/2-fh*holeplay/2,my+y,z-zd/2-fh*holeplay/2)
|
||||
cube ([abs(xd)+fh*holeplay,abs(yd),abs(zd)+fh*holeplay]);
|
||||
}
|
||||
|
||||
module cubez (xd,yd,zd,x=0,y=0,z=0, fh=0) { // centered on x anz y, not centered on z
|
||||
// fh is a coefficient for holeplay - default 0 for cubes
|
||||
if (fh==true)
|
||||
echo ("cubez : change holeplay parameter to numeric");
|
||||
cfh = (zd<0)?-1:1; // what is done with that ???
|
||||
mz=(zd<0)?zd:0;
|
||||
tsl(x-xd/2-fh*holeplay/2,y-yd/2-fh*holeplay/2,mz+z)
|
||||
cube ([abs(xd)+fh*holeplay,abs(yd)+fh*holeplay,abs(zd)]);
|
||||
}
|
||||
|
||||
/*extrusion of rounded rectangular profile (centered), first param radius. p1 & p2 = rectangular side size (not half as above)
|
||||
Translation only on main axis, others are the rectangle parameters
|
||||
negative radius center around main axis
|
||||
//usage: rcubex (5,12,40,60,20) */
|
||||
|
||||
module rcubex (radius,length,x=0,y,z) {
|
||||
hull()
|
||||
quadx (x,y/2-abs(radius),z/2-abs(radius))
|
||||
cylx(2*radius,length);
|
||||
}
|
||||
|
||||
module hrcubex (radius,length,x=0,y,z) { // 'special' - rounded below, flat on top
|
||||
hull() {
|
||||
tsl(x)
|
||||
cubex (length,y,z/2,0,0,z/4);
|
||||
dmirrory()
|
||||
cylx(2*radius,length,x,y/2-abs(radius),-z/2+abs(radius),32);
|
||||
}
|
||||
}
|
||||
|
||||
//hrcubex (7, 5, 40, 40,30);
|
||||
//rcubex (7, 5, 20, 40,30);
|
||||
|
||||
module rcubey (radius,length,x,y=0,z) {
|
||||
hull()
|
||||
quady (x/2-abs(radius),y,z/2-abs(radius))
|
||||
cyly(2*radius,length);
|
||||
}
|
||||
|
||||
module rcubez (radius,length,x,y,z=0) {
|
||||
hull()
|
||||
quadz (x/2-abs(radius),y/2-abs(radius), z)
|
||||
cylz(2*radius,length);
|
||||
}
|
||||
|
||||
//tubex (20,2,-100, 50,60,80);
|
||||
|
||||
module tubex (diam, thickness, length, x=0,y=0,z=0, div=$fn, fh=1) {
|
||||
dt = (length<0)?-1:1;
|
||||
dtx = (diam<0)?0:dt;
|
||||
cf = (diam<0)?-1:1;
|
||||
difference() {
|
||||
cylx(cf*abs(diam), length, x,y,z, div, 0); // neutralise the holeplay
|
||||
cylx(cf*(abs(diam)-2*thickness), length+dt+dt, x-dtx,y,z, div, fh);
|
||||
}
|
||||
}
|
||||
|
||||
module tubey (diam, thickness, length, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
dt = (length<0)?-1:1;
|
||||
dty = (diam<0)?0:dt;
|
||||
cf = (diam<0)?-1:1;
|
||||
difference() {
|
||||
cyly(cf*abs(diam), length, x,y,z,div, 0);
|
||||
cyly(cf*(abs(diam)-2*thickness), length+dt+dt, x,y-dty,z,div, fh);
|
||||
}
|
||||
}
|
||||
|
||||
module tubez (diam, thickness, length, x=0,y=0,z=0, div=$fn, fh=1) {
|
||||
dt = (length<0)?-1:1;
|
||||
dtz = (diam<0)?0:dt;
|
||||
cf = (diam<0)?-1:1;
|
||||
difference() {
|
||||
cylz(cf*abs(diam), length, x,y,z, div,0);
|
||||
cylz(cf*(abs(diam)-2*thickness), length+dt+dt, x,y,z-dtz, div, fh);
|
||||
}
|
||||
}
|
||||
|
||||
//eqtrianglez (-100, 15); cylz (100, 5);
|
||||
module eqtrianglez (dim, length, x=0,y=0,z=0) { // dim positive is base, dim negative is external circle diameter. Centered
|
||||
mz = (length<0)?-length:0;
|
||||
base = (dim<0)? -dim/cos(30)*3/4: dim;
|
||||
tsl(x,y-base*cos(30)/3,z+mz)
|
||||
linear_extrude(height=abs(length))
|
||||
polygon(points=[[-base/2,0],[base/2,0],[0,base*cos(30)]]);
|
||||
}
|
||||
|
||||
//=== Tenon and mortise/slots library, for laser/router cut
|
||||
// Beware of the axis name. The first axis is the direction of propagation of the slots/tenon
|
||||
// The second axis name is the second plane axis, slot plate wise. This is done to have the same name for the connecting modules, hence, the slotxy will be in an horizontal plate, with propagation in x, while the connecting tenonxy will be for a vertical plate, oriented on x
|
||||
// library is yet limited to xy and zx combos. Use rotations for other axis
|
||||
// As the slots are holes, the slot module is not only a primive but also an operator, so it COULD be used to MODIFY your plate objects. The location coordinates are the last two parameters (x,y or x,z). Typical use will be slotxy(slotlength, interval, tlength, thktenonplate,x,y) myplate(); Alternatively, if not used as an operator, it just creates the holes.
|
||||
//You shall define the 'cutplay' and 'bithole' parameters (look configuration file) to take into account the width of the laser cut or diameter of the bit. The global holeplay variable will so be set to a negative value equalling the laset beam cut diameter (approx 0.2mm diameter), while doing the exportation to dxf files. Such play make the slots invisibles in your model (the slots are smaller than the tenons), if you are not defining a protrusion.
|
||||
// So, during the development of your model, a positive value for holeplay shall be defined (1~2). Note that the visible play is double in length than in width. This is normal, as the plate thickness will not be affected by the cut.
|
||||
//Neither the slot nor the tenon are centered. Negative thicknesses or negative length could be used, but with caution.
|
||||
//As for line primitive, the use of a negative interval will adjust (round) the intervals to fit the allowed space, however in this primitive as the tenon length is known, there will be no part overpassing the length.
|
||||
|
||||
module tenonxy (slotlength, interval, totlength, thkplate, height) { //creates tenons of length slotlength on totlength (does not go over length) - raise in 'z' axis
|
||||
sll=abs(slotlength);
|
||||
// echo (holeplay=holeplay);
|
||||
cfl=(totlength<0)?-1:1;
|
||||
mvh= (height<0)?height:-0.2;
|
||||
mvl= (totlength<0)?-sll+holeplay/2:holeplay/2;
|
||||
lduplx (interval, cfl*(abs(totlength)-sll))
|
||||
tsl(mvl,0,mvh) //-0.2 to avoid merging surface-no play as //cuts will equal height
|
||||
cube([sll-holeplay, thkplate, abs(height)+0.2]);
|
||||
}
|
||||
|
||||
module tenonbitxy (slotlength, interval, totlength, thkplate, height) { //cut the bit room aside tenons - parameters shall be identical to tenonxy, and this function shall be set in substraction block
|
||||
sll= abs(slotlength);
|
||||
cfl= (totlength<0)?-1:1;
|
||||
mvh= (height<0)?-0.1*bithole :0.1*bithole;
|
||||
mvl= (totlength<0)?-sll:0;
|
||||
lduplx (interval, cfl*(abs(totlength)-sll))
|
||||
tsl(mvl,0,mvh) {
|
||||
cyly(-bithole,66,-0.48*bithole);
|
||||
cyly(-bithole,66,sll+0.48*bithole);
|
||||
}
|
||||
}
|
||||
|
||||
module tenonzx (slotlength, interval, totlength, thkplate, height) { //creates slots of length slotlength on totlength (does not go over length) - raise in 'y' axis
|
||||
sll=abs(slotlength);
|
||||
echo (holeplay=holeplay);
|
||||
cfl=(totlength<0)?-1:1;
|
||||
mvh= (height<0)?height:-0.2;
|
||||
mvl= (totlength<0)?-sll+holeplay/2:holeplay/2;
|
||||
lduplz (interval, cfl*(abs(totlength)-sll))
|
||||
tsl(0,mvh,mvl)
|
||||
cube([thkplate, abs(height)+0.2,sll-holeplay]);
|
||||
}
|
||||
|
||||
// As slots are full through holes, no depth defined
|
||||
module slotxy (slotlength, interval, totlength, thkplate,x=0,y=0) {
|
||||
sll= abs(slotlength);
|
||||
cfl= (totlength<0)?-1:1;
|
||||
mvt= (thkplate<0)?thkplate-holeplay/2:-holeplay/2;
|
||||
mvl= (totlength<0)?-sll-holeplay/2:-holeplay/2;
|
||||
difference () {
|
||||
children();
|
||||
tsl(x,y)
|
||||
lduplx (interval, cfl*(abs(totlength)-sll))
|
||||
tsl(mvl,mvt,-5) {
|
||||
cube([sll+holeplay, abs(thkplate)+holeplay, 100]);
|
||||
if (bithole)
|
||||
tsl(sll/2, thkplate/2) dmirrorx() dmirrory()
|
||||
cylz (-bithole,66,sll/2-bithole*.485,thkplate/2-bithole*0.1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module slotzx (slotlength, interval, totlength, thkplate,z=0,x=0) {
|
||||
//-- not checked --- ???
|
||||
sll= abs(slotlength);
|
||||
cfl= (totlength<0)?-1:1;
|
||||
mvt= (thkplate<0)?thkplate-holeplay/2:-holeplay/2;
|
||||
mvl= (totlength<0)?-sll-holeplay/2:-holeplay/2;
|
||||
difference () {
|
||||
children();
|
||||
tsl(x,0,z)
|
||||
lduplz (interval, cfl*(abs(totlength)-sll))
|
||||
tsl(mvt,-5,mvl) {
|
||||
cube([abs(thkplate)+holeplay, 100, sll+holeplay]);
|
||||
if (bithole)
|
||||
tsl(thkplate/2,0,sll/2) dmirrorx() dmirrorz()
|
||||
cylz(-bithole,66,thkplate/2-bithole*0.1,0,sll/2-bithole*.485);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module conex (diam1, diam2, ht, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
mv = (ht<0)?ht:0;
|
||||
di1 = (ht<0)?diam2:diam1;
|
||||
di2 = (ht<0)?diam1:diam2;
|
||||
translate([x+mv,y,z])
|
||||
rotate([0,90,0])
|
||||
cylinder (d1=di1+fh*holeplay, d2=di2+fh*holeplay, h=abs(ht), $fn=div);
|
||||
}
|
||||
|
||||
module coney (diam1, diam2, ht, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
mv = (ht<0)?ht:0;
|
||||
di1 = (ht<0)?diam2:diam1;
|
||||
di2 = (ht<0)?diam1:diam2;
|
||||
translate([x,y+mv,z])
|
||||
rotate([-90,0])
|
||||
cylinder (d1=di1+fh*holeplay, d2=di2+fh*holeplay, h=abs(ht),$fn=div);
|
||||
}
|
||||
|
||||
module conez (diam1, diam2, ht, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
mz = (ht<0)?ht:0;
|
||||
di1 = (ht<0)?diam2:diam1;
|
||||
di2 = (ht<0)?diam1:diam2;
|
||||
translate ([x,y,z+mz])
|
||||
cylinder (d1=di1+fh*holeplay, d2=di2+fh*holeplay, h=abs(ht),$fn=div);
|
||||
}
|
||||
|
||||
//coney (10, 5, 3);
|
||||
|
||||
//cone3n
|
||||
//diam 1 & diam2 shall be > 0
|
||||
// if ht1 negative, ref is end of cylinder
|
||||
// then if ht2 negative, ref is end of cone
|
||||
// then if ht3 negative, ref is end of 2nd cylinder
|
||||
|
||||
module cone3x (diam1, diam2, ht1, ht2, ht3=0, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
mov1 = (ht1<0)?ht1:0;
|
||||
mov2 = (ht2<0)?ht2+mov1:mov1;
|
||||
mov3 = (ht3<0)?ht3+mov2:mov2;
|
||||
tsl(mov3) {
|
||||
cylx (diam1, abs(ht1)+0.02, x,y,z,div,fh);
|
||||
tsl(abs(ht1)+x,y,z)
|
||||
rot(0,90)
|
||||
cylinder (d1=diam1+fh*holeplay, d2=diam2+fh*holeplay, h=abs(ht2), $fn=div);
|
||||
cylx (diam2, abs(ht3)+0.02, x+abs(ht1)+abs(ht2)-0.02,y,z,div,fh);
|
||||
}
|
||||
}
|
||||
|
||||
module cone3y (diam1, diam2, ht1, ht2, ht3=0, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
mov1 = (ht1<0)?ht1:0;
|
||||
mov2 = (ht2<0)?ht2+mov1:mov1;
|
||||
mov3 = (ht3<0)?ht3+mov2:mov2;
|
||||
tsl(0,mov3) {
|
||||
cyly (diam1, abs(ht1)+0.02, x,y,z,div,fh);
|
||||
tsl(x, y+abs(ht1),z)
|
||||
rot(-90)
|
||||
cylinder (d1=diam1+fh*holeplay, d2=diam2+fh*holeplay, h=abs(ht2), $fn=div);
|
||||
cyly (diam2, abs(ht3)+0.02, x, y+abs(ht1)+abs(ht2)-0.02,z,div,fh);
|
||||
}
|
||||
}
|
||||
|
||||
module cone3z (diam1, diam2, ht1, ht2, ht3=0, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
mov1 = (ht1<0)?ht1:0;
|
||||
mov2 = (ht2<0)?ht2+mov1:mov1;
|
||||
mov3 = (ht3<0)?ht3+mov2:mov2;
|
||||
tsl(0,0,mov3) {
|
||||
cylz (diam1, abs(ht1)+0.02, x,y,z, div,fh);
|
||||
tsl(x, y,z+abs(ht1))
|
||||
cylinder (d1=diam1+fh*holeplay, d2=diam2+fh*holeplay, h=abs(ht2), $fn=div);
|
||||
cylz (diam2, abs(ht3)+0.02, x,y,z+abs(ht1)+abs(ht2)-0.02, div,fh);
|
||||
}
|
||||
}
|
||||
/*
|
||||
holeplay=0.2;
|
||||
cone3x (2, 4, 4, 2, 6);
|
||||
cone3x (2, 4, -4, 2, 6, 0,-8);
|
||||
cone3x (2, 4, -4, -2, 6,0,-16);
|
||||
cone3x (2, 4, -4, -2, -6,0,-24);
|
||||
cone3x (4, 2, -4, 2, -6,0,-32);
|
||||
|
||||
cone3y (2, 4, 4, 2, 6, 0,0,0, $fn,0);
|
||||
cone3y (2, 4, -4, 2, 6, -8,0);
|
||||
cone3y (2, 4, -4, -2, 6,-16,0);
|
||||
cone3y (2, 4, -4, -2, -6,-24,0);
|
||||
cone3y (4, 2, -4, 2, -6,-32,0);
|
||||
|
||||
cone3z (2, 4, 4, 2, 6, 20);
|
||||
cone3z (2, 4, -4, 2, 6, 20,-8);
|
||||
cone3z (2, 4, -4, -2, 6, 20,-16);
|
||||
cone3z (2, 4, -4, -2, -6, 20,-24);
|
||||
cone3z (4, 2, -4, 2, -6, 20,-32);
|
||||
//*/
|
||||
|
||||
// cconen primitives may be deprecated in favor of cone3n primitives - avoid using them
|
||||
module cconex (diam1, diam2, ht, htcyl=-1, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
// if htcyl negative, go from reference plan
|
||||
// if htcyl positive, cone atop cylinder
|
||||
mcyl = (htcyl>0) ?(htcyl-0.02)*sign(ht):-0.02*sign(ht);
|
||||
tsl(mcyl) conex (diam1, diam2, ht, x,y,z,div, fh);
|
||||
cylx (diam1, abs(htcyl)*sign(ht)*sign(htcyl),x,y,z, div, fh);
|
||||
}
|
||||
|
||||
module cconey (diam1, diam2, ht, htcyl=-1, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
// if htcyl negative, go from reference plan
|
||||
// if htcyl positive, cone atop cylinder
|
||||
mcyl = (htcyl>0) ?(htcyl-0.02)*sign(ht):-0.02*sign(ht);
|
||||
tsl(0,mcyl) coney (diam1, diam2, ht, x,y,z,div, fh);
|
||||
cyly (diam1, abs(htcyl)*sign(ht)*sign(htcyl),x,y,z, div, fh);
|
||||
}
|
||||
|
||||
module cconez (diam1, diam2, ht, htcyl=-1, x=0,y=0,z=0,div=$fn, fh=1) {
|
||||
// if htcyl negative, go from reference plan
|
||||
// if htcyl positive, cone atop cylinder
|
||||
mcyl = (htcyl>0) ?(htcyl-0.02)*sign(ht):-0.02*sign(ht);
|
||||
tsl(0,0,mcyl) conez (diam1, diam2, ht, x,y,z,div, fh);
|
||||
cylz (diam1, abs(htcyl)*sign(ht)*sign(htcyl),x,y,z, div, fh);
|
||||
}
|
||||
|
||||
// filleting primitives - the fillet is an independant volume
|
||||
module filletx (rad, lg, x=0,y=0,z=0) {
|
||||
mv = (rad<0)?rad+0.02:0;
|
||||
mv2 = (rad<0)?rad:0;
|
||||
mlg = (lg<0)?lg:0;
|
||||
translate ([x+mlg, y-0.02+mv, z-0.02])
|
||||
difference() {
|
||||
cube ([abs(lg), abs(rad),abs(rad)]);
|
||||
cylx (abs(rad)*2,abs(lg)+2, -1,rad-mv2,abs(rad));
|
||||
}
|
||||
}
|
||||
|
||||
module fillety (rad, lg, x=0,y=0,z=0) {
|
||||
mv = (rad<0)?rad+0.02:0;
|
||||
mv2 = (rad<0)?rad:0;
|
||||
mlg = (lg<0)?lg:0;
|
||||
translate ([x-0.02+mv, y+mlg,z-0.02])
|
||||
difference() {
|
||||
cube ([abs(rad), abs(lg),abs(rad)]);
|
||||
cyly (abs(rad)*2,abs(lg)+2,rad-mv2,-1,abs(rad));
|
||||
}
|
||||
}
|
||||
|
||||
module filletz (rad, lg, x=0,y=0,z=0) {
|
||||
mv = (rad<0)?rad+0.02:0;
|
||||
mv2 = (rad<0)?rad:0;
|
||||
mlg = (lg<0)?lg:0;
|
||||
translate ([x-0.02+mv, y-0.02,z+mlg])
|
||||
difference() {
|
||||
cube ([abs(rad), abs(rad), abs(lg)]);
|
||||
cylz (abs(rad)*2, abs(lg)+2, rad-mv2, abs(rad),-1);
|
||||
}
|
||||
}
|
||||
|
||||
//cubez (20,20,20,10);
|
||||
//fillety (-5,-50);
|
||||
|
||||
/*
|
||||
holeplay=0;
|
||||
bithole=3.5; // to cut bit room
|
||||
slotxy (12,-30,200,10,25,35)
|
||||
mcube (250,120,10,false, 20,20); //*/
|
||||
/*
|
||||
holeplay=0;
|
||||
bithole=3.5; // to cut bit room
|
||||
tsl(25,35) {
|
||||
difference() {
|
||||
union() {
|
||||
mcube (250,10,-100);
|
||||
tenonxy (12,-30,200,10,10);
|
||||
}
|
||||
tenonbitxy (12,-30,200,10,10);
|
||||
}
|
||||
} //*/
|
||||
|
||||
//== PART II : DEVELOPPED PRIMITIVES =================
|
||||
// Rather basic bolt routines // head size is realistic only in metric
|
||||
// Bolts type are "HEX", "SH" (socket head), "DOME" and "FLAT" - all uppercase-
|
||||
// dome shown is medium size, default "HEX"
|
||||
// Washer types are 'S','M','L','LL', corresponding washer size, default none for one below nut. For two '2S', '2M', etc.
|
||||
// Length is between the head and washer base. bolt total length not defined - this is a weakness
|
||||
// Negative length are allowed, this reverse the bolt
|
||||
// Normal reference point is under head
|
||||
// NEGATIVE diameter center the bolt - reference point is middle of bolt
|
||||
// Head size as shown is fictive, as in the ISO standard, they are rounded to the nearest plain number and not the direct result of a coefficient.
|
||||
// usage: boltx(5,12); -- boltz(-5,20,8,0,30,"SH");
|
||||
// washer not yet implemented...
|
||||
|
||||
//boltx(-5, 20, 10,20,50);
|
||||
module boltx (d,l,x=0,y=0,z=0,type="HEX", washer="") {//bolt on X axis
|
||||
dia=abs(d);
|
||||
lg=abs(l); // accept negative height
|
||||
mi= (l<0)?[1,0,0]:[0,0,0];
|
||||
mvc=(d<0)?-lg/2:0;//negative diameter CENTER the bolt
|
||||
translate ([x,y,z])
|
||||
mirror (mi)
|
||||
translate ([mvc,0,0]) {
|
||||
if (abs(lg)>2) { // only show head if lg<2 (decoration) - allow negative for returning the head
|
||||
cylx (dia,lg+dia*1.2);
|
||||
cylx (dia*1.8,dia*0.8,lg,0,0,6); // nut
|
||||
}
|
||||
// bolt head
|
||||
if (type=="DOME") { // domed head
|
||||
cylx (dia*2,-dia*0.16);
|
||||
difference (){
|
||||
rot (0,-90,0)
|
||||
dome (dia*2, dia/2,0,0,dia*0.16);
|
||||
cylx (dia*0.92,-dia,-dia*0.2,0,0,6);
|
||||
}
|
||||
}
|
||||
else if (type=="SH") //socket head
|
||||
difference () {
|
||||
cylx ((1/dia+1.5)*dia,-dia);
|
||||
cylx (dia*0.92,-dia,-dia*0.2,0,0,6);
|
||||
}
|
||||
else if (type=="FLAT") difference () {
|
||||
cylx (dia*2.4,-dia*0.5);
|
||||
cylx (dia*0.92,-dia,-dia*0.2,0,0,6);
|
||||
}
|
||||
else // hexagonal
|
||||
cylx (dia*1.8,-dia*0.8,0,0,0,6);
|
||||
} //tr
|
||||
} //boltx
|
||||
|
||||
module bolty (d,l,x=0,y=0,z=0,type="HEX", washer) {
|
||||
translate([x,y,z])
|
||||
rotate([0,0,90])
|
||||
boltx(d,l,0,0,0,type, washer);
|
||||
}
|
||||
|
||||
module boltz (d,l,x=0,y=0,z=0,type="HEX", washer) {
|
||||
translate([x,y,z])
|
||||
rotate([0,90,0])
|
||||
boltx(d,l,0,0,0,type, washer);
|
||||
}
|
||||
|
||||
//--- Text display ----------------------------
|
||||
|
||||
module textz (txt,size,h,bold,x=0,y=0,z=0, hal="left", val ="baseline") { // position text normal to z axis
|
||||
a =(h<0)?180:0;
|
||||
st=(bold)? "Liberation Sans:style=Bold":"Liberation Sans";
|
||||
tsl(x,y,z) rot(a,0,0)
|
||||
linear_extrude(height = abs(h)) text (str(txt), size, font=st, halign=hal, valign=val);
|
||||
}
|
||||
|
||||
module textx (txt,size,h,bold,x=0,y=0,z=0, hal="left", val ="baseline") { // position text normal to x axis
|
||||
a =(h<0)?-90:90;
|
||||
tsl(x,y,z) rot (90,0,a)
|
||||
textz(txt,size,abs(h),bold,0,0,0,hal,val);
|
||||
}
|
||||
|
||||
//tore (10, 50, 15, 220);
|
||||
|
||||
module tore (dia, ldia, angstart, angend, qual=100) {
|
||||
// first diameter is the small diameter, qual defines segment numbers (on 360 °)->$fn
|
||||
sectorz(angstart,angend, -ldia*2)
|
||||
rotate_extrude($fn=qual)
|
||||
tsl(ldia/2)
|
||||
circle(dia/2);
|
||||
}
|
||||
//tore (10, 50, 220, 290);
|
||||
|
||||
module cylsectz (di, height, thickness, angstart,angend) { // cylindrical sector
|
||||
sectorz (angstart,angend)
|
||||
difference () {
|
||||
cylz (di+2*thickness, height,0,0,0,120);
|
||||
cylz (di, height+2,0,0,-1,120);
|
||||
}
|
||||
}
|
||||
|
||||
module cylsectx (di, height, thickness, angstart,angend) { // cylindrical sector
|
||||
sectorx (angstart,angend)
|
||||
difference () {
|
||||
cylx (di+2*thickness,height, 0,0,0,120);
|
||||
cylx (di, height+2, -1,0,0,120);
|
||||
}
|
||||
}
|
||||
//cylsectz (100,25,10,100,160);
|
||||
|
||||
module sectorz (angstart,angend, radius=-1000,depth=2000 ) { //cut a sector in any shape, z axis
|
||||
// negative radius will equilibrate the depth on z axis
|
||||
// angstart could be negative, angend could not
|
||||
mvz = radius<0?-abs(depth)/2:depth<0?depth:0;
|
||||
sectang = angend-angstart;
|
||||
cutang = 360-sectang;
|
||||
module cutcube() {
|
||||
tsl(-0.02,-abs(radius),mvz-0.1)
|
||||
cube(size= [abs(radius),abs(radius),abs(depth)], center =false);
|
||||
}
|
||||
module cutsect () {
|
||||
if (sectang >270) {
|
||||
difference () {
|
||||
cutcube();
|
||||
rotz (-cutang)
|
||||
cutcube();
|
||||
}
|
||||
}
|
||||
else {
|
||||
cutcube();
|
||||
rotz (-cutang+90)
|
||||
cutcube();
|
||||
if (cutang > 180)
|
||||
rotz(-90)
|
||||
cutcube();
|
||||
if (cutang > 270)
|
||||
rotz(-180)
|
||||
cutcube();
|
||||
}
|
||||
} // cutsect
|
||||
difference () {
|
||||
children();
|
||||
rotz (angstart)
|
||||
cutsect();
|
||||
}
|
||||
}
|
||||
|
||||
module sectorx (angstart,angend, radius=-1000,depth=2000 ) { //cut a sector in any shape, z axis
|
||||
// negative radius will equilibrate the depth on z axis
|
||||
// angstart could be negative, angend could not
|
||||
mvx = radius<0?-abs(depth)/2:depth<0?depth:0;
|
||||
sectang = angend-angstart;
|
||||
cutang = 360-sectang;
|
||||
module cutcube() {
|
||||
tsl(mvx-0.1,-0.02,-abs(radius))
|
||||
cube(size=[abs(depth), abs(radius),abs(radius)], center =false);
|
||||
}
|
||||
module cutsect () {
|
||||
if (sectang >270) {
|
||||
difference () {
|
||||
cutcube();
|
||||
rot (-cutang)
|
||||
cutcube();
|
||||
}
|
||||
}
|
||||
else {
|
||||
cutcube();
|
||||
rot (-cutang+90)
|
||||
cutcube();
|
||||
if (cutang > 180)
|
||||
rot(-90)
|
||||
cutcube();
|
||||
if (cutang > 270)
|
||||
rot(-180)
|
||||
cutcube();
|
||||
}
|
||||
} // cutsect
|
||||
difference () {
|
||||
children();
|
||||
rot (angstart)
|
||||
cutsect();
|
||||
}
|
||||
}
|
||||
|
||||
//--- Profiles ------------------------------------
|
||||
// profile_angle (30, 30, 2, -80) ;
|
||||
module profile_angle (legW, legH, thickness, length) { // length could be negative
|
||||
mv = (length<0)?length:0;
|
||||
tsl(0,0,mv)
|
||||
linear_extrude (height=abs(length))
|
||||
difference () {
|
||||
square ([legW,legH]);
|
||||
tsl(thickness,thickness)
|
||||
square ([legW,legH]);
|
||||
}
|
||||
}
|
||||
|
||||
//profile_T(20,20,1.5, 100);
|
||||
module profile_T (width, height, thickness, length) { // length could be negative
|
||||
mv = (length<0)?length:0;
|
||||
w=width/2;
|
||||
tsl(0,0,mv)
|
||||
linear_extrude (height=abs(length))
|
||||
polygon(points=[[-w,0],[w,0],[w,thickness],[thickness/2,thickness],[thickness/2,height],[-thickness/2,height],[-thickness/2,thickness],[-w,thickness]]);
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
module profile_rectangle (wd,ht, thk, length) { // length could be negative
|
||||
mv = (length<0)?length:0;
|
||||
tsl(0,0,mv)
|
||||
linear_extrude (height=abs(length))
|
||||
difference () {
|
||||
square ([ht,wd]);
|
||||
tsl(thk,thk)
|
||||
square ([ht-2*thk,wd-2*thk]);
|
||||
}
|
||||
}
|
||||
//-----------------------------------------
|
||||
module profile_u (wd,ht, thk, length) { // length could be negative
|
||||
mv = (length<0)?length:0;
|
||||
tsl(0,0,mv)
|
||||
linear_extrude (height=abs(length))
|
||||
difference () {
|
||||
square ([ht,wd]);
|
||||
tsl(thk,thk)
|
||||
square ([ht-2*thk,wd]);
|
||||
}
|
||||
}
|
||||
|
||||
//== PART III : OPERATORS =======================
|
||||
//aliases
|
||||
module u() {union() children();} // union alias
|
||||
|
||||
module diff () { // difference alias
|
||||
difference() {
|
||||
children(0);
|
||||
if ($children>1) for(i=[1:$children-1]) children(i);
|
||||
}
|
||||
}
|
||||
|
||||
//rotation and translations without brackets -
|
||||
module rot (x,y=0,z=0) {rotate([x,y,z]) children();}
|
||||
module r (x,y=0,z=0) {rotate([x,y,z]) children();}
|
||||
module rotz (z) {rotate([0,0,z]) children();}
|
||||
module tsl (mx,my=0,mz=0) {translate([mx,my,mz]) children();}
|
||||
module t (mx,my=0,mz=0) {translate([mx,my,mz]) children();}
|
||||
module tslz (mz) {translate ([0,0,mz]) children();}
|
||||
|
||||
// for a delta, everything is rotated three times at 120°, so an operator for that
|
||||
module rot120 (a=0) {
|
||||
for(i=[0,120,240]) rotate([0,0,i+a]) children();
|
||||
}
|
||||
|
||||
module mirrorx (mi=true) { // parameter helps in conditional mirroring
|
||||
mm = (mi)?1:0;
|
||||
mirror([mm,0,0]) children();
|
||||
}
|
||||
module mirrory (mi=true) {
|
||||
mm = (mi)?1:0;
|
||||
mirror([0,mm,0]) children();
|
||||
}
|
||||
module mirrorz (mi=true) {
|
||||
mm = (mi)?1:0;
|
||||
mirror([0,0,mm]) children();
|
||||
}
|
||||
|
||||
module dmirrorx (dup=true, x=0, nmirr=dmirr_s) { // duplicate and mirror
|
||||
if(dup||!nmirr)
|
||||
tsl(x) children();
|
||||
if(dup||nmirr)
|
||||
mirror ([1,0,0]) tsl(x) children();
|
||||
}
|
||||
module dmirrory (dup=true, y=0, nmirr=dmirr_s) {
|
||||
if(dup||!nmirr)
|
||||
tsl(0,y) children();
|
||||
if(dup||nmirr)
|
||||
mirror([0,1,0])
|
||||
tsl(0,y) children();
|
||||
}
|
||||
module dmirrorz (dup=true, z=0, nmirr=dmirr_s) {
|
||||
if(dup||!nmirr)
|
||||
tsl(0,0,z) children();
|
||||
if(dup||nmirr)
|
||||
mirror ([0,0,1])
|
||||
tsl(0,0,z) children();
|
||||
}
|
||||
|
||||
module duplMirror (x,y,z) {//mirror AND maintain the base- beware, OpenSCAD is not iterative
|
||||
children();
|
||||
mirror ([x,y,z]) children();
|
||||
}
|
||||
|
||||
module dupl (vct, nb=1) { // duplicate object at vector distance
|
||||
for (i=[0:nb])
|
||||
translate (vct*i) children();
|
||||
}
|
||||
|
||||
module duplx (dx, nb=1, startx=0) { // duplicate object at distance 'dx', times nb
|
||||
for (i=[0:nb])
|
||||
tsl(dx*i+startx) children();
|
||||
}
|
||||
|
||||
module duply (dy, nb=1, starty=0) { // duplicate object at distance 'dy', times nb
|
||||
for (i=[0:nb])
|
||||
tsl(0,dy*i+starty) children();
|
||||
}
|
||||
|
||||
module duplz (dz, nb=1, startz=0) { // duplicate object at distance 'dz', times nb
|
||||
for (i=[0:nb])
|
||||
tsl(0,0,dz*i+startz) children();
|
||||
}
|
||||
|
||||
// Duplicates children on a given length at intervals following axis. Number is calculated
|
||||
// x,y,z are for translation of the ensemble
|
||||
// module linex (interval, length, x=0,y=0,z=0) {lduplx (interval, length, x,y,z);}
|
||||
module lduplx (interval, length, x=0,y=0,z=0) { // if distance negative, optimize space to have a children at the end, else, the interval is respected
|
||||
nb = sign(length)*floor(abs(length)/abs(interval));
|
||||
sp=(interval<0)?length/nb:interval;
|
||||
for (i=[0:nb]) tsl(i*sp+x,y,z) children();
|
||||
}
|
||||
|
||||
module lduply (interval, length, x=0,y=0,z=0) {
|
||||
nb = sign(length)*floor(abs(length)/abs(interval));
|
||||
sp=(interval<0)?length/nb:interval;
|
||||
for (i=[0:nb]) tsl(x,y+i*sp,z) children();
|
||||
}
|
||||
|
||||
module lduplz (interval, length, x=0,y=0,z=0) {
|
||||
nb = sign(length)*floor(abs(length)/abs(interval));
|
||||
sp=(interval<0)?length/nb:interval;
|
||||
for (i=[0:nb]) tsl(x,y,z+i*sp) children();
|
||||
}
|
||||
|
||||
module drotz (angle, nb=1, initial=0) { // polar duplication rotating around Z axis
|
||||
for (i=[0:nb])
|
||||
rotz (angle*i+initial) children();
|
||||
}
|
||||
|
||||
module droty (angle, nb=1, initial=0) {
|
||||
for (i=[0:nb])
|
||||
rot (0,angle*i+initial) children();
|
||||
}
|
||||
|
||||
module drotx (angle, nb=1, initial=0) {
|
||||
for (i=[0:nb])
|
||||
rot (angle*i+initial) children();
|
||||
}
|
||||
|
||||
//segz (2,2, 0,-5,200,-5);
|
||||
//linez (31, 200) cylz (2,2);
|
||||
|
||||
//-- rectangular quad multiplier operator +p1/-p1, +p2/-p2
|
||||
//Translation only on main axis, others are the rectangle parameters
|
||||
//usage: quady (20,0,50) cylx(3,5);
|
||||
module quadx (x=0,y,z) {
|
||||
duplMirror(0,0,1) {
|
||||
translate ([x,y,z]) children();
|
||||
mirror ([0,1,0])
|
||||
translate ([x,y,z]) children();
|
||||
}
|
||||
}
|
||||
|
||||
module quady (x,y=0,z) {
|
||||
duplMirror(0,0,1) {
|
||||
translate ([x,y,z]) children();
|
||||
mirror ([1,0,0])
|
||||
translate ([x,y,z]) children();
|
||||
}
|
||||
}
|
||||
module quadz (x,y,z=0) { // create four blocs at -x/-x and +y/-y (mirrored)
|
||||
duplMirror(0,1,0) {
|
||||
translate ([x,y,z]) children();
|
||||
mirror ([1,0,0])
|
||||
translate ([x,y,z]) children();
|
||||
}
|
||||
}
|
||||
|
||||
//== PART IV : MISCELLANEOUS =====================
|
||||
|
||||
//-- Miscellaneous Modules ---------------
|
||||
module dome (d,ht,x,y,z){ // origin base of dome - rise in 'z' axis
|
||||
mv = (z==undef)?0:z;
|
||||
Sph_Rd = (ht*ht + d*d/4) / (2*ht);
|
||||
translate([x,y,-Sph_Rd+ht+mv])
|
||||
difference() {
|
||||
sphere(Sph_Rd, $fn=64);
|
||||
translate([0,0,-ht]) // remove the useless sphere portion
|
||||
cube([2*Sph_Rd,2*Sph_Rd,2*Sph_Rd],center=true);
|
||||
}
|
||||
}
|
||||
|
||||
module echo_camera () { // Echo camera variables on console
|
||||
echo ("Camera distance: ",$vpd);
|
||||
echo ("Camera translation vector: ",$vpt);
|
||||
echo ("Camera rotation vector: ",$vpr);
|
||||
}
|
||||
|
||||
module segz (d,depth, x1,y1,x2,y2) { //extrude rounded segment
|
||||
linear_extrude(height=depth, center=false)
|
||||
hull () {tsl(x1,y1) circle (d=d); tsl(x2,y2) circle(d=d);}
|
||||
}
|
||||
|
||||
//-- color modules ---------------------------
|
||||
module black() {color ("black") children();}
|
||||
//black color is problematic in OpenScad as you can't view shapes, so a not completely black color is created and called 'dark'
|
||||
module dark() {color([0.22,0.22,0.22]) children();}
|
||||
module white() {color ("white") children();}
|
||||
module silver(){color ("silver") children();}
|
||||
module gray() {color ("gray") children();}
|
||||
module red() {color ("red") children();}
|
||||
module green() {color ("green") children();}
|
||||
module blue() {color ("blue") children();}
|
||||
module yellow(){color ("yellow") children();}
|
||||
module orange(){color ("orange") children();}
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1 +0,0 @@
|
|||
This thing was created by Thingiverse user Parkinbot, and is licensed under Creative Commons - Attribution - Non-Commercial
|
|
@ -1,4 +0,0 @@
|
|||
NACA Airfoils - 4 digit fully parametric OpenSCAD library by Parkinbot on Thingiverse: https://www.thingiverse.com/thing:898554
|
||||
|
||||
Summary:
|
||||
Are you playing around with airfoils? Better have a fast airfoil data generator at hand. I found some code doing airfoils in this forum, but that wasn't flexible enough as it didn't take advantage of the new vector features of OpenSCAD 2015.So I coded my own little library to always have a fully customizable 4 digit NACA airfoil data generator at hand. What you geta fully parametric library a bunch of usage examples help functionality well documented code (but very tough in the core part) In my next post I'll show how to do objects that sweep smoothly between different airfoil types being freely shifted and rotated in 3D space. Stay tuned.
|
|
@ -1,60 +0,0 @@
|
|||
// Naca4.scad - library for parametric airfoils of 4 digit NACA series
|
||||
// Code: Rudolf Huttary, Berlin
|
||||
// June 2015
|
||||
// commercial use prohibited
|
||||
|
||||
|
||||
// general use: for more examples refer to sampler.scad
|
||||
// naca = naca digits or 3el vector (default = 12 or [0, 0, .12])
|
||||
// L = chord length [mm] (default= 100)
|
||||
// N = # sample points (default= 81)
|
||||
// h = height [mm] (default= 1)
|
||||
// open = close at the thin end? (default = true)
|
||||
// two equivalent example calls
|
||||
// airfoil(naca = 2408, L = 60, N=1001, h = 30, open = false);
|
||||
// airfoil(naca = [.2, .4, .32], L = 60, N=1001, h = 30, open = false);
|
||||
|
||||
module help_Naca4()
|
||||
{
|
||||
echo(str("\n\nList of signatures in lib:\n=================\n",
|
||||
"module help() - displays this help\n",
|
||||
"module help_Naca() - displays this help\n",
|
||||
"module help_Naca4() - displays this help\n",
|
||||
"module airfoil(naca=2412, L = 100, N = 81, h = 1, open = false) - renders airfoil object\n",
|
||||
"module airfoil(naca=[.2, .4, .12], L = 100, N = 81, h = 1, open = false) - renders airfoil object using percentage for camber, camber distance and thicknes\n",
|
||||
"function airfoil_data(naca=12, L = 100, N = 81, open = false)\n",
|
||||
"=================\n"));
|
||||
}
|
||||
|
||||
module help() help_Naca4();
|
||||
|
||||
// help();
|
||||
// this is the object
|
||||
module airfoil(naca=12, L = 100, N = 81, h = 1, open = false)
|
||||
{
|
||||
linear_extrude(height = h)
|
||||
polygon(points = airfoil_data(naca, L, N, open));
|
||||
}
|
||||
|
||||
// this is the main function providing the airfoil data
|
||||
function airfoil_data(naca=12, L = 100, N = 81, open = false) =
|
||||
let(Na = len(naca)!=3?NACA(naca):naca)
|
||||
let(A = [.2969, -0.126, -.3516, .2843, open?-0.1015:-0.1036])
|
||||
[for (b=[-180:360/(N):179.99])
|
||||
let (x = (1-cos(b))/2)
|
||||
let(yt = sign(b)*Na[2]/.2*(A*[sqrt(x), x, x*x, x*x*x, x*x*x*x]))
|
||||
Na[0]==0?L*[x, yt]:L*camber(x, yt, Na[0], Na[1], sign(b))];
|
||||
|
||||
// helper functions
|
||||
function NACA(naca) =
|
||||
let (M = floor(naca/1000))
|
||||
let (P = floor((naca-M*1000)/100))
|
||||
[M/100, P/10, floor(naca-M*1000-P*100)/100];
|
||||
|
||||
function camber(x, y, M, P, upper) =
|
||||
let(yc = (x<P)?M/P/P*(2*P*x-x*x): M/(1-P)/(1-P)*(1 - 2*P + 2*P*x -x*x))
|
||||
let(dy = (x<P)?2*M/P/P*(P-x):2*M/(1-P)/(1-P)*(P-x))
|
||||
let(th = atan(dy))
|
||||
[upper ? x - y*sin(th):x + y*sin(th), upper ? yc + y*cos(th):yc - y*cos(th)];
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,60 +0,0 @@
|
|||
// Sampler.scad - library for parametric airfoils of 4 digit NACA series
|
||||
// Code: Rudolf Huttary, Berlin
|
||||
// June 2015
|
||||
// commercial use prohibited
|
||||
|
||||
use <ShortCuts.scad> // see: http://www.thingiverse.com/thing:644830
|
||||
use <Naca4.scad>
|
||||
|
||||
place_in_rect(110, 70) // arange that stuff in a grid
|
||||
{
|
||||
// duct
|
||||
T(50, 30, 0)
|
||||
rotate_extrude($fn = 100)
|
||||
translate([30, 100, 0])
|
||||
R(0, -180, 90)
|
||||
polygon(points = airfoil_data([-.1, .4, .1], L=100));
|
||||
|
||||
// drop
|
||||
T(50, 30, 0)
|
||||
scale([1, 2])
|
||||
rotate_extrude()
|
||||
Rz(90)
|
||||
difference()
|
||||
{
|
||||
polygon(points = airfoil_data(30));
|
||||
square(100, 100);
|
||||
}
|
||||
|
||||
// some winding airfoils
|
||||
linear_extrude(height = 100, twist = 30, scale = .5)
|
||||
polygon(points = airfoil_data(30));
|
||||
|
||||
translate([50, 0, 0])
|
||||
linear_extrude(height = 100, twist = 30, scale = .5)
|
||||
translate([-50, 0, 0])
|
||||
polygon(points = airfoil_data(30));
|
||||
|
||||
translate([100, 0, 0])
|
||||
linear_extrude(height = 100, twist = 30, scale = .5)
|
||||
translate([-100, 0, 0])
|
||||
polygon(points = airfoil_data(30));
|
||||
|
||||
T(30)
|
||||
airfoil(naca = 2432, L = 60, N=101, h = 30, open = false);
|
||||
|
||||
// some airfoil objects, Naca values defined with number or vector
|
||||
airfoil (); // NACA12 object
|
||||
airfoil (2417); // NACA2417 object
|
||||
airfoil ([.2, .4, .17]); // NACA2417 object
|
||||
airfoil ([-.10101, .52344, .17122]); // inverted precise curvature
|
||||
|
||||
help(); // show help in console
|
||||
|
||||
// end of sampler
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,251 +0,0 @@
|
|||
// ShortCuts.scad
|
||||
// Autor: Rudolf Huttary, Berlin 2015
|
||||
//
|
||||
$fn = 100;
|
||||
|
||||
|
||||
//show_examples();
|
||||
|
||||
module show_examples()
|
||||
place_in_rect(30, 30)
|
||||
{
|
||||
Cy(h = 10);
|
||||
CyH(h = 10);
|
||||
CyH(h = 10, w = 30);
|
||||
CyS(h = 10);
|
||||
CyS(h = 10, w1 = 25, w2 = 75);
|
||||
Cu(10);
|
||||
Ri(h = 10);
|
||||
RiH(h = 10);
|
||||
RiS(h = 10, w1 = 10);
|
||||
RiS(h = 10, w1 = 30, w2 = 300);
|
||||
Sp();
|
||||
SpH(10, 30, 30);
|
||||
}
|
||||
|
||||
|
||||
|
||||
module help()
|
||||
{
|
||||
echo("===============");
|
||||
echo("help(): shows this help");
|
||||
echo("show_examples(): shows some examples");
|
||||
echo("place_in_rect(): places children objects in grid");
|
||||
echo("Transformations:");
|
||||
echo(" transform : T(x=0, y=0, z=0), Tx(x=0) , Ty(y=0), Tz(z=0)");
|
||||
echo(" rotate : R(x=0, y=0, z=0), Rx(x=0) , Ry(y=0), Rz(z=0)");
|
||||
echo(" scale : S(x=1, y=1, z=1), Sx(x=1) , Sy(y=1), Sz(z=1)");
|
||||
echo("Logical");
|
||||
echo(" difference : D()");
|
||||
echo(" union : U()");
|
||||
echo(" intersection : *missing*");
|
||||
echo("Primitives");
|
||||
echo(" circle : Ci(r=10)");
|
||||
echo(" circle_half : CiH(r=10, w=0)")
|
||||
echo(" circle_segment : CiS(r=10, w1=0, w2=90)")
|
||||
echo(" square : Sq(x=10, y=0, center=true))");
|
||||
echo(" cylinder : Cy(r=10, h=1, center=true)");
|
||||
echo(" cylinder_half : CyH(r=10, w=0)")
|
||||
echo(" cylinder_segment: CyS(r=10, h=1, w1=0, w2=90,center=true)");
|
||||
echo(" cylinder_segment: Pie(r=10, h=1, w1=0, w2=90,center=true)");
|
||||
echo(" cube : Cu(x=10, y=0, z=10, center=true)");
|
||||
echo(" ring : Ri(R=10, r=5, h=1, center=true)");
|
||||
echo(" ring_half : RiH(R=10, r=5, h=1, w=0 center=true)");
|
||||
echo(" ring_segment : RiS(R=10, r=5, h=1, w1=0, w2=90, center=true)");
|
||||
echo(" sphere: Sp(r=10))");
|
||||
echo(" sphere_half: SpH(r=10, w1 = 0, w2 = 0))");
|
||||
echo("===============");
|
||||
}
|
||||
|
||||
|
||||
// Euclidean Transformations
|
||||
|
||||
module T(x=0, y=0, z=0){translate([x, y, z])children(); }
|
||||
module Tx(x) { translate([x, 0, 0])children(); }
|
||||
module Ty(y) { translate([0, y, 0])children(); }
|
||||
module Tz(z) { translate([0, 0, z])children(); }
|
||||
|
||||
|
||||
module R(x=0, y=0, z=0){rotate([x, y, z]) children();}
|
||||
module Rx(x=90){rotate([x, 0, 0]) children();}
|
||||
module Ry(y=90){rotate([0, y, 0]) children();}
|
||||
module Rz(z=90){rotate([0, 0, z]) children();}
|
||||
|
||||
module S(x=1, y=1, z=1){scale([x, y, z]) children();}
|
||||
module Sx(x=1){scale([x, 1, 1]) children();}
|
||||
module Sy(y=1){scale([1, y, 1]) children();}
|
||||
module Sz(z=1){scale([1, 1, z]) children();}
|
||||
|
||||
|
||||
module D() difference(){children(0); children([1:$children-1]);}
|
||||
module U() children([0:$children-1]);
|
||||
// module I() intersection()children([0:$children-1]); // does not work for some reason
|
||||
|
||||
|
||||
// primitives - 2D
|
||||
|
||||
module Sq(x =10, y = 0, center = true)
|
||||
{
|
||||
if(y==0)
|
||||
square([x, x], center = center);
|
||||
else
|
||||
square([x, y], center = center);
|
||||
}
|
||||
module Ci(r = 10)
|
||||
{
|
||||
circle(r = r);
|
||||
}
|
||||
|
||||
// derived primitives - 2d
|
||||
module CiH(r = 10, w = 0)
|
||||
circle_half(r, w);
|
||||
|
||||
module CiS(r = 10, w1 = 0, w2 = 90)
|
||||
circle_segment(r, w1, w2);
|
||||
|
||||
|
||||
// primitives - 3d
|
||||
module Cy(r = 10, h = 1, center = true)
|
||||
{
|
||||
cylinder(r = r, h = h, center = center);
|
||||
}
|
||||
module Cu(x = 10, y = 0, z = 10, center = true)
|
||||
{
|
||||
if (y==0)
|
||||
cube([x, x, x], center = center);
|
||||
else
|
||||
cube([x, y, z], center = center);
|
||||
}
|
||||
|
||||
// derived primitives - 3d
|
||||
module CyH(r = 10, h = 1, w = 0, center = true)
|
||||
cylinder_half(r, h, w, center);
|
||||
|
||||
module CyS(r = 10, h = 1, w1 = 0, w2 = 90, center = true)
|
||||
cylinder_segment(r, h, w1, w2, center);
|
||||
|
||||
module Ri(R = 10, r = 5, h = 1, center = true)
|
||||
ring(R, r, h, center);
|
||||
|
||||
module RiS(R = 10, r = 5, h = 1, w1 = 0, w2 = 90, center = true)
|
||||
ring_segment(R, r, h, w1, w2, center);
|
||||
|
||||
module RiH(r1 = 10, r2, h = 1, w = 0, center = true)
|
||||
ring_half(r1, r2, h, w, center);
|
||||
module Pie(r = 10, h = 1, w1 = 0, w2 = 90, center = true)
|
||||
cylinder_segment(r, h, w1, w2, center);
|
||||
module Sp(r = 10)
|
||||
sphere(r);
|
||||
module SpH(r = 10, w1 = 0, w2 = 0)
|
||||
sphere_half(r, w1, w2);
|
||||
module SpS(r = 10, w1 = 0, w2 = 90, w3 = 90)
|
||||
sphere_segment(r, w1, w2);
|
||||
|
||||
|
||||
|
||||
|
||||
// clear text definitions
|
||||
module circle_half(r = 10, w = 0)
|
||||
{
|
||||
difference()
|
||||
{
|
||||
circle(r);
|
||||
rotate([0, 0, w-90])
|
||||
translate([0, -r])
|
||||
square([r, 2*r], center = false);
|
||||
}
|
||||
}
|
||||
|
||||
module circle_segment(r = 10, w1 = 0, w2 = 90)
|
||||
{
|
||||
W2 = (w1>w2)?w2+360:w2;
|
||||
if (W2-w1 < 180)
|
||||
intersection()
|
||||
{
|
||||
circle_half(r, w1);
|
||||
circle_half(r, W2-180);
|
||||
}
|
||||
else
|
||||
union()
|
||||
{
|
||||
circle_half(r, w1);
|
||||
circle_half(r, W2-180);
|
||||
}
|
||||
}
|
||||
|
||||
module cylinder_half(r = 10, h = 1, w = 0, center = true)
|
||||
{
|
||||
linear_extrude(height = h, center = center)
|
||||
circle_half(r, w);
|
||||
}
|
||||
|
||||
module cylinder_segment(r = 10, h = 1, w1 = 0, w2 = 90, center = true)
|
||||
{
|
||||
linear_extrude(height = h, center = center)
|
||||
circle_segment(r, w1, w2);
|
||||
}
|
||||
|
||||
module ring(R = 10, r = 5, h = 1, center = true)
|
||||
{
|
||||
difference()
|
||||
{
|
||||
cylinder(r = R, h = h, center = center);
|
||||
translate([0, 0, -2*h])
|
||||
cylinder(r = r, h = 4*h, center = false);
|
||||
}
|
||||
}
|
||||
|
||||
module ring_half(R = 10, r = 5, h = 1, w = 0, center = true)
|
||||
{
|
||||
difference()
|
||||
{
|
||||
ring(R, r, h, center);
|
||||
rotate([0, 0, w])
|
||||
translate([0, -R/2, 0])
|
||||
cube([2*R, R, 3*h], center = true);
|
||||
}
|
||||
}
|
||||
|
||||
module ring_segment(R = 10, r = 5, h = 1, w1 = 0, w2 = 90, center = true)
|
||||
{
|
||||
W2 = (w1>w2)?w2+360:w2;
|
||||
if (W2-w1 < 180)
|
||||
intersection()
|
||||
{
|
||||
ring_half(R, r, h, w1, center);
|
||||
ring_half(R, r, h, W2-180, center);
|
||||
}
|
||||
else
|
||||
union()
|
||||
{
|
||||
ring_half(R, r, h, w1, center);
|
||||
ring_half(R, r, h, W2-180, center);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
module sphere_half(r = 10, w1 = 0, w2 = 0)
|
||||
{
|
||||
difference()
|
||||
{
|
||||
sphere(r);
|
||||
rotate([-w1, -w2, 0])
|
||||
translate([0, 0, r])
|
||||
cube(2*r, 2*r, r, center = true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// additional code
|
||||
module place_in_rect(dx =20, dy=20)
|
||||
{
|
||||
cols = ceil(sqrt($children));
|
||||
rows = floor(sqrt($children));
|
||||
for(i = [0:$children-1])
|
||||
{
|
||||
T(dx*(-cols/2+(i%cols)+.5), dy*(rows/2-floor(i/cols)-.5))
|
||||
children(i);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 279 KiB |
Binary file not shown.
Before Width: | Height: | Size: 278 KiB |
|
@ -1 +0,0 @@
|
|||
This thing was created by Thingiverse user haand001 (Hampus Andersson), and is licensed under Creative Commons - Attribution
|
|
@ -1,4 +0,0 @@
|
|||
Sprocket Generator V2 - OpenSCAD by haand001 on Thingiverse: https://www.thingiverse.com/thing:3059422
|
||||
|
||||
Summary:
|
||||
This is a sprocket generator that is designed and coded to be easy to use, even if you are new to OpenSCAD. Customize your own sprocket according to your needs and export it directly to a .stl file. Slice it and print it!For example, you can change:Bore diameterTeeth countPitch, roller diameterToleranceThicknessShaft length and diameterNumber of holes evenly distributedand a lot more...Test it using the Customizer to the right --> !Use PETG or Nylon for best results with 100% infill, many wall layers and concentric filling setting.The code is generously commented and easy to understand for you to make your own adjustments if required by your specific application. All measurements is in millimeters.Enjoy!
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
|
||||
Sprocket generator v2
|
||||
|
||||
This code is based on the code written by *Talon_1* who based his code on the work of
|
||||
*Aleksejs*. Big thanks for your contributions. The aim of this code is to be easier
|
||||
understood by folks that are new to OpenSCAD. The rendered sprocket can be downloaded
|
||||
as a .STL file and 3D-printed directly using any slicing program.
|
||||
|
||||
*/
|
||||
|
||||
//////////////////////
|
||||
/* CHAIN-PARAMETERS */
|
||||
//////////////////////
|
||||
|
||||
// THESE ARE FOR 25H/04C
|
||||
roller_d = 4.1;
|
||||
thickness = 2.9;
|
||||
pitch = 6.35;
|
||||
tolerance = 0.05;
|
||||
|
||||
///////////////
|
||||
/* VARIABLES */
|
||||
///////////////
|
||||
|
||||
teeth = 10;
|
||||
|
||||
// Shaft
|
||||
bottom_shaft_d = 10;
|
||||
bottom_shaft_h = 2; // = 0 to remove
|
||||
|
||||
top_shaft_d = 10;
|
||||
top_shaft_h = 3; // = 0 to remove
|
||||
|
||||
toptop_shaft_d = 16;
|
||||
toptop_shaft_h = 8; // = 0 to remove
|
||||
|
||||
// Bore
|
||||
hole_d = 8;
|
||||
|
||||
// Holes
|
||||
number_of_holes = 0;
|
||||
hole_dia = 4;
|
||||
hole_ring_dia = 40;
|
||||
|
||||
///////////////////////
|
||||
// RENDERING QUALITY */
|
||||
///////////////////////
|
||||
|
||||
// HIGH : fs=0.25 : fa=3 : fn=0
|
||||
// LOW : fs=1 : fa=7 : fn=0
|
||||
fs = 0.25; // Minimum size of a fragment
|
||||
fa = 1; // Minimum angle for a fragment
|
||||
fn = 0; // Number of fragments (overrides fs & fa if non zero)
|
||||
|
||||
///////////////
|
||||
/* MAIN CODE */
|
||||
///////////////
|
||||
|
||||
difference()
|
||||
{
|
||||
// Create a union of four shapes, 3 cylinders and 1 sprocket
|
||||
union()
|
||||
{
|
||||
// Create sprocket using the difined module
|
||||
sprocket(teeth, roller_d, pitch, thickness, tolerance);
|
||||
|
||||
// Create cylinder on front side of sprocket
|
||||
translate([0, 0, thickness])
|
||||
cylinder(top_shaft_h, top_shaft_d/2, top_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
|
||||
// Create cylinder on back side of sprocket
|
||||
rotate([0,180])
|
||||
cylinder(bottom_shaft_h, bottom_shaft_d/2, bottom_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
|
||||
// Create cylinder on top of the front side cylinder
|
||||
translate([0, 0, thickness+top_shaft_h])
|
||||
cylinder(toptop_shaft_h, toptop_shaft_d/2, toptop_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
|
||||
// Rest of shapes are removal of material
|
||||
// Drills out the center hole with 1 mm extra in both directions
|
||||
translate([0, 0, -bottom_shaft_h-1])
|
||||
{
|
||||
cylinder(bottom_shaft_h+thickness+top_shaft_h+toptop_shaft_h+2, hole_d/2, hole_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
|
||||
// Drills 'number_of_holes' many holes in a circle
|
||||
angle_between_holes = 360/number_of_holes;
|
||||
for(hole_angle = [0:360/number_of_holes:360])
|
||||
{
|
||||
translate([hole_ring_dia/2*cos(hole_angle), hole_ring_dia/2*sin(hole_angle), -bottom_shaft_h-1])
|
||||
{
|
||||
cylinder(h = bottom_shaft_h+thickness+top_shaft_h+toptop_shaft_h+2, r = hole_dia/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
/* SPROCKET MODULE */
|
||||
/////////////////////
|
||||
|
||||
module sprocket(teeth=20, roller=3, pitch=17, thickness=3, tolerance=0.2)
|
||||
{
|
||||
roller_radius = roller/2; //We need radius in our calculations, not diameter
|
||||
distance_from_center = pitch/(2*sin(180/teeth));
|
||||
angle = (360/teeth);
|
||||
|
||||
pitch_radius = sqrt((distance_from_center*distance_from_center) - (pitch*(roller_radius+tolerance))+((roller_radius+tolerance)*(roller_radius+tolerance)));
|
||||
|
||||
difference()
|
||||
{
|
||||
union()
|
||||
{
|
||||
// Quality parameters
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
|
||||
// Create inner cylinder with radius = pitch_radius
|
||||
cylinder(r=pitch_radius, h=thickness);
|
||||
|
||||
// Create outer part of the teeth
|
||||
for(tooth=[1:teeth])
|
||||
{
|
||||
intersection()
|
||||
{
|
||||
rotate(a=[0, 0, angle*(tooth+0.5)])
|
||||
{
|
||||
translate([distance_from_center, 0, 0])
|
||||
{
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
cylinder(r=pitch-roller_radius-tolerance, h=thickness);
|
||||
}
|
||||
}
|
||||
rotate(a=[0,0,angle*(tooth-0.5)])
|
||||
{
|
||||
translate([distance_from_center,0,0])
|
||||
{
|
||||
cylinder(r=pitch-roller_radius-tolerance,h=thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cuts away the inner groove between the teeth
|
||||
for(tooth=[1:teeth])
|
||||
{
|
||||
rotate(a=[0, 0, angle*(tooth+0.5)])
|
||||
{
|
||||
translate([distance_from_center, 0, -1])
|
||||
{
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
cylinder(r=roller_radius+tolerance, h=thickness+2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
|
||||
Sprocket generator v2
|
||||
|
||||
This code is based on the code written by *Talon_1* who based his code on the work of
|
||||
*Aleksejs*. Big thanks for your contributions. The aim of this code is to be easier
|
||||
understood by folks that are new to OpenSCAD. The rendered sprocket can be downloaded
|
||||
as a .STL file and 3D-printed directly using any slicing program.
|
||||
|
||||
*/
|
||||
|
||||
//////////////////////
|
||||
/* CHAIN-PARAMETERS */
|
||||
//////////////////////
|
||||
|
||||
// THESE ARE FOR 25H/04C
|
||||
roller_d = 4.1;
|
||||
thickness = 2.9;
|
||||
pitch = 6.35;
|
||||
tolerance = 0.05;
|
||||
|
||||
///////////////
|
||||
/* VARIABLES */
|
||||
///////////////
|
||||
|
||||
teeth = 23;
|
||||
|
||||
// Shaft
|
||||
bottom_shaft_d = 20;
|
||||
bottom_shaft_h = 2; // = 0 to remove
|
||||
|
||||
top_shaft_d = 40;
|
||||
top_shaft_h = 8; // = 0 to remove
|
||||
|
||||
toptop_shaft_d = 36;
|
||||
toptop_shaft_h = 4; // = 0 to remove
|
||||
|
||||
// Bore
|
||||
hole_d = 12;
|
||||
|
||||
// Holes
|
||||
number_of_holes = 12;
|
||||
hole_dia = 4;
|
||||
hole_ring_dia = 30;
|
||||
|
||||
///////////////////////
|
||||
// RENDERING QUALITY */
|
||||
///////////////////////
|
||||
|
||||
// HIGH : fs=0.25 : fa=3 : fn=0
|
||||
// LOW : fs=1 : fa=7 : fn=0
|
||||
fs = 0.25; // Minimum size of a fragment
|
||||
fa = 1; // Minimum angle for a fragment
|
||||
fn = 0; // Number of fragments (overrides fs & fa if non zero)
|
||||
|
||||
///////////////
|
||||
/* MAIN CODE */
|
||||
///////////////
|
||||
|
||||
difference()
|
||||
{
|
||||
// Create a union of four shapes, 3 cylinders and 1 sprocket
|
||||
union()
|
||||
{
|
||||
// Create sprocket using the difined module
|
||||
sprocket(teeth, roller_d, pitch, thickness, tolerance);
|
||||
|
||||
// Create cylinder on front side of sprocket
|
||||
translate([0, 0, thickness])
|
||||
cylinder(top_shaft_h, top_shaft_d/2, top_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
|
||||
// Create cylinder on back side of sprocket
|
||||
rotate([0,180])
|
||||
cylinder(bottom_shaft_h, bottom_shaft_d/2, bottom_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
|
||||
// Create cylinder on top of the front side cylinder
|
||||
translate([0, 0, thickness+top_shaft_h])
|
||||
cylinder(toptop_shaft_h, toptop_shaft_d/2, toptop_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
|
||||
// Rest of shapes are removal of material
|
||||
// Drills out the center hole with 1 mm extra in both directions
|
||||
translate([0, 0, -bottom_shaft_h-1])
|
||||
{
|
||||
cylinder(bottom_shaft_h+thickness+top_shaft_h+toptop_shaft_h+2, hole_d/2, hole_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
|
||||
// Drills 'number_of_holes' many holes in a circle
|
||||
angle_between_holes = 360/number_of_holes;
|
||||
for(hole_angle = [0:360/number_of_holes:360])
|
||||
{
|
||||
translate([hole_ring_dia/2*cos(hole_angle), hole_ring_dia/2*sin(hole_angle), -bottom_shaft_h-1])
|
||||
{
|
||||
cylinder(h = bottom_shaft_h+thickness+top_shaft_h+toptop_shaft_h+2, r = hole_dia/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
/* SPROCKET MODULE */
|
||||
/////////////////////
|
||||
|
||||
module sprocket(teeth=20, roller=3, pitch=17, thickness=3, tolerance=0.2)
|
||||
{
|
||||
roller_radius = roller/2; //We need radius in our calculations, not diameter
|
||||
distance_from_center = pitch/(2*sin(180/teeth));
|
||||
angle = (360/teeth);
|
||||
|
||||
pitch_radius = sqrt((distance_from_center*distance_from_center) - (pitch*(roller_radius+tolerance))+((roller_radius+tolerance)*(roller_radius+tolerance)));
|
||||
|
||||
difference()
|
||||
{
|
||||
union()
|
||||
{
|
||||
// Quality parameters
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
|
||||
// Create inner cylinder with radius = pitch_radius
|
||||
cylinder(r=pitch_radius, h=thickness);
|
||||
|
||||
// Create outer part of the teeth
|
||||
for(tooth=[1:teeth])
|
||||
{
|
||||
intersection()
|
||||
{
|
||||
rotate(a=[0, 0, angle*(tooth+0.5)])
|
||||
{
|
||||
translate([distance_from_center, 0, 0])
|
||||
{
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
cylinder(r=pitch-roller_radius-tolerance, h=thickness);
|
||||
}
|
||||
}
|
||||
rotate(a=[0,0,angle*(tooth-0.5)])
|
||||
{
|
||||
translate([distance_from_center,0,0])
|
||||
{
|
||||
cylinder(r=pitch-roller_radius-tolerance,h=thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cuts away the inner groove between the teeth
|
||||
for(tooth=[1:teeth])
|
||||
{
|
||||
rotate(a=[0, 0, angle*(tooth+0.5)])
|
||||
{
|
||||
translate([distance_from_center, 0, -1])
|
||||
{
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
cylinder(r=roller_radius+tolerance, h=thickness+2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
/*
|
||||
|
||||
Sprocket generator v2
|
||||
|
||||
This code is based on the code written by *Talon_1* who based his code on the work of
|
||||
*Aleksejs*. Big thanks for your contributions. The aim of this code is to be easier
|
||||
understood by folks that are new to OpenSCAD. The rendered sprocket can be downloaded
|
||||
as a .STL file and 3D-printed directly using any slicing program.
|
||||
|
||||
*/
|
||||
|
||||
//////////////////////
|
||||
/* CHAIN-PARAMETERS */
|
||||
//////////////////////
|
||||
|
||||
// THESE ARE FOR 25H/04C
|
||||
roller_d = 4.1;
|
||||
thickness = 2.9;
|
||||
pitch = 6.35;
|
||||
tolerance = 0.05;
|
||||
|
||||
///////////////
|
||||
/* VARIABLES */
|
||||
///////////////
|
||||
|
||||
teeth = 31;
|
||||
|
||||
// Shaft
|
||||
bottom_shaft_d = 20;
|
||||
bottom_shaft_h = 0; // = 0 to remove
|
||||
|
||||
top_shaft_d = 50;
|
||||
top_shaft_h = 3; // = 0 to remove
|
||||
|
||||
toptop_shaft_d = 24;
|
||||
toptop_shaft_h = 8; // = 0 to remove
|
||||
|
||||
// Bore
|
||||
hole_d = 20;
|
||||
|
||||
// Holes
|
||||
number_of_holes = 5;
|
||||
hole_dia = 4;
|
||||
hole_ring_dia = 40;
|
||||
|
||||
///////////////////////
|
||||
// RENDERING QUALITY */
|
||||
///////////////////////
|
||||
|
||||
// HIGH : fs=0.25 : fa=3 : fn=0
|
||||
// LOW : fs=1 : fa=7 : fn=0
|
||||
fs = 0.25; // Minimum size of a fragment
|
||||
fa = 1; // Minimum angle for a fragment
|
||||
fn = 0; // Number of fragments (overrides fs & fa if non zero)
|
||||
|
||||
///////////////
|
||||
/* MAIN CODE */
|
||||
///////////////
|
||||
|
||||
difference()
|
||||
{
|
||||
// Create a union of four shapes, 3 cylinders and 1 sprocket
|
||||
union()
|
||||
{
|
||||
// Create sprocket using the difined module
|
||||
sprocket(teeth, roller_d, pitch, thickness, tolerance);
|
||||
|
||||
// Create cylinder on front side of sprocket
|
||||
translate([0, 0, thickness])
|
||||
cylinder(top_shaft_h, top_shaft_d/2, top_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
|
||||
// Create cylinder on back side of sprocket
|
||||
rotate([0,180])
|
||||
cylinder(bottom_shaft_h, bottom_shaft_d/2, bottom_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
|
||||
// Create cylinder on top of the front side cylinder
|
||||
translate([0, 0, thickness+top_shaft_h])
|
||||
cylinder(toptop_shaft_h, toptop_shaft_d/2, toptop_shaft_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
|
||||
// Rest of shapes are removal of material
|
||||
// Drills out the center hole with 1 mm extra in both directions
|
||||
translate([0, 0, -bottom_shaft_h-1])
|
||||
{
|
||||
cylinder(bottom_shaft_h+thickness+top_shaft_h+toptop_shaft_h+2, hole_d/2, hole_d/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
|
||||
// Drills 'number_of_holes' many holes in a circle
|
||||
angle_between_holes = 360/number_of_holes;
|
||||
for(hole_angle = [0:360/number_of_holes:360])
|
||||
{
|
||||
translate([hole_ring_dia/2*cos(hole_angle), hole_ring_dia/2*sin(hole_angle), -bottom_shaft_h-1])
|
||||
{
|
||||
cylinder(h = bottom_shaft_h+thickness+top_shaft_h+toptop_shaft_h+2, r = hole_dia/2, $fs=fs, $fa=fa, $fn=fn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////
|
||||
/* SPROCKET MODULE */
|
||||
/////////////////////
|
||||
|
||||
module sprocket(teeth=20, roller=3, pitch=17, thickness=3, tolerance=0.2)
|
||||
{
|
||||
roller_radius = roller/2; //We need radius in our calculations, not diameter
|
||||
distance_from_center = pitch/(2*sin(180/teeth));
|
||||
angle = (360/teeth);
|
||||
|
||||
pitch_radius = sqrt((distance_from_center*distance_from_center) - (pitch*(roller_radius+tolerance))+((roller_radius+tolerance)*(roller_radius+tolerance)));
|
||||
|
||||
difference()
|
||||
{
|
||||
union()
|
||||
{
|
||||
// Quality parameters
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
|
||||
// Create inner cylinder with radius = pitch_radius
|
||||
cylinder(r=pitch_radius, h=thickness);
|
||||
|
||||
// Create outer part of the teeth
|
||||
for(tooth=[1:teeth])
|
||||
{
|
||||
intersection()
|
||||
{
|
||||
rotate(a=[0, 0, angle*(tooth+0.5)])
|
||||
{
|
||||
translate([distance_from_center, 0, 0])
|
||||
{
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
cylinder(r=pitch-roller_radius-tolerance, h=thickness);
|
||||
}
|
||||
}
|
||||
rotate(a=[0,0,angle*(tooth-0.5)])
|
||||
{
|
||||
translate([distance_from_center,0,0])
|
||||
{
|
||||
cylinder(r=pitch-roller_radius-tolerance,h=thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cuts away the inner groove between the teeth
|
||||
for(tooth=[1:teeth])
|
||||
{
|
||||
rotate(a=[0, 0, angle*(tooth+0.5)])
|
||||
{
|
||||
translate([distance_from_center, 0, -1])
|
||||
{
|
||||
$fs = fs;
|
||||
$fa = fa;
|
||||
$fn = fn;
|
||||
cylinder(r=roller_radius+tolerance, h=thickness+2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
|
@ -1,43 +0,0 @@
|
|||
/* Taken from https://gist.github.com/boredzo/fde487c724a40a26fa9c?permalink_comment_id=4258747 */
|
||||
|
||||
/* skew takes an array of six angles:
|
||||
* x along y
|
||||
* x along z
|
||||
* y along x
|
||||
* y along z
|
||||
* z along x
|
||||
* z along y
|
||||
*/
|
||||
module skew(dims) {
|
||||
matrix = [
|
||||
[ 1, dims[0]/45, dims[1]/45, 0 ],
|
||||
[ dims[2]/45, 1, dims[4]/45, 0 ],
|
||||
[ dims[5]/45, dims[3]/45, 1, 0 ],
|
||||
[ 0, 0, 0, 1 ]
|
||||
];
|
||||
multmatrix(matrix)
|
||||
children();
|
||||
}
|
||||
|
||||
/* example:
|
||||
* skew([45, 0, 0, 0, 0, 0])
|
||||
* cube([10,10,10]);
|
||||
*/
|
||||
|
||||
// Skews the child geometry.
|
||||
// xy: Angle towards X along Y axis.
|
||||
// xz: Angle towards X along Z axis.
|
||||
// yx: Angle towards Y along X axis.
|
||||
// yz: Angle towards Y along Z axis.
|
||||
// zx: Angle towards Z along X axis.
|
||||
// zy: Angle towards Z along Y axis.
|
||||
module skew2(xy = 0, xz = 0, yx = 0, yz = 0, zx = 0, zy = 0) {
|
||||
matrix = [
|
||||
[ 1, tan(xy), tan(xz), 0 ],
|
||||
[ tan(yx), 1, tan(yz), 0 ],
|
||||
[ tan(zx), tan(zy), 1, 0 ],
|
||||
[ 0, 0, 0, 1 ]
|
||||
];
|
||||
multmatrix(matrix)
|
||||
children();
|
||||
}
|
77
model/chainset.scad
Normal file
77
model/chainset.scad
Normal file
|
@ -0,0 +1,77 @@
|
|||
// chainset.scad
|
||||
|
||||
// (c) Simon Brooke 2025; CC-BY-SA
|
||||
// Derived from Hampus Andersson's Sprocket Generator
|
||||
|
||||
|
||||
include <SprocketGenerator2/files/Sprocket_Generator_v2_example_10.scad>
|
||||
|
||||
include <pedal.scad>
|
||||
|
||||
include <BOSL2/std.scad>
|
||||
|
||||
function sprocket_radius(teeth=52, roller=7.9, pitch=12.7) = let(roller_radius = roller/2,
|
||||
radius = pitch/(2*sin(180/teeth)))
|
||||
sqrt((radius*radius) - (pitch*(roller_radius+tolerance))+((roller_radius+tolerance)*(roller_radius+tolerance)));
|
||||
|
||||
|
||||
module chainring( teeth=52, roller=7.9, pitch=12.7) {
|
||||
radius = sprocket_radius(teeth=teeth, roller=roller, pitch=pitch);
|
||||
|
||||
echo( "Radius=", radius, "mm");
|
||||
|
||||
difference() {
|
||||
color("grey")
|
||||
sprocket( teeth=teeth, roller=roller, pitch=pitch);
|
||||
|
||||
translate([0, 0, -10])
|
||||
cylinder(h=20, r=radius*.75);
|
||||
}
|
||||
}
|
||||
|
||||
module spider(radius, arms) {
|
||||
for(i=[0:1:5])
|
||||
rotate([0,90,i*(360/5)])
|
||||
color("grey")
|
||||
prismoid(size1=[7, radius/5], size2=[5, radius/7], height=radius*.9);
|
||||
}
|
||||
|
||||
|
||||
module chainset(teeth=53, arms=5, crank=172, bbshell=68) {
|
||||
radius = sprocket_radius(teeth=teeth);
|
||||
|
||||
chainring(teeth=teeth);
|
||||
spider(radius*.9, 5);
|
||||
|
||||
// cranks
|
||||
rotate([0, 90, 0])
|
||||
translate([6, 0, -10])
|
||||
color("grey")
|
||||
prismoid(size1=[10, 25], size2=[7, 18], h=crank+20);
|
||||
|
||||
rotate([0, 90, 180])
|
||||
translate([0 - (12+bbshell), 0, -10])
|
||||
color("grey")
|
||||
prismoid(size1=[10, 25], size2=[7, 18], h=crank +20);
|
||||
|
||||
// pedals
|
||||
translate([0-crank, 0, 20 + bbshell])
|
||||
pedal();
|
||||
translate([crank, 0, 0-4])
|
||||
mirror([0, 0, 1])
|
||||
pedal();
|
||||
|
||||
translate([0, 0, 5])
|
||||
color("black")
|
||||
cylinder(h=bbshell, r=17);
|
||||
|
||||
translate([0, 0, -5])
|
||||
color("black")
|
||||
cylinder(h= bbshell+20, r=6);
|
||||
|
||||
}
|
||||
|
||||
// chainring();
|
||||
// spider(90, 1);
|
||||
|
||||
chainset(teeth=82, crank=140);
|
|
@ -4,7 +4,7 @@
|
|||
// dimensions in millimetres, mostly from https://www.rohloff.de/en/service/handbook/speedhub/technical-data
|
||||
// (c) Simon Brooke 2025; CC-BY-SA
|
||||
|
||||
include <Library/SprocketGenerator2/files/Sprocket_Generator_v2_example_10.scad>
|
||||
include <SprocketGenerator2/files/Sprocket_Generator_v2_example_10.scad>
|
||||
|
||||
module epicyclic (olnd=135, disc=1) {
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
// (c) Simon Brooke 2025; CC-BY-SA
|
||||
|
||||
|
||||
include <Library/BentSim/Bike_accessories.scad>
|
||||
include <Library/NACAAirfoils/files/Naca4.scad>
|
||||
include <Library/skew.scad>
|
||||
include <BentSim/Bike_accessories.scad>
|
||||
include <NACAAirfoils/files/Naca4.scad>
|
||||
include <library/skew.scad>
|
||||
|
||||
module fourbar_leg(length=1000, chord=100, long_skew=30, lat_skew=30) {
|
||||
h = length * cos(lat_skew) * cos( long_skew);
|
||||
|
|
42
model/library/look-keo.svg
Normal file
42
model/library/look-keo.svg
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="210mm"
|
||||
height="297mm"
|
||||
viewBox="0 0 210 297"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
xml:space="preserve"
|
||||
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
|
||||
sodipodi:docname="look-keo.svg"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:document-units="mm"
|
||||
inkscape:zoom="1.1216818"
|
||||
inkscape:cx="245.61333"
|
||||
inkscape:cy="524.65859"
|
||||
inkscape:window-width="2256"
|
||||
inkscape:window-height="1423"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="layer1" /><defs
|
||||
id="defs1" /><g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"><path
|
||||
style="fill:#000000"
|
||||
d="m 120.69386,228.45144 c -0.0761,-0.095 -0.79261,-0.42247 -1.26554,-1.04952 -9.62131,-12.75683 -33.154257,-5.14672 -40.908601,-13.8177 -5.945601,-9.75361 -6.096818,-28.97023 -7.49811,-40.36248 -0.423826,-3.44459 -1.62778,-12.20202 -1.95586,-13.74745 -0.194,-0.91382 -1.29048,-1.67354 -2.12735,-1.474 -0.34314,0.0818 -1.52347,-43.24437 -0.59354,-43.14917 1.62952,0.1668 1.71107,0.14448 2.25074,-0.61604 3.554077,-5.00857 14.150775,-51.348637 16.46043,-55.012344 2.85039,-4.52145 9.28824,-10.830036 15.919271,-15.599634 3.98164,-2.863938 8.76461,-5.585353 10.12612,-5.761567 0.39887,-0.05163 10.80316,-1.275826 30.4038,-0.429223 5.80172,0.0264 8.3442,0.868908 13.18812,3.856094 4.51076,2.874865 13.00167,10.546677 16.00089,14.45733 6.58177,8.581924 11.55888,47.790724 18.28256,56.846864 13.66207,18.40148 10.17581,20.50294 4.22287,32.62423 0,0.18301 -0.35001,0.66309 -0.77779,1.06685 -1.72885,1.63175 -2.47654,3.6689 -3.35769,9.12216 -2.66603,16.49954 -5.63705,36.04957 -7.56679,52.70296 -0.23353,2.01533 -0.36519,4.40484 -1.29806,5.46733 -0.99134,1.12907 -1.59325,1.33123 -7.56295,2.54015 -8.0495,2.83844 -24.63958,0.79427 -29.06113,8.32291 -0.67791,1.3431 -3.86013,4.13521 -5.77495,5.06701 -6.68985,3.25545 -14.68052,1.22444 -17.10644,-1.05476 z m 38.90928,-124.39415 c 0.2278,-0.21012 -0.009,-0.70593 0.15396,-0.90244 0.21105,-0.25429 0.2053,-1.45502 -0.0199,-4.165494 -0.43243,-12.73786 0.28691,-28.716002 -7.02684,-39.49635 -5.01355,-5.617497 -16.00873,-6.191253 -24.4214,-7.185857 -7.30944,-0.405206 -23.67811,3.641785 -26.23022,9.197077 -4.986691,10.854737 -9.09714,38.281659 -6.274401,40.686524 l 14.997501,12.77729 h 36.99215 z"
|
||||
id="path1"
|
||||
sodipodi:nodetypes="sssssssssssssssssssssssssccssssccs" /></g></svg>
|
After Width: | Height: | Size: 2.9 KiB |
16
model/pedal.scad
Normal file
16
model/pedal.scad
Normal file
|
@ -0,0 +1,16 @@
|
|||
// pedal.scad
|
||||
|
||||
// (c) Simon Brooke 2025; CC-BY-SA
|
||||
|
||||
|
||||
module pedal(){
|
||||
rotate([0, 270, 0])
|
||||
scale([.6, .6, .6])
|
||||
translate([-50, -160, 0])
|
||||
linear_extrude(height = 10, center = true)
|
||||
// color("black")
|
||||
import("library/look-keo.svg");
|
||||
cylinder(h=80, r=6);
|
||||
}
|
||||
|
||||
// pedal();
|
|
@ -3,9 +3,9 @@
|
|||
// (c) Simon Brooke 2025; CC-BY-SA
|
||||
|
||||
|
||||
include <Library/BentSim/Bike_accessories.scad>
|
||||
include <BentSim/Bike_accessories.scad>
|
||||
|
||||
include <Library/SprocketGenerator2/files/Sprocket_Generator_v2_example_10.scad>
|
||||
include <SprocketGenerator2/files/Sprocket_Generator_v2_example_10.scad>
|
||||
|
||||
include <epicyclic.scad>
|
||||
|
||||
|
|
Loading…
Reference in a new issue