Refactor Edge Treatment Module to Break Cyclic Dependency (#5243)

* break cycle

* yarn fmt
This commit is contained in:
max
2025-02-04 01:14:53 +01:00
committed by GitHub
parent 86349375d0
commit 25ad603502
4 changed files with 111 additions and 26 deletions

View File

@ -1681,6 +1681,12 @@ export const modelingMachine = setup({
// Extract inputs
const ast = kclManager.ast
const { selection, thickness } = input
const dependencies = {
kclManager,
engineCommandManager,
editorManager,
codeManager,
}
// Insert the thickness variable if it exists
if (
@ -1706,6 +1712,7 @@ export const modelingMachine = setup({
'variableName' in thickness
? thickness.variableIdentifierAst
: thickness.valueAst,
dependencies,
})
if (err(shellResult)) {
return err(shellResult)
@ -1745,12 +1752,19 @@ export const modelingMachine = setup({
type: EdgeTreatmentType.Fillet,
radius,
}
const dependencies = {
kclManager,
engineCommandManager,
editorManager,
codeManager,
}
// Apply fillet to selection
const filletResult = await applyEdgeTreatmentToSelection(
ast,
selection,
parameters
parameters,
dependencies
)
if (err(filletResult)) return filletResult
}
@ -1772,12 +1786,19 @@ export const modelingMachine = setup({
type: EdgeTreatmentType.Chamfer,
length,
}
const dependencies = {
kclManager,
engineCommandManager,
editorManager,
codeManager,
}
// Apply chamfer to selection
const chamferResult = await applyEdgeTreatmentToSelection(
ast,
selection,
parameters
parameters,
dependencies
)
if (err(chamferResult)) return chamferResult
}