-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgridfinity_bins.html
295 lines (259 loc) · 7.72 KB
/
gridfinity_bins.html
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE html>
<html>
<head>
<script src="deps/three.min.js" defer></script>
<script src="deps/Projector.js" defer></script>
<script src="deps/stl_viewer.min.js" defer></script>
<script src="deps/webgl_detector.js" defer></script>
<script src="deps/OrbitControls.js" defer></script>
<script src="deps/parser.min.js" defer></script>
<script src="deps/TrackballControls.js" defer></script>
<script src="deps/CanvasRenderer.js" defer></script>
<script src="browserfs.min.js" defer></script>
<script>
const model_path = 'gridfinity_bins/gridfinity_basic_cup.scad'; // folder name (actually zip file) and source file name
const outstl_name = 'model_out.stl';
const model_default_params = {
width: 1,
depth: 1,
height: 6,
magnet_diameter: 0,
screw_depth: 0,
hole_overhang_remedy: true,
chambers: 1,
withLabel: "disabled",
fingerslide: true,
labelWidth: 0,
wall_thickness: 0.95,
efficient_floor: false,
lip_style: "normal",
};
const model_param_desriptions = {
width: "Number of grid units left-to-right (x axis)",
depth: "Number of grid units front-to-back (y axis)",
height: "Height of bin in standard units (multiples of 7 mm)",
magnet_diameter: "Include hole for magnet (Zack's design is 6.5 mm) or 0 to omit magnet hole",
screw_depth: "Include deeper narrow hole for screw (Zack's design is 6 mm) or 0 to omit screw hole",
hole_overhang_remedy: "If both screw and magnet are defined, include feature for better printing of magnet/screw overhang",
chambers: "Number of subdivisions along x axis (uniform divisions)",
withLabel: "Include overhang feature for label and control position, can be 'disabled', 'left', 'right', 'center', 'leftchamber', 'rightchamber', or 'centerchamber' <span class='tooltip-trigger'>(hover for more info)</span><div class='tooltip-text'>When labelWidth (below) is nonzero and therefore not the full width of the bin, the label feature can be left, right, or center justified relative to the entire bin. If x-subdivisions (chambers) are 2 or greater, then 'leftchamber', 'rightchamber', or 'centerchamber' places a label feature on each subdivision, justified relative to the subdivision.</div>",
fingerslide: "Include large corner fillet on the front",
labelWidth: "Width of label in number of units, or zero to indicate full width",
wall_thickness: "Thickness of outer walls (Zack's design is 0.95)",
efficient_floor: "Efficient floor option saves material and time, but the floor is not smooth (only applies if no magnets, screws, or finger-slide used)",
lip_style: "Style of lip at top of walls, can be 'normal', 'reduced', or 'none'",
};
(async() => {
if ('serviceWorker' in navigator) {
for (const reg of await navigator.serviceWorker.getRegistrations()) {
try {
reg.unregister()
} catch (e) {
console.error(e, e.stackTrace);
}
}
}
})();
</script>
<script src="filesystem.js" defer></script>
<script type="module" src="main.js" defer></script>
<style>
.tooltip-trigger {
position: relative;
cursor: pointer;
}
.tooltip-text {
position: absolute;
visibility: hidden;
background-color: #fff;
border: 1px solid #ddd;
padding: 5px;
text-align: center;
z-index: 1;
}
.tooltip-trigger:hover + .tooltip-text {
visibility: visible;
}
body {
margin: 0;
min-height: 100vh;
min-height: -webkit-fill-available;
}
html {
height: -webkit-fill-available;
}
.root {
display: flex;
flex-direction: row;
height: 100vh;
}
#editor-panel,
#view-panel {
padding: 10px;
}
#flip-mode {
display: none;
position: fixed;
left: 5px;
top: 5px;
z-index: 10;
font-size: large;
padding: 10px 20px;
margin: 5px 0;
}
.iPadShowKeyboard {
right: 130px !important;
}
#view-panel {
width: 70vw;
}
#editor-panel {
width: 30vw;
overflow-y: auto; /* Make left pane scrollable */
}
.row {
display: flex;
flex-direction: row;
}
.col {
display: flex;
flex-direction: column;
}
#run, #kill {
padding: 5px;
margin-top: 5px;
}
.button {
margin-right: 10px;
}
.text {
padding: 5px 0 5px 0;
}
.text-fragment {
padding: 0 10px 0 10px;
align-self: center;
}
.logs-container {
overflow-y: auto;
height: calc(min(200px, 30vh));
position: relative;
}
.deep-link {
position: absolute;
top: 5px;
right: 5px;
}
#features {
position: fixed;
bottom: 0;
}
.spacer {
flex-grow: 1;
}
.title {
text-align: center;
width: 100%;
}
#viewer {
min-height: 80vh;
}
@media only screen and (max-height: 600px),
only screen and (max-width: 600px),
only screen and (max-width: 767px),
only screen and (max-aspect-ratio: 1/2) {
.settings,
.desktop {
display: none;
}
}
@media only screen and (max-width: 767px),
only screen and (max-aspect-ratio: 1/2) {
#flip-mode {
display: block;
}
#viewer {
padding: 10px 0;
position: absolute;
left: 0;
top: 50px;
right: 0;
bottom: 0;
width: 100vw;
}
#viewer {
height: calc(100vh - 55px);
}
#link-container {
position: absolute;
bottom: 15px;
right: 15px;
z-index: 4;
}
.logs-container {
position: absolute;
bottom: 0;
height: 30vh;
width: 100vw;
left: 0;
z-index: 1;
background-color: rgba(255,255,255,0.7) !important;
}
.logs-container pre {
color: rgba(50, 50, 50, 0.9);
font-family: Consolas, "Courier New", monospace;
font-weight: normal;
font-size: 12px;
}
#viewer {
z-index: 0;
}
#viewer.focused {
z-index: 3;
}
.features
{
display: none;
}
}
</style>
</head>
<body>
<div class="root row">
<div id="editor-panel" class="col">
<button id="flip-mode">Flip</button>
<form id="params">
<input type="submit" hidden />
</form>
<div>
<br/>
<a href='' id="permalink">Link to current parameters</a>
</div>
<div class="logs-container">
<pre><code id="logs"></code></pre>
</div>
</div>
<div id="view-panel" class="col">
<div class="text title desktop">
<h2>Gridfinity Parametric Web Generator</h2>
</div>
<div class="text desktop">
<a href="https://github.com/vector76/Web_OpenSCAD_Customizer">Web OpenSCAD Customizer Project</a><br/>
<a href="https://github.com/vector76/gridfinity_openscad">Gridfinity OpenSCAD</a>
</div>
<div class="text desktop">
</div>
<div class="row text">
<button class="button settings" id="run">Render (Enter)</button>
<button class="button settings" id="kill" disabled>Kill</button>
<div class="text-fragment" id="link-container"></div>
<div class="text-fragment settings" id="meta"></div>
<span class="spacer settings"></span>
<span class="text-fragment settings"><input type="checkbox" id="autorotate" checked>Rotate</span>
<span class="spacer settings"></span>
</div>
<div id="viewer" tabindex="0"></div>
<span id="features" class="features"></span>
</div>
</div>
</body>
</html>