Rough changes to make the CadQuery integration work with the customizer
This commit is contained in:
@@ -2,7 +2,7 @@ FROM public.ecr.aws/lts/ubuntu:20.04_stable
|
|||||||
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
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 -y -qq install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates xvfb
|
||||||
RUN apt-get update -qq
|
RUN apt-get update -qq
|
||||||
RUN apt-get install -y wget
|
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
|
# Get the distribution copy of cq-cli
|
||||||
RUN apt-get install -y libglew2.1
|
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
|
# 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
|
# More cutting edge release
|
||||||
# RUN wget https://github.com/CadQuery/cq-cli/releases/download/v2.1.0/cq-cli-Linux-x86_64.zip
|
RUN wget http://7bindustries.com/static/downloads/cq-cli-Linux-x86_64.zip
|
||||||
RUN unzip cq-cli-Linux-x86_64.zip
|
RUN unzip cq-cli-Linux-x86_64.zip
|
||||||
|
|
||||||
RUN chmod +x cq-cli/cq-cli
|
RUN chmod +x cq-cli/cq-cli
|
||||||
|
|||||||
@@ -11,21 +11,34 @@ export const runCQ = async ({
|
|||||||
)
|
)
|
||||||
const fullPath = `/tmp/${tempFile}/output.gz`
|
const fullPath = `/tmp/${tempFile}/output.gz`
|
||||||
const stlPath = `/tmp/${tempFile}/output.stl`
|
const stlPath = `/tmp/${tempFile}/output.stl`
|
||||||
|
const customizerPath = `/tmp/${tempFile}/customizer.param`
|
||||||
const command = [
|
const command = [
|
||||||
`cq-cli/cq-cli`,
|
`cq-cli/cq-cli`,
|
||||||
`--codec stl`,
|
`--codec stl`,
|
||||||
`--infile /tmp/${tempFile}/main.py`,
|
`--infile /tmp/${tempFile}/main.py`,
|
||||||
`--outfile ${stlPath}`,
|
`--outfile ${stlPath}`,
|
||||||
`--outputopts "deflection:${deflection};angularDeflection:${deflection};"`,
|
`--outputopts "deflection:${deflection};angularDeflection:${deflection};"`,
|
||||||
|
`--params ${customizerPath}`,
|
||||||
].join(' ')
|
].join(' ')
|
||||||
|
const command2 = [
|
||||||
|
`cq-cli/cq-cli`,
|
||||||
|
`--getparams true`,
|
||||||
|
`--infile /tmp/${tempFile}/main.py`,
|
||||||
|
`--outfile ${customizerPath}`,
|
||||||
|
]
|
||||||
console.log('command', command)
|
console.log('command', command)
|
||||||
let consoleMessage = ''
|
let consoleMessage = ''
|
||||||
try {
|
try {
|
||||||
consoleMessage = await runCommand(command, 30000)
|
consoleMessage = await runCommand(command, 30000)
|
||||||
|
consoleMessage2 = await runCommand(command2, 30000)
|
||||||
|
const params = JSON.parse(
|
||||||
|
await readFile(customizerPath, { encoding: 'ascii'})
|
||||||
|
).parameters
|
||||||
await writeFiles(
|
await writeFiles(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
file: JSON.stringify({
|
file: JSON.stringify({
|
||||||
|
customizerParams: params,
|
||||||
consoleMessage,
|
consoleMessage,
|
||||||
type: 'stl',
|
type: 'stl',
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FROM public.ecr.aws/lts/ubuntu:20.04_stable
|
|||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
## install things needed to run openscad (xvfb is an important one)
|
## 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
|
# 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 -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
|
RUN apt-get install -y curl wget
|
||||||
|
|||||||
@@ -43,12 +43,13 @@ export const render: DefaultKernelExport['render'] = async ({
|
|||||||
}
|
}
|
||||||
const blob = await response.blob()
|
const blob = await response.blob()
|
||||||
const text = await new Response(blob).text()
|
const text = await new Response(blob).text()
|
||||||
const { consoleMessage } = splitGziped(text)
|
const { consoleMessage, customizerParams, type } = splitGziped(text)
|
||||||
return createHealthyResponse({
|
return createHealthyResponse({
|
||||||
type: 'geometry',
|
type: 'geometry',
|
||||||
data: await stlToGeometry(window.URL.createObjectURL(blob)),
|
data: await stlToGeometry(window.URL.createObjectURL(blob)),
|
||||||
consoleMessage,
|
consoleMessage,
|
||||||
date: new Date(),
|
date: new Date(),
|
||||||
|
customizerParams: customizerParams,
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return createUnhealthyResponse(new Date())
|
return createUnhealthyResponse(new Date())
|
||||||
|
|||||||
Reference in New Issue
Block a user