Allow point-and-click Substract to take in multiple solids and tools (#7614)

* Allow point-and-click Substract to take in multiple tools
Fixes #7612

* Change target to solids for consistency and make it support multi select too

* Improve err message

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>

* Update src/lang/modifyAst/boolean.ts

Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>

* Good bot

* Reduce array to single value if len 1

* Remove console.log

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
Pierre Jacquier
2025-06-26 16:43:53 -04:00
committed by GitHub
parent 7de27c648f
commit f49cf8281c
4 changed files with 92 additions and 94 deletions

View File

@ -3570,17 +3570,17 @@ export const modelingMachine = setup({
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
}
const { target, tool } = input
const { solids, tools } = input
if (
!target.graphSelections[0].artifact ||
!tool.graphSelections[0].artifact
!solids.graphSelections.some((selection) => selection.artifact) ||
!tools.graphSelections.some((selection) => selection.artifact)
) {
return Promise.reject(new Error('No artifact in selections found'))
}
await applySubtractFromTargetOperatorSelections(
target.graphSelections[0],
tool.graphSelections[0],
const result = await applySubtractFromTargetOperatorSelections(
solids,
tools,
{
kclManager,
codeManager,
@ -3588,6 +3588,9 @@ export const modelingMachine = setup({
editorManager,
}
)
if (err(result)) {
return Promise.reject(result)
}
}
),
boolUnionAstMod: fromPromise(
@ -3605,12 +3608,15 @@ export const modelingMachine = setup({
return Promise.reject(new Error('No artifact in selections found'))
}
await applyUnionFromTargetOperatorSelections(solids, {
const result = await applyUnionFromTargetOperatorSelections(solids, {
kclManager,
codeManager,
engineCommandManager,
editorManager,
})
if (err(result)) {
return Promise.reject(result)
}
}
),
boolIntersectAstMod: fromPromise(
@ -3628,12 +3634,18 @@ export const modelingMachine = setup({
return Promise.reject(new Error('No artifact in selections found'))
}
await applyIntersectFromTargetOperatorSelections(solids, {
kclManager,
codeManager,
engineCommandManager,
editorManager,
})
const result = await applyIntersectFromTargetOperatorSelections(
solids,
{
kclManager,
codeManager,
engineCommandManager,
editorManager,
}
)
if (err(result)) {
return Promise.reject(result)
}
}
),