Final tweaks for deploy
virtual screen size does matter,and curv is a little more memory hungry than the other functions
This commit is contained in:
@@ -126,6 +126,7 @@ export async function storeAssetAndReturnUrl({
|
||||
|
||||
try {
|
||||
buffer = await readFile(fullPath, { encoding: 'base64' })
|
||||
await runCommand(`rm -R /tmp/${tempFile}`)
|
||||
} catch (e) {
|
||||
console.log('read file error', e)
|
||||
const response = {
|
||||
|
||||
@@ -32,7 +32,7 @@ export const runCurv = async ({
|
||||
const customizerPath = `/tmp/${tempFile}/customizer.param`
|
||||
|
||||
const command = [
|
||||
'xvfb-run --auto-servernum --server-args "-screen 0 1024x768x24" curv',
|
||||
'xvfb-run --auto-servernum --server-args "-screen 0 3840x2160x24" curv',
|
||||
`-o ${imPath}`,
|
||||
`-O xsize=${x}`,
|
||||
`-O ysize=${y}`,
|
||||
|
||||
@@ -117,6 +117,7 @@ functions:
|
||||
method: post
|
||||
cors: true
|
||||
timeout: 25
|
||||
memorySize: 3008
|
||||
curvstl:
|
||||
image:
|
||||
name: curvimage
|
||||
|
||||
@@ -230,7 +230,7 @@ export function PureIdeViewer({
|
||||
<Controls
|
||||
onDragStart={() => setIsDragging(true)}
|
||||
onInit={onInit}
|
||||
onCameraChange={() => {onCameraChange(); setIsDragging(false)}}
|
||||
onCameraChange={(...args) => {onCameraChange(...args); setIsDragging(false)}}
|
||||
controlsRef={controlsRef}
|
||||
camera={camera}
|
||||
/>
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Camera } from 'src/helpers/hooks/useIdeState'
|
||||
|
||||
export const lambdaBaseURL =
|
||||
process.env.CAD_LAMBDA_BASE_URL ||
|
||||
'https://oxt2p7ddgj.execute-api.us-east-1.amazonaws.com/prod'
|
||||
'https://2inlbple1b.execute-api.us-east-1.amazonaws.com/prod2'
|
||||
|
||||
export const stlToGeometry = (url) =>
|
||||
new Promise((resolve, reject) => {
|
||||
|
||||
@@ -1,90 +0,0 @@
|
||||
import { CadhubParams } from 'src/components/Customizer/customizerConverter'
|
||||
|
||||
interface CurvParamsBase {
|
||||
caption: string
|
||||
name: string
|
||||
group: string
|
||||
initial: number | string | number[]
|
||||
type: 'string' | 'number'
|
||||
}
|
||||
|
||||
interface CurvNumberParam extends CurvParamsBase {
|
||||
type: 'number'
|
||||
initial: number | number[]
|
||||
max?: number
|
||||
min?: number
|
||||
step?: number
|
||||
options?: { name: string; value: number }[]
|
||||
}
|
||||
interface CurvStringParam extends CurvParamsBase {
|
||||
type: 'string'
|
||||
initial: string
|
||||
maxLength?: number
|
||||
options?: { name: string; value: string }[]
|
||||
}
|
||||
|
||||
export type CurvParams =
|
||||
| CurvNumberParam
|
||||
| CurvStringParam
|
||||
|
||||
export function openScadToCadhubParams(
|
||||
input: CurvParams[]
|
||||
): CadhubParams[] {
|
||||
return input
|
||||
.map((param): CadhubParams => {
|
||||
const common: { caption: string; name: string } = {
|
||||
caption: param.caption,
|
||||
name: param.name,
|
||||
}
|
||||
switch (param.type) {
|
||||
case 'string':
|
||||
if (!Array.isArray(param?.options)) {
|
||||
return {
|
||||
type: 'string',
|
||||
input: 'default-string',
|
||||
...common,
|
||||
initial: param.initial,
|
||||
maxLength: param.maxLength,
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
type: 'string',
|
||||
input: 'choice-string',
|
||||
...common,
|
||||
initial: param.initial,
|
||||
options: param.options,
|
||||
}
|
||||
}
|
||||
case 'number':
|
||||
if (
|
||||
!Array.isArray(param?.options) &&
|
||||
!Array.isArray(param?.initial)
|
||||
) {
|
||||
return {
|
||||
type: 'number',
|
||||
input: 'default-number',
|
||||
...common,
|
||||
initial: param.initial,
|
||||
min: param.min,
|
||||
max: param.max,
|
||||
step: param.step,
|
||||
}
|
||||
} else if (
|
||||
Array.isArray(param?.options) &&
|
||||
!Array.isArray(param?.initial)
|
||||
) {
|
||||
return {
|
||||
type: 'number',
|
||||
input: 'choice-number',
|
||||
...common,
|
||||
initial: param.initial,
|
||||
options: param.options,
|
||||
}
|
||||
} // TODO else vector
|
||||
break
|
||||
default:
|
||||
return
|
||||
}
|
||||
})
|
||||
.filter((a) => a)
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
// sphere box
|
||||
|
||||
(smooth 1).union [
|
||||
box,
|
||||
sphere
|
||||
]
|
||||
let
|
||||
N = 5;
|
||||
C = red;
|
||||
Twists = 6;
|
||||
in
|
||||
box [1,1,N]
|
||||
>> colour C
|
||||
>> twist (Twists*90*deg/N)
|
||||
>> rotate {angle: 90*deg, axis: Y_axis}
|
||||
>> bend{}
|
||||
|
||||
Reference in New Issue
Block a user