// ************************************************** // description of file contents // ************************************************** // curve values // set finer than default $fa=6; $fs=2; // ************************************************** // general print / printer parameters // ************************************************** // layer height on the printer layer=0.15; // nozzle size nozzle=0.4; // if print is set, will be oriented / spaced for printing // note that in this file parts are rotyated for printing but only positioned approximately // it will be necesary to move parts vertically onto print bed printable=0; // if set, will have internal components fitted fitout=1; // display only between limits min_x=-100; max_x=200; min_y=-100; max_y=100; min_z=-100; max_z=100; // ************************************************** // size / shape dimensional parameters // ************************************************** // convert inches to mm i=25.4; // ************************************************** // component and element dimensional parameters // ************************************************** // dimensions of load cell recess // (slightly more than load cell, but should be reaosnably snug) lcell=[82,13,13]; // loadcell centre axis is offset vertically from spool carrier axis // this is distance of load cell axis is below spool carrier centre // (+ve value means spc centre above cell centre) lc_offs=3.5; // amount cell projects into spool carrier // generally so spool carriewr is centred on bolts lc_spc_p=5+80/2+7.5+5+1; // load cell mounted 'snugly' over the end this far // (allow for any over-length specified above) lc_tight=26; // taper from tight to additional clearance happens over length lc_tll=2; // additional clearance to cell sides where not connected lc_scl=2; // additional clearnace to cell top where not joined (needs to clear strain gauges) lc_tcl=2; // load cell bolt positions // measure from supported end of load cell and allow for if cell is defined over length lc_bpos=[6,21,61,76]; // load cell bolt hole diameters lc_bdia=[5.4,5.4,4.4,4.4]; // note that bolts have quite a lot of hard-coded stuff below: // in supporting bracket bolts are counter-bored and set with head faying surface at -20mm and -30mm // in spool carrier bolts are countersunk with surface 2mm before top edge of spool carrier // search 'bolts hardcoded' to find all such hardcoded elements // spool width (note spc caps project beyond this) spool_w=80; // spool carrier (ie axle) diameter spc_dia=25; // spool carrier end-cap thickness and height spc_ect=5; spc_ech=8; // mount plate thickness mnt_plt_t=6; // mount plate corners radius mnt_plt_r=4; // width of mount plate mnt_plt_w=38; // height of mount plate mnt_plt_h=75; // mount plate faying surface this far from end of loadcell mnt_plt_p=7; //thickness under mounting plate bolt-heads (i.e define counterbore if less than mnt_plt_t; mnt_plt_bt=5; //bolt diamter (counterbores will be twice this) mnt_b_d=3.5; //bolt centres widthwise (probably 20) and heightwise mnt_b_w=20; mnt_b_h=60; // this is height bottom edge of mounting plate is below spool carrier centre mnt_plt_be=51; // this is height of support bracket at tip and at root // note this is height at virtual' tip - trimming to clear spool carrier may eat into the bracket at this position sb_ht=[35,60]; // dimensions of amplifier board (oriented as mounted) amp=[21,6,34]; // amp bottom left position (offset from intersection of faying surface and spc axis) amp_pos=[4,-spc_dia/2,-24]; // ************************************************** // no more configuration parameters after this point // ************************************************** // ************************************************** // pre-process values from specified parameters // ************************************************** // ************************************************** // user defined functions // ************************************************** // ************************************************** // modules for compnents / elements // ************************************************** // ************************************************** // main assembly // ************************************************** intersection() { // this is envelope of part we want to diplay translate([min_x,min_y,min_z]) cube([max_x-min_x,max_y-min_y,max_z-min_z]); // this is what we are actually creating union(){ if (fitout && printable==0) { // load cell translate([-lcell[0]+lc_spc_p,-lcell[1]/2,-lcell[2]/2-lc_offs]) %cube(lcell); // amplifier board translate([-lcell[0]+lc_spc_p-mnt_plt_p,-amp[1],0] + amp_pos) %cube(amp); } // spool carrier // note this is always in teh same orientation (not affected by 'printable') // but moved vertically to bring to zero plane for printable translate(printable?[0,0,lcell[2]/2+lc_offs]:[0,0,0]) difference(){ rotate([0,90,0]) union(){ // main spool surface cylinder(spool_w+2*spc_ect,spc_dia/2,spc_dia/2); // end cap nearest root hull(){ cylinder(spc_ect,spc_dia/2,spc_dia/2); translate([-spc_ech,0,0]) cylinder(spc_ect,spc_dia/2,spc_dia/2); } // end cap nearest tip hull(){ translate([0,0,spool_w+spc_ect])cylinder(spc_ect,spc_dia/2,spc_dia/2); translate([-spc_ech,0,spool_w+spc_ect]) cylinder(spc_ect,spc_dia/2,spc_dia/2); } } // carve out loadcell tight translate([-lcell[0]+lc_spc_p,-lcell[1]/2,-lcell[2]/2-lc_offs-1]) cube(lcell+[0,0,1]); // carve out loadcell additional clearance to specified distance from end from end which tapers to tight hull(){ translate([-lcell[0]+lc_spc_p,-lcell[1]/2-lc_scl,-lcell[2]/2-lc_offs-1]) cube(lcell+[-lc_tight-lc_tll,2*lc_scl,lc_tcl+1]); translate([-lcell[0]+lc_spc_p,-lcell[1]/2,-lcell[2]/2-lc_offs-1]) cube(lcell+[-lc_tight,0,1]); } // trim across at base of loadcell translate([-1,-spc_dia,-lcell[2]/2-lc_offs-spc_dia]) cube([spool_w+2*spc_ect+2,2*spc_dia,spc_dia]); // higher trim for support bracket translate([-lcell[0]+lc_spc_p,-spc_dia,-lcell[2]/2-lc_offs-spc_dia]) cube([lc_tight+lc_tll+2,2*spc_dia,spc_dia+2]); // fixing bolts at specified positions from loadcell end for (n = [0:len(lc_bpos)-1]){ if (lc_bpos[n] > lcell[0]/2) { translate([-lcell[0]+lc_spc_p+lc_bpos[n],0,-spc_dia]) cylinder(2*spc_dia,lc_bdia[n]/2,lc_bdia[n]/2,$fn=12); // bolts hardcoded : make countersinks set 2mm below axle top surface // change the '-2' on z component of first translate to change this translate([-lcell[0]+lc_spc_p+lc_bpos[n],0,spc_dia/2-2]) hull(){ cylinder(spc_dia,lc_bdia[n],lc_bdia[n],$fn=16); translate([0,0,-lc_bdia[n]]) cylinder(1,0,1,$fn=12); } } } } // support bracket // this gets waved around if printable translate(printable?[-spc_dia,0,sqrt(3)/2*(lcell[0]-lc_spc_p+mnt_plt_p)]:[0,0,0]) rotate(printable?[-90,-60,0]:[0,0,0]) difference(){ union(){ translate([-lcell[0]+lc_spc_p+lc_tight+lc_tll,0,0]) rotate([0,-90,0]) hull(){ translate([0,0,0]) cylinder(mnt_plt_p+lc_tight+lc_tll+10,spc_dia/2,spc_dia/2); translate([-sb_ht[0]+spc_dia,0,0]) cylinder(1,spc_dia/2,spc_dia/2); translate([-sb_ht[1]+spc_dia,0,mnt_plt_p+lc_tight+lc_tll]) cylinder(10,spc_dia/2,spc_dia/2); } // ensure a landing plane for M5 bolt //translate([-lcell[0]+lc_spc_p+lc_bpos[1],0,-20]) cylinder(20,5,5,$fn=16); // mounting plate translate([-lcell[0]+lc_spc_p-mnt_plt_p,0,-mnt_plt_be]) rotate([90,0,60]) hull(){ mirrorplus() translate([mnt_plt_w/2-mnt_plt_r,mnt_plt_r,0]) cylinder(mnt_plt_t,mnt_plt_r,mnt_plt_r); mirrorplus() translate([mnt_plt_w/2-mnt_plt_r,mnt_plt_h-mnt_plt_r,0]) cylinder(mnt_plt_t,mnt_plt_r,mnt_plt_r); } // plinth for mounting amplifier board translate([-lcell[0]+lc_spc_p-mnt_plt_p,0,0] + amp_pos + [-1,0,-1]) cube(amp + [2,spc_dia/2-amp[1],2]); } //end of positives // carve out loadcell tight top and bottom but space on one side translate([-lcell[0]+lc_spc_p,-lcell[1]/2,-lcell[2]/2-lc_offs]) cube(lcell+[0,lc_scl,0]); // carve out loadcell additional clearance to specified distance from end from end which tapers to tight hull(){ translate([-lcell[0]+lc_spc_p+lc_tight,-lcell[1]/2,-lcell[2]/2-lc_offs]) cube([1,lcell[1],lcell[2]]); translate([-lcell[0]+lc_spc_p+lc_tight+lc_tcl,-lcell[1]/2-lc_scl,-lcell[2]/2-lc_offs-lc_tcl]) cube([lcell[0]-lc_tight-lc_tcl,lcell[1]+2*lc_scl,lcell[2]+2*lc_tcl]); } // clearance from spool carrier translate([-2,0,0]) rotate([0,90,0]) difference(){ cylinder(spool_w,spc_dia/2+2,spc_dia/2+2); translate([lc_offs+lcell[2]/2,-spc_dia,-1]) cube([spc_dia,2*spc_dia,spool_w+2]); } // mounting plate bolt holes translate([-lcell[0]+lc_spc_p-mnt_plt_p,0,-mnt_plt_be]) rotate([90,0,60]) union(){ mirrorplus() translate([mnt_b_w/2,mnt_plt_h/2-mnt_b_h/2,-1]) cylinder(mnt_plt_t+2,mnt_b_d/2,mnt_b_d/2,$fn=8); mirrorplus() translate([mnt_b_w/2,mnt_plt_h/2+mnt_b_h/2,-1]) cylinder(mnt_plt_t+2,mnt_b_d/2,mnt_b_d/2,$fn=8); mirrorplus() translate([mnt_b_w/2,mnt_plt_h/2-mnt_b_h/2,mnt_plt_bt]) cylinder(mnt_plt_t-mnt_plt_bt+10,mnt_b_d,mnt_b_d,$fn=16); mirrorplus() translate([mnt_b_w/2,mnt_plt_h/2+mnt_b_h/2,mnt_plt_bt]) cylinder(mnt_plt_t-mnt_plt_bt+10,mnt_b_d,mnt_b_d,$fn=16); } // load cell mounting holes // fixing bolts M5 at specified positions from loadcell end //for (bp = lc_bpos){ // translate([-lcell[0]+lc_spc_p+bp,0,-2*spc_dia]) cylinder(2*spc_dia,2.7,2.7,$fn=12); //} // fixing bolts at specified positions from loadcell end for (n = [0:len(lc_bpos)-1]){ if (lc_bpos[n] < lcell[0]/2) { translate([-lcell[0]+lc_spc_p+lc_bpos[n],0,-100]) cylinder(100,lc_bdia[n]/2,lc_bdia[n]/2,$fn=12); } } // bolts hardcoded : counterbores for 20mm and 30mm bolt translate([-lcell[0]+lc_spc_p+lc_bpos[0],0,-100]) cylinder(100-30,lc_bdia[0],lc_bdia[0],$fn=16); translate([-lcell[0]+lc_spc_p+lc_bpos[1],0,-100]) cylinder(100-20,lc_bdia[1],lc_bdia[1],$fn=16); // wiring channel fudged by trial-and-error translate([-lcell[0]+lc_spc_p,+lcell[1]/2+lc_scl-1,-lc_offs]) rotate([35,0,-15]) rotate([90,22.5,0]) cylinder(100,2,2,$fn=8); //additional wiring clearance at hidden corner translate([-lcell[0]+lc_spc_p-9,lcell[1]/2+lc_scl-5,-lcell[2]/2-lc_offs]) cube([10,5,lcell[2]]); // mounting bolts for amp board // bolts hardcoded : position and diameter of fixing bolts // amp board bottom left back corner is at ([-lcell[0]+lc_spc_p-mnt_plt_p,0,0] + amp_pos) translate([-lcell[0]+lc_spc_p-mnt_plt_p,0,0] + amp_pos + [amp[0]/2,0,amp[2]] + [-7.5,-1,-5]) rotate([-90,0,0]) cylinder(15,1.3,1.3,$fn=8); translate([-lcell[0]+lc_spc_p-mnt_plt_p,0,0] + amp_pos + [amp[0]/2,0,amp[2]] + [7.5,-1,-5]) rotate([-90,0,0]) cylinder(15,1.3,1.3,$fn=8); //trim off at back of mounting plate translate([-lcell[0]+lc_spc_p-mnt_plt_p,0,0]) rotate([0,0,-30]) translate([-100,-100,-150]) cube([100,200,300]); } } } // ************************************************** // utility modules / functions // ************************************************** // mirror all children, keeping source and mirrored module mirrorplus(m=[1,0,0]){ children(); mirror(m) children(); } // concatenate up to nine lists into one function cat(L1,L2=[],L3=[],L4=[],L5=[],L6=[],L7=[],L8=[],L9=[]) = [for(L=[L1, L2, L3, L4, L5, L6, L7, L8, L9], a=L) a]; // sum terms 0 to i of a vector // if i unspecified or beyond end of v, return sum of whole vector function sumv(v,i) = (((i==undef) || (i >= len(v))) ? sumv(v,len(v)-1) : (i==0 ? v[0] : v[i] + sumv(v,i-1)) ); // flatten nested vector // eg flatten( [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] ) = [1, 2, 3, 4, 5, 6] function flatten(l) = [ for (a = l) for (b = a) b ] ;