Files: 485abbed38bbfd00fab0954f74231a8d4085db0d / index.js
738 bytesRaw
1 | var csg = require('@jscad/csg') |
2 | var path = require('path') |
3 | var container = document.createElement('div') |
4 | function resize () { |
5 | container.style.height = (window.innerHeight - 4)+'px' |
6 | container.style.width = (window.innerWidth - 4)+'px' |
7 | } |
8 | document.body.style.margin = '0px' |
9 | |
10 | CSG = csg.CSG |
11 | CAG = csg.CAG |
12 | |
13 | window.onresize = resize |
14 | resize() |
15 | |
16 | document.body.appendChild(container) |
17 | |
18 | var opts = require('minimist')(process.argv.slice(2)) |
19 | |
20 | var v = new (require('jscad-viewer'))(container, opts) |
21 | |
22 | var model = require(path.resolve(process.cwd(), process.argv[2]))(csg) |
23 | V = v |
24 | v.setCsg(model) |
25 | |
26 | //var base64 = v.canvas.toDataURL('image/png') |
27 | //require('fs').writeFileSync('output.png', new Buffer(base64.substring(base64.indexOf(',')+1), 'base64')) |
28 | |
29 |
Built with git-ssb-web