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

View File

@ -1629,6 +1629,7 @@ export const modelingMachine = setup({
}) })
if (trap(shellResult)) return if (trap(shellResult)) return
try {
const updateAstResult = await kclManager.updateAst( const updateAstResult = await kclManager.updateAst(
shellResult.modifiedAst, shellResult.modifiedAst,
true, true,
@ -1644,6 +1645,9 @@ export const modelingMachine = setup({
if (updateAstResult?.selections) { if (updateAstResult?.selections) {
editorManager.selectRange(updateAstResult?.selections) editorManager.selectRange(updateAstResult?.selections)
} }
} catch (e) {
console.error(e)
}
} }
), ),
}, },