Add STL renderer
This commit is contained in:
parent
1a6f2a9caa
commit
00380ac602
5 changed files with 36 additions and 6 deletions
|
|
@ -93,9 +93,12 @@ def upload_svg():
|
|||
flash(f'Error uploading SVG file: {"; ".join(msg for elem in upload_form.errors.values() for msg in elem)}', 'error')
|
||||
return redirect(url_for('jigerator'))
|
||||
|
||||
@app.route('/render/download')
|
||||
def render_download():
|
||||
return send_file(tempfile_path(f'renders.zip'),
|
||||
@app.route('/render/download/<file>')
|
||||
def render_download(file):
|
||||
if file not in ['jig.stl', 'pcb_shape.dxf', 'kicad.zip', 'sources.zip']:
|
||||
abort(404)
|
||||
|
||||
return send_file(tempfile_path(file),
|
||||
mimetype='application/zip',
|
||||
as_attachment=True,
|
||||
attachment_filename=f'{path.splitext(session["filename"])[0]}_pogojig.zip')
|
||||
|
|
|
|||
1
webapp/static/Madeleine.js
Submodule
1
webapp/static/Madeleine.js
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 9e39e65b7257bc1139502a14970cc174ca594750
|
||||
|
|
@ -227,3 +227,11 @@ a.btn:active, a.btn:hover, a.btn:visited, a.btn:link {
|
|||
background-color: #d35f5f;
|
||||
box-shadow: 1px 2px 4px 1px #000;
|
||||
}
|
||||
|
||||
.controls {
|
||||
padding-top: 8em;
|
||||
}
|
||||
|
||||
.render_output {
|
||||
padding-bottom: 8em;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,9 +116,9 @@
|
|||
</div>
|
||||
{% else %}
|
||||
<div class="preview-images">
|
||||
<a href="{{url_for('render_download')}}" class="render" style="background-image:url('{{url_for('render_preview')}}');">
|
||||
<div class="overlay">Download model and PCB</div>
|
||||
</a>
|
||||
<a href="{{url_for('render_download', file='sources.zip')}}" class="render">Download renders</a>
|
||||
|
||||
<div id="stl-target" class="madeleine"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
@ -132,5 +132,20 @@
|
|||
<div class="copyright">© 2019 jaseg</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- STL viewer -->
|
||||
<link href="static/Madeleine.js/src/css/Madeleine.css" rel="stylesheet">
|
||||
<script src="static/Madeleine.js/src/lib/stats.js"></script>
|
||||
<script src="static/Madeleine.js/src/lib/detector.js"></script>
|
||||
<script src="static/Madeleine.js/src/lib/three.min.js"></script>
|
||||
<script src="static/Madeleine.js/src/Madeleine.js"></script>
|
||||
<script>
|
||||
window.onload = function(){
|
||||
var madeleine = new Madeleine({
|
||||
target: 'target', // target div id
|
||||
data: '{{url_for('render_download', file='jig.stl')}}', // data path
|
||||
path: '.' // path to source directory from current html file
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue