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