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