sketch on chamfer start
This commit is contained in:
@ -11,6 +11,7 @@ import {
|
||||
getCapCodeRef,
|
||||
getSweepEdgeCodeRef,
|
||||
getSweepFromSuspectedSweepSurface,
|
||||
getEdgeCuteConsumedCodeRef,
|
||||
getSolid2dCodeRef,
|
||||
getWallCodeRef,
|
||||
} from 'lang/std/artifactGraph'
|
||||
@ -72,6 +73,17 @@ export function useEngineConnectionSubscriptions() {
|
||||
editorManager.setHighlightRange([
|
||||
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 {
|
||||
editorManager.setHighlightRange([[0, 0]])
|
||||
}
|
||||
@ -177,12 +189,21 @@ export function useEngineConnectionSubscriptions() {
|
||||
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 =
|
||||
artifact.type === 'cap'
|
||||
? getCapCodeRef(artifact, engineCommandManager.artifactGraph)
|
||||
: getWallCodeRef(artifact, engineCommandManager.artifactGraph)
|
||||
: artifact.type === 'wall'
|
||||
? getWallCodeRef(artifact, engineCommandManager.artifactGraph)
|
||||
: artifact.codeRef
|
||||
|
||||
const faceInfo = await getFaceDetails(faceId)
|
||||
if (!faceInfo?.origin || !faceInfo?.z_axis || !faceInfo?.y_axis)
|
||||
|
@ -724,21 +724,55 @@ export function getSweepEdgeCodeRef(
|
||||
if (err(seg)) return seg
|
||||
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(
|
||||
id: ArtifactId,
|
||||
artifactGraph: ArtifactGraph
|
||||
): SweepArtifact | Error {
|
||||
const artifact = getArtifactOfTypes(
|
||||
{ key: id, types: ['wall', 'cap'] },
|
||||
{ key: id, types: ['wall', 'cap', 'edgeCut'] },
|
||||
artifactGraph
|
||||
)
|
||||
if (err(artifact)) return artifact
|
||||
if (artifact.type === 'wall' || artifact.type === 'cap') {
|
||||
return getArtifactOfTypes(
|
||||
{ key: artifact.sweepId, types: ['sweep'] },
|
||||
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(
|
||||
id: ArtifactId,
|
||||
|
@ -1902,6 +1902,11 @@ export function addTagForSketchOnFace(
|
||||
if (expressionName === 'close') {
|
||||
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) {
|
||||
const { addTag } = sketchLineHelperMap[expressionName]
|
||||
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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user