Neale Pickett
·
2023-11-26
temp-tower.scad
1/** Small temperature tower.
2
3©2023 Neale Pickett <neale@woozle.org>
4
5Permission is hereby granted, free of charge, to any person obtaining a copy of
6this software and associated documentation files (the "Software"), to deal in
7the Software without restriction, including without limitation the rights to
8use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9the Software, and to permit persons to whom the Software is furnished to do so,
10subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in all
13copies or substantial portions of the Software. The software is provided "as
14is", without warranty of any kind, express or implied, including but not limited
15to the warranties of merchantability, fitness for a particular purpose and
16noninfringement. In no event shall the authors or copyright holders be liable
17for any claim, damages or other liability, whether in an action of contract,
18tort or otherwise, arising from, out of or in connection with the software or
19the use or other dealings in the software.
20
21*/
22
23/* [Main Options] */
24
25// Temperature at the bottom
26TempBase = 220; // [100:300]
27
28// Temperature increase at each tier
29TempIncrease = -10; // [-20:20]
30
31// How many tiers
32Tiers = 7;
33
34// Print a full tower? If false, you just get two poles.
35FullTower = true;
36
37// Text to engrave on the side
38SideText = "PLA";
39
40/* [Hidden] */
41PlateHeight = 0.8;
42Font = "Liberation Sans:style=bold";
43EngraveDepth = 0.3;
44$fn = 90;
45
46module FullTier(temperature) {
47 difference() {
48 cube([25, 5, 5]);
49 translate([12, -1, 0]) cube([12, 10, 5 - PlateHeight]); // Inner cavity
50 translate([0, 2.5, 0]) rotate([0, 45, 0]) rotate([0, 0, 90]) cube(5*sqrt(2), center=true); // Overhang
51 translate([2.5, 2.5, 0.1]) cylinder(r=1, h=5); // Overhang hole
52 translate([4.4, EngraveDepth, 0.8])
53 rotate([90, 0, 0])
54 linear_extrude(EngraveDepth + 0.1)
55 text(str(temperature), size=3.2, font=Font);
56 }
57 translate([22, 2.5, 0]) cylinder(r=1, h=3); // Cylinder
58 translate([14, 2.5, 0]) cylinder(r1=1, r2=0.2, h=3); // Cone
59 translate([5, 0.5, 0.4]) cube([6, 5, 0.2]); // Rear protrusion: y translate = protrusion depth
60}
61
62module Posts(temperature) {
63 difference() {
64 translate([4, 0, 0]) cube([8, 5, 5]);
65 translate([4.4, EngraveDepth, 0.8])
66 rotate([90, 0, 0])
67 linear_extrude(EngraveDepth + 0.1)
68 text(str(temperature), size=3.2, font=Font);
69 }
70 translate([22, 2.5, 0]) cylinder(r=2, h=5);
71
72}
73
74module Tier(temperature) {
75 if (FullTower) {
76 FullTier(temperature);
77 } else {
78 Posts(temperature);
79 }
80}
81
82module EngraveText(text) {
83 linear_extrude(EngraveDepth + 0.1)
84 text(text, size=3.2, valign="center", font=Font);
85}
86
87// Ouptut special code to add to 3mf file
88module ZCodeWrite(text) {
89 echo(str(
90 "#",
91 "#CUSTOM",
92 "#3mf",
93 "#Metadata/Prusa_Slicer_custom_gcode_per_print_z.xml",
94 "#", text,
95 "##"
96 ));
97}
98
99module main() {
100 ZCodeWrite("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
101 ZCodeWrite("<custom_gcodes_per_print_z>");
102 difference() {
103 union() {
104 cube([25, 5, PlateHeight]); // Floor plate
105 for (tier = [0 : 1 : Tiers-1]) {
106 z = PlateHeight + (5 * tier);
107 temp = TempBase + (TempIncrease * tier);
108 ZCodeWrite(str(
109 "<code print_z=\"", z, "\"",
110 " type=\"4\"",
111 " extruder=\"1\"",
112 " color=\"\"",
113 " extra=\"M104 S", temp, "\"",
114 " gcode=\"M104 S", temp, "\"/>",
115 ""
116 ));
117 translate([0, 0, z]) Tier(temp);
118 }
119 }
120 if (FullTower) {
121 translate([25 - EngraveDepth, 2.5, 1+PlateHeight])
122 rotate([90, -90, 90])
123 EngraveText(SideText);
124 } else {
125 translate([4 + EngraveDepth, 2.5, 1+PlateHeight])
126 rotate([90, -90, -90])
127 EngraveText(SideText);
128 }
129 }
130 ZCodeWrite("<mode value=\"SingleExtruder\"/>");
131 ZCodeWrite("</custom_gcodes_per_print_z>");
132}
133
134main();
135