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