mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2026-02-02 09:25:09 +01:00
CLI and output restructure, SVG/DXF/STL integration
This commit is contained in:
parent
c49881c2b4
commit
42a3e2de55
7 changed files with 730 additions and 154 deletions
21
src/io.js
21
src/io.js
|
|
@ -1,21 +0,0 @@
|
|||
const m = require('makerjs')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
|
||||
const u = require('./utils')
|
||||
|
||||
exports.dump_model = (model, file='model', debug=false) => {
|
||||
const assembly = m.model.originate({
|
||||
models: {
|
||||
export: u.deepcopy(model)
|
||||
},
|
||||
units: 'mm'
|
||||
})
|
||||
|
||||
fs.mkdirpSync(path.dirname(`${file}.dxf`))
|
||||
fs.writeFileSync(`${file}.dxf`, m.exporter.toDXF(assembly))
|
||||
if (debug) {
|
||||
fs.writeFileSync(`${file}.svg`, m.exporter.toSVG(assembly))
|
||||
fs.writeJSONSync(`${file}.json`, assembly, {spaces: 4})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue