Initial work to support curv #578

Merged
lf94 merged 11 commits from integration-curv into main 2021-11-30 05:24:24 +01:00
Showing only changes of commit 9797405834 - Show all commits

View File

@@ -4,14 +4,8 @@ import { nanoid } from 'nanoid'
export const runCurv = async ({ export const runCurv = async ({
file, file,
settings: { settings: {
viewAll = false,
size: { x = 500, y = 500 } = {}, size: { x = 500, y = 500 } = {},
parameters, parameters,
camera: {
position = { x: 40, y: 40, z: 40 },
rotation = { x: 55, y: 0, z: 25 },
dist = 200,
} = {},
} = {}, // TODO add view settings } = {}, // TODO add view settings
} = {}): Promise<{ } = {}): Promise<{
error?: string error?: string
@@ -33,9 +27,6 @@ export const runCurv = async ({
], ],
'a' + nanoid() // 'a' ensure nothing funny happens if it start with a bad character like "-", maybe I should pick a safer id generator :shrug: 'a' + nanoid() // 'a' ensure nothing funny happens if it start with a bad character like "-", maybe I should pick a safer id generator :shrug:
) )
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},${dist}`
const fullPath = `/tmp/${tempFile}/output.gz` const fullPath = `/tmp/${tempFile}/output.gz`
const imPath = `/tmp/${tempFile}/output.png` const imPath = `/tmp/${tempFile}/output.png`
const customizerPath = `/tmp/${tempFile}/customizer.param` const customizerPath = `/tmp/${tempFile}/customizer.param`
@@ -94,7 +85,7 @@ export const stlExport = async ({ file, settings: { parameters } } = {}) => {
'(cd /tmp && curv', '(cd /tmp && curv',
'-o', stlPath, '-o', stlPath,
'-O jit', '-O jit',
'-O vsize=0.6', '-O vcount=350000',
`/tmp/${tempFile}/main.curv`, `/tmp/${tempFile}/main.curv`,
')', ')',
].join(' ') ].join(' ')