Created a git repository to track this.

This commit is contained in:
Simon Brooke 2025-09-04 08:35:19 +01:00
parent b12d735c3d
commit bcea01f8b6
12 changed files with 7819 additions and 1 deletions

View file

@ -1,3 +1,13 @@
# tricycle-mechanical-design
Design of a highly experimental recumbent tricycle, not software at all
Design of a highly experimental recumbent tricycle, not software at all.
![Early sketch of the tricycle](tricycle-2b-export.svg)
## Status
Still at a very preliminary, pre-prototype stage. Work is documented [here](https://www.journeyman.cc/blog/tags-output/Tricycle/).
## Copyright
Copyright © Simon Brooke, 2024-2025; may be used and modified under [Creative Commons Attribution-Share Alike](https://creativecommons.org/licenses/by-sa/4.0/deed.en) licence; but (currently) uses elements from [Pierre Rouzeau](https://rouzeau.net/)'s [BentSim](https://github.com/PRouzeau/BentSim) project, which is [GPL](https://github.com/PRouzeau/BentSim/blob/master/LICENSE) licensed.

BIN
by-sa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View file

@ -0,0 +1,926 @@
//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.

View file

@ -0,0 +1,171 @@
//*******************************
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);
}

View file

@ -0,0 +1,414 @@
//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();
}

View file

@ -0,0 +1,890 @@
//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();}

2584
model/Library/flag_image.dxf Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

10
model/subframe.scad Normal file
View file

