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