chiark / gitweb /
4890fa2d96fa3978881c3bd337ccd29774e5e6df
[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       translate([-nondove_armbase, -armendwallthick, -armendbasethick])
288         rotate([90,0,0])
289         Commitid_BestCount([nondove_armbase, totalwidth]);
290     }
291   }
292
293   for (otherside=[0,1]) {
294     for (circum = [300:100:1500]) {
295       assign(rad = circum / tau)
296         assign(fn = str("filamentspool-number-n",circum,".dxf"))
297         assign(rotateoffset = [0, totalwidth/2, 0])
298         assign(xlen = rad - real_exteffrad) {
299         if (xlen >= numbers_tick_width/2
300             + (otherside ? numbers_height_allow : 0) &&
301             xlen <= length - (otherside ? 0 : numbers_height_allow))
302           translate([xlen, -armendwallthick,
303                      -armendbasethick + (totalheight - numbers_tick_len)/2])
304           translate(rotateoffset)
305           rotate([0,0, otherside*180])
306           translate(-rotateoffset){
307             translate([-numbers_tick_width/2, -1, 0])
308               cube([numbers_tick_width, numbers_relief+1, numbers_tick_len]);
309             translate([numbers_tick_width/2 + numbers_tick_linespc,
310                        1,
311                        numbers_tick_len])
312               rotate([90,0,0])
313               rotate([0,0,-90])
314               linear_extrude(height= numbers_relief+1)
315               //    scale(templatescale)
316               import(file=fn, convexity=100);
317           }
318       }
319     }
320   }
321
322   difference(){
323     translate([0, -armendwallthick, -armendbasethick])
324       cube([length, totalwidth, totalheight]);
325     translate([-1, 0, 0])
326       cube([length+1 - ratchettooth, channelwidth, channeldepth+1]);
327     translate([-1, 0, ratchettoothheight])
328       cube([length+2, channelwidth, channeldepth+1]);
329
330     if (usedove()){
331       translate([0,0, -armendbasethick])
332         Commitid_BestCount_M([length/3, totalwidth]);
333     }
334   }
335   for (dx = [0 : ratchetstep : length - ratchetstep]) translate([dx,0,0]) {
336     translate([ratchettoothsmoothr+0.5, armendwallthick/2, 0]) minkowski(){
337       rotate([90,0,0])
338         cylinder($fn=20, r=ratchettoothsmoothr, h=armendwallthick);
339       multmatrix([      [       1, 0, ratchettoothslope, 0      ],
340                         [       0,      1,      0,      0       ],
341                         [       0,      0,      1,      0       ],
342                         [       0,      0,      0,      1       ]])
343         cube([ratchettooth - ratchettoothsmoothr*2,
344               channelwidth, ratchettoothheight - ratchettoothsmoothr]);
345     }
346   }
347 }
348
349 module FilamentCupHandle(){
350   pawlusewidth = ratchetpawl-ratchettoothsmoothr*2;
351   mirror([0,1,0]) {
352     difference(){
353       union(){
354         cube([stalklength, stalkwidth, prongthick]);
355         translate([stalklength, stalkwidth/2, 0])
356           cylinder(r=stalkwidth/2, h=prongthick, $fn=20);
357       }
358       Commitid_BestCount([stalklength, stalkwidth]);
359     }
360     translate([ratchettoothsmoothr, stalkwidth, 0]) {
361       minkowski(){
362         cylinder($fn=20,r=ratchettoothsmoothr, h=1);
363         multmatrix([    [       1, -ratchettoothslope, 0, 0     ],
364                         [       0,      1,      0,      0       ],
365                         [       0,      0,      1,      0       ],
366                         [       0,      0,      0,      1       ]])
367           cube([pawlusewidth,
368                 ratchettoothheight - ratchettoothsmoothr,
369                 prongthick - 1]);
370       }
371     }
372   }
373 }
374
375 module FilamentCupCup(){
376   for (my=[0,1]) mirror([0,my,0]) {
377     translate([0, cupwidth/2, 0])
378       cube([cupheight + prongwidth, prongwidth, prongthick]);
379   }
380 }
381
382 module FilamentCup() { ////toplevel
383   FilamentCupHandle();
384
385   gapy = prongwidth;
386   dy = cupwidth/2 + gapy + overclipcupgap;
387   baselen = dy+cupwidth/2;
388
389   translate([0, dy, 0])
390     FilamentCupCup();
391   cube([prongwidth, baselen+1, prongthick]);
392
393   translate([cupstrong_dx, prongwidth, 0]) {
394     cube([prongwidth, baselen-prongwidth, prongthick]);
395     for (y = [0, .33, .67, 1])
396       translate([0, (baselen - prongwidth) * y, 0])
397         cube([-cupstrong_dx + 1, prongwidth, prongthick]);
398   }
399   if (cupstrong_dx != 0) {
400     rotate([0,0,45])
401       translate([-prongwidth*.55, -prongwidth*2.1, 0])
402       cube([prongwidth*(2.65), prongwidth*4.2, prongthick]);
403   }
404
405   translate([0, -0.2, 0])
406     cube([prongribwidth, baselen, prongthick + prongribheight]);
407
408   if (prongribheight > 0) {
409     translate([-prongwidth, baselen, 0])
410       cube([cupheight/2, prongwidth + prongribheight, prongribwidth]);
411   }
412
413   midrad = cupwidth/2 + prongwidth/2;
414
415   propshift = stalklength - overclipdepth - prongthick + propxshift;
416   proptaken = propshift;
417   echo(midrad, propshift, proptaken);
418
419   translate([propshift, -1, 0]) {
420     // something is wrong with the y calculation
421     cube([prongwidth,
422           gapy+2,
423           prongthick]);
424   }
425   for (y = [overclipcupgap, overclipcupgap+overclipcupnextgap]) {
426     translate([cupstrong_dx, y + prongwidth, 0])
427       rotate([0,0, 102 + fdia])
428       FilamentTeeth(fdia=fdia, h=teethh);
429   }
430   for (x = [-0.3, -1.3]) {
431     translate([cupheight + overclipcupnextgap*x, baselen + prongwidth, 0])
432       rotate([0,0, 12 + fdia])
433       FilamentTeeth(fdia=fdia, h=teethh);
434   }      
435 }
436
437 module CupSecuringClipSolid(w,d,h1,h2){
438   rotate([0,-90,0]) translate([0,-h1/2,-w/2]) linear_extrude(height=w) {
439     polygon(points=[[0,0], [d,0], [d,h2], [0,h1]]);
440   }
441 }
442
443 module CupSecuringClipSolidSmooth(xrad=0, xdepth=0){
444   hbase = totalheight + prongstalkxwidth - overcliproundr*2;
445   minkowski(){
446     CupSecuringClipSolid(w=totalwidth,
447                          d=overclipdepth + xdepth,
448                          h1=hbase - overclipsmaller,
449                          h2=hbase + overclipbigger);
450     cylinder($fn=20, h=0.01, r=overcliproundr+xrad);
451   }
452 }
453
454 module CupSecuringClip(){ ////toplevel
455   wingswidth = wingspoke*2 + overclipthick*2 + overcliproundr*2 + totalwidth;
456   difference(){
457     union(){
458       CupSecuringClipSolidSmooth(xrad=overclipthick, xdepth=0);
459       translate([-wingswidth/2, -wingsize/2, 0])
460         cube([wingswidth, wingsize, wingthick]);
461       translate([-wingsize/2, -wingswidth/2, 0])
462         cube([wingsize, wingswidth, wingthick]);
463     }
464     translate([0,0,-0.1])
465       CupSecuringClipSolidSmooth(xrad=0, xdepth=0.2);
466   }
467 }
468
469 module ArmDoveClipPin(){ ////toplevel
470   DoveClipPin(h=doveclipheight);
471 }
472
473 module TowerDoveClipPin(){ ////toplevel
474   DoveClipPin(h=towercliph/2);
475 }
476
477 module Hub(){ ////toplevel
478   axlerad = hubaxlerad + slop;
479   xmin = axlerad+hublwidth/2;
480   xmax = hubbigrad-hublwidth/2;
481   hole = hubeffrad - hubbigrad - DoveClip_depth() - hublwidth*2;
482   holewidth = DoveClipPairSane_width() - hubstemwidth*2;
483   nondove_allwidth = nondove_armhole_wall*2 + totalwidth;
484   difference(){
485     union(){
486       difference(){
487         cylinder($fn=60, h=hublthick, r=hubbigrad);
488         translate([0,0,-1])
489           cylinder($fn=30, h=hublthick+2, r=(hubbigrad-hublwidth));
490       }
491       cylinder(h=hubaxlelen, r=axlerad+hublwidth);
492       for (ang=[0 : 360/num_arms : 359])
493         rotate([0,0,ang]) {
494           if (usedove()){
495             difference() {
496               translate([hubeffrad,0,0])
497                 DoveClipPairSane(h=doveclipheight,
498                                  baseextend = hub_clip_baseextend);
499               if (hole>hublwidth && holewidth > 2) {
500                 translate([hubbigrad + hublwidth, -holewidth/2, -1])
501                   cube([hole, holewidth, hublthick+2]);
502               }
503             }
504           } else {
505             difference(){
506               translate([0,
507                          -nondove_allwidth/2,
508                          0])
509                 cube([hubeffrad + nondove_armhole_x
510                       + nondove_armhole_hole/2 + nondove_armhole_support,
511                       nondove_allwidth,
512                       nondove_armhole_wall + totalheight]);
513               translate([hubeffrad - nondove_armhole_slop_x,
514                          -nondove_allwidth/2
515                          + nondove_armhole_wall - nondove_armhole_slop,
516                          nondove_armhole_wall])
517                 cube([nondove_armhole_x + 50,
518                       totalwidth + nondove_armhole_slop*2,
519                       totalheight + 1]);
520               translate([hubeffrad + nondove_armhole_x, 0, -20])
521                 cylinder(r= nondove_armhole_hole/2, h=50, $fn=10);
522             }
523           }
524         }
525       for (ang = [0 : 180/num_arms : 359])
526         rotate([0,0,ang]) rotate([90,0,0]) {
527           translate([0,0,-hublwidth/2])
528             linear_extrude(height=hublwidth)
529             polygon([[xmin,0.05], [xmax,0.05],
530                      [xmax,hublthick-0.2], [xmin, hubaxlelen-0.2]]);
531         }
532     }
533     translate([0,0,-1]) cylinder($fn=60, h=hubaxlelen+2, r=axlerad);
534
535     rotate([0,0, selsz(0,0,45)])
536       translate([axlerad+hublwidth,
537                  -hublwidth/2,
538                  0])
539       rotate([90,0,0])
540       Commitid_BestCount([(hubbigrad-hublwidth) - (axlerad+hublwidth),
541                           hublthick +
542                           hublwidth/2 * hubaxlelen/(hubbigrad-axlerad),
543                           ]);
544   }
545 }
546
547 module ArmExtender(){ ////toplevel
548   DoveClipExtender(length=exteffrad-hubeffrad,
549                    ha=doveclipheight,
550                    hb=doveclipheight);
551 }
552
553 module FsAxlePin(){ ////toplevel
554   AxlePin(hubaxlerad, washerrad*2, axlepinrad, axlepintabrad, slop);
555 }
556
557 module Axle(){ ////toplevel
558   pillarswidth = DoveClipPairSane_width(towerclipcount);
559
560   rotate([0,0, -( axleaxlefudgebend + atan(slop/hubaxlelen) ) ])
561   translate([-axlehorizoffset, -axlevertheight, 0]) {
562     rotate([0,0,-axletowerfudgebend])
563     rotate([0,0,-90])
564       DoveClipPairSane(h=towercliph, count=towerclipcount, baseextend=3);
565     translate([0, DoveClip_depth(), 0])
566     rotate([0,0,90])
567       ExtenderPillars(axlevertheight - DoveClip_depth(),
568                       pillarswidth, towercliph,
569                       pillarw=towerpillarw);
570   }
571
572   axleclearlen = hubaxlelen + slop*4 + washerthick*2 + axlepadlen;
573   axlerad = hubaxlerad-slop;
574   bump = axlerad * 0.2;
575   shift = axlerad-bump;
576   joinbelowallow = 3;
577
578   intersection(){
579     translate([0, 0, shift]) {
580       difference() {
581         union(){
582           translate([-1, 0, 0])
583             rotate([0,90,0])
584             cylinder($fn=60,
585                      r = axlerad,
586                      h = 1 + axleclearlen + axlepinrad*2 + 2);
587           mirror([1,0,0]) rotate([0,90,0])
588             cylinder(r = axlerad*1.75, h = 3);
589           intersection(){
590             mirror([1,0,0])
591               translate([axlehorizoffset - pillarswidth/2, 0, 0])
592               rotate([0,90,0])
593               cylinder($fn=60,
594                        r = towercliph - shift,
595                        h = pillarswidth);
596             translate([-50, -joinbelowallow, -50])
597               cube([100, joinbelowallow+50, 100]);
598           }
599         }
600         rotate([90,0,0])
601         translate([axleclearlen + axlepinrad/2, 0, -25])
602           cylinder(r = axlepinrad + slop, h=50);
603       }
604     }
605     translate([-50,-50,0]) cube([100,100,100]);
606   }
607 }
608
609 module washer(thick){
610   Washer(hubaxlerad, washerrad, thick, slop);
611 }
612
613 module AxleWasher(){ ////toplevel
614   washer(thick=washerthick);
615 }
616
617 module AxleThinWasher(){ ////toplevel
618   washer(thick=washerthinthick);
619 }
620
621 module AxleVeryThinWasher(){ ////toplevel
622   washer(thick=washerverythinthick);
623 }
624
625 module AxleFrictionWasher(){ ////toplevel
626   difference(){
627     cylinder(h=washerthick, r=washerrad);
628     translate([0,0,-1]) cylinder(h=washerthick+2, r=hubaxlerad+slop);
629   }
630   frarmr = hubbigrad;
631   frarmw = frictionwasherarmwidth;
632   frarmpawlr = hublwidth;
633   frarmpawlpush = slop*4 + frictionwasherextrapush;
634   for (ang=[0,180]) rotate([0,0,ang]) {
635     translate([washerrad-1, -frarmw/2, 0])
636       cube([frarmr - washerrad + 1, frarmw, washerthick]);
637     intersection(){
638       translate([frarmr - frarmpawlr, -50, 0])
639         cube([frarmpawlr, 100, 50]);
640       rotate([0,90,0])
641         cylinder(h = 50, r = frarmpawlpush, $fn=36);
642     }
643   }
644 }
645
646 module TowerExtender(){ ////toplevel
647   l = totalheightfromtower - axlevertheight;
648   echo("TowerExtender",l);
649   DoveClipExtender(length = l,
650                    ha = towercliph, hb = towercliph,
651                    counta = towerclipcount, countb = towerclipcount,
652                    pillarw = towerpillarw);
653 }
654
655 module FilamentCupPair(){ ////toplevel
656   FilamentCup();
657   translate([cupheight + prongthick*3,
658              cupwidth/2*1.7,
659              0])
660     rotate([0,0,180]) FilamentCup();
661 }
662
663 //----- storarm -----
664
665 storarm_hooklen = 8;
666 storarm_hookheight = 5;
667 storarm_thick = 10;
668 storarm_axleslop = 4;
669
670 storarm_base_w = 30;
671 storarm_base_h = 100;
672 storarm_base_d = 15;
673 storarm_base_mind = 2;
674
675 storarm_cope_hubaxle_mk1 = true;
676
677 storarm_screw_hole = 4;
678 storarm_screw_hole_slop = 0.5;
679 storarm_besides_hole = 4;
680
681 storarm_under_hole = 5;
682 storarm_screw_hole_head = 8.8;
683 storarm_screw_hole_head_slop = 1.5;
684
685 // calculated
686
687 storarm_axlerad = hubaxlerad - storarm_axleslop;
688 storarm_mainlen = hubaxlelen*2 + storarm_axleslop
689   + (storarm_cope_hubaxle_mk1 ? 10 : 0);
690 storarm_totlen = storarm_mainlen + storarm_hooklen;
691
692 storarm_mid_off_y = storarm_axlerad;
693
694 storarm_base_off_y = storarm_mid_off_y + storarm_base_h/2;
695
696 module StorageArmDiagPartSide(xmin, xmax){
697   xsz = xmax-xmin;
698   yuse = storarm_thick/2;
699
700   intersection(){
701     translate([xmin-1, -storarm_axlerad, storarm_thick/2])
702       rotate([0,90,0])
703       cylinder(r=storarm_axlerad, h=xsz+2, $fn=60);
704     translate([xmin, -yuse, 0])
705       cube([xsz, yuse, storarm_thick]);
706   }
707 }
708
709 module StorageArmDiagPart(xmin, xmax, shear, adjbot){
710   hull(){
711     StorageArmDiagPartSide(xmin,xmax);
712
713     multmatrix([[1,0,0,0],
714                 [shear,1,0,0],
715                 [0,0,1,0],
716                 [0,0,0,1]])
717       translate([0, -storarm_axlerad*2 + adjbot, 0])
718       mirror([0,1,0])
719       StorageArmDiagPartSide(xmin,xmax);
720   }
721 }
722
723 module StorageArmBaseTemplate(){
724   square([storarm_base_w, storarm_base_h]);
725 }
726
727 module StorageArmAtMountingHoles(){
728   bes = storarm_besides_hole + storarm_screw_hole;
729
730   x0 = bes;
731   x1 = storarm_base_w-bes;
732   y1 = storarm_base_h - bes;
733   y0 = bes;
734
735   for (pos=[ [x0, y1],
736              [x1, y1],
737              [x1, y0] ]) {
738     rotate([0,90,0])
739       translate([pos[0] - storarm_base_w,
740                  pos[1] - storarm_base_off_y, -storarm_base_d])
741       children();
742   }
743 }
744
745 module StorageArmRight(){ ////toplevel
746   shear = storarm_hookheight / (storarm_mainlen/2);
747
748   StorageArmDiagPart(-1, storarm_mainlen/2+1, shear, 0);
749   StorageArmDiagPart(storarm_mainlen/2-1, storarm_mainlen+1, shear/2,
750                      storarm_hookheight/2);
751
752   translate([0, storarm_hookheight, 0])
753     StorageArmDiagPart(storarm_mainlen, storarm_totlen,
754                        shear/2, -storarm_hookheight/2);
755
756   difference(){
757     union(){
758       hull(){
759         translate([-storarm_base_d, -storarm_base_off_y, storarm_base_w])
760           rotate([0,90,0])
761           linear_extrude(height=storarm_base_mind)
762           StorageArmBaseTemplate();
763         StorageArmDiagPart(-1, 0, shear, 0);
764       }
765       StorageArmAtMountingHoles(){
766         cylinder(r= storarm_screw_hole_head/2,
767                  h=10);
768       }
769     }
770     StorageArmAtMountingHoles(){
771       translate([0,0,-1])
772         cylinder(r= (storarm_screw_hole + storarm_screw_hole_slop)/2 ,
773                  h=20);
774       translate([0,0,storarm_under_hole])
775         cylinder(r= (storarm_screw_hole_head + storarm_screw_hole_head_slop)/2,
776                  h=20);
777     }
778   }
779 }
780
781 module StorageArmLeft(){ ////toplevel
782   mirror([1,0,0]) StorageArmRight();
783 }
784
785 module StorArmHoleTest(){ ////toplevel
786   sz = storarm_screw_hole_head + storarm_besides_hole*2;
787   intersection(){
788     StorageArmRight();
789     translate([-50, -storarm_base_off_y, -1])
790       cube([100, sz, sz+1]);
791   }
792 }
793
794
795 //----- filament guide spacer -----
796
797 guide_armdia = 15.0;
798 guide_armwidth = 10.2;
799 guide_armcorelen = 25.0;
800 guide_clipcirclethick = 10.0;
801
802 guidefilclip_outerdia = 22.8;
803
804 guidespacer_armslop = 0.75;
805 guidespacer_armlenslop = 1.05;
806
807 guidespacer_prongprotrude = 4;
808 guidespacer_thick = 1.6;
809
810 // calculated
811
812 guidespacer_armdia = guide_armdia + guidespacer_armslop;
813 guidespacer_armwidth = guide_armwidth + guidespacer_armslop;
814 guidespacer_len = guide_armcorelen - guide_clipcirclethick
815   + guidespacer_armlenslop;
816
817 guidespacer_wingheight = (guidefilclip_outerdia - guidespacer_armdia)/2;
818
819 module FilamentGuideArmTemplate(extra=0){
820   intersection(){
821     circle(r= (guidespacer_armdia/2) + extra);
822     square(center=true, [guidespacer_armwidth+extra*2,
823                          guidespacer_armdia + extra*2 + 10]);
824   }
825 }
826
827 module FilamentGuideSpacerInnerTemplate(){
828   FilamentGuideArmTemplate();
829   translate([0, -guidespacer_armdia/2])
830     square(center=true, [guidespacer_armwidth - guidespacer_prongprotrude,
831                          guidespacer_armdia]);
832 }
833
834 module FilamentGuideSpacer(){ ////toplevel
835   difference(){
836     union(){
837       linear_extrude(height= guidespacer_len)
838         FilamentGuideArmTemplate(extra= guidespacer_thick);
839       for (angle=[26, 60]) {
840         for (m=[0,1]) {
841           mirror([m,0,0]) {
842             rotate([0,0,angle]) {
843               hull(){
844                 for (t=[[0, guidespacer_wingheight],
845                         [guidespacer_len-1, -guidespacer_wingheight]])
846                   translate([0,0, t[0] + 0.5])
847                     cube([guidespacer_thick, guidespacer_armdia + t[1]*2,
848                       1],
849                          center=true);
850               }
851             }
852           }
853         }
854       }
855     }
856     translate([0,0,-1])
857       linear_extrude(height= guidespacer_len+5)
858       FilamentGuideSpacerInnerTemplate();
859   }
860 }
861
862
863 //----- replacement filament guide arm for TAZ-5 -----
864
865 guidearm_armslop = 0.25;
866 guidearm_armlenslop = 0.25;
867
868 guidearm_hookprotr = 3;
869 guidearm_hookprotrflat = 1;
870 guidearm_hookslope = 0.3;
871
872 guidearm_totallen = 60;
873
874 guidearm_screwplatesz = 12;
875 guidearm_screwplateth = 4;
876 guidearm_screwplatewd = 15;
877 guidearm_screwhole = 5 + 0.5;
878
879 guidearm_bendlen = 40;
880 guidearm_bendslot = 4.5;
881
882 guidearm_stopthick = 4;
883 guidearm_protrslop = 1.0;
884
885 // calculated
886
887 guidearm_armdia = guide_armdia - guidearm_armslop;
888 guidearm_armwidth = guide_armwidth - guidearm_armslop;
889 guidearm_armcorelen = guide_armcorelen + guidearm_armlenslop;
890
891 guidearm_base_z0 = -(guidearm_totallen - guidearm_armcorelen);
892
893 guidearm_realbendlen = min(guidearm_bendlen,
894                            guidearm_totallen - guidearm_screwplateth - 0.1);
895 guidearm_slopelen = guidearm_hookprotr/guidearm_hookslope;
896
897 module FilamentGuideArmStop(h){
898   for (ts=[-1,+1]) {
899     translate([ts * guidearm_hookprotr, 0,0])
900       cylinder(r=guidearm_armdia/2, h, $fn=80);
901   }
902 }
903
904 module FilamentGuideArmShaftPositive(){
905   r = guidearm_armdia/2;
906
907   translate([0,0, guidearm_base_z0+1])
908     cylinder(r=r, h= guidearm_totallen, $fn=80);
909   translate([0,0, guidearm_armcorelen]){
910     hull(){
911       FilamentGuideArmStop(guidearm_hookprotrflat);
912       translate([0,0, guidearm_slopelen])
913         cylinder(r=r, h=guidearm_hookprotrflat, $fn=80);
914     }
915   }
916   mirror([0,0,1])
917     FilamentGuideArmStop(guidearm_stopthick);
918 }
919
920 module FilamentGuideArmBase(){
921   translate([0,
922              (guidearm_screwplatewd - guidearm_armwidth)/2,
923              guidearm_base_z0]){
924     difference(){
925       translate([0,0, guidearm_screwplateth/2])
926         cube(center=true,
927              [guidearm_armdia + guidearm_screwplatesz*2,
928               guidearm_screwplatewd,
929               guidearm_screwplateth]);
930       for (ts=[-1,+1]) {
931         translate([ts * (guidearm_armdia/2 + guidearm_screwplatesz/2),
932                    0,
933                    -20])
934           cylinder(r= guidearm_screwhole/2, h=40, $fn=20);
935       }
936     }
937   }
938 }
939
940 module FilamentGuideArm(){ ///toplevel
941   intersection(){
942     difference(){
943       FilamentGuideArmShaftPositive();
944       translate([-guidearm_bendslot/2,
945                  -50,
946                  -guidearm_realbendlen + guidearm_armcorelen])
947         cube([guidearm_bendslot,
948               100,
949               guidearm_realbendlen + 100]);
950       hull(){
951         for (zx=[ [ 0, guidearm_bendslot ],
952                   [ guidearm_armcorelen + guidearm_slopelen,
953                     guidearm_hookprotr*2 + guidearm_protrslop ]
954                   ]) {
955           translate([-zx[1]/2, -50, zx[0]])
956           cube([zx[1], 100, 1]);
957         }
958       }
959     }
960     cube(center=true,
961          [guidearm_armdia*2,
962           guidearm_armwidth,
963           guidearm_totallen*3]);
964   }
965   FilamentGuideArmBase();
966 }
967
968 module FilamentGuideArmPrint(){ ////toplevel
969   rotate([90,0,0])
970     FilamentGuideArm();
971 }
972
973 module Demo(){ ////toplevel
974   translate([-real_exteffrad,-20,0]) Hub();
975   ArmEnd();
976   translate([ratchettooth*2, 30, 0]) FilamentCup();
977   if (selsz(true,false,false)) {
978     translate([-exteffrad + hubeffrad - hub_clip_baseextend, -10, 0])
979       ArmExtender();
980   }
981 }
982
983 //ArmEnd();
984 //FilamentCup();
985 //FilamentCupPair();
986 //CupSecuringClip();
987 //Hub();
988 //ArmExtender();
989 //Axle();
990 //AxleWasher();
991 //AxlePin();
992 //AxleFrictionWasher();
993 //StorageArmLeft();
994 //StorArmHoleTest();
995 //FilamentGuideSpacer();
996 //FilamentGuideArm();
997 //FilamentGuideArmPrint();
998 //Demo();