add edges to Artifact Graph (Fillet UI related) (#3675)
* add edges to artifact graph * update graph snapshot sizes (too cluttered * fix adjencent reverse issue * add comments * remove log * Look at this (photo)Graph *in the voice of Nickelback* * remove log * remove silly debug * make wasm-prep windows friendly * don't swallow error * more rust tweaks * Increase test timeout --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
This commit is contained in:
@ -9,6 +9,7 @@ import { useModelingContext } from './useModelingContext'
|
|||||||
import { getEventForSelectWithPoint } from 'lib/selections'
|
import { getEventForSelectWithPoint } from 'lib/selections'
|
||||||
import {
|
import {
|
||||||
getCapCodeRef,
|
getCapCodeRef,
|
||||||
|
getExtrudeEdgeCodeRef,
|
||||||
getExtrusionFromSuspectedExtrudeSurface,
|
getExtrusionFromSuspectedExtrudeSurface,
|
||||||
getSolid2dCodeRef,
|
getSolid2dCodeRef,
|
||||||
getWallCodeRef,
|
getWallCodeRef,
|
||||||
@ -60,6 +61,13 @@ export function useEngineConnectionSubscriptions() {
|
|||||||
? [codeRef.range]
|
? [codeRef.range]
|
||||||
: [codeRef.range, extrusion.codeRef.range]
|
: [codeRef.range, extrusion.codeRef.range]
|
||||||
)
|
)
|
||||||
|
} else if (artifact?.type === 'extrudeEdge') {
|
||||||
|
const codeRef = getExtrudeEdgeCodeRef(
|
||||||
|
artifact,
|
||||||
|
engineCommandManager.artifactGraph
|
||||||
|
)
|
||||||
|
if (err(codeRef)) return
|
||||||
|
editorManager.setHighlightRange([codeRef.range])
|
||||||
} else if (artifact?.type === 'segment') {
|
} else if (artifact?.type === 'segment') {
|
||||||
editorManager.setHighlightRange([
|
editorManager.setHighlightRange([
|
||||||
artifact?.codeRef?.range || [0, 0],
|
artifact?.codeRef?.range || [0, 0],
|
||||||
|
@ -58,7 +58,10 @@ Map {
|
|||||||
92,
|
92,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
@ -77,7 +80,10 @@ Map {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeCutId": "UUID",
|
"edgeCutId": "UUID",
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
@ -95,7 +101,10 @@ Map {
|
|||||||
156,
|
156,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
@ -113,7 +122,10 @@ Map {
|
|||||||
209,
|
209,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
@ -152,7 +164,16 @@ Map {
|
|||||||
266,
|
266,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceIds": [
|
"surfaceIds": [
|
||||||
"UUID",
|
"UUID",
|
||||||
@ -209,6 +230,54 @@ Map {
|
|||||||
"type": "cap",
|
"type": "cap",
|
||||||
},
|
},
|
||||||
"UUID-15" => {
|
"UUID-15" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-16" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-17" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-18" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-19" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-20" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-21" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-22" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-23" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -226,7 +295,7 @@ Map {
|
|||||||
"subType": "fillet",
|
"subType": "fillet",
|
||||||
"type": "edgeCut",
|
"type": "edgeCut",
|
||||||
},
|
},
|
||||||
"UUID-16" => {
|
"UUID-24" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -250,7 +319,7 @@ Map {
|
|||||||
"solid2dId": "UUID",
|
"solid2dId": "UUID",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
},
|
},
|
||||||
"UUID-17" => {
|
"UUID-25" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -263,12 +332,15 @@ Map {
|
|||||||
416,
|
416,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
},
|
},
|
||||||
"UUID-18" => {
|
"UUID-26" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -281,12 +353,15 @@ Map {
|
|||||||
438,
|
438,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
},
|
},
|
||||||
"UUID-19" => {
|
"UUID-27" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -299,12 +374,15 @@ Map {
|
|||||||
491,
|
491,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceId": "UUID",
|
"surfaceId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
},
|
},
|
||||||
"UUID-20" => {
|
"UUID-28" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -321,11 +399,11 @@ Map {
|
|||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"type": "segment",
|
"type": "segment",
|
||||||
},
|
},
|
||||||
"UUID-21" => {
|
"UUID-29" => {
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"type": "solid2D",
|
"type": "solid2D",
|
||||||
},
|
},
|
||||||
"UUID-22" => {
|
"UUID-30" => {
|
||||||
"codeRef": {
|
"codeRef": {
|
||||||
"pathToNode": [
|
"pathToNode": [
|
||||||
[
|
[
|
||||||
@ -338,7 +416,14 @@ Map {
|
|||||||
546,
|
546,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"edgeIds": [],
|
"edgeIds": [
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
"UUID",
|
||||||
|
],
|
||||||
"pathId": "UUID",
|
"pathId": "UUID",
|
||||||
"surfaceIds": [
|
"surfaceIds": [
|
||||||
"UUID",
|
"UUID",
|
||||||
@ -349,40 +434,76 @@ Map {
|
|||||||
],
|
],
|
||||||
"type": "extrusion",
|
"type": "extrusion",
|
||||||
},
|
},
|
||||||
"UUID-23" => {
|
"UUID-31" => {
|
||||||
"edgeCutEdgeIds": [],
|
"edgeCutEdgeIds": [],
|
||||||
"extrusionId": "UUID",
|
"extrusionId": "UUID",
|
||||||
"pathIds": [],
|
"pathIds": [],
|
||||||
"segId": "UUID",
|
"segId": "UUID",
|
||||||
"type": "wall",
|
"type": "wall",
|
||||||
},
|
},
|
||||||
"UUID-24" => {
|
"UUID-32" => {
|
||||||
"edgeCutEdgeIds": [],
|
"edgeCutEdgeIds": [],
|
||||||
"extrusionId": "UUID",
|
"extrusionId": "UUID",
|
||||||
"pathIds": [],
|
"pathIds": [],
|
||||||
"segId": "UUID",
|
"segId": "UUID",
|
||||||
"type": "wall",
|
"type": "wall",
|
||||||
},
|
},
|
||||||
"UUID-25" => {
|
"UUID-33" => {
|
||||||
"edgeCutEdgeIds": [],
|
"edgeCutEdgeIds": [],
|
||||||
"extrusionId": "UUID",
|
"extrusionId": "UUID",
|
||||||
"pathIds": [],
|
"pathIds": [],
|
||||||
"segId": "UUID",
|
"segId": "UUID",
|
||||||
"type": "wall",
|
"type": "wall",
|
||||||
},
|
},
|
||||||
"UUID-26" => {
|
"UUID-34" => {
|
||||||
"edgeCutEdgeIds": [],
|
"edgeCutEdgeIds": [],
|
||||||
"extrusionId": "UUID",
|
"extrusionId": "UUID",
|
||||||
"pathIds": [],
|
"pathIds": [],
|
||||||
"subType": "start",
|
"subType": "start",
|
||||||
"type": "cap",
|
"type": "cap",
|
||||||
},
|
},
|
||||||
"UUID-27" => {
|
"UUID-35" => {
|
||||||
"edgeCutEdgeIds": [],
|
"edgeCutEdgeIds": [],
|
||||||
"extrusionId": "UUID",
|
"extrusionId": "UUID",
|
||||||
"pathIds": [],
|
"pathIds": [],
|
||||||
"subType": "end",
|
"subType": "end",
|
||||||
"type": "cap",
|
"type": "cap",
|
||||||
},
|
},
|
||||||
|
"UUID-36" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-37" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-38" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-39" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-40" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "opposite",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
|
"UUID-41" => {
|
||||||
|
"extrusionId": "UUID",
|
||||||
|
"segId": "UUID",
|
||||||
|
"subType": "adjacent",
|
||||||
|
"type": "extrudeEdge",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -247,7 +247,7 @@ describe('testing createArtifactGraph', () => {
|
|||||||
// of the edges refers to a non-existent node, the graph will throw.
|
// of the edges refers to a non-existent node, the graph will throw.
|
||||||
// further more we can check that each edge is bi-directional, if it's not
|
// further more we can check that each edge is bi-directional, if it's not
|
||||||
// by checking the arrow heads going both ways, on the graph.
|
// by checking the arrow heads going both ways, on the graph.
|
||||||
await GraphTheGraph(theMap, 1400, 1400, 'exampleCode1.png')
|
await GraphTheGraph(theMap, 2000, 2000, 'exampleCode1.png')
|
||||||
}, 20000)
|
}, 20000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -271,7 +271,7 @@ describe('capture graph of sketchOnFaceOnFace...', () => {
|
|||||||
// of the edges refers to a non-existent node, the graph will throw.
|
// of the edges refers to a non-existent node, the graph will throw.
|
||||||
// further more we can check that each edge is bi-directional, if it's not
|
// further more we can check that each edge is bi-directional, if it's not
|
||||||
// by checking the arrow heads going both ways, on the graph.
|
// by checking the arrow heads going both ways, on the graph.
|
||||||
await GraphTheGraph(theMap, 2500, 2500, 'sketchOnFaceOnFaceEtc.png')
|
await GraphTheGraph(theMap, 3000, 3000, 'sketchOnFaceOnFaceEtc.png')
|
||||||
}, 20000)
|
}, 20000)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -603,7 +603,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'segment',
|
type: 'segment',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceId: expect.any(String),
|
surfaceId: expect.any(String),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [98, 125],
|
range: [98, 125],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -623,7 +623,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'segment',
|
type: 'segment',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceId: expect.any(String),
|
surfaceId: expect.any(String),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [162, 209],
|
range: [162, 209],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -633,7 +633,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'extrusion',
|
type: 'extrusion',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceIds: expect.any(Array),
|
surfaceIds: expect.any(Array),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [243, 266],
|
range: [243, 266],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -650,7 +650,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'segment',
|
type: 'segment',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceId: expect.any(String),
|
surfaceId: expect.any(String),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [131, 156],
|
range: [131, 156],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -660,7 +660,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'extrusion',
|
type: 'extrusion',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceIds: expect.any(Array),
|
surfaceIds: expect.any(Array),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [243, 266],
|
range: [243, 266],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -677,7 +677,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'segment',
|
type: 'segment',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceId: expect.any(String),
|
surfaceId: expect.any(String),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [98, 125],
|
range: [98, 125],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -688,7 +688,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'extrusion',
|
type: 'extrusion',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceIds: expect.any(Array),
|
surfaceIds: expect.any(Array),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [243, 266],
|
range: [243, 266],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -705,7 +705,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'segment',
|
type: 'segment',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceId: expect.any(String),
|
surfaceId: expect.any(String),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [76, 92],
|
range: [76, 92],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -715,7 +715,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'extrusion',
|
type: 'extrusion',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceIds: expect.any(Array),
|
surfaceIds: expect.any(Array),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [243, 266],
|
range: [243, 266],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -732,7 +732,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'extrusion',
|
type: 'extrusion',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceIds: expect.any(Array),
|
surfaceIds: expect.any(Array),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [243, 266],
|
range: [243, 266],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
@ -749,7 +749,7 @@ describe('testing getArtifactsToUpdate', () => {
|
|||||||
type: 'extrusion',
|
type: 'extrusion',
|
||||||
pathId: expect.any(String),
|
pathId: expect.any(String),
|
||||||
surfaceIds: expect.any(Array),
|
surfaceIds: expect.any(Array),
|
||||||
edgeIds: [],
|
edgeIds: expect.any(Array),
|
||||||
codeRef: {
|
codeRef: {
|
||||||
range: [243, 266],
|
range: [243, 266],
|
||||||
pathToNode: [['body', '']],
|
pathToNode: [['body', '']],
|
||||||
|
@ -91,7 +91,7 @@ interface ExtrudeEdge {
|
|||||||
type: 'extrudeEdge'
|
type: 'extrudeEdge'
|
||||||
segId: string
|
segId: string
|
||||||
extrusionId: string
|
extrusionId: string
|
||||||
edgeId: string
|
subType: 'opposite' | 'adjacent'
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A edgeCut is a more generic term for both fillet or chamfer */
|
/** A edgeCut is a more generic term for both fillet or chamfer */
|
||||||
@ -422,6 +422,56 @@ export function getArtifactsToUpdate({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return returnArr
|
return returnArr
|
||||||
|
} else if (
|
||||||
|
// is opposite edge
|
||||||
|
(cmd.type === 'solid3d_get_opposite_edge' &&
|
||||||
|
response.type === 'modeling' &&
|
||||||
|
response.data.modeling_response.type === 'solid3d_get_opposite_edge' &&
|
||||||
|
response.data.modeling_response.data.edge) ||
|
||||||
|
// or is adjacent edge
|
||||||
|
(cmd.type === 'solid3d_get_prev_adjacent_edge' &&
|
||||||
|
response.type === 'modeling' &&
|
||||||
|
response.data.modeling_response.type ===
|
||||||
|
'solid3d_get_prev_adjacent_edge' &&
|
||||||
|
response.data.modeling_response.data.edge)
|
||||||
|
) {
|
||||||
|
const wall = getArtifact(cmd.face_id)
|
||||||
|
if (wall?.type !== 'wall') return returnArr
|
||||||
|
const extrusion = getArtifact(wall.extrusionId)
|
||||||
|
if (extrusion?.type !== 'extrusion') return returnArr
|
||||||
|
const path = getArtifact(extrusion.pathId)
|
||||||
|
if (path?.type !== 'path') return returnArr
|
||||||
|
const segment = getArtifact(cmd.edge_id)
|
||||||
|
if (segment?.type !== 'segment') return returnArr
|
||||||
|
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
id: response.data.modeling_response.data.edge,
|
||||||
|
artifact: {
|
||||||
|
type: 'extrudeEdge',
|
||||||
|
subType:
|
||||||
|
cmd.type === 'solid3d_get_prev_adjacent_edge'
|
||||||
|
? 'adjacent'
|
||||||
|
: 'opposite',
|
||||||
|
segId: cmd.edge_id,
|
||||||
|
extrusionId: path.extrusionId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: cmd.edge_id,
|
||||||
|
artifact: {
|
||||||
|
...segment,
|
||||||
|
edgeIds: [response.data.modeling_response.data.edge],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: path.extrusionId,
|
||||||
|
artifact: {
|
||||||
|
...extrusion,
|
||||||
|
edgeIds: [response.data.modeling_response.data.edge],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
} else if (cmd.type === 'solid3d_fillet_edge') {
|
} else if (cmd.type === 'solid3d_fillet_edge') {
|
||||||
returnArr.push({
|
returnArr.push({
|
||||||
id,
|
id,
|
||||||
@ -655,6 +705,18 @@ export function getWallCodeRef(
|
|||||||
return seg.codeRef
|
return seg.codeRef
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getExtrudeEdgeCodeRef(
|
||||||
|
edge: ExtrudeEdge,
|
||||||
|
artifactGraph: ArtifactGraph
|
||||||
|
): CommonCommandProperties | Error {
|
||||||
|
const seg = getArtifactOfTypes(
|
||||||
|
{ key: edge.segId, types: ['segment'] },
|
||||||
|
artifactGraph
|
||||||
|
)
|
||||||
|
if (err(seg)) return seg
|
||||||
|
return seg.codeRef
|
||||||
|
}
|
||||||
|
|
||||||
export function getExtrusionFromSuspectedExtrudeSurface(
|
export function getExtrusionFromSuspectedExtrudeSurface(
|
||||||
id: string,
|
id: string,
|
||||||
artifactGraph: ArtifactGraph
|
artifactGraph: ArtifactGraph
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 380 KiB |
Binary file not shown.
Before Width: | Height: | Size: 371 KiB After Width: | Height: | Size: 617 KiB |
@ -33,6 +33,7 @@ import {
|
|||||||
getArtifactOfTypes,
|
getArtifactOfTypes,
|
||||||
getArtifactsOfTypes,
|
getArtifactsOfTypes,
|
||||||
getCapCodeRef,
|
getCapCodeRef,
|
||||||
|
getExtrudeEdgeCodeRef,
|
||||||
getSolid2dCodeRef,
|
getSolid2dCodeRef,
|
||||||
getWallCodeRef,
|
getWallCodeRef,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
@ -141,6 +142,20 @@ export async function getEventForSelectWithPoint({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_artifact.type === 'extrudeEdge') {
|
||||||
|
const codeRef = getExtrudeEdgeCodeRef(
|
||||||
|
_artifact,
|
||||||
|
engineCommandManager.artifactGraph
|
||||||
|
)
|
||||||
|
if (err(codeRef)) return null
|
||||||
|
return {
|
||||||
|
type: 'Set selection',
|
||||||
|
data: {
|
||||||
|
selectionType: 'singleCodeCursor',
|
||||||
|
selection: { range: codeRef.range, type: 'edge' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +181,32 @@ pub(crate) async fn do_post_extrude(
|
|||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for face_info in face_infos.iter() {
|
||||||
|
if face_info.cap == kittycad::types::ExtrusionFaceCapType::None {
|
||||||
|
if let (Some(curve_id), Some(face_id)) = (face_info.curve_id, face_info.face_id) {
|
||||||
|
args.batch_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
kittycad::types::ModelingCmd::Solid3DGetOppositeEdge {
|
||||||
|
edge_id: curve_id,
|
||||||
|
object_id: sketch_group.id,
|
||||||
|
face_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
args.batch_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
kittycad::types::ModelingCmd::Solid3DGetPrevAdjacentEdge {
|
||||||
|
edge_id: curve_id,
|
||||||
|
object_id: sketch_group.id,
|
||||||
|
face_id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create a hashmap for quick id lookup
|
// Create a hashmap for quick id lookup
|
||||||
let mut face_id_map = std::collections::HashMap::new();
|
let mut face_id_map = std::collections::HashMap::new();
|
||||||
// creating fake ids for start and end caps is to make extrudes mock-execute safe
|
// creating fake ids for start and end caps is to make extrudes mock-execute safe
|
||||||
|
Reference in New Issue
Block a user