Compare commits
4 Commits
franknoiro
...
kurt-add-e
Author | SHA1 | Date | |
---|---|---|---|
fcf3e89013 | |||
ed7b54c52e | |||
f715509a86 | |||
d73e5ca7c0 |
@ -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],
|
||||||
|
@ -35,6 +35,7 @@ export function addFillet(
|
|||||||
node: Program,
|
node: Program,
|
||||||
pathToSegmentNode: PathToNode,
|
pathToSegmentNode: PathToNode,
|
||||||
pathToExtrudeNode: PathToNode,
|
pathToExtrudeNode: PathToNode,
|
||||||
|
edgeType: 'oppositeEdge' | 'adjacentEdge' | 'default',
|
||||||
radius = createLiteral(5) as Value
|
radius = createLiteral(5) as Value
|
||||||
// shouldPipe = false, // TODO: Implement this feature
|
// shouldPipe = false, // TODO: Implement this feature
|
||||||
): { modifiedAst: Program; pathToFilletNode: PathToNode } | Error {
|
): { modifiedAst: Program; pathToFilletNode: PathToNode } | Error {
|
||||||
@ -84,10 +85,18 @@ export function addFillet(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Create the fillet call expression in one line
|
// Create the fillet call expression in one line
|
||||||
|
|
||||||
|
let tagCall: Value = createIdentifier(tag)
|
||||||
|
if (edgeType === 'oppositeEdge') {
|
||||||
|
tagCall = createCallExpressionStdLib('getOppositeEdge', [tagCall])
|
||||||
|
} else if (edgeType === 'adjacentEdge') {
|
||||||
|
tagCall = createCallExpressionStdLib('getNextAdjacentEdge', [tagCall])
|
||||||
|
}
|
||||||
|
|
||||||
const filletCall = createCallExpressionStdLib('fillet', [
|
const filletCall = createCallExpressionStdLib('fillet', [
|
||||||
createObjectExpression({
|
createObjectExpression({
|
||||||
radius: radius,
|
radius: radius,
|
||||||
tags: createArrayExpression([createIdentifier(tag)]),
|
tags: createArrayExpression([tagCall]),
|
||||||
}),
|
}),
|
||||||
createPipeSubstitution(),
|
createPipeSubstitution(),
|
||||||
])
|
])
|
||||||
@ -178,11 +187,13 @@ export function addFillet(
|
|||||||
extrudeDeclarator.init = createPipeExpression([extrudeInit, filletCall])
|
extrudeDeclarator.init = createPipeExpression([extrudeInit, filletCall])
|
||||||
return {
|
return {
|
||||||
modifiedAst: _node,
|
modifiedAst: _node,
|
||||||
pathToFilletNode: getPathToNodeOfFilletLiteral(
|
pathToFilletNode: [],
|
||||||
pathToExtrudeNode,
|
// TODO fix and re-enable this
|
||||||
extrudeDeclarator,
|
// pathToFilletNode: getPathToNodeOfFilletLiteral(
|
||||||
tag
|
// pathToExtrudeNode,
|
||||||
),
|
// extrudeDeclarator,
|
||||||
|
// tag
|
||||||
|
// ),
|
||||||
}
|
}
|
||||||
} else if (extrudeInit.type === 'PipeExpression') {
|
} else if (extrudeInit.type === 'PipeExpression') {
|
||||||
// 2. fillet case
|
// 2. fillet case
|
||||||
|
@ -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",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
@ -251,7 +251,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)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -275,7 +275,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)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -607,7 +607,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', '']],
|
||||||
@ -627,7 +627,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', '']],
|
||||||
@ -637,7 +637,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', '']],
|
||||||
@ -654,7 +654,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', '']],
|
||||||
@ -664,7 +664,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', '']],
|
||||||
@ -681,7 +681,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', '']],
|
||||||
@ -692,7 +692,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', '']],
|
||||||
@ -709,7 +709,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', '']],
|
||||||
@ -719,7 +719,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', '']],
|
||||||
@ -736,7 +736,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', '']],
|
||||||
@ -753,7 +753,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', '']],
|
||||||
|
@ -86,12 +86,11 @@ interface CapArtifact {
|
|||||||
extrusionId: string
|
extrusionId: string
|
||||||
pathIds: Array<string>
|
pathIds: Array<string>
|
||||||
}
|
}
|
||||||
|
export interface ExtrudeEdge {
|
||||||
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 +421,54 @@ export function getArtifactsToUpdate({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
return returnArr
|
return returnArr
|
||||||
|
} else if (
|
||||||
|
(cmd.type === 'solid3d_get_opposite_edge' &&
|
||||||
|
response.type === 'modeling' &&
|
||||||
|
response.data.modeling_response.type === 'solid3d_get_opposite_edge' &&
|
||||||
|
response.data.modeling_response.data.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 +702,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 |
@ -30,9 +30,11 @@ import { AXIS_GROUP, X_AXIS } from 'clientSideScene/sceneInfra'
|
|||||||
import { PathToNodeMap } from 'lang/std/sketchcombos'
|
import { PathToNodeMap } from 'lang/std/sketchcombos'
|
||||||
import { err } from 'lib/trap'
|
import { err } from 'lib/trap'
|
||||||
import {
|
import {
|
||||||
|
ExtrudeEdge,
|
||||||
getArtifactOfTypes,
|
getArtifactOfTypes,
|
||||||
getArtifactsOfTypes,
|
getArtifactsOfTypes,
|
||||||
getCapCodeRef,
|
getCapCodeRef,
|
||||||
|
getExtrudeEdgeCodeRef,
|
||||||
getSolid2dCodeRef,
|
getSolid2dCodeRef,
|
||||||
getWallCodeRef,
|
getWallCodeRef,
|
||||||
} from 'lang/std/artifactGraph'
|
} from 'lang/std/artifactGraph'
|
||||||
@ -56,6 +58,8 @@ export type Selection = {
|
|||||||
| 'line'
|
| 'line'
|
||||||
| 'arc'
|
| 'arc'
|
||||||
| 'all'
|
| 'all'
|
||||||
|
| 'opposite-edge'
|
||||||
|
| 'adjacent-edge'
|
||||||
range: SourceRange
|
range: SourceRange
|
||||||
}
|
}
|
||||||
export type Selections = {
|
export type Selections = {
|
||||||
@ -85,6 +89,7 @@ export async function getEventForSelectWithPoint({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
let _artifact = engineCommandManager.artifactGraph.get(data.entity_id)
|
let _artifact = engineCommandManager.artifactGraph.get(data.entity_id)
|
||||||
|
console.log('entity id', data.entity_id)
|
||||||
if (!_artifact)
|
if (!_artifact)
|
||||||
return {
|
return {
|
||||||
type: 'Set selection',
|
type: 'Set selection',
|
||||||
@ -141,6 +146,27 @@ export async function getEventForSelectWithPoint({
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_artifact.type === 'extrudeEdge') {
|
||||||
|
const codeRef = getExtrudeEdgeCodeRef(
|
||||||
|
_artifact,
|
||||||
|
engineCommandManager.artifactGraph
|
||||||
|
)
|
||||||
|
console.log('codeRef', codeRef)
|
||||||
|
if (err(codeRef)) return null
|
||||||
|
return {
|
||||||
|
type: 'Set selection',
|
||||||
|
data: {
|
||||||
|
selectionType: 'singleCodeCursor',
|
||||||
|
selection: {
|
||||||
|
range: codeRef.range,
|
||||||
|
type:
|
||||||
|
_artifact.subType === 'adjacent'
|
||||||
|
? 'adjacent-edge'
|
||||||
|
: 'opposite-edge',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -531,6 +557,25 @@ function codeToIdSelections(
|
|||||||
bestCandidate = entry
|
bestCandidate = entry
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
(type === 'opposite-edge' || type === 'adjacent-edge') &&
|
||||||
|
entry.artifact.type === 'segment'
|
||||||
|
) {
|
||||||
|
const tweakedType: ExtrudeEdge['subType'] =
|
||||||
|
type === 'opposite-edge' ? 'opposite' : 'adjacent'
|
||||||
|
const edgeArtifact = [
|
||||||
|
...getArtifactsOfTypes(
|
||||||
|
{ keys: entry.artifact.edgeIds, types: ['extrudeEdge'] },
|
||||||
|
engineCommandManager.artifactGraph
|
||||||
|
),
|
||||||
|
].find(([_, edge]) => edge.subType === tweakedType)
|
||||||
|
if (!edgeArtifact) return
|
||||||
|
bestCandidate = {
|
||||||
|
artifact: edgeArtifact[1],
|
||||||
|
selection: { type, range, ...rest },
|
||||||
|
id: edgeArtifact[0],
|
||||||
|
}
|
||||||
|
}
|
||||||
if (type === 'solid2D' && entry.artifact.type === 'path') {
|
if (type === 'solid2D' && entry.artifact.type === 'path') {
|
||||||
const solid = engineCommandManager.artifactGraph.get(
|
const solid = engineCommandManager.artifactGraph.get(
|
||||||
entry.artifact.solid2dId || ''
|
entry.artifact.solid2dId || ''
|
||||||
|
@ -51,4 +51,39 @@ if (typeof window !== 'undefined') {
|
|||||||
padding: 0.2, // padding around the objects
|
padding: 0.2, // padding around the objects
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
;(window as any).getEdgesForAndAskEngineForType = async (faceId: string) => {
|
||||||
|
// Kurt - Debugging tool used help to show edges aren't stable after further 3d operations
|
||||||
|
// if this was added more than a few months ago, it probably can be removed.
|
||||||
|
const face = engineCommandManager.artifactGraph.get(faceId)
|
||||||
|
if (face?.type !== 'wall') {
|
||||||
|
console.log('was expecting a wall, you gave me a ', face?.type)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const extrusion = engineCommandManager.artifactGraph.get(face.extrusionId)
|
||||||
|
if (extrusion?.type !== 'extrusion') {
|
||||||
|
console.log('was expecting an extrusion, but got ', extrusion?.type)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
extrusion.edgeIds.forEach(async (edgeId) => {
|
||||||
|
const result = await engineCommandManager
|
||||||
|
.sendSceneCommand({
|
||||||
|
type: 'modeling_cmd_req',
|
||||||
|
cmd_id: uuidv4(),
|
||||||
|
cmd: {
|
||||||
|
type: 'get_entity_type',
|
||||||
|
entity_id: edgeId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.catch((a) => console.log('error:', a))
|
||||||
|
if (!result?.success) return
|
||||||
|
if (result.resp.type !== 'modeling') return
|
||||||
|
if (result.resp.data.modeling_response.type !== 'get_entity_type') return
|
||||||
|
console.log(
|
||||||
|
'result edge is: ',
|
||||||
|
result.resp.data.modeling_response.data.entity_type,
|
||||||
|
' id: ',
|
||||||
|
edgeId
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1197,6 +1197,11 @@ export const modelingMachine = createMachine(
|
|||||||
ast,
|
ast,
|
||||||
pathToSegmentNode,
|
pathToSegmentNode,
|
||||||
pathToExtrudeNode,
|
pathToExtrudeNode,
|
||||||
|
selection.codeBasedSelections[0].type === 'opposite-edge'
|
||||||
|
? 'oppositeEdge'
|
||||||
|
: selection.codeBasedSelections[0].type === 'adjacent-edge'
|
||||||
|
? 'adjacentEdge'
|
||||||
|
: 'default',
|
||||||
'variableName' in radius
|
'variableName' in radius
|
||||||
? radius.variableIdentifierAst
|
? radius.variableIdentifierAst
|
||||||
: radius.valueAst
|
: radius.valueAst
|
||||||
@ -1206,7 +1211,8 @@ export const modelingMachine = createMachine(
|
|||||||
const { modifiedAst, pathToFilletNode } = addFilletResult
|
const { modifiedAst, pathToFilletNode } = addFilletResult
|
||||||
|
|
||||||
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
const updatedAst = await kclManager.updateAst(modifiedAst, true, {
|
||||||
focusPath: pathToFilletNode,
|
// TODO fix and re-enable
|
||||||
|
// focusPath: pathToFilletNode,
|
||||||
})
|
})
|
||||||
if (updatedAst?.selections) {
|
if (updatedAst?.selections) {
|
||||||
editorManager.selectRange(updatedAst?.selections)
|
editorManager.selectRange(updatedAst?.selections)
|
||||||
|
@ -181,6 +181,48 @@ pub(crate) async fn do_post_extrude(
|
|||||||
vec![]
|
vec![]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
for face_info in face_infos.iter() {
|
||||||
|
if face_info.cap == kittycad::types::ExtrusionFaceCapType::None
|
||||||
|
&& face_info.face_id.is_some()
|
||||||
|
&& face_info.curve_id.is_some()
|
||||||
|
{
|
||||||
|
match args
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
kittycad::types::ModelingCmd::Solid3DGetOppositeEdge {
|
||||||
|
edge_id: face_info.curve_id.unwrap(),
|
||||||
|
object_id: sketch_group.id,
|
||||||
|
face_id: face_info.face_id.unwrap_or_default(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(info) => info,
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("Error fetching opposite edge: {:?}", e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
match args
|
||||||
|
.batch_modeling_cmd(
|
||||||
|
uuid::Uuid::new_v4(),
|
||||||
|
kittycad::types::ModelingCmd::Solid3DGetPrevAdjacentEdge {
|
||||||
|
edge_id: face_info.curve_id.unwrap(),
|
||||||
|
object_id: sketch_group.id,
|
||||||
|
face_id: face_info.face_id.unwrap(),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(info) => info,
|
||||||
|
Err(e) => {
|
||||||
|
eprintln!("Error fetching adjacent edge: {:?}", e);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 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