-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathstrut_plate.html
267 lines (233 loc) · 5.98 KB
/
strut_plate.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
<!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 = 'lr4_strut_plate_3d/lr4_strut_plate_3d.scad'; // folder name (actually zip file) and source file name
const outstl_name = 'model_out.stl';
const outsvg_name = 'strut_plate.svg';
const model_default_params = {
strut_length: 780,
num_braces: 0,
dogbones: 3.5,
front_plate: true,
bottom_plate: true,
front_wing_size: 8.0,
};
const model_param_desriptions = {
strut_length: "Length of strut in mm",
num_braces: "Number of braces (leave 0 for reasonable defaults)",
dogbones: "Size of dogbone feature for inside corners",
front_plate: "Include front plate",
bottom_plate: "Include bottom plate",
front_wing_size: "(advanced) Wing size for front plate. <br>Recommended limit is 8.0 for 32mm tubes,<br>10.8 for 30mm tubes,<br>or 11.5 for 29.5 mm tubes."
};
(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>
body {
margin: 0;
min-height: 100vh;
min-height: -webkit-fill-available;
}
html {
height: -webkit-fill-available;
}
.root {
position: fixed;
left: 0;
top: 100;
width: 100vw;
height: 100vh;
}
#editor-panel,
#view-panel {
min-width: 40vw;
padding: 10px;
/* height: 100vh; */
}
#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;
}
.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: scroll;
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>
<div id="params">
</div>
<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>Parametric Web Generator for LR4 Strut Plates</h2>
</div>
<div class="text desktop">
<span class="text-fragment">
LR4 strut plates <a target="_blank" href="lr4_strut_plate_3d.zip">OpenSCAD file</a>
</span>
</div>
<div class="text desktop">
</div>
<div class="row text">
<button class="button settings" id="run">Render (Ctrl+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>