sketch on chamfer start
This commit is contained in:
@ -11,6 +11,7 @@ import {
|
|||||||
getCapCodeRef,
|
getCapCodeRef,
|
||||||
getSweepEdgeCodeRef,
|
getSweepEdgeCodeRef,
|
||||||
getSweepFromSuspectedSweepSurface,
|
getSweepFromSuspectedSweepSurface,
|
||||||
|
getEdgeCuteConsumedCodeRef,
|
||||||
getSolid2dCodeRef,
|
getSolid2dCodeRef,
|
||||||
getWallCodeRef,
|
getWallCodeRef,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
@ -72,6 +73,17 @@ export function useEngineConnectionSubscriptions() {
|
|||||||
editorManager.setHighlightRange([
|
editorManager.setHighlightRange([
|
||||||
artifact?.codeRef?.range || [0, 0],
|
artifact?.codeRef?.range || [0, 0],
|
||||||
])
|
])
|
||||||
|
} else if (artifact?.type === 'edgeCut') {
|
||||||
|
const codeRef = artifact.codeRef
|
||||||
|
const consumedCodeRef = getEdgeCuteConsumedCodeRef(
|
||||||
|
artifact,
|
||||||
|
engineCommandManager.artifactGraph
|
||||||
|
)
|
||||||
|
editorManager.setHighlightRange(
|
||||||
|
err(consumedCodeRef)
|
||||||
|
? [codeRef.range]
|
||||||
|
: [codeRef.range, consumedCodeRef.range]
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
editorManager.setHighlightRange([[0, 0]])
|
editorManager.setHighlightRange([[0, 0]])
|
||||||
}
|
}
|
||||||
@ -177,12 +189,21 @@ export function useEngineConnectionSubscriptions() {
|
|||||||
engineCommandManager.artifactGraph
|
engineCommandManager.artifactGraph
|
||||||
)
|
)
|
||||||
|
|
||||||
if (artifact?.type !== 'cap' && artifact?.type !== 'wall') return
|
if (
|
||||||
|
artifact?.type !== 'cap' &&
|
||||||
|
artifact?.type !== 'wall' &&
|
||||||
|
!(
|
||||||
|
artifact?.type === 'edgeCut' && artifact.subType === 'chamfer'
|
||||||
|
)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
const codeRef =
|
const codeRef =
|
||||||
artifact.type === 'cap'
|
artifact.type === 'cap'
|
||||||
? getCapCodeRef(artifact, engineCommandManager.artifactGraph)
|
? getCapCodeRef(artifact, engineCommandManager.artifactGraph)
|
||||||
: getWallCodeRef(artifact, engineCommandManager.artifactGraph)
|
: artifact.type === 'wall'
|
||||||
|
? getWallCodeRef(artifact, engineCommandManager.artifactGraph)
|
||||||
|
: artifact.codeRef
|
||||||
|
|
||||||
const faceInfo = await getFaceDetails(faceId)
|
const faceInfo = await getFaceDetails(faceId)
|
||||||
if (!faceInfo?.origin || !faceInfo?.z_axis || !faceInfo?.y_axis)
|
if (!faceInfo?.origin || !faceInfo?.z_axis || !faceInfo?.y_axis)
|
||||||
|
@ -724,21 +724,55 @@ export function getSweepEdgeCodeRef(
|
|||||||
if (err(seg)) return seg
|
if (err(seg)) return seg
|
||||||
return seg.codeRef
|
return seg.codeRef
|
||||||
}
|
}
|
||||||
|
export function getEdgeCuteConsumedCodeRef(
|
||||||
|
edge: EdgeCut,
|
||||||
|
artifactGraph: ArtifactGraph
|
||||||
|
): CommonCommandProperties | Error {
|
||||||
|
const seg = getArtifactOfTypes(
|
||||||
|
{ key: edge.consumedEdgeId, types: ['segment', 'sweepEdge'] },
|
||||||
|
artifactGraph
|
||||||
|
)
|
||||||
|
if (err(seg)) return seg
|
||||||
|
if (seg.type === 'segment') return seg.codeRef
|
||||||
|
return getSweepEdgeCodeRef(seg, artifactGraph)
|
||||||
|
}
|
||||||
|
|
||||||
export function getSweepFromSuspectedSweepSurface(
|
export function getSweepFromSuspectedSweepSurface(
|
||||||
id: ArtifactId,
|
id: ArtifactId,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
): SweepArtifact | Error {
|
): SweepArtifact | Error {
|
||||||
const artifact = getArtifactOfTypes(
|
const artifact = getArtifactOfTypes(
|
||||||
{ key: id, types: ['wall', 'cap'] },
|
{ key: id, types: ['wall', 'cap', 'edgeCut'] },
|
||||||
artifactGraph
|
artifactGraph
|
||||||
)
|
)
|
||||||
if (err(artifact)) return artifact
|
if (err(artifact)) return artifact
|
||||||
|
if (artifact.type === 'wall' || artifact.type === 'cap') {
|
||||||
return getArtifactOfTypes(
|
return getArtifactOfTypes(
|
||||||
{ key: artifact.sweepId, types: ['sweep'] },
|
{ key: artifact.sweepId, types: ['sweep'] },
|
||||||
artifactGraph
|
artifactGraph
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
const segOrEdge = getArtifactOfTypes(
|
||||||
|
{ key: artifact.consumedEdgeId, types: ['segment', 'sweepEdge'] },
|
||||||
|
artifactGraph
|
||||||
|
)
|
||||||
|
if (err(segOrEdge)) return segOrEdge
|
||||||
|
if (segOrEdge.type === 'segment') {
|
||||||
|
const path = getArtifactOfTypes(
|
||||||
|
{ key: segOrEdge.pathId, types: ['path'] },
|
||||||
|
artifactGraph
|
||||||
|
)
|
||||||
|
if (err(path)) return path
|
||||||
|
return getArtifactOfTypes(
|
||||||
|
{ key: path.sweepId, types: ['sweep'] },
|
||||||
|
artifactGraph
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return getArtifactOfTypes(
|
||||||
|
{ key: segOrEdge.sweepId, types: ['sweep'] },
|
||||||
|
artifactGraph
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
export function getSweepFromSuspectedPath(
|
export function getSweepFromSuspectedPath(
|
||||||
id: ArtifactId,
|
id: ArtifactId,
|
||||||
|
@ -1902,6 +1902,11 @@ export function addTagForSketchOnFace(
|
|||||||
if (expressionName === 'close') {
|
if (expressionName === 'close') {
|
||||||
return addTag(1)(tagInfo)
|
return addTag(1)(tagInfo)
|
||||||
}
|
}
|
||||||
|
if (expressionName === 'chamfer') {
|
||||||
|
// TODO: if there are two (or more) tags on the chamfer, it needs to pull out
|
||||||
|
// the relevant tag and put it into a separate chamfer call
|
||||||
|
return addTag(2)(tagInfo)
|
||||||
|
}
|
||||||
if (expressionName in sketchLineHelperMap) {
|
if (expressionName in sketchLineHelperMap) {
|
||||||
const { addTag } = sketchLineHelperMap[expressionName]
|
const { addTag } = sketchLineHelperMap[expressionName]
|
||||||
return addTag(tagInfo)
|
return addTag(tagInfo)
|
||||||
|
@ -164,6 +164,14 @@ export async function getEventForSelectWithPoint({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_artifact.type === 'edgeCut')
|
||||||
|
return {
|
||||||
|
type: 'Set selection',
|
||||||
|
data: {
|
||||||
|
selectionType: 'singleCodeCursor',
|
||||||
|
selection: { range: _artifact.codeRef.range, type: 'default' },
|
||||||
|
},
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user