fix horz vert distance contraint (#2572)

fix hor vert distance contraint
This commit is contained in:
Kurt Hutten
2024-06-03 15:37:23 +10:00
committed by GitHub
parent 59b1319e50
commit f52d2d55f1
4 changed files with 151 additions and 6 deletions

View File

@ -508,13 +508,26 @@ export const ModelingMachineProvider = ({
},
'Get horizontal info': async ({
selectionRanges,
sketchDetails,
}): Promise<SetSelections> => {
const { modifiedAst, pathToNodeMap } =
await applyConstraintHorzVertDistance({
constraint: 'setHorzDistance',
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(
@ -522,17 +535,31 @@ export const ModelingMachineProvider = ({
selectionRanges,
pathToNodeMap
),
updatedPathToNode,
}
},
'Get vertical info': async ({
selectionRanges,
sketchDetails,
}): Promise<SetSelections> => {
const { modifiedAst, pathToNodeMap } =
await applyConstraintHorzVertDistance({
constraint: 'setVertDistance',
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(
@ -540,6 +567,7 @@ export const ModelingMachineProvider = ({
selectionRanges,
pathToNodeMap
),
updatedPathToNode,
}
},
'Get angle info': async ({