WIP: Fix setUpDraftSegment to work without a variable

This isn't finished.  It needs to look up the SketchGroup coordinates
without a variable.
This commit is contained in:
Jonathan Tran
2024-08-07 16:59:40 -04:00
parent 1a569af476
commit 3b7bbc1642

View File

@ -607,11 +607,13 @@ export class SceneEntities {
const _node1 = getNodeFromPath<VariableDeclaration>(
_ast,
sketchPathToNode || [],
'VariableDeclaration'
)
['VariableDeclaration', 'ExpressionStatement']
) as { node: { type: string } } | Error
if (trap(_node1)) return Promise.reject(_node1)
const variableDeclarationName =
_node1.node?.declarations?.[0]?.id?.name || ''
_node1.node.type === 'VariableDeclaration'
? (_node1.node as VariableDeclaration).declarations[0]?.id?.name || ''
: ''
const sg = sketchGroupFromKclValue(
kclManager.programMemory.get(variableDeclarationName),