diff --git a/app/api/src/docker/cadquery/Dockerfile b/app/api/src/docker/cadquery/Dockerfile index 0589092..de41ca7 100644 --- a/app/api/src/docker/cadquery/Dockerfile +++ b/app/api/src/docker/cadquery/Dockerfile @@ -2,7 +2,7 @@ FROM public.ecr.aws/lts/ubuntu:20.04_stable ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get update -qq +RUN apt-get update --fix-missing -qq RUN apt-get -y -qq install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates xvfb RUN apt-get update -qq RUN apt-get install -y wget @@ -38,9 +38,9 @@ RUN npm install aws-lambda-ric@1.0.0 # Get the distribution copy of cq-cli RUN apt-get install -y libglew2.1 -RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.2-beta.2/cq-cli-Linux-x86_64.zip -# Comment the entry above out and uncomment the one below to revert to the stable release -# RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.1.0/cq-cli-Linux-x86_64.zip +# RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.2-beta.2/cq-cli-Linux-x86_64.zip +# More cutting edge release +RUN wget http://7bindustries.com/static/downloads/cq-cli-Linux-x86_64.zip RUN unzip cq-cli-Linux-x86_64.zip RUN chmod +x cq-cli/cq-cli diff --git a/app/api/src/docker/cadquery/runCQ.ts b/app/api/src/docker/cadquery/runCQ.ts index afcb916..0d3e16b 100644 --- a/app/api/src/docker/cadquery/runCQ.ts +++ b/app/api/src/docker/cadquery/runCQ.ts @@ -11,21 +11,34 @@ export const runCQ = async ({ ) const fullPath = `/tmp/${tempFile}/output.gz` const stlPath = `/tmp/${tempFile}/output.stl` + const customizerPath = `/tmp/${tempFile}/customizer.param` const command = [ `cq-cli/cq-cli`, `--codec stl`, `--infile /tmp/${tempFile}/main.py`, `--outfile ${stlPath}`, `--outputopts "deflection:${deflection};angularDeflection:${deflection};"`, + `--params ${customizerPath}`, ].join(' ') + const command2 = [ + `cq-cli/cq-cli`, + `--getparams true`, + `--infile /tmp/${tempFile}/main.py`, + `--outfile ${customizerPath}`, + ] console.log('command', command) let consoleMessage = '' try { consoleMessage = await runCommand(command, 30000) + consoleMessage2 = await runCommand(command2, 30000) + const params = JSON.parse( + await readFile(customizerPath, { encoding: 'ascii'}) + ).parameters await writeFiles( [ { file: JSON.stringify({ + customizerParams: params, consoleMessage, type: 'stl', }), diff --git a/app/api/src/docker/openscad/Dockerfile b/app/api/src/docker/openscad/Dockerfile index 001730d..d17153a 100644 --- a/app/api/src/docker/openscad/Dockerfile +++ b/app/api/src/docker/openscad/Dockerfile @@ -3,7 +3,7 @@ FROM public.ecr.aws/lts/ubuntu:20.04_stable ARG DEBIAN_FRONTEND=noninteractive ## install things needed to run openscad (xvfb is an important one) -RUN apt-get update -qq +RUN apt-get update --fix-missing -qq # double check this below, I'm not sure we need inkscape etc RUN apt-get -y -qq install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates xvfb imagemagick unzip inkscape RUN apt-get install -y curl wget diff --git a/app/web/src/helpers/cadPackages/cadQueryController.ts b/app/web/src/helpers/cadPackages/cadQueryController.ts index 5f77b93..d9f30e2 100644 --- a/app/web/src/helpers/cadPackages/cadQueryController.ts +++ b/app/web/src/helpers/cadPackages/cadQueryController.ts @@ -43,12 +43,13 @@ export const render: DefaultKernelExport['render'] = async ({ } const blob = await response.blob() const text = await new Response(blob).text() - const { consoleMessage } = splitGziped(text) + const { consoleMessage, customizerParams, type } = splitGziped(text) return createHealthyResponse({ type: 'geometry', data: await stlToGeometry(window.URL.createObjectURL(blob)), consoleMessage, date: new Date(), + customizerParams: customizerParams, }) } catch (e) { return createUnhealthyResponse(new Date())