Fix OpenSCAD move sync

Hard to capture in a title. when you move the object with right-click drag, that axis move away from the shape.

resolves #241
This commit is contained in:
Kurt Hutten
2021-03-13 16:45:56 +11:00
parent ba45e3ea57
commit 1de49b66dc
3 changed files with 79 additions and 53 deletions

View File

@@ -10,13 +10,14 @@ module.exports.runScad = async ({
camera: {
position = { x: 40, y: 40, z: 40 },
rotation = { x: 55, y: 0, z: 25 },
dist = 200,
} = {},
} = {}, // TODO add view settings
} = {}) => {
const tempFile = await makeFile(file)
const { x: rx, y: ry, z: rz } = rotation
const { x: px, y: py, z: pz } = position
const cameraArg = `--camera=${px},${py},${pz},${rx},${ry},${rz},300`
const cameraArg = `--camera=${px},${py},${pz},${rx},${ry},${rz},${dist}`
const command = `xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" openscad -o /tmp/${tempFile}/output.png ${cameraArg} --imgsize=${x},${y} --colorscheme DeepOcean /tmp/${tempFile}/main.scad`
console.log('command', command)