WIP: first time working shell mod

This commit is contained in:
Pierre Jacquier
2024-12-04 18:41:45 -05:00
parent f407c53032
commit 4dde3f60e0
2 changed files with 26 additions and 15 deletions

View File

@ -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)

View File

@ -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)
}
}
),