-
Notifications
You must be signed in to change notification settings - Fork 0
/
queen_bed.scad
202 lines (160 loc) · 5 KB
/
queen_bed.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
// 1000 = 1 inch
// Port and starboard are from the perspective of sitting up in bed
// Queen bed
MATTRESS_HEIGHT = 10 * 1000;
MATTRESS_WIDTH = 60 * 1000;
MATTRESS_LENGTH = 80 * 1000;
/*//////////////////////////////////////////////////////
// //
// PRIMITIVES //
// //
//////////////////////////////////////////////////////*/
module BoxProfile(width, height, thickness) {
difference() {
square([width, height]);
translate([thickness/2, thickness/2])
square([width - thickness, height - thickness]);
}
}
module BoxSection(length, width, height, thickness) {
linear_extrude(length) {
BoxProfile(width, height, thickness);
}
}
module LProfile(width, height, thickness) {
square([thickness, height]);
square([width, thickness]);
}
module LSection(length, width, height, thickness) {
linear_extrude(length) {
LProfile(width, height, thickness);
}
}
module Fin() {
linear_extrude(125)
polygon([
[0, 0],
[500, 0],
[1000, 2000],
[0, 2000]
]);
}
module FinSlot() {
translate([0, 0, 125])
linear_extrude(125)
polygon([
[0, 0],
[500, 0],
[1000, 2000],
[0, 2000]
]);
translate([0, 0, -125])
linear_extrude(125)
polygon([
[0, 0],
[500, 0],
[1000, 2000],
[0, 2000]
]);
translate([125, 0, -125])
linear_extrude(375)
polygon([
[500 - 125, 0],
[500, 0],
[1000, 2000],
[1000 - 125, 2000]
]);
}
/*//////////////////////////////////////////////////////
// //
// COMPONENTS //
// //
//////////////////////////////////////////////////////*/
module LegAssembly(height) {
rotate([-90, 0, 0])
translate([0, -2000, 0])
BoxSection(height, 2000, 2000, 250);
rotate([0, 90, 0])
translate([0, MATTRESS_HEIGHT, 125])
FinSlot();
}
module Footboard() {
HEIGHT = 22 * 1000;
// port leg
mirror([0,0,1])
translate([0, 0, -2000])
LegAssembly(HEIGHT);
// starboard leg
translate([MATTRESS_WIDTH, 0, 2000])
rotate([0,180,0])
LegAssembly(HEIGHT);
// top pieces are not longer and are not translated,
// as a miter joint
translate([0, HEIGHT - 2000, 2000])
rotate([0, 90, 0])
BoxSection(MATTRESS_WIDTH, 2000, 2000, 250);
// non-top pieces are shorter and translated, as a
// butt joint
translate([2000, MATTRESS_HEIGHT, 2000])
rotate([0, 90, 0])
BoxSection(MATTRESS_WIDTH - 4000, 2000, 2000, 250);
}
module Headboard() {
HEIGHT = MATTRESS_HEIGHT * 4 + 2000;
// port
LegAssembly(HEIGHT);
// startboard
translate([MATTRESS_WIDTH, 0, 0])
mirror([1,0,0])
LegAssembly(HEIGHT);
// top pieces are not longer and are not translated,
// as a miter joint
translate([0, MATTRESS_HEIGHT * 4, 2000])
rotate([0, 90, 0])
BoxSection(MATTRESS_WIDTH, 2000, 2000, 250);
// non-top pieces are shorter and translated, as a
// butt joint
translate([2000, MATTRESS_HEIGHT * 3, 2000])
rotate([0, 90, 0])
BoxSection(MATTRESS_WIDTH - 4000, 2000, 2000, 250);
translate([2000, MATTRESS_HEIGHT * 2, 2000])
rotate([0, 90, 0])
BoxSection(MATTRESS_WIDTH - 4000, 2000, 2000, 250);
translate([2000, MATTRESS_HEIGHT, 2000])
rotate([0, 90, 0])
BoxSection(MATTRESS_WIDTH - 4000, 2000, 2000, 250);
}
module SideRail() {
// side rail
translate([0, MATTRESS_HEIGHT + 2000, 2000])
LSection(MATTRESS_LENGTH, 2000, 2000, 125);
// footboard fin
rotate([0,270,0])
translate([2000, MATTRESS_HEIGHT, -250])
Fin();
// headboard fin
rotate([0,90,0])
translate([-MATTRESS_LENGTH - 2000, MATTRESS_HEIGHT, 125])
Fin();
}
module Mattress(width, height, thickness) {
translate([125, 125, 125])
cube([width - 250, thickness - 250, height - 250]);
}
/*//////////////////////////////////////////////////////
// //
// ASSEMBLY //
// //
//////////////////////////////////////////////////////*/
translate([0, 2000 + MATTRESS_HEIGHT, 2000])
color("gray", 0.5)
Mattress(MATTRESS_WIDTH, MATTRESS_LENGTH, 10 * 1000);
Footboard();
translate([0, 0, MATTRESS_LENGTH + 2000])
Headboard();
// port
SideRail();
// starboard
translate([MATTRESS_WIDTH, 0, 0])
mirror([1,0,0])
SideRail();