fix ABS XY constraint (#2560)

* fix source rangen for abs x y constraints

* fix abs bug

* add e2e test
This commit is contained in:
Kurt Hutten
2024-05-31 14:00:32 +10:00
committed by GitHub
parent bd16902f02
commit 3c01924184
4 changed files with 157 additions and 25 deletions

View File

@ -614,13 +614,26 @@ export const ModelingMachineProvider = ({
},
'Get ABS X info': async ({
selectionRanges,
sketchDetails,
}): Promise<SetSelections> => {
const { modifiedAst, pathToNodeMap } =
await applyConstraintAbsDistance({
constraint: 'xAbs',
selectionRanges,
})
await kclManager.updateAst(modifiedAst, true)
const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details')
const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode,
pathToNodeMap
)
await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode,
_modifiedAst,
sketchDetails.zAxis,
sketchDetails.yAxis,
sketchDetails.origin
)
return {
selectionType: 'completeSelection',
selection: pathMapToSelections(
@ -628,17 +641,31 @@ export const ModelingMachineProvider = ({
selectionRanges,
pathToNodeMap
),
updatedPathToNode,
}
},
'Get ABS Y info': async ({
selectionRanges,
sketchDetails,
}): Promise<SetSelections> => {
const { modifiedAst, pathToNodeMap } =
await applyConstraintAbsDistance({
constraint: 'yAbs',
selectionRanges,
})
await kclManager.updateAst(modifiedAst, true)
const _modifiedAst = parse(recast(modifiedAst))
if (!sketchDetails) throw new Error('No sketch details')
const updatedPathToNode = updatePathToNodeFromMap(
sketchDetails.sketchPathToNode,
pathToNodeMap
)
await sceneEntitiesManager.updateAstAndRejigSketch(
updatedPathToNode,
_modifiedAst,
sketchDetails.zAxis,
sketchDetails.yAxis,
sketchDetails.origin
)
return {
selectionType: 'completeSelection',
selection: pathMapToSelections(
@ -646,6 +673,7 @@ export const ModelingMachineProvider = ({
selectionRanges,
pathToNodeMap
),
updatedPathToNode,
}
},
'Get convert to variable info': async ({ sketchDetails }, { data }) => {