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