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