chiark / gitweb /
distort-stl: introduce $gensplit (nfc)
[reprap-play.git] / floating-phases.scad
1 // -*- C -*-
2
3 // caller should define
4 //
5 //   z_pause = 2;    // higher than any thing in the model
6 //   total_sz = [ 200, 141 ];
7 //   phases=4;   // how many phases
8 //   colours = [
9 //         "blue",
10 //         "black",
11 //         "red",          
12 //         "yellow",
13 //         ];
14 //
15 // Pause height         z_pause value from caller
16 // head park X          15
17 // head park Y          0
18 // head move Z          1
19 // min head park Z      1
20 // retraction           1
21 // re-home              [ ] [ ]
22
23 // when z pause occurs
24 //   * set feed rate to 10% (or whatever minimum is)
25 //   * press knob, printer will start
26 //   * quickly, press again, select "stop"
27 //   * set temp
28 //   * set feed rate back to 100%
29 //   * now change filament etc., start next file
30
31 include <utils.scad>
32
33 $test_thicker = 1.0; // 2.5;
34
35 th_l0 = .425 * $test_thicker;
36 th_l1 = .250 * $test_thicker;
37 frame_w = 0.8;
38 tower_w = 2.0;
39
40 th_most = th_l0 + th_l1*2;
41
42 noz_gap = 8;
43
44
45 multicolour_gap = 0.15; // each side
46
47 underlayer_smaller = 0.35; // each side
48
49 total_sz_actual = $test ? $test : total_sz;
50
51 module Interlayer_Bigger(){
52   offset(r=multicolour_gap, $fn=20){
53     union(){ children(); }
54   }
55 }
56
57 module Interlayer_Smaller(){
58   offset(r=-multicolour_gap, $fn=20){
59     union(){ children(); }
60   }
61 }
62
63 module Underlayer_Smaller(){
64   offset(r=-underlayer_smaller, $fn=20){
65     union(){ children(); }
66   }
67 }
68
69 module FloatingPhaseFraming(phase, zmin) {
70   frame_inner =
71     total_sz_actual
72     + noz_gap * [2,2] * (phase > 0 ? phase : 0.5);
73
74   frame_outer =
75     frame_inner
76     + frame_w * [2,2];    
77
78   tower_pos =
79     -0.5 * frame_inner
80     + noz_gap * [1,0] * (phases - phase)
81     + -[1,0] * tower_w + 0.5 * [0,-1] * frame_w;
82
83   // frame for alignment
84   linear_extrude(height= th_l0)
85     difference(){
86       square(frame_outer, center=true);
87       square(frame_inner, center=true);
88   }
89
90   // tower to avoid diagonal traverse to start position
91   linear_extrude(height= zmin + th_l1)
92     translate(tower_pos)
93     square([1,1] * tower_w);
94
95   // trick to pause rather than finishing
96   if (phase != phases-1)
97     translate([0,0, z_pause+th_l1])
98       linear_extrude(th_l1)
99       translate(tower_pos)
100       square([1,1] * tower_w);
101 }
102
103 echo(str("SET PAUSE AT Z HEIGHT TO ",z_pause));