@ -0,0 +1,10 @@
// tricycle.scad:
module subframe () {
translate([0, 180, 109])
cube([50, 25, 230], center = true);
cube([50, 25,
}
subframe();

197
tricycle-2b-export.svg Normal file
View file

@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="297mm"
height="210mm"
viewBox="0 0 297 210"
version="1.1"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<g
id="layer1">
<path
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-dasharray:0.4, 0.2, 0.1, 0.2;stroke-dashoffset:0;stroke-opacity:1"
d="m 82.79371,75.126497 45.68764,68.405043"
id="path2950" />
<ellipse
style="fill:#06244f;stroke:#000000;stroke-width:1.88435;stroke-opacity:1"
id="front-wheel"
cx="180.0621"
cy="121.84438"
rx="19.203894"
ry="18.38097" />
<g
id="fuselage">
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 102.26997,94.842457 -54.582033,-8.39204 c 7.63919,-7.73858 25.362616,-8.35414 38.523401,-8.99381 7.396929,-0.35952 15.045412,-0.0643 22.518482,0.67487 6.42571,0.63556 19.101,3.2241 19.101,3.2241 0,0 -11.73664,-0.48442 -18.94448,2.3135 -7.20783,2.79792 -7.82355,3.40581 -8.27009,6.98688 -0.21195,1.69981 2.99091,4.17887 2.99091,4.17887"
id="hood" />
<path
style="fill:#cccccc;fill-opacity:0.740255;stroke:#000000;stroke-width:0.3;stroke-dasharray:none;stroke-opacity:1"
d="m 36.143914,104.63545 c -1.906348,7.68324 0.570726,21.78295 8.235453,23.76241 9.817667,2.53547 45.641823,1.89727 59.125673,2.53466 5.70026,0.26945 11.26521,1.94949 16.9577,2.35091 29.33905,2.06891 59.34416,5.77895 88.2353,0.26875 7.17674,-1.36877 15.43788,-2.72547 20.35505,-8.12923 2.2975,-2.52485 4.32195,-6.38268 4.15129,-11.09743 L 47.479344,86.511437 c -4.853635,5.9915 -9.428061,10.52259 -11.33543,18.124013 z"
id="hull" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 173.24708,105.65549 13.73771,-9.807323 c 12.50499,4.314233 44.12427,7.526153 46.08211,18.300263 z"
id="apron" />
</g>
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.1;stroke-dasharray:0.4, 0.2, 0.1, 0.2;stroke-dashoffset:0;stroke-opacity:0.981867"
d="M 92.298168,72.634837 253.51075,111.54875"
id="roof-line" />
<g
id="floor"
transform="translate(6.960657,-33.163543)">
<path
style="fill:none;fill-opacity:0.827152;stroke:#000000;stroke-width:0.5;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 61.506412,156.13955 104.904048,6.57439 v 0 l 0.0255,6.31614"
id="path3452" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 152.13619,161.7029 0.086,7.3068"
id="path3454" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 134.98086,161.04439 0.0132,6.9182"
id="path3456" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 119.06175,159.94277 -0.0178,6.69492"
id="path3458" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 101.82507,159.07434 v 5.67834 0 0"
id="path3460" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 86.020224,158.05582 -0.118005,5.75365 v 0 0"
id="path3462" />
<path
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="m 68.687679,156.93765 -0.04363,6.43973"
id="path3464" />
</g>
<path
style="fill:none;fill-opacity:0.855687;stroke:#000000;stroke-width:0.499999;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
d="M 84.764173,78.466627 116.73802,126.07526"
id="roll-bulkhead" />
<path
style="fill:#878585;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-dasharray:0.4, 0.2, 0.1, 0.2;stroke-dashoffset:0;stroke-opacity:0.981867"
d="M 47.808002,54.554887 182.03051,174.03446"
id="four-bar-upper-pivot" />
<g
id="rear-linkage">
<path
id="rear-linkage-brace"
style="fill:#06244f;fill-opacity:0.855687;stroke:#000000;stroke-width:0.3"
d="m 106.92718,107.22664 1.63625,1.50707 -46.011506,15.92451 -1.63625,-1.50706 z" />
<rect
style="fill:#06244f;fill-opacity:0.855687;stroke:#000000;stroke-width:0.3;stroke-dasharray:none;stroke-opacity:1"
id="rear-linkage-leg"
width="4.8642311"
height="42.587696"
x="125.26166"
y="13.571681"
transform="rotate(39.508174)" />
<ellipse
style="fill:#06244f;fill-opacity:0.855687;stroke:#000000;stroke-width:1.88435;stroke-opacity:1"
id="rear-wheel"
cx="91.51973"
cy="103.24182"
rx="19.203894"
ry="18.38097"
transform="rotate(13.297691)" />
</g>
<g
id="subframe">
<ellipse
style="fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:0.1;stroke-dasharray:0.4, 0.2, 0.1, 0.2;stroke-dashoffset:0;stroke-opacity:0.171453"
id="path1752"
cx="201.49368"
cy="116.30716"
rx="1.54164"
ry="1.5156831" />
<circle
style="fill:#808080;fill-opacity:0.827152;stroke:#000000;stroke-width:0.3;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.981867"
id="chainwheel"
cx="201.22968"
cy="116.47282"
r="12.193081" />
<path
id="transmission-suppport-bracket"
style="fill:#6b8dbd;fill-opacity:0.996078;stroke:#000000;stroke-width:0.1;stroke-opacity:0.537399"
d="m 218.36274,114.73854 h 3.26248 c 0,0 -1.01776,0.56964 -0.98222,2.0333 0.0355,1.46366 2.15152,2.38408 2.15152,2.38408 0,0 -2.26845,0.90301 -2.19829,2.7115 0.0702,1.80849 1.0056,2.59456 1.0056,2.59456 h -3.23909 z" />
<circle
style="fill:#1c241c;fill-opacity:0.463953;stroke:#000000;stroke-width:0.144267"
id="epicyclic"
cx="223.79642"
cy="122.12004"
r="3.2051458" />
<circle
style="fill:#1c241c;fill-opacity:0.463953;stroke:#000000;stroke-width:0.116828"
id="path23"
cx="223.04807"
cy="116.55415"
r="2.3769667" />
<path
id="subframe-upper"
style="fill:#6b8dbd;fill-opacity:0.997471;stroke:#000000;stroke-width:0.1"
d="m 167.47105,98.829387 37.10202,3.790923 28.57779,11.6369 v 1.49671 l -28.57779,-11.6369 -37.65159,-3.87273 z" />
<path
id="transmission-support-leg"
style="fill:#6b8dbd;fill-opacity:0.997471;stroke:#000000;stroke-width:0.1"
d="m 216.71387,109.11876 1.73057,0.65481 v 21.45432 l -1.73057,0.51449 z" />
<path
id="wheel-support-leg"
style="fill:#6b8dbd;fill-opacity:0.997471;stroke:#000000;stroke-width:0.115185"
d="m 177.92051,101.31403 4.19431,0.42095 v 34.59622 h -4.19431 z" />
<path
id="subframe-rear"
style="fill:#6b8dbd;fill-opacity:0.997471;stroke:#000000;stroke-width:0.1"
d="m 165.89249,98.652117 1.60194,0.1637 -11.9386,29.291073 h -1.63702 z" />
<circle
style="fill:#ececec;fill-opacity:0.463953;stroke:#000000;stroke-width:0.144267"
id="front-hub"
cx="179.9709"
cy="122.12004"
r="3.2051458" />
<ellipse
style="fill:#80b3ff;fill-opacity:0.463953;stroke:#000000;stroke-width:0.0441736"
id="circle24"
cx="179.9709"
cy="122.12004"
rx="0.98969775"
ry="0.97316134" />
<g
id="primary-chain">
<path
style="fill:#000000;fill-opacity:0.835934;stroke:#313131;stroke-width:0.5;stroke-dasharray:1.5, 0.5;stroke-dashoffset:0;stroke-opacity:1"
d="m 205.92945,105.09498 19.55077,14.31229 v 0"
id="path26" />
<path
style="fill:#000000;fill-opacity:0.835934;stroke:#313131;stroke-width:0.5;stroke-dasharray:1.5, 0.5;stroke-dashoffset:0;stroke-opacity:1"
d="m 200.9716,128.66815 23.199,-3.36759"
id="path27" />
</g>
<path
id="bb-support-leg"
style="fill:#6b8dbd;fill-opacity:0.997471;stroke:#000000;stroke-width:0.1"
d="m 202.88463,103.94301 1.71979,0.28063 v 29.97783 l -1.71979,0.32741 z" />
<g
id="secondary-chain">
<path
style="fill:#000000;fill-opacity:0.835934;stroke:#313131;stroke-width:0.5;stroke-dasharray:1.5, 0.5;stroke-dashoffset:0;stroke-opacity:1"
d="m 180.11122,118.93954 43.77874,0.0935 v 0"
id="path28" />
<path
style="fill:#000000;fill-opacity:0.835934;stroke:#313131;stroke-width:0.5;stroke-dasharray:1.5, 0.5;stroke-dashoffset:0;stroke-opacity:1"
d="m 179.83058,125.20701 h 43.59166"
id="path29" />
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 9.4 KiB

32
tutorial.scad Normal file
View file

@ -0,0 +1,32 @@
$fa = 1;
$fs = 0.4;
cube([60,20,10],center=true);
translate([5,0,10])
cube([30,20,10],center=true);
translate([-20,-12,0])
rotate([90,0,10])
cylinder(h=3,r=8);
translate([-20, 15,0])
rotate([90,0,10])
cylinder(h=3,r=8);
translate([20,-12,0])
rotate([90,0,0])
cylinder(h=3,r=8);
translate([20, 15,0])
rotate([90,0,0])
cylinder(h=3,r=8);
translate([-20, 0, 0])
rotate([90, 0, 0])
cylinder(h=27, r=2.5, center=true);
translate([20, 0, 0])
rotate([90, 0, 0])
cylinder(h=27, r=2.5, center=true);