mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2025-12-12 16:10:04 +01:00
20 lines
No EOL
516 B
JavaScript
20 lines
No EOL
516 B
JavaScript
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.writeJSONSync(`${file}.json`, assembly, {spaces: 4})
|
|
}
|
|
} |