mirror of
https://github.com/TECHNOFAB11/ergogen.git
synced 2025-12-13 08:30:05 +01:00
14 lines
422 B
JavaScript
14 lines
422 B
JavaScript
|
|
const m = require('makerjs')
|
||
|
|
const fs = require('fs-extra')
|
||
|
|
|
||
|
|
exports.deepcopy = (value) => JSON.parse(JSON.stringify(value))
|
||
|
|
|
||
|
|
exports.dump_model = (model, file='model', json=false) => {
|
||
|
|
const assembly = m.model.originate({
|
||
|
|
model,
|
||
|
|
units: 'mm'
|
||
|
|
})
|
||
|
|
|
||
|
|
fs.writeFileSync(`${file}.dxf`, m.exporter.toDXF(assembly))
|
||
|
|
if (json) fs.writeFileSync(`${file}.json`, JSON.stringify(assembly, null, ' '))
|
||
|
|
}
|