make multiple sketches on same face individually editable (#5430)
make multipl sketches individuall editable
This commit is contained in:
@ -800,11 +800,18 @@ export const ModelingMachineProvider = ({
|
|||||||
}),
|
}),
|
||||||
'animate-to-sketch': fromPromise(
|
'animate-to-sketch': fromPromise(
|
||||||
async ({ input: { selectionRanges } }) => {
|
async ({ input: { selectionRanges } }) => {
|
||||||
|
const artifact = selectionRanges.graphSelections[0].artifact
|
||||||
const plane = getPlaneFromArtifact(
|
const plane = getPlaneFromArtifact(
|
||||||
selectionRanges.graphSelections[0].artifact,
|
artifact,
|
||||||
engineCommandManager.artifactGraph
|
engineCommandManager.artifactGraph
|
||||||
)
|
)
|
||||||
if (err(plane)) return Promise.reject(plane)
|
if (err(plane)) return Promise.reject(plane)
|
||||||
|
// if the user selected a segment, make sure we enter the right sketch as there can be multiple on a plan
|
||||||
|
// but still works if the user selected a plane/face by defaulting to the first path
|
||||||
|
const mainPath =
|
||||||
|
artifact?.type === 'segment' || artifact?.type === 'solid2d'
|
||||||
|
? artifact?.pathId
|
||||||
|
: plane?.pathIds[0]
|
||||||
let sketch: KclValue | null = null
|
let sketch: KclValue | null = null
|
||||||
for (const variable of Object.values(
|
for (const variable of Object.values(
|
||||||
kclManager.execState.variables
|
kclManager.execState.variables
|
||||||
@ -812,7 +819,7 @@ export const ModelingMachineProvider = ({
|
|||||||
// find programMemory that matches path artifact
|
// find programMemory that matches path artifact
|
||||||
if (
|
if (
|
||||||
variable?.type === 'Sketch' &&
|
variable?.type === 'Sketch' &&
|
||||||
variable.value.artifactId === plane.pathIds[0]
|
variable.value.artifactId === mainPath
|
||||||
) {
|
) {
|
||||||
sketch = variable
|
sketch = variable
|
||||||
break
|
break
|
||||||
@ -821,7 +828,7 @@ export const ModelingMachineProvider = ({
|
|||||||
// if the variable is an sweep, check if the underlying sketch matches the artifact
|
// if the variable is an sweep, check if the underlying sketch matches the artifact
|
||||||
variable?.type === 'Solid' &&
|
variable?.type === 'Solid' &&
|
||||||
variable.value.sketch.on.type === 'plane' &&
|
variable.value.sketch.on.type === 'plane' &&
|
||||||
variable.value.sketch.artifactId === plane.pathIds[0]
|
variable.value.sketch.artifactId === mainPath
|
||||||
) {
|
) {
|
||||||
sketch = {
|
sketch = {
|
||||||
type: 'Sketch',
|
type: 'Sketch',
|
||||||
@ -841,9 +848,8 @@ export const ModelingMachineProvider = ({
|
|||||||
info?.sketchDetails?.faceId || ''
|
info?.sketchDetails?.faceId || ''
|
||||||
)
|
)
|
||||||
|
|
||||||
const sketchArtifact = engineCommandManager.artifactGraph.get(
|
const sketchArtifact =
|
||||||
plane.pathIds[0]
|
engineCommandManager.artifactGraph.get(mainPath)
|
||||||
)
|
|
||||||
if (sketchArtifact?.type !== 'path')
|
if (sketchArtifact?.type !== 'path')
|
||||||
return Promise.reject(new Error('No sketch artifact'))
|
return Promise.reject(new Error('No sketch artifact'))
|
||||||
const sketchPaths = getPathsFromArtifact({
|
const sketchPaths = getPathsFromArtifact({
|
||||||
|
Reference in New Issue
Block a user