Add stl download for OpenSCAD and CadQuery IDEs

Resolves #330.
This commit is contained in:
Kurt Hutten
2021-05-29 21:06:33 +10:00
parent 32fa22efcd
commit bd58e6c7cb
12 changed files with 311 additions and 168 deletions

View File

@@ -35,14 +35,15 @@ module.exports.runScad = async ({
module.exports.stlExport = async ({ file } = {}) => {
const tempFile = await makeFile(file, '.scad', nanoid)
const fullPath = `/tmp/${tempFile}/output.stl`
try {
const result = await runCommand(
`openscad -o /tmp/${tempFile}/output.stl /tmp/${tempFile}/main.scad`,
300000 // lambda will time out before this, we might need to look at background jobs if we do git integration stl generation
const consoleMessage = await runCommand(
`xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" openscad -o ${fullPath} /tmp/${tempFile}/main.scad`,
60000 // lambda will time out before this, we might need to look at background jobs if we do git integration stl generation
)
return { result, tempFile }
return { consoleMessage, fullPath }
} catch (error) {
return { error, tempFile }
return { error, fullPath }
}
}