chiark / gitweb /
filamentspool: for revert/fix: add commitid to hub (wrong in many versions)
[reprap-play.git] / filamentspool.scad
1 // -*- C -*-
2
3 // filamentspool.scad
4 // 3D design for filament spools to hold coils as supplied by Faberdashery
5 //
6
7 //
8 // Copyright 2012,2013,2016 Ian Jackson
9 //
10 // This work is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // This work is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with this work.  If not, see <http://www.gnu.org/licenses/>
22 //
23
24 //
25 // Each spool is a hub with 3 or 4 arms.  Each arm has a cup for
26 // holding the filament.  The effective diameter can be adjusted by
27 // setting the cup into a different seat in the arm.  The cups are
28 // held on with simple clips, so the filement coil can easily be
29 // removed and replaced.
30 //
31 // This file (and its includes) can generate:
32 //
33 // ===== Heavy duty 4-armed spool for 3mm x 100m coil =====
34 //
35 // A heavy duty 4-armed spool suitable for holding a 100m
36 // Faberdashery coil on the spool arm of a Lulzbot TAZ-5.
37 //
38 //     Set
39 //           fdia=2.85
40 //           lightduty=false
41 //     And print following parts
42 //            Hub
43 //            ArmEnd x 4
44 //            FilamentCup x 4  (or FilamentCupPair x 2)
45 //            CupSecuringClip x 4
46 //
47 //     You will also need  4 x M4 machine screws and nuts.
48 //
49 //     This is the default.
50 //
51 // ===== Light duty 3-armed spool for 3mm x <=30m coil =====
52 //
53 // A light duty 3-armed spool suitable for up to around 30m
54 // of Faberdashery 2.85mm PLA.
55 //
56 //     Set
57 //           fdia=2.85
58 //           lightduty=true
59 //     (or look in filamentspool-lt.scad).
60 //
61 //     And print following parts
62 //           Hub
63 //           ArmEnd x 3
64 //           FilamentCup x 3  (or FilamentCup + FilamentCupPair)
65 //           CupSecuringClip x 3
66 //           TowerDoveClipPin x 6
67 //
68 //     When assembling, insert one TowerDoveClipPin from each side,
69 //     joining each ArmEnd to the Hub with two TowerDoveClipPins.
70 //     Modest force with pliers is good to seat them properly.
71 //
72 //     (note that the light duty and heavy duty CupSecuringClips
73 //      are slightly different)
74 //
75 // ===== Notes regarding both the above spools =====
76 //
77 // When mounting either spool on the TAZ-5 spool arm, put the `pointy'
78 // end of the hub towards the printer - ie, put put the spool on
79 // `backwards'.  This ensures that the spool's arms will clear the
80 // printer framework.
81 //
82 // For the above, I generally used the Cura `Standard' PLA profile.
83 //
84 // ===== TAZ-5 feed tube adjustment kit =====
85 //
86 // With a TAZ-5 I recommend using this kit to improve the feed
87 // reliability:
88 //
89 //       Set
90 //           fdia=2.85
91 //     And print following parts
92 //           FilamentGuideSpacer (ideally, at `high detail')
93 //           FilamentGuideArmPrint (optional; `high detail' or `standard')
94 //
95 //     And possibly also
96 //           t-nut_jig_0.2.stl
97 //     from Aleph Objects - look here:
98 //           http://download.lulzbot.com/TAZ/accessories/tool_heads/version_2/Dual_Extruder_v2/production_parts/stl/
99 //
100 // The spacer clips onto the filament guide tube holder arm, on the
101 // inside, with the pointy flanged end towards the filament guide
102 // tube.  It stops the filament guide tube angle (and so the
103 // filament's natural pickup location) changing as the print head moves.
104 //
105 // The FilamentGuideArm[Print] is a replacement for the arm supplied
106 // with your TAZ-5.  It's longer, so that the filament pickup point is
107 // closer to the middle of the coil.  Use the t-nut_jig to stop the
108 // T-nuts in the aluminium channel from annoyingly sliding down to the
109 // bottom while you swap out the arm.
110 //
111 // (Faberdashery coils, and therefore both the above spools, have a
112 // larger diameter than the flat-walled spools often supplied by other
113 // vendors.  And the spools above have individual arms rather than a
114 // continuous disc.  If the filament `unhooks' from the arm, it can
115 // pull taught around the hub and stop feeding properly.)
116 //
117 // ===== Spool storage arm, for mounting on walls =====
118 //
119 // A storage arm suitable for screwing to walls, bookshelves,
120 // etc. (requires non-countersunk M4 screws); will hold two heavy duty
121 // spools each with a 100m coil.
122 //
123 //     Set
124 //           fdia=2.85
125 //           lightduty=false
126 //     (or look in filamentspool-sm.scad).
127 //
128 //     And print one of these, according to taste
129 //            StorageArmLeft
130 //            StorageArmRight
131 //
132 //     NB that the `light duty' version of this is shorter and
133 //     will only take two `light duty' spools.
134 //
135 // For the above, I used the Cura `High detail' PLA profile because
136 // I wanted it pretty, but the `Standard' profile should do fine.
137 //
138 // ===== Spools for 1.75mm filament =====
139 //
140 // Spool (in many parts) for handing 1.75mm filament, printable
141 // on, and with parts for mounting on, a Reprappro Huxley.
142
143
144 fdia=2.85; // or 1.75
145 lightduty=false; // or true
146
147
148 slop=0.5;
149 bigslop=slop*2;
150
151 function selsz(sm,lt,lg) = fdia < 2 ? sm : lightduty ? lt : lg;
152 function usedove() = selsz(true,true,false);
153
154 num_arms = selsz(3,3,4);
155
156 channelslop=selsz(slop,0.75,slop);
157
158 exteffrad = 70;
159 hubeffrad = selsz(30, 82, 40);
160 hubbigrad = selsz(20, 38, 38);
161 hublwidth = selsz(3, 2.5, 4);
162 hubstemwidth = 2;
163 hublthick = 10;
164 hubaxlerad = selsz(5, 28/2, 28/2);
165 totalheightfromtower = 240;
166 axletowerfudgebend = 0;
167 axleaxlefudgebend = 3;
168 axlepadlen = 1.0;
169
170 armend_length = 120;
171
172 prongthick=selsz(5,4,5);
173 prongwidth=selsz(5,4,5);
174 prongribwidth=3;
175 prongribheight=selsz(0,0,4);
176 ratchetstep=15;
177 ratchettooth=3;
178 ratchettoothheight=5;
179 ratchettoothsmoothr=1;
180 ratchettoothslope=0.75;
181 overlap=0.5;
182 cupwidth=selsz(40,25,50);
183 cupheight=selsz(55,25,55);
184
185 cupstrong_dx=selsz(0,0,-10);
186
187 propxshift = -6;
188
189 doveclipheight = 10;
190
191 teethh=3;
192 teethgapx=4+fdia;
193
194 prongstalkxwidth=3;
195
196 stalklength=selsz(35,25,55);
197 overclipcupgap=5;
198 overclipdepth=15;
199 overcliproundr=2.0;
200 overclipthick=1.0;
201 overclipcupnextgap=selsz(20,15,20);
202
203 hubaxlelen = selsz(25, 62.5, 77.5);
204 echo(hubaxlelen);
205
206 overclipsmaller=-2.5;
207 overclipbigger=0.0;
208
209 wingspoke=2.5;
210 wingsize=6;
211 wingthick=3;
212
213 armendwallthick=selsz(2.5, 1.8, 2.5);
214 armendbasethick=selsz(1.2, 1.2, 1.2);
215
216 numbers_relief = 0.7;
217 numbers_tick_len = 8;
218 numbers_tick_width = 0.75;
219 numbers_tick_linespc = 1.0;
220 numbers_height_allow = 8;
221
222 axlehorizoffset = 12.5;
223 axlevertheight = 100;
224 towercliph = 16;
225 towerclipcount = 3;
226 towerpillarw = 5;
227
228 axlepinrad = 2;
229 axlepintabrad = 5;
230
231 washerthick = 1.2;
232 washerthinthick = 0.8;
233 washerverythinthick = 0.4;
234 washerrad = hubaxlerad + 7.5;
235 frictionwasherarmwidth = 3;
236 frictionwasherextrapush = 1.0;
237
238 ratchetpawl=ratchetstep-ratchettooth-bigslop*2;
239
240 nondove_armhole_x = 32;
241 nondove_armhole_hole = 4 + 0.8;
242 nondove_armhole_support = 7;
243 nondove_armhole_wall = 3.2;
244 nondove_armhole_slop = 0.5;
245 nondove_armhole_slop_x = 0.5;
246
247 nondove_armbase = nondove_armhole_x + nondove_armhole_hole/2 +
248   nondove_armhole_support;
249 echo(nondove_armbase);
250
251 include <doveclip.scad>
252 include <cliphook.scad>
253 include <filamentteeth.scad>
254 include <axlepin.scad>
255 include <commitid.scad>
256
257 hub_clip_baseextend = (hubeffrad - DoveClip_depth()
258                        - hubbigrad + hublwidth);
259
260 real_exteffrad = selsz(exteffrad + hub_clip_baseextend,
261                        hubeffrad + DoveClip_depth(),
262                        hubeffrad + nondove_armbase);
263
264 channelwidth = prongthick + channelslop;
265 channeldepth = prongwidth + ratchettoothheight;
266 totalwidth = armendwallthick*2 + channelwidth;
267 totalheight = channeldepth + armendbasethick;
268 stalkwidth = prongwidth + prongstalkxwidth;
269
270 tau = PI*2;
271
272 module ArmEnd(length=armend_length){ ////toplevel
273   if (usedove()) {
274     translate([ratchettoothsmoothr, channelwidth/2, -armendbasethick]) {
275       rotate([0,0,-90])
276         DoveClipPairBase(h=doveclipheight);
277     }
278   } else {
279     difference(){
280       translate([1, -armendwallthick, -armendbasethick])
281         mirror([1,0,0])
282         cube([nondove_armbase+1, totalwidth, totalheight]);
283       translate([-nondove_armbase + nondove_armhole_x,
284                  -armendwallthick + totalwidth/2,
285                  -armendbasethick -1])
286         cylinder(r= nondove_armhole_hole/2, h=totalheight+2, $fn=10);
287     }
288   }
289
290   for (otherside=[0,1]) {
291     for (circum = [300:100:1500]) {
292       assign(rad = circum / tau)
293         assign(fn = str("filamentspool-number-n",circum,".dxf"))
294         assign(rotateoffset = [0, totalwidth/2, 0])
295         assign(xlen = rad - real_exteffrad) {
296         if (xlen >= numbers_tick_width/2
297             + (otherside ? numbers_height_allow : 0) &&
298             xlen <= length - (otherside ? 0 : numbers_height_allow))
299           translate([xlen, -armendwallthick,
300                      -armendbasethick + (totalheight - numbers_tick_len)/2])
301           translate(rotateoffset)
302           rotate([0,0, otherside*180])
303           translate(-rotateoffset){
304             translate([-numbers_tick_width/2, -1, 0])
305               cube([numbers_tick_width, numbers_relief+1, numbers_tick_len]);
306             translate([numbers_tick_width/2 + numbers_tick_linespc,
307                        1,
308                        numbers_tick_len])
309               rotate([90,0,0])
310               rotate([0,0,-90])
311               linear_extrude(height= numbers_relief+1)
312               //    scale(templatescale)
313               import(file=fn, convexity=100);
314           }
315       }
316     }
317   }
318
319   difference(){
320     translate([0, -armendwallthick, -armendbasethick])
321       cube([length, totalwidth, totalheight]);
322     translate([-1, 0, 0])
323       cube([length+1 - ratchettooth, channelwidth, channeldepth+1]);
324     translate([-1, 0, ratchettoothheight])
325       cube([length+2, channelwidth, channeldepth+1]);
326   }
327   for (dx = [0 : ratchetstep : length - ratchetstep]) translate([dx,0,0]) {
328     translate([ratchettoothsmoothr+0.5, armendwallthick/2, 0]) minkowski(){
329       rotate([90,0,0])
330         cylinder($fn=20, r=ratchettoothsmoothr, h=armendwallthick);
331       multmatrix([      [       1, 0, ratchettoothslope, 0      ],
332                         [       0,      1,      0,      0       ],
333                         [       0,      0,      1,      0       ],
334                         [       0,      0,      0,      1       ]])
335         cube([ratchettooth - ratchettoothsmoothr*2,
336               channelwidth, ratchettoothheight - ratchettoothsmoothr]);
337     }
338   }
339 }
340
341 module FilamentCupHandle(){
342   pawlusewidth = ratchetpawl-ratchettoothsmoothr*2;
343   mirror([0,1,0]) {
344     cube([stalklength, stalkwidth, prongthick]);
345     translate([stalklength, stalkwidth/2, 0])
346       cylinder(r=stalkwidth/2, h=prongthick, $fn=20);
347     translate([ratchettoothsmoothr, stalkwidth, 0]) {
348       minkowski(){
349         cylinder($fn=20,r=ratchettoothsmoothr, h=1);
350         multmatrix([    [       1, -ratchettoothslope, 0, 0     ],
351                         [       0,      1,      0,      0       ],
352                         [       0,      0,      1,      0       ],
353                         [       0,      0,      0,      1       ]])
354           cube([pawlusewidth,
355                 ratchettoothheight - ratchettoothsmoothr,
356                 prongthick - 1]);
357       }
358     }
359   }
360 }
361
362 module FilamentCupCup(){
363   for (my=[0,1]) mirror([0,my,0]) {
364     translate([0, cupwidth/2, 0])
365       cube([cupheight + prongwidth, prongwidth, prongthick]);
366   }
367 }
368
369 module FilamentCup() { ////toplevel
370   FilamentCupHandle();
371
372   gapy = prongwidth;
373   dy = cupwidth/2 + gapy + overclipcupgap;
374   baselen = dy+cupwidth/2;
375
376   translate([0, dy, 0])
377     FilamentCupCup();
378   cube([prongwidth, baselen+1, prongthick]);
379
380   translate([cupstrong_dx, prongwidth, 0]) {
381     cube([prongwidth, baselen-prongwidth, prongthick]);
382     for (y = [0, .33, .67, 1])
383       translate([0, (baselen - prongwidth) * y, 0])
384         cube([-cupstrong_dx + 1, prongwidth, prongthick]);
385   }
386   if (cupstrong_dx != 0) {
387     rotate([0,0,45])
388       translate([-prongwidth*.55, -prongwidth*2.1, 0])
389       cube([prongwidth*(2.65), prongwidth*4.2, prongthick]);
390   }
391
392   translate([0, -0.2, 0])
393     cube([prongribwidth, baselen, prongthick + prongribheight]);
394
395   if (prongribheight > 0) {
396     translate([-prongwidth, baselen, 0])
397       cube([cupheight/2, prongwidth + prongribheight, prongribwidth]);
398   }
399
400   midrad = cupwidth/2 + prongwidth/2;
401
402   propshift = stalklength - overclipdepth - prongthick + propxshift;
403   proptaken = propshift;
404   echo(midrad, propshift, proptaken);
405
406   translate([propshift, -1, 0]) {
407     // something is wrong with the y calculation
408     cube([prongwidth,
409           gapy+2,
410           prongthick]);
411   }
412   for (y = [overclipcupgap, overclipcupgap+overclipcupnextgap]) {
413     translate([cupstrong_dx, y + prongwidth, 0])
414       rotate([0,0, 102 + fdia])
415       FilamentTeeth(fdia=fdia, h=teethh);
416   }
417   for (x = [-0.3, -1.3]) {
418     translate([cupheight + overclipcupnextgap*x, baselen + prongwidth, 0])
419       rotate([0,0, 12 + fdia])
420       FilamentTeeth(fdia=fdia, h=teethh);
421   }      
422 }
423
424 module CupSecuringClipSolid(w,d,h1,h2){
425   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
426     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
427   }
428 }
429
430 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
431   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
432   minkowski(){
433     CupSecuringClipSolid(w=totalwidth,
434                          d=overclipdepth + xdepth,
435                          h1=hbase - overclipsmaller,
436                          h2=hbase + overclipbigger);
437     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
438   }
439 }
440
441 module CupSecuringClip(){ ////toplevel
442   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
443   difference(){
444     union(){
445       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
446       translate([-wingswidth/2, -wingsize/2, 0])
447         cube([wingswidth, wingsize, wingthick]);
448       translate([-wingsize/2, -wingswidth/2, 0])
449         cube([wingsize, wingswidth, wingthick]);
450     }
451     translate([0,0,-0.1])
452       CupSecuringClipSolidSmooth(xrad=0, xdepth=0.2);
453   }
454 }
455
456 module ArmDoveClipPin(){ ////toplevel
457   DoveClipPin(h=doveclipheight);
458 }
459
460 module TowerDoveClipPin(){ ////toplevel
461   DoveClipPin(h=towercliph/2);
462 }
463
464 module Hub(){ ////toplevel
465   axlerad = hubaxlerad + slop;
466   xmin = axlerad+hublwidth/2;
467   xmax = hubbigrad-hublwidth/2;
468   hole = hubeffrad - hubbigrad - DoveClip_depth() - hublwidth*2;
469   holewidth = DoveClipPairSane_width() - hubstemwidth*2;
470   nondove_allwidth = nondove_armhole_wall*2 + totalwidth;
471   difference(){
472     union(){
473       difference(){
474         cylinder($fn=60, h=hublthick, r=hubbigrad);
475         translate([0,0,-1])
476           cylinder($fn=30, h=hublthick+2, r=(hubbigrad-hublwidth));
477       }
478       cylinder(h=hubaxlelen, r=axlerad+hublwidth);
479       for (ang=[0 : 360/num_arms : 359])
480         rotate([0,0,ang]) {
481           if (usedove()){
482             difference() {
483               translate([hubeffrad,0,0])
484                 DoveClipPairSane(h=doveclipheight,
485                                  baseextend = hub_clip_baseextend);
486               if (hole>hublwidth && holewidth > 2) {
487                 translate([hubbigrad + hublwidth, -holewidth/2, -1])
488                   cube([hole, holewidth, hublthick+2]);
489               }
490             }
491           } else {
492             difference(){
493               translate([0,
494                          -nondove_allwidth/2,
495                          0])
496                 cube([hubeffrad + nondove_armhole_x
497                       + nondove_armhole_hole/2 + nondove_armhole_support,
498                       nondove_allwidth,
499                       nondove_armhole_wall + totalheight]);
500               translate([hubeffrad - nondove_armhole_slop_x,
501                          -nondove_allwidth/2
502                          + nondove_armhole_wall - nondove_armhole_slop,
503                          nondove_armhole_wall])
504                 cube([nondove_armhole_x + 50,
505                       totalwidth + nondove_armhole_slop*2,
506                       totalheight + 1]);
507               translate([hubeffrad + nondove_armhole_x, 0, -20])
508                 cylinder(r= nondove_armhole_hole/2, h=50, $fn=10);
509             }
510           }
511         }
512       for (ang = [0 : 180/num_arms : 359])
513         rotate([0,0,ang]) rotate([90,0,0]) {
514           translate([0,0,-hublwidth/2])
515             linear_extrude(height=hublwidth)
516             polygon([[xmin,0.05], [xmax,0.05],
517                      [xmax,hublthick-0.2], [xmin, hubaxlelen-0.2]]);
518         }
519     }
520     translate([0,0,-1]) cylinder($fn=60, h=hubaxlelen+2, r=axlerad);
521
522     translate([hubbigrad - hublwidth,
523                -DoveClipPairSane_width()/2,
524                0])
525       Commitid_BestCount_M([(usedove()
526                               ? hubeffrad - DoveClip_depth()
527                               : hubeffrad)-
528                              (hubbigrad - hublwidth),
529                              DoveClipPairSane_width()]);
530   }
531 }
532
533 module ArmExtender(){ ////toplevel
534   DoveClipExtender(length=exteffrad-hubeffrad,
535                    ha=doveclipheight,
536                    hb=doveclipheight);
537 }
538
539 module FsAxlePin(){ ////toplevel
540   AxlePin(hubaxlerad, washerrad*2, axlepinrad, axlepintabrad, slop);
541 }
542
543 module Axle(){ ////toplevel
544   pillarswidth = DoveClipPairSane_width(towerclipcount);
545
546   rotate([0,0, -( axleaxlefudgebend + atan(slop/hubaxlelen) ) ])
547   translate([-axlehorizoffset, -axlevertheight, 0]) {
548     rotate([0,0,-axletowerfudgebend])
549     rotate([0,0,-90])
550       DoveClipPairSane(h=towercliph, count=towerclipcount, baseextend=3);
551     translate([0, DoveClip_depth(), 0])
552     rotate([0,0,90])
553       ExtenderPillars(axlevertheight - DoveClip_depth(),
554                       pillarswidth, towercliph,
555                       pillarw=towerpillarw);
556   }
557
558   axleclearlen = hubaxlelen + slop*4 + washerthick*2 + axlepadlen;
559   axlerad = hubaxlerad-slop;
560   bump = axlerad * 0.2;
561   shift = axlerad-bump;
562   joinbelowallow = 3;
563
564   intersection(){
565     translate([0, 0, shift]) {
566       difference() {
567         union(){
568           translate([-1, 0, 0])
569             rotate([0,90,0])
570             cylinder($fn=60,
571                      r = axlerad,
572                      h = 1 + axleclearlen + axlepinrad*2 + 2);
573           mirror([1,0,0]) rotate([0,90,0])
574             cylinder(r = axlerad*1.75, h = 3);
575           intersection(){
576             mirror([1,0,0])
577               translate([axlehorizoffset - pillarswidth/2, 0, 0])
578               rotate([0,90,0])
579               cylinder($fn=60,
580                        r = towercliph - shift,
581                        h = pillarswidth);
582             translate([-50, -joinbelowallow, -50])
583               cube([100, joinbelowallow+50, 100]);
584           }
585         }
586         rotate([90,0,0])
587         translate([axleclearlen + axlepinrad/2, 0, -25])
588           cylinder(r = axlepinrad + slop, h=50);
589       }
590     }
591     translate([-50,-50,0]) cube([100,100,100]);
592   }
593 }
594
595 module washer(thick){
596   Washer(hubaxlerad, washerrad, thick, slop);
597 }
598
599 module AxleWasher(){ ////toplevel
600   washer(thick=washerthick);
601 }
602
603 module AxleThinWasher(){ ////toplevel
604   washer(thick=washerthinthick);
605 }
606
607 module AxleVeryThinWasher(){ ////toplevel
608   washer(thick=washerverythinthick);
609 }
610
611 module AxleFrictionWasher(){ ////toplevel
612   difference(){
613     cylinder(h=washerthick, r=washerrad);
614     translate([0,0,-1]) cylinder(h=washerthick+2, r=hubaxlerad+slop);
615   }
616   frarmr = hubbigrad;
617   frarmw = frictionwasherarmwidth;
618   frarmpawlr = hublwidth;
619   frarmpawlpush = slop*4 + frictionwasherextrapush;
620   for (ang=[0,180]) rotate([0,0,ang]) {
621     translate([washerrad-1, -frarmw/2, 0])
622       cube([frarmr - washerrad + 1, frarmw, washerthick]);
623     intersection(){
624       translate([frarmr - frarmpawlr, -50, 0])
625         cube([frarmpawlr, 100, 50]);
626       rotate([0,90,0])
627         cylinder(h = 50, r = frarmpawlpush, $fn=36);
628     }
629   }
630 }
631
632 module TowerExtender(){ ////toplevel
633   l = totalheightfromtower - axlevertheight;
634   echo("TowerExtender",l);
635   DoveClipExtender(length = l,
636                    ha = towercliph, hb = towercliph,
637                    counta = towerclipcount, countb = towerclipcount,
638                    pillarw = towerpillarw);
639 }
640
641 module FilamentCupPair(){ ////toplevel
642   FilamentCup();
643   translate([cupheight + prongthick*3,
644              cupwidth/2*1.7,
645              0])
646     rotate([0,0,180]) FilamentCup();
647 }
648
649 //----- storarm -----
650
651 storarm_hooklen = 8;
652 storarm_hookheight = 5;
653 storarm_thick = 10;
654 storarm_axleslop = 4;
655
656 storarm_base_w = 30;
657 storarm_base_h = 100;
658 storarm_base_d = 15;
659 storarm_base_mind = 2;
660
661 storarm_cope_hubaxle_mk1 = true;
662
663 storarm_screw_hole = 4;
664 storarm_screw_hole_slop = 0.5;
665 storarm_besides_hole = 4;
666
667 storarm_under_hole = 5;
668 storarm_screw_hole_head = 8.8;
669 storarm_screw_hole_head_slop = 1.5;
670
671 // calculated
672
673 storarm_axlerad = hubaxlerad - storarm_axleslop;
674 storarm_mainlen = hubaxlelen*2 + storarm_axleslop
675   + (storarm_cope_hubaxle_mk1 ? 10 : 0);
676 storarm_totlen = storarm_mainlen + storarm_hooklen;
677
678 storarm_mid_off_y = storarm_axlerad;
679
680 storarm_base_off_y = storarm_mid_off_y + storarm_base_h/2;
681
682 module StorageArmDiagPartSide(xmin, xmax){
683   xsz = xmax-xmin;
684   yuse = storarm_thick/2;
685
686   intersection(){
687     translate([xmin-1, -storarm_axlerad, storarm_thick/2])
688       rotate([0,90,0])
689       cylinder(r=storarm_axlerad, h=xsz+2, $fn=60);
690     translate([xmin, -yuse, 0])
691       cube([xsz, yuse, storarm_thick]);
692   }
693 }
694
695 module StorageArmDiagPart(xmin, xmax, shear, adjbot){
696   hull(){
697     StorageArmDiagPartSide(xmin,xmax);
698
699     multmatrix([[1,0,0,0],
700                 [shear,1,0,0],
701                 [0,0,1,0],
702                 [0,0,0,1]])
703       translate([0, -storarm_axlerad*2 + adjbot, 0])
704       mirror([0,1,0])
705       StorageArmDiagPartSide(xmin,xmax);
706   }
707 }
708
709 module StorageArmBaseTemplate(){
710   square([storarm_base_w, storarm_base_h]);
711 }
712
713 module StorageArmAtMountingHoles(){
714   bes = storarm_besides_hole + storarm_screw_hole;
715
716   x0 = bes;
717   x1 = storarm_base_w-bes;
718   y1 = storarm_base_h - bes;
719   y0 = bes;
720
721   for (pos=[ [x0, y1],
722              [x1, y1],
723              [x1, y0] ]) {
724     rotate([0,90,0])
725       translate([pos[0] - storarm_base_w,
726                  pos[1] - storarm_base_off_y, -storarm_base_d])
727       children();
728   }
729 }
730
731 module StorageArmRight(){ ////toplevel
732   shear = storarm_hookheight / (storarm_mainlen/2);
733
734   StorageArmDiagPart(-1, storarm_mainlen/2+1, shear, 0);
735   StorageArmDiagPart(storarm_mainlen/2-1, storarm_mainlen+1, shear/2,
736                      storarm_hookheight/2);
737
738   translate([0, storarm_hookheight, 0])
739     StorageArmDiagPart(storarm_mainlen, storarm_totlen,
740                        shear/2, -storarm_hookheight/2);
741
742   difference(){
743     union(){
744       hull(){
745         translate([-storarm_base_d, -storarm_base_off_y, storarm_base_w])
746           rotate([0,90,0])
747           linear_extrude(height=storarm_base_mind)
748           StorageArmBaseTemplate();
749         StorageArmDiagPart(-1, 0, shear, 0);
750       }
751       StorageArmAtMountingHoles(){
752         cylinder(r= storarm_screw_hole_head/2,
753                  h=10);
754       }
755     }
756     StorageArmAtMountingHoles(){
757       translate([0,0,-1])
758         cylinder(r= (storarm_screw_hole + storarm_screw_hole_slop)/2 ,
759                  h=20);
760       translate([0,0,storarm_under_hole])
761         cylinder(r= (storarm_screw_hole_head + storarm_screw_hole_head_slop)/2,
762                  h=20);
763     }
764   }
765 }
766
767 module StorageArmLeft(){ ////toplevel
768   mirror([1,0,0]) StorageArmRight();
769 }
770
771 module StorArmHoleTest(){ ////toplevel
772   sz = storarm_screw_hole_head + storarm_besides_hole*2;
773   intersection(){
774     StorageArmRight();
775     translate([-50, -storarm_base_off_y, -1])
776       cube([100, sz, sz+1]);
777   }
778 }
779
780
781 //----- filament guide spacer -----
782
783 guide_armdia = 15.0;
784 guide_armwidth = 10.2;
785 guide_armcorelen = 25.0;
786 guide_clipcirclethick = 10.0;
787
788 guidefilclip_outerdia = 22.8;
789
790 guidespacer_armslop = 0.75;
791 guidespacer_armlenslop = 1.05;
792
793 guidespacer_prongprotrude = 4;
794 guidespacer_thick = 1.6;
795
796 // calculated
797
798 guidespacer_armdia = guide_armdia + guidespacer_armslop;
799 guidespacer_armwidth = guide_armwidth + guidespacer_armslop;
800 guidespacer_len = guide_armcorelen - guide_clipcirclethick
801   + guidespacer_armlenslop;
802
803 guidespacer_wingheight = (guidefilclip_outerdia - guidespacer_armdia)/2;
804
805 module FilamentGuideArmTemplate(extra=0){
806   intersection(){
807     circle(r= (guidespacer_armdia/2) + extra);
808     square(center=true, [guidespacer_armwidth+extra*2,
809                          guidespacer_armdia + extra*2 + 10]);
810   }
811 }
812
813 module FilamentGuideSpacerInnerTemplate(){
814   FilamentGuideArmTemplate();
815   translate([0, -guidespacer_armdia/2])
816     square(center=true, [guidespacer_armwidth - guidespacer_prongprotrude,
817                          guidespacer_armdia]);
818 }
819
820 module FilamentGuideSpacer(){ ////toplevel
821   difference(){
822     union(){
823       linear_extrude(height= guidespacer_len)
824         FilamentGuideArmTemplate(extra= guidespacer_thick);
825       for (angle=[26, 60]) {
826         for (m=[0,1]) {
827           mirror([m,0,0]) {
828             rotate([0,0,angle]) {
829               hull(){
830                 for (t=[[0, guidespacer_wingheight],
831                         [guidespacer_len-1, -guidespacer_wingheight]])
832                   translate([0,0, t[0] + 0.5])
833                     cube([guidespacer_thick, guidespacer_armdia + t[1]*2,
834                       1],
835                          center=true);
836               }
837             }
838           }
839         }
840       }
841     }
842     translate([0,0,-1])
843       linear_extrude(height= guidespacer_len+5)
844       FilamentGuideSpacerInnerTemplate();
845   }
846 }
847
848
849 //----- replacement filament guide arm for TAZ-5 -----
850
851 guidearm_armslop = 0.25;
852 guidearm_armlenslop = 0.25;
853
854 guidearm_hookprotr = 3;
855 guidearm_hookprotrflat = 1;
856 guidearm_hookslope = 0.3;
857
858 guidearm_totallen = 60;
859
860 guidearm_screwplatesz = 12;
861 guidearm_screwplateth = 4;
862 guidearm_screwplatewd = 15;
863 guidearm_screwhole = 5 + 0.5;
864
865 guidearm_bendlen = 40;
866 guidearm_bendslot = 4.5;
867
868 guidearm_stopthick = 4;
869 guidearm_protrslop = 1.0;
870
871 // calculated
872
873 guidearm_armdia = guide_armdia - guidearm_armslop;
874 guidearm_armwidth = guide_armwidth - guidearm_armslop;
875 guidearm_armcorelen = guide_armcorelen + guidearm_armlenslop;
876
877 guidearm_base_z0 = -(guidearm_totallen - guidearm_armcorelen);
878
879 guidearm_realbendlen = min(guidearm_bendlen,
880                            guidearm_totallen - guidearm_screwplateth - 0.1);
881 guidearm_slopelen = guidearm_hookprotr/guidearm_hookslope;
882
883 module FilamentGuideArmStop(h){
884   for (ts=[-1,+1]) {
885     translate([ts * guidearm_hookprotr, 0,0])
886       cylinder(r=guidearm_armdia/2, h, $fn=80);
887   }
888 }
889
890 module FilamentGuideArmShaftPositive(){
891   r = guidearm_armdia/2;
892
893   translate([0,0, guidearm_base_z0+1])
894     cylinder(r=r, h= guidearm_totallen, $fn=80);
895   translate([0,0, guidearm_armcorelen]){
896     hull(){
897       FilamentGuideArmStop(guidearm_hookprotrflat);
898       translate([0,0, guidearm_slopelen])
899         cylinder(r=r, h=guidearm_hookprotrflat, $fn=80);
900     }
901   }
902   mirror([0,0,1])
903     FilamentGuideArmStop(guidearm_stopthick);
904 }
905
906 module FilamentGuideArmBase(){
907   translate([0,
908              (guidearm_screwplatewd - guidearm_armwidth)/2,
909              guidearm_base_z0]){
910     difference(){
911       translate([0,0, guidearm_screwplateth/2])
912         cube(center=true,
913              [guidearm_armdia + guidearm_screwplatesz*2,
914               guidearm_screwplatewd,
915               guidearm_screwplateth]);
916       for (ts=[-1,+1]) {
917         translate([ts * (guidearm_armdia/2 + guidearm_screwplatesz/2),
918                    0,
919                    -20])
920           cylinder(r= guidearm_screwhole/2, h=40, $fn=20);
921       }
922     }
923   }
924 }
925
926 module FilamentGuideArm(){ ///toplevel
927   intersection(){
928     difference(){
929       FilamentGuideArmShaftPositive();
930       translate([-guidearm_bendslot/2,
931                  -50,
932                  -guidearm_realbendlen + guidearm_armcorelen])
933         cube([guidearm_bendslot,
934               100,
935               guidearm_realbendlen + 100]);
936       hull(){
937         for (zx=[ [ 0, guidearm_bendslot ],
938                   [ guidearm_armcorelen + guidearm_slopelen,
939                     guidearm_hookprotr*2 + guidearm_protrslop ]
940                   ]) {
941           translate([-zx[1]/2, -50, zx[0]])
942           cube([zx[1], 100, 1]);
943         }
944       }
945     }
946     cube(center=true,
947          [guidearm_armdia*2,
948           guidearm_armwidth,
949           guidearm_totallen*3]);
950   }
951   FilamentGuideArmBase();
952 }
953
954 module FilamentGuideArmPrint(){ ////toplevel
955   rotate([90,0,0])
956     FilamentGuideArm();
957 }
958
959 module Demo(){ ////toplevel
960   translate([-real_exteffrad,-20,0]) Hub();
961   ArmEnd();
962   translate([ratchettooth*2, 30, 0]) FilamentCup();
963   if (selsz(true,false,false)) {
964     translate([-exteffrad + hubeffrad - hub_clip_baseextend, -10, 0])
965       ArmExtender();
966   }
967 }
968
969 //ArmEnd();
970 //FilamentCup();
971 //FilamentCupPair();
972 //CupSecuringClip();
973 //Hub();
974 //ArmExtender();
975 //Axle();
976 //AxleWasher();
977 //AxlePin();
978 //AxleFrictionWasher();
979 //StorageArmLeft();
980 //StorArmHoleTest();
981 //FilamentGuideSpacer();
982 //FilamentGuideArm();
983 //FilamentGuideArmPrint();
984 //Demo();