update puzzle to latest version to match solution instructions
[ozzloy@gmail.com/3d-printables] / erin / puzzle.scad
CommitLineData
271bfd5f 1$fn = 100;
2
3h = 10;
4
64c08061 5module block() {
6 translate([-h, -h])
7 cube([2*h, 2*h, h]);
8};
9
10module cut() {
11 translate([0, -h/2, h/2])
12 rotate([45, 0, 0])
13 translate([-1.5*h, -1.5*h])
14 cube([3*h, 3*h, h]);
15};
16
271bfd5f 17module pyramid() {
64c08061 18 difference() {
19 block();
20 cut();
21 rotate(90) cut();
22 rotate(180) cut();
23 rotate(270) cut();
24 }
25};
26
27//polyhedron(
28// points=[
29// [h,h,0], [h,-h,0], [-h,-h,0], [-h,h,0], [0,0,h]
30// ],
31// faces = [
32// [1,4,0], [2,4,1], [2,3,4], [4,3,0],
33// [0,3,2,1]
34// ]
35//);
271bfd5f 36
37module quarter_pyramid() {
38 difference() {
39 pyramid();
40 rotate([0,0,45]) translate([-2*h, 0, -h]) cube([h*4,h*4,h*4]);
41 rotate([0,0,-45]) translate([-2*h, -4*h, -h]) cube([h*4,h*4,h*4]);
42 rotate([0,0,-45]) translate([0, -4*h, -h]) cube([h*4,h*4,h*4]);
43 }
64c08061 44};
271bfd5f 45
46//quarter_pyramid();
47
48module bottom() {
49 children();
64c08061 50};
271bfd5f 51
52module top() {
53 translate([0,0,2*h]) rotate([180,0,0])
54 children();
64c08061 55};
271bfd5f 56
57module north() {
58 translate([0,h,h]) rotate([90,90,0])
59 children();
64c08061 60};
271bfd5f 61
62module south() {
63 rotate([0,0,180]) north()
64 children();
64c08061 65};
271bfd5f 66
67module east() {
68 translate([h,0,h]) rotate([90,0,0]) rotate([0,-90,0])
69 children();
64c08061 70};
271bfd5f 71
72module west() {
73 rotate([0,0,180]) east()
74 children();
64c08061 75};
271bfd5f 76
77module pointy() {
78 translate([0,0,-2*h]) top() pyramid();
64c08061 79};
271bfd5f 80
81module partA() {
82 translate([0,-h,-h]) rotate([180,-90,90]) quarter_pyramid();
64c08061 83};
271bfd5f 84
85module partB() {
86 translate([0,-h,-h]) rotate([180,-90,-90]) quarter_pyramid();
64c08061 87};
271bfd5f 88
89module partC() {
90 translate([-h,h,-h]) rotate([0,180,90]) {
64c08061 91 union() {
92 partA();
93 partB();
94 }
271bfd5f 95 }
64c08061 96};
271bfd5f 97
98module partD() {
99 translate([0,h,-h]) rotate([90, 0, 0]) partC();
100}
101
102module partE() {
103 rotate([0,0,180]) partD();
104}
105
106module puzzle_piece() {
107 pyramid();
108 pointy();
109 partA();
110 partB();
111 partC();
112 partD();
113 partE();
114}
115
64c08061 116module cutout() {
117 translate([0, -2.8, 0])
118 rotate([45, 45, 0])
119 translate([-h, -h, 0])
120 translate([0, 4.2, 4.2])
121 cube([2*h, 2*h, 2*h]);
122}
123
124module puzzle_part(){
125difference() {
126 rotate([0,45,0]) puzzle_piece();
127 cutout();
128 translate([0, 2*h, 0])
129 cutout();
130
131 mirror([0, 180, 0])
132 translate([4, -15, h])
133 rotate([45, 0, 45])
134 block();
135
136 translate([4, -15, h])
137 rotate([45, 0, 45])
138 block();
139}}
140
141//
142module solved_puzzle(){
143bottom() puzzle_piece();
144top() puzzle_piece();
145north() puzzle_piece();
146south() puzzle_piece();
147east() puzzle_piece();
148west() puzzle_piece();
149}
150
151module step_0(){
152bottom() puzzle_piece();
153south() puzzle_piece();
154west() puzzle_piece();
155}
156
157module step_1(){
158bottom() puzzle_piece();
159south() puzzle_piece();
160east() puzzle_piece();
161west() puzzle_piece();
162}
163
164module step_2(){
165bottom() puzzle_piece();
166south() puzzle_piece();
167east() puzzle_piece();
168west() puzzle_piece();
169north() puzzle_piece();
170}
271bfd5f 171
64c08061 172step_2();