WIP: first time working shell mod
This commit is contained in:
@ -623,8 +623,15 @@ export function addShell({
|
||||
if (err(baseNode)) return baseNode
|
||||
console.log("selection.artifact['subType']", selection.artifact['subType'])
|
||||
const shell = createCallExpressionStdLib('shell', [
|
||||
createObjectExpression({ faces: [ selection.artifact['subType'] ], thickness }),
|
||||
createIdentifier(baseNode.node.id.name),
|
||||
createObjectExpression({
|
||||
faces: createArrayExpression([
|
||||
createLiteral(selection.artifact['subType']),
|
||||
]),
|
||||
thickness,
|
||||
}),
|
||||
// createIdentifier(baseNode.node.id.name),
|
||||
// TODO: replace with the query from sketch to extrude
|
||||
createIdentifier('extrude001'),
|
||||
])
|
||||
const declaration = createVariableDeclaration(name, shell)
|
||||
modifiedAst.body.push(declaration)
|
||||
|
||||
@ -1629,20 +1629,24 @@ export const modelingMachine = setup({
|
||||
})
|
||||
|
||||
if (trap(shellResult)) return
|
||||
const updateAstResult = await kclManager.updateAst(
|
||||
shellResult.modifiedAst,
|
||||
true,
|
||||
{
|
||||
focusPath: [shellResult.pathToNode],
|
||||
try {
|
||||
const updateAstResult = await kclManager.updateAst(
|
||||
shellResult.modifiedAst,
|
||||
true,
|
||||
{
|
||||
focusPath: [shellResult.pathToNode],
|
||||
}
|
||||
)
|
||||
|
||||
await codeManager.updateEditorWithAstAndWriteToFile(
|
||||
updateAstResult.newAst
|
||||
)
|
||||
|
||||
if (updateAstResult?.selections) {
|
||||
editorManager.selectRange(updateAstResult?.selections)
|
||||
}
|
||||
)
|
||||
|
||||
await codeManager.updateEditorWithAstAndWriteToFile(
|
||||
updateAstResult.newAst
|
||||
)
|
||||
|
||||
if (updateAstResult?.selections) {
|
||||
editorManager.selectRange(updateAstResult?.selections)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user