* remove unused code in modelingMachine * remove unused actions in featureTreeMachine * video.pause is not async * remove unused param in Toolbar * remove unused rectangleOrigin from getRectangleCallExpressions * fmt * parseProjectRoute is not async anymore * prefix unused params with underscore * insertNewStartProfileAt/sketchEntryNodePath param is not used * remove unused constraintType parameter from getRemoveConstraintsTransform * underscore unused params * remove unused scale param in segment.ts * remove unused for in sceneInfra * remove unused sketchEntryNodePath from sceneEntitiesManager methods * remove unused shouldTearDown param * remove unused planeNodePath param from setup draft methods * remove unused ast param
This commit is contained in:
@ -142,9 +142,7 @@ export function Toolbar({
|
|||||||
} else if (isToolbarDropdown(maybeIconConfig)) {
|
} else if (isToolbarDropdown(maybeIconConfig)) {
|
||||||
return {
|
return {
|
||||||
id: maybeIconConfig.id,
|
id: maybeIconConfig.id,
|
||||||
array: maybeIconConfig.array.map((item) =>
|
array: maybeIconConfig.array.map((item) => resolveItemConfig(item)),
|
||||||
resolveItemConfig(item, maybeIconConfig.id)
|
|
||||||
),
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return resolveItemConfig(maybeIconConfig)
|
return resolveItemConfig(maybeIconConfig)
|
||||||
@ -152,8 +150,7 @@ export function Toolbar({
|
|||||||
})
|
})
|
||||||
|
|
||||||
function resolveItemConfig(
|
function resolveItemConfig(
|
||||||
maybeIconConfig: ToolbarItem,
|
maybeIconConfig: ToolbarItem
|
||||||
dropdownId?: string
|
|
||||||
): ToolbarItemResolved {
|
): ToolbarItemResolved {
|
||||||
const isConfiguredAvailable = ['available', 'experimental'].includes(
|
const isConfiguredAvailable = ['available', 'experimental'].includes(
|
||||||
maybeIconConfig.status
|
maybeIconConfig.status
|
||||||
|
@ -218,7 +218,7 @@ export class SceneEntities {
|
|||||||
onCamChange = () => {
|
onCamChange = () => {
|
||||||
const orthoFactor = orthoScale(this.sceneInfra.camControls.camera)
|
const orthoFactor = orthoScale(this.sceneInfra.camControls.camera)
|
||||||
const callbacks: (() => SegmentOverlayPayload | null)[] = []
|
const callbacks: (() => SegmentOverlayPayload | null)[] = []
|
||||||
Object.values(this.activeSegments).forEach((segment, index) => {
|
Object.values(this.activeSegments).forEach((segment, _index) => {
|
||||||
const factor =
|
const factor =
|
||||||
(this.sceneInfra.camControls.camera instanceof OrthographicCamera
|
(this.sceneInfra.camControls.camera instanceof OrthographicCamera
|
||||||
? orthoFactor
|
? orthoFactor
|
||||||
@ -354,7 +354,6 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createSketchAxis(
|
createSketchAxis(
|
||||||
sketchPathToNode: PathToNode,
|
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
up: [number, number, number],
|
up: [number, number, number],
|
||||||
sketchPosition?: [number, number, number]
|
sketchPosition?: [number, number, number]
|
||||||
@ -623,7 +622,6 @@ export class SceneEntities {
|
|||||||
|
|
||||||
const inserted = insertNewStartProfileAt(
|
const inserted = insertNewStartProfileAt(
|
||||||
this.kclManager.ast,
|
this.kclManager.ast,
|
||||||
sketchDetails.sketchEntryNodePath || [],
|
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
sketchDetails.planeNodePath,
|
||||||
[snappedClickPoint.x, snappedClickPoint.y],
|
[snappedClickPoint.x, snappedClickPoint.y],
|
||||||
@ -679,7 +677,6 @@ export class SceneEntities {
|
|||||||
})
|
})
|
||||||
const sketchesInfo = getSketchesInfo({
|
const sketchesInfo = getSketchesInfo({
|
||||||
sketchNodePaths,
|
sketchNodePaths,
|
||||||
ast: maybeModdedAst,
|
|
||||||
variables: execState.variables,
|
variables: execState.variables,
|
||||||
kclManager: this.kclManager,
|
kclManager: this.kclManager,
|
||||||
})
|
})
|
||||||
@ -926,8 +923,7 @@ export class SceneEntities {
|
|||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
up: [number, number, number],
|
up: [number, number, number],
|
||||||
origin: [number, number, number],
|
origin: [number, number, number],
|
||||||
segmentName: 'line' | 'tangentialArc' = 'line',
|
segmentName: 'line' | 'tangentialArc' = 'line'
|
||||||
shouldTearDown = true
|
|
||||||
) => {
|
) => {
|
||||||
const _ast = structuredClone(this.kclManager.ast)
|
const _ast = structuredClone(this.kclManager.ast)
|
||||||
|
|
||||||
@ -1001,7 +997,6 @@ export class SceneEntities {
|
|||||||
|
|
||||||
const sketch = sketchFromPathToNode({
|
const sketch = sketchFromPathToNode({
|
||||||
pathToNode: sketchEntryNodePath,
|
pathToNode: sketchEntryNodePath,
|
||||||
ast: this.kclManager.ast,
|
|
||||||
variables: this.kclManager.variables,
|
variables: this.kclManager.variables,
|
||||||
kclManager: this.kclManager,
|
kclManager: this.kclManager,
|
||||||
})
|
})
|
||||||
@ -1185,7 +1180,6 @@ export class SceneEntities {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
setupDraftRectangle = async (
|
setupDraftRectangle = async (
|
||||||
sketchEntryNodePath: PathToNode,
|
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
planeNodePath: PathToNode,
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
@ -1256,7 +1250,7 @@ export class SceneEntities {
|
|||||||
// as draft segments
|
// as draft segments
|
||||||
startProfileAt.init = createPipeExpression([
|
startProfileAt.init = createPipeExpression([
|
||||||
startProfileAt?.init,
|
startProfileAt?.init,
|
||||||
...getRectangleCallExpressions(rectangleOrigin, tag),
|
...getRectangleCallExpressions(tag),
|
||||||
])
|
])
|
||||||
|
|
||||||
const code = recast(_ast)
|
const code = recast(_ast)
|
||||||
@ -1395,7 +1389,6 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupDraftCenterRectangle = async (
|
setupDraftCenterRectangle = async (
|
||||||
sketchEntryNodePath: PathToNode,
|
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
planeNodePath: PathToNode,
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
@ -1465,7 +1458,7 @@ export class SceneEntities {
|
|||||||
// as draft segments
|
// as draft segments
|
||||||
startProfileAt.init = createPipeExpression([
|
startProfileAt.init = createPipeExpression([
|
||||||
startProfileAt?.init,
|
startProfileAt?.init,
|
||||||
...getRectangleCallExpressions(rectangleOrigin, tag),
|
...getRectangleCallExpressions(tag),
|
||||||
])
|
])
|
||||||
const code = recast(_ast)
|
const code = recast(_ast)
|
||||||
__recastAst = parse(code)
|
__recastAst = parse(code)
|
||||||
@ -1602,7 +1595,6 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupDraftCircleThreePoint = async (
|
setupDraftCircleThreePoint = async (
|
||||||
sketchEntryNodePath: PathToNode,
|
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
planeNodePath: PathToNode,
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
@ -1789,7 +1781,6 @@ export class SceneEntities {
|
|||||||
setupDraftArc = async (
|
setupDraftArc = async (
|
||||||
sketchEntryNodePath: PathToNode,
|
sketchEntryNodePath: PathToNode,
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
up: [number, number, number],
|
up: [number, number, number],
|
||||||
sketchOrigin: [number, number, number],
|
sketchOrigin: [number, number, number],
|
||||||
@ -2026,7 +2017,6 @@ export class SceneEntities {
|
|||||||
setupDraftArcThreePoint = async (
|
setupDraftArcThreePoint = async (
|
||||||
sketchEntryNodePath: PathToNode,
|
sketchEntryNodePath: PathToNode,
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
up: [number, number, number],
|
up: [number, number, number],
|
||||||
sketchOrigin: [number, number, number],
|
sketchOrigin: [number, number, number],
|
||||||
@ -2286,7 +2276,6 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setupDraftCircle = async (
|
setupDraftCircle = async (
|
||||||
sketchEntryNodePath: PathToNode,
|
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
planeNodePath: PathToNode,
|
||||||
forward: [number, number, number],
|
forward: [number, number, number],
|
||||||
@ -2541,7 +2530,6 @@ export class SceneEntities {
|
|||||||
|
|
||||||
const sketch = sketchFromPathToNode({
|
const sketch = sketchFromPathToNode({
|
||||||
pathToNode,
|
pathToNode,
|
||||||
ast: this.kclManager.ast,
|
|
||||||
variables: this.kclManager.variables,
|
variables: this.kclManager.variables,
|
||||||
kclManager: this.kclManager,
|
kclManager: this.kclManager,
|
||||||
})
|
})
|
||||||
@ -3095,7 +3083,6 @@ export class SceneEntities {
|
|||||||
const variables = execState.variables
|
const variables = execState.variables
|
||||||
const sketchesInfo = getSketchesInfo({
|
const sketchesInfo = getSketchesInfo({
|
||||||
sketchNodePaths,
|
sketchNodePaths,
|
||||||
ast: truncatedAst,
|
|
||||||
variables,
|
variables,
|
||||||
kclManager: this.kclManager,
|
kclManager: this.kclManager,
|
||||||
})
|
})
|
||||||
@ -3418,7 +3405,7 @@ export class SceneEntities {
|
|||||||
}
|
}
|
||||||
this.editorManager.setHighlightRange([defaultSourceRange()])
|
this.editorManager.setHighlightRange([defaultSourceRange()])
|
||||||
},
|
},
|
||||||
onMouseLeave: ({ selected, ...rest }: OnMouseEnterLeaveArgs) => {
|
onMouseLeave: ({ selected }: OnMouseEnterLeaveArgs) => {
|
||||||
this.editorManager.setHighlightRange([defaultSourceRange()])
|
this.editorManager.setHighlightRange([defaultSourceRange()])
|
||||||
const parent = getParentGroup(
|
const parent = getParentGroup(
|
||||||
selected,
|
selected,
|
||||||
@ -3782,12 +3769,10 @@ function prepareTruncatedAst(
|
|||||||
|
|
||||||
function sketchFromPathToNode({
|
function sketchFromPathToNode({
|
||||||
pathToNode,
|
pathToNode,
|
||||||
ast,
|
|
||||||
variables,
|
variables,
|
||||||
kclManager,
|
kclManager,
|
||||||
}: {
|
}: {
|
||||||
pathToNode: PathToNode
|
pathToNode: PathToNode
|
||||||
ast: Program
|
|
||||||
variables: VariableMap
|
variables: VariableMap
|
||||||
kclManager: KclManager
|
kclManager: KclManager
|
||||||
}): Sketch | null | Error {
|
}): Sketch | null | Error {
|
||||||
@ -3837,7 +3822,6 @@ export function getSketchQuaternion(
|
|||||||
): Quaternion | Error {
|
): Quaternion | Error {
|
||||||
const sketch = sketchFromPathToNode({
|
const sketch = sketchFromPathToNode({
|
||||||
pathToNode: sketchPathToNode,
|
pathToNode: sketchPathToNode,
|
||||||
ast: kclManager.ast,
|
|
||||||
variables: kclManager.variables,
|
variables: kclManager.variables,
|
||||||
kclManager,
|
kclManager,
|
||||||
})
|
})
|
||||||
@ -3879,12 +3863,10 @@ function massageFormats(
|
|||||||
|
|
||||||
function getSketchesInfo({
|
function getSketchesInfo({
|
||||||
sketchNodePaths,
|
sketchNodePaths,
|
||||||
ast,
|
|
||||||
variables,
|
variables,
|
||||||
kclManager,
|
kclManager,
|
||||||
}: {
|
}: {
|
||||||
sketchNodePaths: PathToNode[]
|
sketchNodePaths: PathToNode[]
|
||||||
ast: Node<Program>
|
|
||||||
variables: VariableMap
|
variables: VariableMap
|
||||||
kclManager: KclManager
|
kclManager: KclManager
|
||||||
}): {
|
}): {
|
||||||
@ -3898,7 +3880,6 @@ function getSketchesInfo({
|
|||||||
for (const path of sketchNodePaths) {
|
for (const path of sketchNodePaths) {
|
||||||
const sketch = sketchFromPathToNode({
|
const sketch = sketchFromPathToNode({
|
||||||
pathToNode: path,
|
pathToNode: path,
|
||||||
ast,
|
|
||||||
variables,
|
variables,
|
||||||
kclManager,
|
kclManager,
|
||||||
})
|
})
|
||||||
|
@ -101,7 +101,6 @@ export class SceneInfra {
|
|||||||
readonly renderer: WebGLRenderer
|
readonly renderer: WebGLRenderer
|
||||||
readonly labelRenderer: CSS2DRenderer
|
readonly labelRenderer: CSS2DRenderer
|
||||||
readonly camControls: CameraControls
|
readonly camControls: CameraControls
|
||||||
private readonly fov = 45
|
|
||||||
isFovAnimationInProgress = false
|
isFovAnimationInProgress = false
|
||||||
_baseUnitMultiplier = 1
|
_baseUnitMultiplier = 1
|
||||||
_theme: Themes = Themes.System
|
_theme: Themes = Themes.System
|
||||||
|
@ -307,7 +307,6 @@ class StraightSegment implements SegmentUtils {
|
|||||||
updateLine(snapLine, {
|
updateLine(snapLine, {
|
||||||
from: snapLineFrom,
|
from: snapLineFrom,
|
||||||
to: [snapLineTo.x, snapLineTo.y],
|
to: [snapLineTo.x, snapLineTo.y],
|
||||||
scale,
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1076,7 +1075,6 @@ class ArcSegment implements SegmentUtils {
|
|||||||
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
||||||
startAngle: 0,
|
startAngle: 0,
|
||||||
endAngle,
|
endAngle,
|
||||||
scale,
|
|
||||||
color: grey, // Red color for the angle indicator
|
color: grey, // Red color for the angle indicator
|
||||||
})
|
})
|
||||||
angleIndicator.name = 'angleIndicator'
|
angleIndicator.name = 'angleIndicator'
|
||||||
@ -1087,7 +1085,6 @@ class ArcSegment implements SegmentUtils {
|
|||||||
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
||||||
startAngle: 0,
|
startAngle: 0,
|
||||||
endAngle: (endAngle * Math.PI) / 180,
|
endAngle: (endAngle * Math.PI) / 180,
|
||||||
scale,
|
|
||||||
color: grey, // Green color for the end angle indicator
|
color: grey, // Green color for the end angle indicator
|
||||||
})
|
})
|
||||||
endAngleIndicator.name = 'endAngleIndicator'
|
endAngleIndicator.name = 'endAngleIndicator'
|
||||||
@ -1275,12 +1272,12 @@ class ArcSegment implements SegmentUtils {
|
|||||||
|
|
||||||
const centerToFromLine = group.getObjectByName(ARC_CENTER_TO_FROM) as Line
|
const centerToFromLine = group.getObjectByName(ARC_CENTER_TO_FROM) as Line
|
||||||
if (centerToFromLine) {
|
if (centerToFromLine) {
|
||||||
updateLine(centerToFromLine, { from: center, to: from, scale })
|
updateLine(centerToFromLine, { from: center, to: from })
|
||||||
centerToFromLine.visible = isHandlesVisible
|
centerToFromLine.visible = isHandlesVisible
|
||||||
}
|
}
|
||||||
const centerToToLine = group.getObjectByName(ARC_CENTER_TO_TO) as Line
|
const centerToToLine = group.getObjectByName(ARC_CENTER_TO_TO) as Line
|
||||||
if (centerToToLine) {
|
if (centerToToLine) {
|
||||||
updateLine(centerToToLine, { from: center, to, scale })
|
updateLine(centerToToLine, { from: center, to })
|
||||||
centerToToLine.visible = isHandlesVisible
|
centerToToLine.visible = isHandlesVisible
|
||||||
}
|
}
|
||||||
const angleReferenceLine = group.getObjectByName(
|
const angleReferenceLine = group.getObjectByName(
|
||||||
@ -1290,7 +1287,6 @@ class ArcSegment implements SegmentUtils {
|
|||||||
updateLine(angleReferenceLine, {
|
updateLine(angleReferenceLine, {
|
||||||
from: center,
|
from: center,
|
||||||
to: [center[0] + 34 * scale, center[1]],
|
to: [center[0] + 34 * scale, center[1]],
|
||||||
scale,
|
|
||||||
})
|
})
|
||||||
angleReferenceLine.visible = isHandlesVisible
|
angleReferenceLine.visible = isHandlesVisible
|
||||||
}
|
}
|
||||||
@ -1536,7 +1532,7 @@ class ThreePointArcSegment implements SegmentUtils {
|
|||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
const overlays: SegmentOverlays = {}
|
const overlays: SegmentOverlays = {}
|
||||||
const overlayDetails = [p2Handle, p3Handle].map((handle, index) =>
|
const overlayDetails = [p2Handle, p3Handle].map((handle, _index) =>
|
||||||
sceneInfra.updateOverlayDetails({
|
sceneInfra.updateOverlayDetails({
|
||||||
handle: handle,
|
handle: handle,
|
||||||
group,
|
group,
|
||||||
@ -2042,11 +2038,7 @@ function createLine({
|
|||||||
|
|
||||||
function updateLine(
|
function updateLine(
|
||||||
line: Line,
|
line: Line,
|
||||||
{
|
{ from, to }: { from: [number, number]; to: [number, number] }
|
||||||
from,
|
|
||||||
to,
|
|
||||||
scale,
|
|
||||||
}: { from: [number, number]; to: [number, number]; scale: number }
|
|
||||||
) {
|
) {
|
||||||
// Implementation for updating a line
|
// Implementation for updating a line
|
||||||
const points = [
|
const points = [
|
||||||
@ -2061,14 +2053,12 @@ function createAngleIndicator({
|
|||||||
radius,
|
radius,
|
||||||
startAngle,
|
startAngle,
|
||||||
endAngle,
|
endAngle,
|
||||||
scale,
|
|
||||||
color,
|
color,
|
||||||
}: {
|
}: {
|
||||||
center: [number, number]
|
center: [number, number]
|
||||||
radius: number
|
radius: number
|
||||||
startAngle: number
|
startAngle: number
|
||||||
endAngle: number
|
endAngle: number
|
||||||
scale: number
|
|
||||||
color: number
|
color: number
|
||||||
}): Line {
|
}): Line {
|
||||||
// Implementation for creating an angle indicator
|
// Implementation for creating an angle indicator
|
||||||
|
@ -36,7 +36,7 @@ export function AstExplorer() {
|
|||||||
type="checkbox"
|
type="checkbox"
|
||||||
className="form-checkbox"
|
className="form-checkbox"
|
||||||
checked={filterKeys.includes(key)}
|
checked={filterKeys.includes(key)}
|
||||||
onChange={(e) => {
|
onChange={(_e) => {
|
||||||
if (filterKeys.includes(key)) {
|
if (filterKeys.includes(key)) {
|
||||||
setFilterKeys(filterKeys.filter((k) => k !== key))
|
setFilterKeys(filterKeys.filter((k) => k !== key))
|
||||||
} else {
|
} else {
|
||||||
@ -51,7 +51,7 @@ export function AstExplorer() {
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
className="h-full relative"
|
className="h-full relative"
|
||||||
onMouseLeave={(e) => {
|
onMouseLeave={(_e) => {
|
||||||
editorManager.setHighlightRange([defaultSourceRange()])
|
editorManager.setHighlightRange([defaultSourceRange()])
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -44,7 +44,7 @@ function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
|||||||
[argumentsToSubmit, selectedCommand]
|
[argumentsToSubmit, selectedCommand]
|
||||||
)
|
)
|
||||||
|
|
||||||
Object.keys(argumentsToSubmit).forEach((key, i) => {
|
Object.keys(argumentsToSubmit).forEach((key, _i) => {
|
||||||
const arg = selectedCommand?.args ? selectedCommand?.args[key] : undefined
|
const arg = selectedCommand?.args ? selectedCommand?.args[key] : undefined
|
||||||
if (!arg) return
|
if (!arg) return
|
||||||
})
|
})
|
||||||
@ -75,7 +75,7 @@ function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
|||||||
className="absolute opacity-0 inset-0 pointer-events-none"
|
className="absolute opacity-0 inset-0 pointer-events-none"
|
||||||
onSubmit={submitCommand}
|
onSubmit={submitCommand}
|
||||||
>
|
>
|
||||||
{Object.entries(argumentsToSubmit).map(([key, value], i) => {
|
{Object.entries(argumentsToSubmit).map(([key, value], _i) => {
|
||||||
const arg = selectedCommand?.args
|
const arg = selectedCommand?.args
|
||||||
? selectedCommand?.args[key]
|
? selectedCommand?.args[key]
|
||||||
: undefined
|
: undefined
|
||||||
|
@ -1489,7 +1489,6 @@ export const ModelingMachineProvider = ({
|
|||||||
return reject('No sketch details or data')
|
return reject('No sketch details or data')
|
||||||
|
|
||||||
const result = await sceneEntitiesManager.setupDraftCircle(
|
const result = await sceneEntitiesManager.setupDraftCircle(
|
||||||
sketchDetails.sketchEntryNodePath,
|
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
sketchDetails.planeNodePath,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -1510,7 +1509,6 @@ export const ModelingMachineProvider = ({
|
|||||||
|
|
||||||
const result =
|
const result =
|
||||||
await sceneEntitiesManager.setupDraftCircleThreePoint(
|
await sceneEntitiesManager.setupDraftCircleThreePoint(
|
||||||
sketchDetails.sketchEntryNodePath,
|
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
sketchDetails.planeNodePath,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -1531,7 +1529,6 @@ export const ModelingMachineProvider = ({
|
|||||||
return reject('No sketch details or data')
|
return reject('No sketch details or data')
|
||||||
|
|
||||||
const result = await sceneEntitiesManager.setupDraftRectangle(
|
const result = await sceneEntitiesManager.setupDraftRectangle(
|
||||||
sketchDetails.sketchEntryNodePath,
|
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
sketchDetails.planeNodePath,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -1550,7 +1547,6 @@ export const ModelingMachineProvider = ({
|
|||||||
if (!sketchDetails || !data)
|
if (!sketchDetails || !data)
|
||||||
return reject('No sketch details or data')
|
return reject('No sketch details or data')
|
||||||
const result = await sceneEntitiesManager.setupDraftCenterRectangle(
|
const result = await sceneEntitiesManager.setupDraftCenterRectangle(
|
||||||
sketchDetails.sketchEntryNodePath,
|
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
sketchDetails.planeNodePath,
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
@ -1571,7 +1567,6 @@ export const ModelingMachineProvider = ({
|
|||||||
const result = await sceneEntitiesManager.setupDraftArcThreePoint(
|
const result = await sceneEntitiesManager.setupDraftArcThreePoint(
|
||||||
sketchDetails.sketchEntryNodePath,
|
sketchDetails.sketchEntryNodePath,
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
sketchDetails.yAxis,
|
sketchDetails.yAxis,
|
||||||
sketchDetails.origin,
|
sketchDetails.origin,
|
||||||
@ -1590,7 +1585,6 @@ export const ModelingMachineProvider = ({
|
|||||||
const result = await sceneEntitiesManager.setupDraftArc(
|
const result = await sceneEntitiesManager.setupDraftArc(
|
||||||
sketchDetails.sketchEntryNodePath,
|
sketchDetails.sketchEntryNodePath,
|
||||||
sketchDetails.sketchNodePaths,
|
sketchDetails.sketchNodePaths,
|
||||||
sketchDetails.planeNodePath,
|
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
sketchDetails.yAxis,
|
sketchDetails.yAxis,
|
||||||
sketchDetails.origin,
|
sketchDetails.origin,
|
||||||
|
@ -55,9 +55,6 @@ export const FeatureTreePane = () => {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
sendEditFlowStart: () => {
|
|
||||||
modelingSend({ type: 'Enter sketch' })
|
|
||||||
},
|
|
||||||
scrollToError: () => {
|
scrollToError: () => {
|
||||||
editorManager.scrollToFirstErrorDiagnosticIfExists()
|
editorManager.scrollToFirstErrorDiagnosticIfExists()
|
||||||
},
|
},
|
||||||
|
@ -22,7 +22,7 @@ export const MemoryPaneMenu = () => {
|
|||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(JSON.stringify(variables))
|
.writeText(JSON.stringify(variables))
|
||||||
.then(() => toast.success('Program memory copied to clipboard'))
|
.then(() => toast.success('Program memory copied to clipboard'))
|
||||||
.catch((e) =>
|
.catch((_e) =>
|
||||||
trap(new Error('Failed to copy program memory to clipboard'))
|
trap(new Error('Failed to copy program memory to clipboard'))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -58,8 +58,7 @@ export function removeConstrainingValuesInfo({
|
|||||||
|
|
||||||
const transforms = getRemoveConstraintsTransforms(
|
const transforms = getRemoveConstraintsTransforms(
|
||||||
updatedSelectionRanges,
|
updatedSelectionRanges,
|
||||||
kclManager.ast,
|
kclManager.ast
|
||||||
'removeConstrainingValues'
|
|
||||||
)
|
)
|
||||||
if (err(transforms)) return transforms
|
if (err(transforms)) return transforms
|
||||||
|
|
||||||
|
@ -1005,7 +1005,7 @@ sketch003 = startSketchOn(XZ)
|
|||||||
] as const
|
] as const
|
||||||
test.each(cases)(
|
test.each(cases)(
|
||||||
'%s',
|
'%s',
|
||||||
async (name, { codeBefore, codeAfter, lineOfInterest, type }) => {
|
async (_name, { codeBefore, codeAfter, lineOfInterest, type }) => {
|
||||||
// const lineOfInterest = 'line(end = [-2.94, 2.7])'
|
// const lineOfInterest = 'line(end = [-2.94, 2.7])'
|
||||||
const ast = assertParse(codeBefore)
|
const ast = assertParse(codeBefore)
|
||||||
const execState = await enginelessExecutor(ast)
|
const execState = await enginelessExecutor(ast)
|
||||||
|
@ -103,7 +103,6 @@ export function startSketchOnDefault(
|
|||||||
|
|
||||||
export function insertNewStartProfileAt(
|
export function insertNewStartProfileAt(
|
||||||
node: Node<Program>,
|
node: Node<Program>,
|
||||||
sketchEntryNodePath: PathToNode,
|
|
||||||
sketchNodePaths: PathToNode[],
|
sketchNodePaths: PathToNode[],
|
||||||
planeNodePath: PathToNode,
|
planeNodePath: PathToNode,
|
||||||
at: [number, number],
|
at: [number, number],
|
||||||
|
@ -264,7 +264,7 @@ export async function deleteFromSelection(
|
|||||||
).filter((wall) => wall?.pathIds?.length)
|
).filter((wall) => wall?.pathIds?.length)
|
||||||
const wallIds = wallsWithDependencies.map((wall) => wall.id)
|
const wallIds = wallsWithDependencies.map((wall) => wall.id)
|
||||||
|
|
||||||
Object.entries(variables).forEach(([key, _var]) => {
|
Object.entries(variables).forEach(([_key, _var]) => {
|
||||||
if (
|
if (
|
||||||
_var?.type === 'Face' &&
|
_var?.type === 'Face' &&
|
||||||
wallIds.includes(_var.value.artifactId)
|
wallIds.includes(_var.value.artifactId)
|
||||||
|
@ -631,7 +631,7 @@ describe('Testing traverse and pathToNode', () => {
|
|||||||
'very nested, array, object, callExpression, array, memberExpression',
|
'very nested, array, object, callExpression, array, memberExpression',
|
||||||
'.yo',
|
'.yo',
|
||||||
],
|
],
|
||||||
])('testing %s', async (testName, literalOfInterest) => {
|
])('testing %s', async (_testName, literalOfInterest) => {
|
||||||
const code = `myVar = 5
|
const code = `myVar = 5
|
||||||
sketch001 = startSketchOn(XZ)
|
sketch001 = startSketchOn(XZ)
|
||||||
|> startProfile(at = [3.29, 7.86])
|
|> startProfile(at = [3.29, 7.86])
|
||||||
|
@ -1244,8 +1244,7 @@ const transformMap: TransformMap = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getRemoveConstraintsTransform(
|
export function getRemoveConstraintsTransform(
|
||||||
sketchFnExp: CallExpressionKw,
|
sketchFnExp: CallExpressionKw
|
||||||
constraintType: ConstraintType
|
|
||||||
): TransformInfo | false {
|
): TransformInfo | false {
|
||||||
let name = sketchFnExp.callee.name.name as ToolTip
|
let name = sketchFnExp.callee.name.name as ToolTip
|
||||||
if (!toolTips.includes(name)) {
|
if (!toolTips.includes(name)) {
|
||||||
@ -1779,8 +1778,7 @@ export function getTransformInfos(
|
|||||||
|
|
||||||
export function getRemoveConstraintsTransforms(
|
export function getRemoveConstraintsTransforms(
|
||||||
selectionRanges: Selections,
|
selectionRanges: Selections,
|
||||||
ast: Program,
|
ast: Program
|
||||||
constraintType: ConstraintType
|
|
||||||
): TransformInfo[] | Error {
|
): TransformInfo[] | Error {
|
||||||
const nodes = selectionRanges.graphSelections.map(({ codeRef }) =>
|
const nodes = selectionRanges.graphSelections.map(({ codeRef }) =>
|
||||||
getNodeFromPath<Expr>(ast, codeRef.pathToNode)
|
getNodeFromPath<Expr>(ast, codeRef.pathToNode)
|
||||||
@ -1796,7 +1794,7 @@ export function getRemoveConstraintsTransforms(
|
|||||||
|
|
||||||
const node = nodeMeta.node
|
const node = nodeMeta.node
|
||||||
if (node?.type === 'CallExpressionKw') {
|
if (node?.type === 'CallExpressionKw') {
|
||||||
return getRemoveConstraintsTransform(node, constraintType)
|
return getRemoveConstraintsTransform(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
|
@ -64,7 +64,7 @@ export function createApplicationCommands({
|
|||||||
isDesktop() &&
|
isDesktop() &&
|
||||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||||
skip: true,
|
skip: true,
|
||||||
options: (_, context) => {
|
options: (_, _context) => {
|
||||||
const { folders } = systemIOActor.getSnapshot().context
|
const { folders } = systemIOActor.getSnapshot().context
|
||||||
const options: CommandArgumentOption<string>[] = []
|
const options: CommandArgumentOption<string>[] = []
|
||||||
folders.forEach((folder) => {
|
folders.forEach((folder) => {
|
||||||
@ -217,7 +217,7 @@ export function createApplicationCommands({
|
|||||||
isDesktop() &&
|
isDesktop() &&
|
||||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||||
skip: true,
|
skip: true,
|
||||||
options: (_, context) => {
|
options: (_, _context) => {
|
||||||
const { folders } = systemIOActor.getSnapshot().context
|
const { folders } = systemIOActor.getSnapshot().context
|
||||||
const options: CommandArgumentOption<string>[] = []
|
const options: CommandArgumentOption<string>[] = []
|
||||||
folders.forEach((folder) => {
|
folders.forEach((folder) => {
|
||||||
|
@ -825,7 +825,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
Object.entries(kclManager.execState.variables)
|
Object.entries(kclManager.execState.variables)
|
||||||
// TODO: @franknoirot && @jtran would love to make this go away soon 🥺
|
// TODO: @franknoirot && @jtran would love to make this go away soon 🥺
|
||||||
.filter(([_, variable]) => variable?.type === 'Number')
|
.filter(([_, variable]) => variable?.type === 'Number')
|
||||||
.map(([name, variable]) => {
|
.map(([name, _variable]) => {
|
||||||
const node = getVariableDeclaration(kclManager.ast, name)
|
const node = getVariableDeclaration(kclManager.ast, name)
|
||||||
if (node === undefined) return
|
if (node === undefined) return
|
||||||
const range: SourceRange = [node.start, node.end, node.moduleId]
|
const range: SourceRange = [node.start, node.end, node.moduleId]
|
||||||
@ -926,7 +926,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
inputType: 'kcl',
|
inputType: 'kcl',
|
||||||
required: true,
|
required: true,
|
||||||
createVariable: 'byDefault',
|
createVariable: 'byDefault',
|
||||||
variableName(commandBarContext, machineContext) {
|
variableName(commandBarContext, _machineContext) {
|
||||||
const { currentValue } = commandBarContext.argumentsToSubmit
|
const { currentValue } = commandBarContext.argumentsToSubmit
|
||||||
if (
|
if (
|
||||||
!currentValue ||
|
!currentValue ||
|
||||||
|
@ -224,7 +224,7 @@ export function createNamedViewsCommand() {
|
|||||||
name: {
|
name: {
|
||||||
required: true,
|
required: true,
|
||||||
inputType: 'options',
|
inputType: 'options',
|
||||||
options: (commandBar, machineContext) => {
|
options: (_commandBar, _machineContext) => {
|
||||||
const settings = getSettings()
|
const settings = getSettings()
|
||||||
const namedViews = {
|
const namedViews = {
|
||||||
...settings.app.namedViews.current,
|
...settings.app.namedViews.current,
|
||||||
|
@ -222,7 +222,7 @@ export function createProjectCommands({
|
|||||||
isDesktop() &&
|
isDesktop() &&
|
||||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||||
skip: true,
|
skip: true,
|
||||||
options: (_, context) => {
|
options: (_, _context) => {
|
||||||
const folders = folderSnapshot()
|
const folders = folderSnapshot()
|
||||||
const options: CommandArgumentOption<string>[] = []
|
const options: CommandArgumentOption<string>[] = []
|
||||||
folders.forEach((folder) => {
|
folders.forEach((folder) => {
|
||||||
|
@ -15,7 +15,7 @@ export function createRouteCommands(
|
|||||||
groupId: 'routes',
|
groupId: 'routes',
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
needsReview: false,
|
needsReview: false,
|
||||||
onSubmit: (data) => {
|
onSubmit: (_data) => {
|
||||||
const path = location.pathname.includes(PATHS.FILE)
|
const path = location.pathname.includes(PATHS.FILE)
|
||||||
? filePath + PATHS.TELEMETRY + '?tab=project'
|
? filePath + PATHS.TELEMETRY + '?tab=project'
|
||||||
: PATHS.HOME + PATHS.TELEMETRY
|
: PATHS.HOME + PATHS.TELEMETRY
|
||||||
@ -30,7 +30,7 @@ export function createRouteCommands(
|
|||||||
groupId: 'routes',
|
groupId: 'routes',
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
needsReview: false,
|
needsReview: false,
|
||||||
onSubmit: (data) => {
|
onSubmit: (_data) => {
|
||||||
navigate(PATHS.HOME)
|
navigate(PATHS.HOME)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ export function createRouteCommands(
|
|||||||
groupId: 'routes',
|
groupId: 'routes',
|
||||||
icon: 'settings',
|
icon: 'settings',
|
||||||
needsReview: false,
|
needsReview: false,
|
||||||
onSubmit: (data) => {
|
onSubmit: (_data) => {
|
||||||
const path = location.pathname.includes(PATHS.FILE)
|
const path = location.pathname.includes(PATHS.FILE)
|
||||||
? filePath + PATHS.SETTINGS + '?tab=project'
|
? filePath + PATHS.SETTINGS + '?tab=project'
|
||||||
: PATHS.HOME + PATHS.SETTINGS
|
: PATHS.HOME + PATHS.SETTINGS
|
||||||
|
@ -441,7 +441,7 @@ export class CoreDumpManager {
|
|||||||
screenshot()
|
screenshot()
|
||||||
.then((screenshotStr: string) => screenshotStr)
|
.then((screenshotStr: string) => screenshotStr)
|
||||||
// maybe rust should handle an error, but an empty string at least doesn't cause the core dump to fail entirely
|
// maybe rust should handle an error, but an empty string at least doesn't cause the core dump to fail entirely
|
||||||
.catch((error: any) => ``)
|
.catch((_error: any) => ``)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ describe('testing parseProjectRoute', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
const route = '/home/somebody/projects/project'
|
const route = '/home/somebody/projects/project'
|
||||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||||
projectName: 'project',
|
projectName: 'project',
|
||||||
projectPath: route,
|
projectPath: route,
|
||||||
currentFileName: null,
|
currentFileName: null,
|
||||||
@ -28,7 +28,7 @@ describe('testing parseProjectRoute', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
const route = '/home/somebody/projects'
|
const route = '/home/somebody/projects'
|
||||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||||
projectName: null,
|
projectName: null,
|
||||||
projectPath: route,
|
projectPath: route,
|
||||||
currentFileName: null,
|
currentFileName: null,
|
||||||
@ -44,7 +44,7 @@ describe('testing parseProjectRoute', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
const route = '/home/somebody/projects/assembly/main.kcl'
|
const route = '/home/somebody/projects/assembly/main.kcl'
|
||||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||||
projectName: 'assembly',
|
projectName: 'assembly',
|
||||||
projectPath: '/home/somebody/projects/assembly',
|
projectPath: '/home/somebody/projects/assembly',
|
||||||
currentFileName: 'main.kcl',
|
currentFileName: 'main.kcl',
|
||||||
@ -60,7 +60,7 @@ describe('testing parseProjectRoute', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
const route = '/home/somebody/projects/assembly/subdir/main.kcl'
|
const route = '/home/somebody/projects/assembly/subdir/main.kcl'
|
||||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||||
projectName: 'assembly',
|
projectName: 'assembly',
|
||||||
projectPath: '/home/somebody/projects/assembly',
|
projectPath: '/home/somebody/projects/assembly',
|
||||||
currentFileName: 'main.kcl',
|
currentFileName: 'main.kcl',
|
||||||
@ -70,7 +70,7 @@ describe('testing parseProjectRoute', () => {
|
|||||||
it('should work in the browser context', async () => {
|
it('should work in the browser context', async () => {
|
||||||
let config = {}
|
let config = {}
|
||||||
const route = '/browser/main.kcl'
|
const route = '/browser/main.kcl'
|
||||||
expect(await parseProjectRoute(config, route, undefined)).toEqual({
|
expect(parseProjectRoute(config, route, undefined)).toEqual({
|
||||||
projectName: 'browser',
|
projectName: 'browser',
|
||||||
projectPath: '/browser',
|
projectPath: '/browser',
|
||||||
currentFileName: 'main.kcl',
|
currentFileName: 'main.kcl',
|
||||||
|
@ -51,10 +51,7 @@ function angledLine(
|
|||||||
* |> angledLine(angle = segAng(a), length = -segLen(a), tag = $c)
|
* |> angledLine(angle = segAng(a), length = -segLen(a), tag = $c)
|
||||||
* |> close()
|
* |> close()
|
||||||
*/
|
*/
|
||||||
export const getRectangleCallExpressions = (
|
export const getRectangleCallExpressions = (tag: string) => {
|
||||||
rectangleOrigin: [number, number],
|
|
||||||
tag: string
|
|
||||||
) => {
|
|
||||||
return [
|
return [
|
||||||
angledLine(
|
angledLine(
|
||||||
createLiteral(0), // 0 deg
|
createLiteral(0), // 0 deg
|
||||||
|
@ -322,7 +322,7 @@ export function createSettings() {
|
|||||||
}),
|
}),
|
||||||
namedViews: new Setting<{ [key in string]: NamedView }>({
|
namedViews: new Setting<{ [key in string]: NamedView }>({
|
||||||
defaultValue: {},
|
defaultValue: {},
|
||||||
validate: (v) => true,
|
validate: (_v) => true,
|
||||||
hideOnLevel: 'user',
|
hideOnLevel: 'user',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
@ -455,7 +455,7 @@ export function clearSettingsAtLevel(
|
|||||||
allSettings: typeof settings,
|
allSettings: typeof settings,
|
||||||
level: SettingsLevel
|
level: SettingsLevel
|
||||||
) {
|
) {
|
||||||
Object.entries(allSettings).forEach(([category, settingsCategory]) => {
|
Object.entries(allSettings).forEach(([_category, settingsCategory]) => {
|
||||||
Object.entries(settingsCategory).forEach(
|
Object.entries(settingsCategory).forEach(
|
||||||
([_, settingValue]: [string, Setting]) => {
|
([_, settingValue]: [string, Setting]) => {
|
||||||
settingValue[level] = undefined
|
settingValue[level] = undefined
|
||||||
|
@ -58,7 +58,7 @@ export async function holdOntoVideoFrameInCanvas(
|
|||||||
video: HTMLVideoElement,
|
video: HTMLVideoElement,
|
||||||
canvas: HTMLCanvasElement
|
canvas: HTMLCanvasElement
|
||||||
) {
|
) {
|
||||||
await video.pause()
|
video.pause()
|
||||||
canvas.width = video.videoWidth
|
canvas.width = video.videoWidth
|
||||||
canvas.height = video.videoHeight
|
canvas.height = video.videoHeight
|
||||||
canvas.style.width = video.videoWidth + 'px'
|
canvas.style.width = video.videoWidth + 'px'
|
||||||
@ -119,7 +119,7 @@ export const engineStreamMachine = setup({
|
|||||||
const video = context.videoRef.current
|
const video = context.videoRef.current
|
||||||
if (!video) return
|
if (!video) return
|
||||||
|
|
||||||
await video.pause()
|
video.pause()
|
||||||
|
|
||||||
const canvas = context.canvasRef.current
|
const canvas = context.canvasRef.current
|
||||||
if (!canvas) return
|
if (!canvas) return
|
||||||
|
@ -253,9 +253,7 @@ export const featureTreeMachine = setup({
|
|||||||
}),
|
}),
|
||||||
sendSelectionEvent: () => {},
|
sendSelectionEvent: () => {},
|
||||||
openCodePane: () => {},
|
openCodePane: () => {},
|
||||||
sendEditFlowStart: () => {},
|
|
||||||
scrollToError: () => {},
|
scrollToError: () => {},
|
||||||
sendDeleteSelection: () => {},
|
|
||||||
},
|
},
|
||||||
}).createMachine({
|
}).createMachine({
|
||||||
/** @xstate-layout N4IgpgJg5mDOIC5QDMwEMAuBXATmAKnmAHQCWEANmAMRQD2+dA0gMYUDKduLYA2gAwBdRKAAOdWKQyk6AOxEgAHogCMAFhXF+27QDYArAGZ9AJhWGAHIYA0IAJ6q1ATkPELFkxf1qL-NQHYLNX0AXxDbVExcAiIyShpYMCoWDAB5UTAcTBlZAWEkEHFJaTkFZQQVJ00dPSNTcytbBwRnXWJ-fR0Op3cXJzUwiPRsPEIwEnIqajBZDEyAUQgpADEKOgB3PIUiqRyy1V1qmoNjM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OpC06hVzqLWWuVGFr4W5uExDY+EZMEQqB6mKBSykvD-jOZ5Q+Mtc5Z0jkQq+gryjnF2eQwJVCQnugMFiPJnpCTqCsN+Upmds4syeVSlovz-EUKCdQ0J+FibtDJv6T0NcVydxBbE1VAqWbQqGfAqy-ogjEBFkwlcdpBQGuaEEVwhIMyCnMISV4NN8X6z5WquQSs5Z5zjpZO23iEBnO9pRZwIFN6BG8A3AkTtJJ+CtK6S1-81GcNPjgTV4lva40ou4YwkohretUJKO+OggjsucKGnlcFj60jWknIe7YlRdg8Toh1wqfFOWrYEKwnRfCekbRUIiNoai2n6A8EU1yw04NLX2gZmrAhFkDQcl0v0ghIOIqKama6nSbrCEAA */
|
||||||
|
@ -136,8 +136,6 @@ import { uuidv4 } from '@src/lib/utils'
|
|||||||
import { deleteNodeInExtrudePipe } from '@src/lang/modifyAst/deleteNodeInExtrudePipe'
|
import { deleteNodeInExtrudePipe } from '@src/lang/modifyAst/deleteNodeInExtrudePipe'
|
||||||
import type { ImportStatement } from '@rust/kcl-lib/bindings/ImportStatement'
|
import type { ImportStatement } from '@rust/kcl-lib/bindings/ImportStatement'
|
||||||
|
|
||||||
export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
|
||||||
|
|
||||||
export type SetSelections =
|
export type SetSelections =
|
||||||
| {
|
| {
|
||||||
selectionType: 'singleCodeCursor'
|
selectionType: 'singleCodeCursor'
|
||||||
@ -1135,7 +1133,6 @@ export const modelingMachine = setup({
|
|||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||||
sceneEntitiesManager.createSketchAxis(
|
sceneEntitiesManager.createSketchAxis(
|
||||||
sketchDetails.sketchEntryNodePath || [],
|
|
||||||
sketchDetails.zAxis,
|
sketchDetails.zAxis,
|
||||||
sketchDetails.yAxis,
|
sketchDetails.yAxis,
|
||||||
sketchDetails.origin
|
sketchDetails.origin
|
||||||
@ -4713,41 +4710,3 @@ export function pipeHasCircle({
|
|||||||
)
|
)
|
||||||
return hasCircle
|
return hasCircle
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canRectangleOrCircleTool({
|
|
||||||
sketchDetails,
|
|
||||||
}: {
|
|
||||||
sketchDetails: SketchDetails | null
|
|
||||||
}): boolean {
|
|
||||||
const node = getNodeFromPath<VariableDeclaration>(
|
|
||||||
kclManager.ast,
|
|
||||||
sketchDetails?.sketchEntryNodePath || [],
|
|
||||||
'VariableDeclaration'
|
|
||||||
)
|
|
||||||
// This should not be returning false, and it should be caught
|
|
||||||
// but we need to simulate old behavior to move on.
|
|
||||||
if (err(node)) return false
|
|
||||||
return node.node?.declaration.init.type !== 'PipeExpression'
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If the sketch contains `close` or `circle` stdlib functions it must be closed */
|
|
||||||
export function isClosedSketch({
|
|
||||||
sketchDetails,
|
|
||||||
}: {
|
|
||||||
sketchDetails: SketchDetails | null
|
|
||||||
}): boolean {
|
|
||||||
const node = getNodeFromPath<VariableDeclaration>(
|
|
||||||
kclManager.ast,
|
|
||||||
sketchDetails?.sketchEntryNodePath || [],
|
|
||||||
'VariableDeclaration'
|
|
||||||
)
|
|
||||||
// This should not be returning false, and it should be caught
|
|
||||||
// but we need to simulate old behavior to move on.
|
|
||||||
if (err(node)) return false
|
|
||||||
if (node.node?.declaration?.init?.type !== 'PipeExpression') return false
|
|
||||||
return node.node.declaration.init.body.some(
|
|
||||||
(node) =>
|
|
||||||
node.type === 'CallExpressionKw' &&
|
|
||||||
(node.callee.name.name === 'close' || node.callee.name.name === 'circle')
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
Reference in New Issue
Block a user