forked from hudbrog/gCodeViewer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
403 lines (380 loc) · 22.9 KB
/
index.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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>gcode viewer - online gcode viewer and analyzer in your browser!</title>
<meta name="description" content="Visual GCode viewer and analyzer in your browser. No need to upload you GCode anywhere, everything is done locally." />
<meta name="keywords" content="GCode,g-code,viewer,online,javascript" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="language" content="english" />
<link rel="shortcut icon" type="image/vnd.microsoft.icon" href="favicon.ico" />
<link rel="sitemap" type="application/xml" title="Sitemap" href="/sitemap.xml" />
<link rel="meta" type="application/rdf+xml" title="Dublin" href="/dublin.rdf" />
<link rel="canonical" href="http://gcode.ws/" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" media="screen" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="lib/codemirror.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/gCodeViewer.css" media="screen" />
<script type="text/javascript" src="lib/jquery-1.8.2.js"></script>
<script type="text/javascript" src="lib/codemirror.js"></script>
<script type="text/javascript" src="lib/mode_gcode/gcode_mode.js"></script>
<script type="text/javascript" src="lib/three.js"></script>
<script type="text/javascript" src="lib/bootstrap.min.js"></script>
<script type="text/javascript" src="lib/bootstrap-slider.min.js"></script>
<script type="text/javascript" src="lib/modernizr.custom.09684.js"></script>
<script type="text/javascript" src="lib/TrackballControls.js"></script>
<script type="text/javascript" src="lib/zlib.min.js"></script>
<script type="text/javascript" src="lib/underscore.min.js"></script>
<script type="text/javascript" src="js/ui.js"></script>
<script type="text/javascript" src="js/gCodeReader.js"></script>
<script type="text/javascript" src="js/renderer.js"></script>
<script type="text/javascript" src="js/analyzer.js"></script>
<script type="text/javascript" src="js/renderer3d.js"></script>
<meta property="og:title" content="gCodeViewer - online gcode viewer and analyzer!" />
<meta property="og:type" content="website" />
<meta property="og:url" content="http://gcode.ws" />
<meta property="og:image" content="http://gcode.ws/screenshot.jpg" />
<meta property="og:site_name" content="Online GCode Viewer" />
<meta property="fb:admins" content="1537520789" />
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">GCode Viewer</a>
</div>
<ul class="nav navbar-nav" id="tab-nav">
<li class="active"><a href="#tabAbout" data-toggle="tab"><i class="fa fa-info-circle"></i> About</a></li>
<li><a href="#tab2d" data-toggle="tab"><i class="fa fa-arrows"></i> 2D</a></li>
<li class="clickOnResize"><a href="#tab3d" data-toggle="tab"><i class="fa fa-compass"></i> 3D</a></li>
<li><a href="#tabGCode" data-toggle="tab"><i class="fa fa-code"></i> GCode</a></li>
<li class="gcode-init">
<input type="file" id="file" name="files" style="display: none;" />
<div class="gcode-drop" id="drop_zone">
<i class="fa fa-upload"></i> Drag GCode here
</div>
<div class="gcode-progress">
<div class="progress">
<div id="loadProgress" class="progress-bar" role="progressbar" style="width: 0;"></div>
</div>
<div class="progress">
<div id="analyzeProgress" class="progress-bar" role="progressbar" style="width: 0;"></div>
</div>
</div>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="#" data-toggle="modal" data-target="#preferences-modal"><i class="fa fa-cog"></i> Preferences</a></li>
<li class="dropdown">
<a href="#"
class="dropdown-toggle"
data-toggle="dropdown">
Spread the word
<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li class="socials">Facebook</li>
<li class="socials">Google Plus</li>
<li class="socials">Twitter</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="app">
<div id="control" style="display: none;">
<img src="img/logo.png" alt="gCodeViewer - an online gcode viewer" class="logo" />
<div id="accordion2" class="panel-group">
<div class="panel panel-default hide" id="errAnalyseTab">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion2" href="#errorAnalysisAccordioinTab">
Error Analysis
</a>
</h4>
</div>
<div id="errorAnalysisAccordioinTab" class="panel-collapse collapse in">
<div class="panel-body">
<button class="btn disabled" id="runAnalysisButton" onclick="GCODE.analyzer.runAnalyze()"/>Run analysis</button>
<div id="analysisOptionsDiv" class="hide">
<label for="renderErrors"><input type="checkbox" id="renderErrors" onclick="GCODE.ui.processOptions()">Render error analysis results</label>
</div>
</div>
</div>
</div>
</div>
<output id="errorList"></output>
</div>
<div id="gcode">
<div id="tabs-min" class="tabbable">
<div class="tab-content">
<div class="tab-pane" id="tab2d">
<div class="toolbar toolbar-right" id="layer-info" style="display: none;">
<div class="panel panel-default">
<div class="panel-heading">
Layer info
<span class="label label-primary">
<span class="curLayer">0</span> / <span class="maxLayer"></span>
</span>
</div>
<div class="panel-body">
<ul class="metrics"></ul>
<strong>Extrude speeds:</strong>
<div class="extrudeSpeeds"></div>
<strong>Move speeds:</strong>
<div class="moveSpeeds"></div>
<strong>Retract speeds:</strong>
<div class="retractSpeeds"></div>
</div>
</div>
</div>
<div class="scrollbar">
<div class="scrollbar-group">
<span class="scrollbar-plus"><i class="fa fa-arrow-up"></i></span>
<div class="scrollbar-control">
<input id="layer-scrollbar" value="" data-slider-id='layer-scrollbar' type="text" />
</div>
<span class="scrollbar-minus"><i class="fa fa-arrow-down"></i></span>
</div>
</div>
<canvas id="canvas"></canvas>
</div>
<div class="tab-pane" id="tab3d">
<div id="3d_container"></div>
</div>
<div class="tab-pane" id="tabGCode">
<div id="gCodeContainer"></div>
</div>
<div class="tab-pane active" id="tabAbout">
<div class="container">
<h1 class="logo"><img src="img/logo.png" alt="GCode Viewer" /></h1>
<b>gCodeViewer</b> is a visual GCode visualizer, viewer and analyzer in your own browser! It works on any OS in almost any modern browser (chrome, ff, safari 6, opera, ie10 should work too). All you need to do - is drag your *.gcode file to the designated zone.<br /><br />
Current features include:<br />
<ul>
<li>Visualize GCode in 2D, layer by layer
<ul>
<li>Show retracts and restarts</li>
<li>Show print/move/retract speeds</li>
<li>Display only part of layer, animate sequence of layer printing</li>
<li>Show two layers simultaneously so you can check overhangs</li>
<li>Adjust line width to simulate print more closely</li>
<li><b>Gcode viewer will try to parse nozzle and filament diameters from gcode, but it may fail to do so. In that case you will need to set it manually in 'Printer Info' tab</b></li>
</ul>
</li>
<li>Analyze GCode
<ul>
<li>Print time, amount of plastic used, layer height, etc. for whole file and for single layer</li>
<li>Reference visualized part to GCode file (i.e. select a certain part of 2d visualization, switch to GCode view - it will highlight list of lines responsible for visualized piece)</li>
</ul>
</li>
<li>Multiplatform, available online (but works offline too), works locally (doesn't upload you g-code anywhere or download anything but application itself)</li>
<li>3D visualization (I don't know what for, it's dull and useless.. need to rewrite it from scratch)</li>
<li>And yeah, it's slow, memory hungry and only supports modern browsers</li>
<li>Totally open source so you can use it as you like</li>
</ul>
<br /><br />
All sources are available at <a href="https://github.com/hudbrog/gCodeViewer">https://github.com/hudbrog/gCodeViewer</a><br />
If you find any bugs or have feature requests - don't hesitate to post them to <a href="https://github.com/hudbrog/gCodeViewer/issues">https://github.com/hudbrog/gCodeViewer/issues</a><br />
And I would appreciate if you like it on Thingiverse page: <a href="http://www.thingiverse.com/thing:35248">http://www.thingiverse.com/thing:35248</a><br />
</div>
</div>
</div>
</div>
</div>
</div>
<div id="status">
<div class="container-fluid">
<ul class="metrics" id="metrics-list"></ul>
</div>
</div>
<div class="modal fade" id="preferences-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-cog"></i> Preferences</h4>
</div>
<div class="modal-body">
<div class="panel panel-primary">
<div class="panel-heading">Printer Info</div>
<div class="panel-body">
<form role="form" class="form-horizontal">
<div class="form-group">
<label for="filamentDia" class="col-sm-3 control-label">Plastic diameter:</label>
<div class="col-sm-9">
<input type="text" value="1.75" id="filamentDia" onchange="GCODE.ui.processOptions()" class="form-control" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Plastic type:</label>
<div class="col-sm-9">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="radPlastic" id="plasticABS" value="ABS" onclick="GCODE.ui.processOptions()" checked> ABS
</label>
<label class="btn btn-default">
<input type="radio" name="radPlastic" id="plasticPLA" value="PLA" onclick="GCODE.ui.processOptions()"> PLA
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="nozzleDia" class="col-sm-3 control-label">Nozzle size:</label>
<div class="col-sm-9">
<input type="text" value="0.4" id="nozzleDia" onchange="GCODE.ui.processOptions()" class="form-control" />
</div>
</div>
</form>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">2D Render options</div>
<div class="panel-body">
<form role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">Speed display type: </label>
<div class="col-sm-9">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default active">
<input type="radio" name="speedDisplay" id="speedDisplayRadio" value="1" onclick="GCODE.ui.processOptions()" checked> mm/sec
</label>
<label class="btn btn-default">
<input type="radio" name="speedDisplay" id="exPerMMRadio" value="1" onclick="GCODE.ui.processOptions()" > mm extrusion per mm move
</label>
<label class="btn btn-default">
<input type="radio" name="speedDisplay" id="volPerSecRadio" value="1" onclick="GCODE.ui.processOptions()" > mm^3/sec
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">What to display:</label>
<div class="col-sm-9">
<div class="checkbox">
<label for="showMovesCheckbox">
<input type="checkbox" id="showMovesCheckbox" value="1" onclick="GCODE.ui.processOptions()" checked>
Show non-extrusion moves
</label>
</div>
<div class="checkbox">
<label for="showRetractsCheckbox">
<input type="checkbox" id="showRetractsCheckbox" value="2" onclick="GCODE.ui.processOptions()" checked>
Show retracts and restarts
</label>
</div>
<div class="checkbox">
<label for="differentiateColorsCheckbox">
<input type="checkbox" id="differentiateColorsCheckbox" value="7" onclick="GCODE.ui.processOptions()" checked>
Show different speeds with different colors
</label>
</div>
<div class="checkbox">
<label for="showNextLayer">
<input type="checkbox" id="showNextLayer" value="9" onclick="GCODE.ui.processOptions()" >
Show +1 layer
</label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">Adjust display:</label>
<div class="col-sm-9">
<div class="checkbox">
<label for="moveModelCheckbox">
<input type="checkbox" id="moveModelCheckbox" value="3" onclick="GCODE.ui.processOptions()" checked>
Move model to the center of the grid
</label>
</div>
<div class="checkbox">
<label for="thickExtrusionCheckbox">
<input type="checkbox" id="thickExtrusionCheckbox" value="8" onclick="GCODE.ui.processOptions()">
Emulate extrusion width
</label>
</div>
<div class="checkbox">
<label for="alphaCheckbox">
<input type="checkbox" id="alphaCheckbox" value="10" onclick="GCODE.ui.processOptions()" >
Render lines slightly transparent
</label>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">GCode analyzer options</div>
<div class="panel-body">
<div class="alert alert-warning">
<strong><i class="fa fa-warning"></i> Attention:</strong>
Changing these settings requires re-analyzing your GCode file.
</div>
<form role="form" class="form-horizontal">
<div class="form-group">
<label class="col-sm-3 control-label">Enhanced options:</label>
<div class="col-sm-9">
<div class="checkbox">
<label for="sortLayersCheckbox">
<input type="checkbox" id="sortLayersCheckbox" value="4" onclick="GCODE.ui.processOptions()" checked>
Sort layers by Z
</label>
</div>
<div class="checkbox">
<label for="purgeEmptyLayersCheckbox">
<input type="checkbox" id="purgeEmptyLayersCheckbox" value="5" onclick="GCODE.ui.processOptions()" checked>
Hide empty layers
</label>
</div>
<div class="checkbox">
<label for="showGCodeCheckbox">
<input type="checkbox" id="showGCodeCheckbox" value="6" onclick="GCODE.ui.processOptions()" checked>
Show GCode in GCode tab (memory intensive!)
</label>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div id="analysisModal" class="modal hide fade">
<div class="modal-header">
<h3>Running analysis....</h3>
</div>
<div class="modal-body">
<div class="progress" >
<div id="analysisProgress" class="bar" style="width: 0;"></div>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn disabled">Please wait for process to get finished</a>
</div>
</div>
<div id="mobile-notification" class="visible-xs visible-sm visible-md">
<div class="modal show">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title">GCode Viewer</h1>
</div>
<div class="modal-body">
<i class="fa fa-desktop"></i>
<p>We are very sorry, but to use the GCode Viewer your screen has to have a higher resolution.</p>
<div class="alert alert-info"><i class="fa fa-info-circle"></i> Try browsing this site with your desktop computer.</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function() {
GCODE.ui.initHandlers();
})
</script>
</body>
</html>