fix failing tests from chalmers pr (#3619)
* fix failing tests from chalmers pr Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix memory pane Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -90,12 +90,12 @@ export const processMemory = (programMemory: ProgramMemory) => {
|
|||||||
for (const [key, val] of programMemory?.visibleEntries()) {
|
for (const [key, val] of programMemory?.visibleEntries()) {
|
||||||
if (typeof val.value !== 'function') {
|
if (typeof val.value !== 'function') {
|
||||||
const sg = sketchGroupFromKclValue(val, null)
|
const sg = sketchGroupFromKclValue(val, null)
|
||||||
if (!err(sg)) {
|
if (val.type === 'ExtrudeGroup') {
|
||||||
processedMemory[key] = sg.value.map(({ __geoMeta, ...rest }: Path) => {
|
processedMemory[key] = val.value.map(({ ...rest }: ExtrudeSurface) => {
|
||||||
return rest
|
return rest
|
||||||
})
|
})
|
||||||
} else if (val.type === 'ExtrudeGroup') {
|
} else if (!err(sg)) {
|
||||||
processedMemory[key] = val.value.map(({ ...rest }: ExtrudeSurface) => {
|
processedMemory[key] = sg.value.map(({ __geoMeta, ...rest }: Path) => {
|
||||||
return rest
|
return rest
|
||||||
})
|
})
|
||||||
} else if ((val.type as any) === 'Function') {
|
} else if ((val.type as any) === 'Function') {
|
||||||
|
@ -338,13 +338,16 @@ export function sketchGroupFromKclValue(
|
|||||||
varName: string | null
|
varName: string | null
|
||||||
): SketchGroup | Error {
|
): SketchGroup | Error {
|
||||||
if (obj?.value?.type === 'SketchGroup') return obj.value
|
if (obj?.value?.type === 'SketchGroup') return obj.value
|
||||||
|
if (obj?.value?.type === 'ExtrudeGroup') return obj.value.sketchGroup
|
||||||
|
if (obj?.type === 'ExtrudeGroup') return obj.sketchGroup
|
||||||
if (!varName) {
|
if (!varName) {
|
||||||
varName = 'a KCL value'
|
varName = 'a KCL value'
|
||||||
}
|
}
|
||||||
const actualType = obj?.value?.type ?? obj?.type
|
const actualType = obj?.value?.type ?? obj?.type
|
||||||
if (actualType) {
|
if (actualType) {
|
||||||
|
console.log(obj)
|
||||||
return new Error(
|
return new Error(
|
||||||
`Expected ${varName} to be a sketchGroup, but it was ${actualType} instead.`
|
`Expected ${varName} to be a sketchGroup or extrudeGroup, but it was ${actualType} instead.`
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
return new Error(`Expected ${varName} to be a sketchGroup, but it wasn't.`)
|
return new Error(`Expected ${varName} to be a sketchGroup, but it wasn't.`)
|
||||||
|
Reference in New Issue
Block a user