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