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