Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
b5fe5f85eb | |||
29fd6ad45f | |||
479179dd9b | |||
67f9dba77b | |||
89c345649d | |||
0550eef701 | |||
1c21198499 | |||
8ac232414d |
@ -8,16 +8,16 @@ layout: manual
|
||||
|
||||
There are three levels of settings available in Zoo Design Studio:
|
||||
|
||||
1. [User Settings](/docs/kcl/settings/user): Global settings that apply to all projects, stored in `user.toml`
|
||||
2. [Project Settings](/docs/kcl/settings/project): Settings specific to a project, stored in `project.toml`
|
||||
1. [User Settings](/docs/kcl-lang/settings/user): Global settings that apply to all projects, stored in `user.toml`
|
||||
2. [Project Settings](/docs/kcl-lang/settings/project): Settings specific to a project, stored in `project.toml`
|
||||
3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute
|
||||
|
||||
## Configuration Files
|
||||
|
||||
Zoo Design Studio uses TOML files for configuration:
|
||||
|
||||
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings/user)
|
||||
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings/project)
|
||||
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl-lang/settings/user)
|
||||
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl-lang/settings/project)
|
||||
|
||||
## Per-file settings
|
||||
|
||||
|
@ -197,5 +197,10 @@ test.describe('Basic sketch', () => {
|
||||
)
|
||||
}, PERSIST_MODELING_CONTEXT)
|
||||
await doBasicSketch(page, [], { cmdBar, scene, homePage, editor })
|
||||
await expect(true).toBe(false)
|
||||
})
|
||||
|
||||
test('new test for demo', async ({}) => {
|
||||
await expect(true).toBe(true)
|
||||
})
|
||||
})
|
||||
|
@ -3425,6 +3425,72 @@ profile003 = startProfile(sketch002, at = [-201.08, 254.17])
|
||||
).toBeVisible()
|
||||
})
|
||||
})
|
||||
test('empty draft sketch is cleaned up properly', async ({
|
||||
scene,
|
||||
toolbar,
|
||||
cmdBar,
|
||||
page,
|
||||
homePage,
|
||||
}) => {
|
||||
// This is the sketch used in the original report, but any sketch would work
|
||||
await page.addInitScript(async () => {
|
||||
localStorage.setItem(
|
||||
'persistCode',
|
||||
`yRel002 = 200
|
||||
lStraight = -200
|
||||
yRel001 = -lStraight
|
||||
length001 = lStraight
|
||||
sketch001 = startSketchOn(XZ)
|
||||
profile001 = startProfile(sketch001, at = [-102.72, 237.44])
|
||||
|> yLine(length = lStraight)
|
||||
|> tangentialArc(endAbsolute = [118.9, 23.57])
|
||||
|> line(end = [-17.64, yRel002])
|
||||
`
|
||||
)
|
||||
})
|
||||
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
await homePage.goToModelingScene()
|
||||
await scene.connectionEstablished()
|
||||
await scene.settled(cmdBar)
|
||||
|
||||
// Ensure start sketch button is enabled
|
||||
await expect(
|
||||
page.getByRole('button', { name: 'Start Sketch' })
|
||||
).not.toBeDisabled()
|
||||
|
||||
// Start a new sketch
|
||||
const [selectXZPlane] = scene.makeMouseHelpers(650, 150)
|
||||
await toolbar.startSketchPlaneSelection()
|
||||
await selectXZPlane()
|
||||
await page.waitForTimeout(2000) // wait for engine animation
|
||||
|
||||
// Switch to a different tool (circle)
|
||||
await toolbar.circleBtn.click()
|
||||
await expect(toolbar.circleBtn).toHaveAttribute('aria-pressed', 'true')
|
||||
|
||||
// Exit the empty sketch
|
||||
await page.getByRole('button', { name: 'Exit Sketch' }).click()
|
||||
|
||||
// Ensure the feature tree now shows only one sketch
|
||||
await toolbar.openFeatureTreePane()
|
||||
await expect(
|
||||
toolbar.featureTreePane.getByRole('button', { name: 'Sketch' })
|
||||
).toHaveCount(1)
|
||||
await toolbar.closeFeatureTreePane()
|
||||
|
||||
// Open the first sketch from the feature tree (the existing sketch)
|
||||
await (await toolbar.getFeatureTreeOperation('Sketch', 0)).dblclick()
|
||||
// timeout is a bit longer because when the bug happened, it did go into sketch mode for a split second, but returned
|
||||
// automatically, we want to make sure it stays there.
|
||||
await page.waitForTimeout(2000)
|
||||
|
||||
// Validate we are in sketch mode (Exit Sketch button visible)
|
||||
await expect(
|
||||
page.getByRole('button', { name: 'Exit Sketch' })
|
||||
).toBeVisible()
|
||||
})
|
||||
|
||||
test('adding a syntax error, recovers after fixing', async ({
|
||||
page,
|
||||
homePage,
|
||||
|
@ -142,9 +142,7 @@ export function Toolbar({
|
||||
} else if (isToolbarDropdown(maybeIconConfig)) {
|
||||
return {
|
||||
id: maybeIconConfig.id,
|
||||
array: maybeIconConfig.array.map((item) =>
|
||||
resolveItemConfig(item, maybeIconConfig.id)
|
||||
),
|
||||
array: maybeIconConfig.array.map((item) => resolveItemConfig(item)),
|
||||
}
|
||||
} else {
|
||||
return resolveItemConfig(maybeIconConfig)
|
||||
@ -152,8 +150,7 @@ export function Toolbar({
|
||||
})
|
||||
|
||||
function resolveItemConfig(
|
||||
maybeIconConfig: ToolbarItem,
|
||||
dropdownId?: string
|
||||
maybeIconConfig: ToolbarItem
|
||||
): ToolbarItemResolved {
|
||||
const isConfiguredAvailable = ['available', 'experimental'].includes(
|
||||
maybeIconConfig.status
|
||||
|
@ -218,7 +218,7 @@ export class SceneEntities {
|
||||
onCamChange = () => {
|
||||
const orthoFactor = orthoScale(this.sceneInfra.camControls.camera)
|
||||
const callbacks: (() => SegmentOverlayPayload | null)[] = []
|
||||
Object.values(this.activeSegments).forEach((segment, index) => {
|
||||
Object.values(this.activeSegments).forEach((segment, _index) => {
|
||||
const factor =
|
||||
(this.sceneInfra.camControls.camera instanceof OrthographicCamera
|
||||
? orthoFactor
|
||||
@ -354,7 +354,6 @@ export class SceneEntities {
|
||||
}
|
||||
|
||||
createSketchAxis(
|
||||
sketchPathToNode: PathToNode,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
sketchPosition?: [number, number, number]
|
||||
@ -623,7 +622,6 @@ export class SceneEntities {
|
||||
|
||||
const inserted = insertNewStartProfileAt(
|
||||
this.kclManager.ast,
|
||||
sketchDetails.sketchEntryNodePath || [],
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
[snappedClickPoint.x, snappedClickPoint.y],
|
||||
@ -679,7 +677,6 @@ export class SceneEntities {
|
||||
})
|
||||
const sketchesInfo = getSketchesInfo({
|
||||
sketchNodePaths,
|
||||
ast: maybeModdedAst,
|
||||
variables: execState.variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -926,8 +923,7 @@ export class SceneEntities {
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
origin: [number, number, number],
|
||||
segmentName: 'line' | 'tangentialArc' = 'line',
|
||||
shouldTearDown = true
|
||||
segmentName: 'line' | 'tangentialArc' = 'line'
|
||||
) => {
|
||||
const _ast = structuredClone(this.kclManager.ast)
|
||||
|
||||
@ -1001,7 +997,6 @@ export class SceneEntities {
|
||||
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode: sketchEntryNodePath,
|
||||
ast: this.kclManager.ast,
|
||||
variables: this.kclManager.variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -1185,7 +1180,6 @@ export class SceneEntities {
|
||||
})
|
||||
}
|
||||
setupDraftRectangle = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -1256,7 +1250,7 @@ export class SceneEntities {
|
||||
// as draft segments
|
||||
startProfileAt.init = createPipeExpression([
|
||||
startProfileAt?.init,
|
||||
...getRectangleCallExpressions(rectangleOrigin, tag),
|
||||
...getRectangleCallExpressions(tag),
|
||||
])
|
||||
|
||||
const code = recast(_ast)
|
||||
@ -1395,7 +1389,6 @@ export class SceneEntities {
|
||||
}
|
||||
}
|
||||
setupDraftCenterRectangle = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -1465,7 +1458,7 @@ export class SceneEntities {
|
||||
// as draft segments
|
||||
startProfileAt.init = createPipeExpression([
|
||||
startProfileAt?.init,
|
||||
...getRectangleCallExpressions(rectangleOrigin, tag),
|
||||
...getRectangleCallExpressions(tag),
|
||||
])
|
||||
const code = recast(_ast)
|
||||
__recastAst = parse(code)
|
||||
@ -1602,7 +1595,6 @@ export class SceneEntities {
|
||||
}
|
||||
}
|
||||
setupDraftCircleThreePoint = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -1789,7 +1781,6 @@ export class SceneEntities {
|
||||
setupDraftArc = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
sketchOrigin: [number, number, number],
|
||||
@ -2026,7 +2017,6 @@ export class SceneEntities {
|
||||
setupDraftArcThreePoint = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
up: [number, number, number],
|
||||
sketchOrigin: [number, number, number],
|
||||
@ -2286,7 +2276,6 @@ export class SceneEntities {
|
||||
}
|
||||
}
|
||||
setupDraftCircle = async (
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
forward: [number, number, number],
|
||||
@ -2541,7 +2530,6 @@ export class SceneEntities {
|
||||
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode,
|
||||
ast: this.kclManager.ast,
|
||||
variables: this.kclManager.variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -3095,7 +3083,6 @@ export class SceneEntities {
|
||||
const variables = execState.variables
|
||||
const sketchesInfo = getSketchesInfo({
|
||||
sketchNodePaths,
|
||||
ast: truncatedAst,
|
||||
variables,
|
||||
kclManager: this.kclManager,
|
||||
})
|
||||
@ -3418,7 +3405,7 @@ export class SceneEntities {
|
||||
}
|
||||
this.editorManager.setHighlightRange([defaultSourceRange()])
|
||||
},
|
||||
onMouseLeave: ({ selected, ...rest }: OnMouseEnterLeaveArgs) => {
|
||||
onMouseLeave: ({ selected }: OnMouseEnterLeaveArgs) => {
|
||||
this.editorManager.setHighlightRange([defaultSourceRange()])
|
||||
const parent = getParentGroup(
|
||||
selected,
|
||||
@ -3782,12 +3769,10 @@ function prepareTruncatedAst(
|
||||
|
||||
function sketchFromPathToNode({
|
||||
pathToNode,
|
||||
ast,
|
||||
variables,
|
||||
kclManager,
|
||||
}: {
|
||||
pathToNode: PathToNode
|
||||
ast: Program
|
||||
variables: VariableMap
|
||||
kclManager: KclManager
|
||||
}): Sketch | null | Error {
|
||||
@ -3837,7 +3822,6 @@ export function getSketchQuaternion(
|
||||
): Quaternion | Error {
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode: sketchPathToNode,
|
||||
ast: kclManager.ast,
|
||||
variables: kclManager.variables,
|
||||
kclManager,
|
||||
})
|
||||
@ -3879,12 +3863,10 @@ function massageFormats(
|
||||
|
||||
function getSketchesInfo({
|
||||
sketchNodePaths,
|
||||
ast,
|
||||
variables,
|
||||
kclManager,
|
||||
}: {
|
||||
sketchNodePaths: PathToNode[]
|
||||
ast: Node<Program>
|
||||
variables: VariableMap
|
||||
kclManager: KclManager
|
||||
}): {
|
||||
@ -3898,7 +3880,6 @@ function getSketchesInfo({
|
||||
for (const path of sketchNodePaths) {
|
||||
const sketch = sketchFromPathToNode({
|
||||
pathToNode: path,
|
||||
ast,
|
||||
variables,
|
||||
kclManager,
|
||||
})
|
||||
|
@ -101,7 +101,6 @@ export class SceneInfra {
|
||||
readonly renderer: WebGLRenderer
|
||||
readonly labelRenderer: CSS2DRenderer
|
||||
readonly camControls: CameraControls
|
||||
private readonly fov = 45
|
||||
isFovAnimationInProgress = false
|
||||
_baseUnitMultiplier = 1
|
||||
_theme: Themes = Themes.System
|
||||
|
@ -307,7 +307,6 @@ class StraightSegment implements SegmentUtils {
|
||||
updateLine(snapLine, {
|
||||
from: snapLineFrom,
|
||||
to: [snapLineTo.x, snapLineTo.y],
|
||||
scale,
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -1076,7 +1075,6 @@ class ArcSegment implements SegmentUtils {
|
||||
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
||||
startAngle: 0,
|
||||
endAngle,
|
||||
scale,
|
||||
color: grey, // Red color for the angle indicator
|
||||
})
|
||||
angleIndicator.name = 'angleIndicator'
|
||||
@ -1087,7 +1085,6 @@ class ArcSegment implements SegmentUtils {
|
||||
radius: ANGLE_INDICATOR_RADIUS, // Half the radius for the indicator
|
||||
startAngle: 0,
|
||||
endAngle: (endAngle * Math.PI) / 180,
|
||||
scale,
|
||||
color: grey, // Green color for the end angle indicator
|
||||
})
|
||||
endAngleIndicator.name = 'endAngleIndicator'
|
||||
@ -1275,12 +1272,12 @@ class ArcSegment implements SegmentUtils {
|
||||
|
||||
const centerToFromLine = group.getObjectByName(ARC_CENTER_TO_FROM) as Line
|
||||
if (centerToFromLine) {
|
||||
updateLine(centerToFromLine, { from: center, to: from, scale })
|
||||
updateLine(centerToFromLine, { from: center, to: from })
|
||||
centerToFromLine.visible = isHandlesVisible
|
||||
}
|
||||
const centerToToLine = group.getObjectByName(ARC_CENTER_TO_TO) as Line
|
||||
if (centerToToLine) {
|
||||
updateLine(centerToToLine, { from: center, to, scale })
|
||||
updateLine(centerToToLine, { from: center, to })
|
||||
centerToToLine.visible = isHandlesVisible
|
||||
}
|
||||
const angleReferenceLine = group.getObjectByName(
|
||||
@ -1290,7 +1287,6 @@ class ArcSegment implements SegmentUtils {
|
||||
updateLine(angleReferenceLine, {
|
||||
from: center,
|
||||
to: [center[0] + 34 * scale, center[1]],
|
||||
scale,
|
||||
})
|
||||
angleReferenceLine.visible = isHandlesVisible
|
||||
}
|
||||
@ -1536,7 +1532,7 @@ class ThreePointArcSegment implements SegmentUtils {
|
||||
|
||||
return () => {
|
||||
const overlays: SegmentOverlays = {}
|
||||
const overlayDetails = [p2Handle, p3Handle].map((handle, index) =>
|
||||
const overlayDetails = [p2Handle, p3Handle].map((handle, _index) =>
|
||||
sceneInfra.updateOverlayDetails({
|
||||
handle: handle,
|
||||
group,
|
||||
@ -2042,11 +2038,7 @@ function createLine({
|
||||
|
||||
function updateLine(
|
||||
line: Line,
|
||||
{
|
||||
from,
|
||||
to,
|
||||
scale,
|
||||
}: { from: [number, number]; to: [number, number]; scale: number }
|
||||
{ from, to }: { from: [number, number]; to: [number, number] }
|
||||
) {
|
||||
// Implementation for updating a line
|
||||
const points = [
|
||||
@ -2061,14 +2053,12 @@ function createAngleIndicator({
|
||||
radius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
scale,
|
||||
color,
|
||||
}: {
|
||||
center: [number, number]
|
||||
radius: number
|
||||
startAngle: number
|
||||
endAngle: number
|
||||
scale: number
|
||||
color: number
|
||||
}): Line {
|
||||
// Implementation for creating an angle indicator
|
||||
|
@ -36,7 +36,7 @@ export function AstExplorer() {
|
||||
type="checkbox"
|
||||
className="form-checkbox"
|
||||
checked={filterKeys.includes(key)}
|
||||
onChange={(e) => {
|
||||
onChange={(_e) => {
|
||||
if (filterKeys.includes(key)) {
|
||||
setFilterKeys(filterKeys.filter((k) => k !== key))
|
||||
} else {
|
||||
@ -51,7 +51,7 @@ export function AstExplorer() {
|
||||
</div>
|
||||
<div
|
||||
className="h-full relative"
|
||||
onMouseLeave={(e) => {
|
||||
onMouseLeave={(_e) => {
|
||||
editorManager.setHighlightRange([defaultSourceRange()])
|
||||
}}
|
||||
>
|
||||
|
@ -148,6 +148,8 @@ function CommandBarHeader({ children }: React.PropsWithChildren<object>) {
|
||||
),
|
||||
4
|
||||
)
|
||||
) : arg.inputType === 'text' && !arg.valueSummary ? (
|
||||
`${argValue.slice(0, 12)}${argValue.length > 12 ? '...' : ''}`
|
||||
) : typeof argValue === 'object' ? (
|
||||
arg.valueSummary ? (
|
||||
arg.valueSummary(argValue)
|
||||
|
@ -44,7 +44,7 @@ function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
||||
[argumentsToSubmit, selectedCommand]
|
||||
)
|
||||
|
||||
Object.keys(argumentsToSubmit).forEach((key, i) => {
|
||||
Object.keys(argumentsToSubmit).forEach((key, _i) => {
|
||||
const arg = selectedCommand?.args ? selectedCommand?.args[key] : undefined
|
||||
if (!arg) return
|
||||
})
|
||||
@ -75,7 +75,7 @@ function CommandBarReview({ stepBack }: { stepBack: () => void }) {
|
||||
className="absolute opacity-0 inset-0 pointer-events-none"
|
||||
onSubmit={submitCommand}
|
||||
>
|
||||
{Object.entries(argumentsToSubmit).map(([key, value], i) => {
|
||||
{Object.entries(argumentsToSubmit).map(([key, value], _i) => {
|
||||
const arg = selectedCommand?.args
|
||||
? selectedCommand?.args[key]
|
||||
: undefined
|
||||
|
@ -37,6 +37,7 @@ import {
|
||||
} from '@src/lib/utils'
|
||||
import { DEFAULT_DEFAULT_LENGTH_UNIT } from '@src/lib/constants'
|
||||
import { createThumbnailPNGOnDesktop } from '@src/lib/screenshot'
|
||||
import type { SettingsViaQueryString } from '@src/lib/settings/settingsTypes'
|
||||
|
||||
export const EngineStream = (props: {
|
||||
pool: string | null
|
||||
@ -54,12 +55,17 @@ export const EngineStream = (props: {
|
||||
const last = useRef<number>(Date.now())
|
||||
const videoWrapperRef = useRef<HTMLDivElement>(null)
|
||||
|
||||
const settingsEngine = {
|
||||
/**
|
||||
* We omit `pool` here because `engineStreamMachine` will override it anyway
|
||||
* within the `EngineStreamTransition.StartOrReconfigureEngine` Promise actor.
|
||||
*/
|
||||
const settingsEngine: Omit<SettingsViaQueryString, 'pool'> = {
|
||||
theme: settings.app.theme.current,
|
||||
enableSSAO: settings.modeling.enableSSAO.current,
|
||||
highlightEdges: settings.modeling.highlightEdges.current,
|
||||
showScaleGrid: settings.modeling.showScaleGrid.current,
|
||||
cameraProjection: settings.modeling.cameraProjection.current,
|
||||
cameraOrbit: settings.modeling.cameraOrbit.current,
|
||||
}
|
||||
|
||||
const { state: modelingMachineState, send: modelingMachineActorSend } =
|
||||
|
@ -24,7 +24,7 @@ import { sortFilesAndDirectories } from '@src/lib/desktopFS'
|
||||
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||
import { PATHS } from '@src/lib/paths'
|
||||
import type { FileEntry } from '@src/lib/project'
|
||||
import { codeManager, kclManager, rustContext } from '@src/lib/singletons'
|
||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||
import { reportRejection } from '@src/lib/trap'
|
||||
import type { IndexLoaderData } from '@src/lib/types'
|
||||
|
||||
@ -32,7 +32,6 @@ import { ToastInsert } from '@src/components/ToastInsert'
|
||||
import { commandBarActor } from '@src/lib/singletons'
|
||||
import toast from 'react-hot-toast'
|
||||
import styles from './FileTree.module.css'
|
||||
import { jsAppSettings } from '@src/lib/settings/settingsUtils'
|
||||
|
||||
function getIndentationCSS(level: number) {
|
||||
return `calc(1rem * ${level + 1})`
|
||||
@ -229,10 +228,6 @@ const FileTreeItem = ({
|
||||
code = normalizeLineEndings(code)
|
||||
codeManager.updateCodeStateEditor(code)
|
||||
} else if (isImportedInCurrentFile && eventType === 'change') {
|
||||
await rustContext.clearSceneAndBustCache(
|
||||
await jsAppSettings(),
|
||||
codeManager?.currentFilePath || undefined
|
||||
)
|
||||
await kclManager.executeAst()
|
||||
}
|
||||
fileSend({ type: 'Refresh' })
|
||||
|
@ -1489,7 +1489,6 @@ export const ModelingMachineProvider = ({
|
||||
return reject('No sketch details or data')
|
||||
|
||||
const result = await sceneEntitiesManager.setupDraftCircle(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1510,7 +1509,6 @@ export const ModelingMachineProvider = ({
|
||||
|
||||
const result =
|
||||
await sceneEntitiesManager.setupDraftCircleThreePoint(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1531,7 +1529,6 @@ export const ModelingMachineProvider = ({
|
||||
return reject('No sketch details or data')
|
||||
|
||||
const result = await sceneEntitiesManager.setupDraftRectangle(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1550,7 +1547,6 @@ export const ModelingMachineProvider = ({
|
||||
if (!sketchDetails || !data)
|
||||
return reject('No sketch details or data')
|
||||
const result = await sceneEntitiesManager.setupDraftCenterRectangle(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
@ -1571,7 +1567,6 @@ export const ModelingMachineProvider = ({
|
||||
const result = await sceneEntitiesManager.setupDraftArcThreePoint(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
sketchDetails.yAxis,
|
||||
sketchDetails.origin,
|
||||
@ -1590,7 +1585,6 @@ export const ModelingMachineProvider = ({
|
||||
const result = await sceneEntitiesManager.setupDraftArc(
|
||||
sketchDetails.sketchEntryNodePath,
|
||||
sketchDetails.sketchNodePaths,
|
||||
sketchDetails.planeNodePath,
|
||||
sketchDetails.zAxis,
|
||||
sketchDetails.yAxis,
|
||||
sketchDetails.origin,
|
||||
|
@ -55,9 +55,6 @@ export const FeatureTreePane = () => {
|
||||
},
|
||||
})
|
||||
},
|
||||
sendEditFlowStart: () => {
|
||||
modelingSend({ type: 'Enter sketch' })
|
||||
},
|
||||
scrollToError: () => {
|
||||
editorManager.scrollToFirstErrorDiagnosticIfExists()
|
||||
},
|
||||
|
@ -22,7 +22,7 @@ export const MemoryPaneMenu = () => {
|
||||
navigator.clipboard
|
||||
.writeText(JSON.stringify(variables))
|
||||
.then(() => toast.success('Program memory copied to clipboard'))
|
||||
.catch((e) =>
|
||||
.catch((_e) =>
|
||||
trap(new Error('Failed to copy program memory to clipboard'))
|
||||
)
|
||||
}
|
||||
|
@ -58,8 +58,7 @@ export function removeConstrainingValuesInfo({
|
||||
|
||||
const transforms = getRemoveConstraintsTransforms(
|
||||
updatedSelectionRanges,
|
||||
kclManager.ast,
|
||||
'removeConstrainingValues'
|
||||
kclManager.ast
|
||||
)
|
||||
if (err(transforms)) return transforms
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ sketch003 = startSketchOn(XZ)
|
||||
] as const
|
||||
test.each(cases)(
|
||||
'%s',
|
||||
async (name, { codeBefore, codeAfter, lineOfInterest, type }) => {
|
||||
async (_name, { codeBefore, codeAfter, lineOfInterest, type }) => {
|
||||
// const lineOfInterest = 'line(end = [-2.94, 2.7])'
|
||||
const ast = assertParse(codeBefore)
|
||||
const execState = await enginelessExecutor(ast)
|
||||
|
@ -103,7 +103,6 @@ export function startSketchOnDefault(
|
||||
|
||||
export function insertNewStartProfileAt(
|
||||
node: Node<Program>,
|
||||
sketchEntryNodePath: PathToNode,
|
||||
sketchNodePaths: PathToNode[],
|
||||
planeNodePath: PathToNode,
|
||||
at: [number, number],
|
||||
|
@ -264,7 +264,7 @@ export async function deleteFromSelection(
|
||||
).filter((wall) => wall?.pathIds?.length)
|
||||
const wallIds = wallsWithDependencies.map((wall) => wall.id)
|
||||
|
||||
Object.entries(variables).forEach(([key, _var]) => {
|
||||
Object.entries(variables).forEach(([_key, _var]) => {
|
||||
if (
|
||||
_var?.type === 'Face' &&
|
||||
wallIds.includes(_var.value.artifactId)
|
||||
|
@ -631,7 +631,7 @@ describe('Testing traverse and pathToNode', () => {
|
||||
'very nested, array, object, callExpression, array, memberExpression',
|
||||
'.yo',
|
||||
],
|
||||
])('testing %s', async (testName, literalOfInterest) => {
|
||||
])('testing %s', async (_testName, literalOfInterest) => {
|
||||
const code = `myVar = 5
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfile(at = [3.29, 7.86])
|
||||
|
@ -1244,8 +1244,7 @@ const transformMap: TransformMap = {
|
||||
}
|
||||
|
||||
export function getRemoveConstraintsTransform(
|
||||
sketchFnExp: CallExpressionKw,
|
||||
constraintType: ConstraintType
|
||||
sketchFnExp: CallExpressionKw
|
||||
): TransformInfo | false {
|
||||
let name = sketchFnExp.callee.name.name as ToolTip
|
||||
if (!toolTips.includes(name)) {
|
||||
@ -1779,8 +1778,7 @@ export function getTransformInfos(
|
||||
|
||||
export function getRemoveConstraintsTransforms(
|
||||
selectionRanges: Selections,
|
||||
ast: Program,
|
||||
constraintType: ConstraintType
|
||||
ast: Program
|
||||
): TransformInfo[] | Error {
|
||||
const nodes = selectionRanges.graphSelections.map(({ codeRef }) =>
|
||||
getNodeFromPath<Expr>(ast, codeRef.pathToNode)
|
||||
@ -1796,7 +1794,7 @@ export function getRemoveConstraintsTransforms(
|
||||
|
||||
const node = nodeMeta.node
|
||||
if (node?.type === 'CallExpressionKw') {
|
||||
return getRemoveConstraintsTransform(node, constraintType)
|
||||
return getRemoveConstraintsTransform(node)
|
||||
}
|
||||
|
||||
return false
|
||||
|
@ -64,7 +64,7 @@ export function createApplicationCommands({
|
||||
isDesktop() &&
|
||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||
skip: true,
|
||||
options: (_, context) => {
|
||||
options: (_, _context) => {
|
||||
const { folders } = systemIOActor.getSnapshot().context
|
||||
const options: CommandArgumentOption<string>[] = []
|
||||
folders.forEach((folder) => {
|
||||
@ -217,7 +217,7 @@ export function createApplicationCommands({
|
||||
isDesktop() &&
|
||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||
skip: true,
|
||||
options: (_, context) => {
|
||||
options: (_, _context) => {
|
||||
const { folders } = systemIOActor.getSnapshot().context
|
||||
const options: CommandArgumentOption<string>[] = []
|
||||
folders.forEach((folder) => {
|
||||
|
@ -825,7 +825,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
Object.entries(kclManager.execState.variables)
|
||||
// TODO: @franknoirot && @jtran would love to make this go away soon 🥺
|
||||
.filter(([_, variable]) => variable?.type === 'Number')
|
||||
.map(([name, variable]) => {
|
||||
.map(([name, _variable]) => {
|
||||
const node = getVariableDeclaration(kclManager.ast, name)
|
||||
if (node === undefined) return
|
||||
const range: SourceRange = [node.start, node.end, node.moduleId]
|
||||
@ -926,7 +926,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
inputType: 'kcl',
|
||||
required: true,
|
||||
createVariable: 'byDefault',
|
||||
variableName(commandBarContext, machineContext) {
|
||||
variableName(commandBarContext, _machineContext) {
|
||||
const { currentValue } = commandBarContext.argumentsToSubmit
|
||||
if (
|
||||
!currentValue ||
|
||||
|
@ -224,7 +224,7 @@ export function createNamedViewsCommand() {
|
||||
name: {
|
||||
required: true,
|
||||
inputType: 'options',
|
||||
options: (commandBar, machineContext) => {
|
||||
options: (_commandBar, _machineContext) => {
|
||||
const settings = getSettings()
|
||||
const namedViews = {
|
||||
...settings.app.namedViews.current,
|
||||
|
@ -222,7 +222,7 @@ export function createProjectCommands({
|
||||
isDesktop() &&
|
||||
commandsContext.argumentsToSubmit.method === 'existingProject',
|
||||
skip: true,
|
||||
options: (_, context) => {
|
||||
options: (_, _context) => {
|
||||
const folders = folderSnapshot()
|
||||
const options: CommandArgumentOption<string>[] = []
|
||||
folders.forEach((folder) => {
|
||||
|
@ -15,7 +15,7 @@ export function createRouteCommands(
|
||||
groupId: 'routes',
|
||||
icon: 'settings',
|
||||
needsReview: false,
|
||||
onSubmit: (data) => {
|
||||
onSubmit: (_data) => {
|
||||
const path = location.pathname.includes(PATHS.FILE)
|
||||
? filePath + PATHS.TELEMETRY + '?tab=project'
|
||||
: PATHS.HOME + PATHS.TELEMETRY
|
||||
@ -30,7 +30,7 @@ export function createRouteCommands(
|
||||
groupId: 'routes',
|
||||
icon: 'settings',
|
||||
needsReview: false,
|
||||
onSubmit: (data) => {
|
||||
onSubmit: (_data) => {
|
||||
navigate(PATHS.HOME)
|
||||
},
|
||||
}
|
||||
@ -42,7 +42,7 @@ export function createRouteCommands(
|
||||
groupId: 'routes',
|
||||
icon: 'settings',
|
||||
needsReview: false,
|
||||
onSubmit: (data) => {
|
||||
onSubmit: (_data) => {
|
||||
const path = location.pathname.includes(PATHS.FILE)
|
||||
? filePath + PATHS.SETTINGS + '?tab=project'
|
||||
: PATHS.HOME + PATHS.SETTINGS
|
||||
|
@ -441,7 +441,7 @@ export class CoreDumpManager {
|
||||
screenshot()
|
||||
.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
|
||||
.catch((error: any) => ``)
|
||||
.catch((_error: any) => ``)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects/project'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: 'project',
|
||||
projectPath: route,
|
||||
currentFileName: null,
|
||||
@ -28,7 +28,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: null,
|
||||
projectPath: route,
|
||||
currentFileName: null,
|
||||
@ -44,7 +44,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects/assembly/main.kcl'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: 'assembly',
|
||||
projectPath: '/home/somebody/projects/assembly',
|
||||
currentFileName: 'main.kcl',
|
||||
@ -60,7 +60,7 @@ describe('testing parseProjectRoute', () => {
|
||||
},
|
||||
}
|
||||
const route = '/home/somebody/projects/assembly/subdir/main.kcl'
|
||||
expect(await parseProjectRoute(config, route, path)).toEqual({
|
||||
expect(parseProjectRoute(config, route, path)).toEqual({
|
||||
projectName: 'assembly',
|
||||
projectPath: '/home/somebody/projects/assembly',
|
||||
currentFileName: 'main.kcl',
|
||||
@ -70,7 +70,7 @@ describe('testing parseProjectRoute', () => {
|
||||
it('should work in the browser context', async () => {
|
||||
let config = {}
|
||||
const route = '/browser/main.kcl'
|
||||
expect(await parseProjectRoute(config, route, undefined)).toEqual({
|
||||
expect(parseProjectRoute(config, route, undefined)).toEqual({
|
||||
projectName: 'browser',
|
||||
projectPath: '/browser',
|
||||
currentFileName: 'main.kcl',
|
||||
|
@ -51,10 +51,7 @@ function angledLine(
|
||||
* |> angledLine(angle = segAng(a), length = -segLen(a), tag = $c)
|
||||
* |> close()
|
||||
*/
|
||||
export const getRectangleCallExpressions = (
|
||||
rectangleOrigin: [number, number],
|
||||
tag: string
|
||||
) => {
|
||||
export const getRectangleCallExpressions = (tag: string) => {
|
||||
return [
|
||||
angledLine(
|
||||
createLiteral(0), // 0 deg
|
||||
|
@ -1,6 +1,5 @@
|
||||
import toast from 'react-hot-toast'
|
||||
|
||||
import { BSON } from 'bson'
|
||||
import type { Configuration } from '@rust/kcl-lib/bindings/Configuration'
|
||||
import type { DefaultPlanes } from '@rust/kcl-lib/bindings/DefaultPlanes'
|
||||
import type { KclError as RustKclError } from '@rust/kcl-lib/bindings/KclError'
|
||||
@ -8,7 +7,9 @@ import type { OutputFormat3d } from '@rust/kcl-lib/bindings/ModelingCmd'
|
||||
import type { Node } from '@rust/kcl-lib/bindings/Node'
|
||||
import type { Program } from '@rust/kcl-lib/bindings/Program'
|
||||
import type { Context } from '@rust/kcl-wasm-lib/pkg/kcl_wasm_lib'
|
||||
import { BSON } from 'bson'
|
||||
|
||||
import type { Models } from '@kittycad/lib/dist/types/src'
|
||||
import type { EngineCommandManager } from '@src/lang/std/engineConnection'
|
||||
import { fileSystemManager } from '@src/lang/std/fileSystemManager'
|
||||
import type { ExecState } from '@src/lang/wasm'
|
||||
@ -25,7 +26,6 @@ import { err, reportRejection } from '@src/lib/trap'
|
||||
import type { DeepPartial } from '@src/lib/types'
|
||||
import type { ModuleType } from '@src/lib/wasm_lib_wrapper'
|
||||
import { getModule } from '@src/lib/wasm_lib_wrapper'
|
||||
import type { Models } from '@kittycad/lib/dist/types/src'
|
||||
|
||||
export default class RustContext {
|
||||
private wasmInitFailed: boolean = true
|
||||
@ -155,6 +155,19 @@ export default class RustContext {
|
||||
}
|
||||
|
||||
// Clear/reset the scene and bust the cache.
|
||||
// Do not use this function unless you absolutely need to. In most cases,
|
||||
// we should just fix the cache for whatever bug you are seeing.
|
||||
// The only time it makes sense to run this is if the engine disconnects and
|
||||
// reconnects. The rust side has no idea that happened and will think the
|
||||
// cache is still valid.
|
||||
// Caching on the rust side accounts for changes to files outside of the
|
||||
// scope of the current file the user is on. It collects all the dependencies
|
||||
// and checks if any of them have changed. If they have, it will bust the
|
||||
// cache and recompile the scene.
|
||||
// The typescript side should never raw dog clear the scene since that would
|
||||
// fuck with the cache as well. So if you _really_ want to just clear the scene
|
||||
// AND NOT re-execute, you can use this for that. But in 99.999999% of cases just
|
||||
// re-execute.
|
||||
async clearSceneAndBustCache(
|
||||
settings: DeepPartial<Configuration>,
|
||||
path?: string
|
||||
|
@ -322,7 +322,7 @@ export function createSettings() {
|
||||
}),
|
||||
namedViews: new Setting<{ [key in string]: NamedView }>({
|
||||
defaultValue: {},
|
||||
validate: (v) => true,
|
||||
validate: (_v) => true,
|
||||
hideOnLevel: 'user',
|
||||
}),
|
||||
},
|
||||
|
@ -455,7 +455,7 @@ export function clearSettingsAtLevel(
|
||||
allSettings: typeof settings,
|
||||
level: SettingsLevel
|
||||
) {
|
||||
Object.entries(allSettings).forEach(([category, settingsCategory]) => {
|
||||
Object.entries(allSettings).forEach(([_category, settingsCategory]) => {
|
||||
Object.entries(settingsCategory).forEach(
|
||||
([_, settingValue]: [string, Setting]) => {
|
||||
settingValue[level] = undefined
|
||||
|
@ -58,7 +58,7 @@ export async function holdOntoVideoFrameInCanvas(
|
||||
video: HTMLVideoElement,
|
||||
canvas: HTMLCanvasElement
|
||||
) {
|
||||
await video.pause()
|
||||
video.pause()
|
||||
canvas.width = video.videoWidth
|
||||
canvas.height = video.videoHeight
|
||||
canvas.style.width = video.videoWidth + 'px'
|
||||
@ -119,7 +119,7 @@ export const engineStreamMachine = setup({
|
||||
const video = context.videoRef.current
|
||||
if (!video) return
|
||||
|
||||
await video.pause()
|
||||
video.pause()
|
||||
|
||||
const canvas = context.canvasRef.current
|
||||
if (!canvas) return
|
||||
|
@ -253,9 +253,7 @@ export const featureTreeMachine = setup({
|
||||
}),
|
||||
sendSelectionEvent: () => {},
|
||||
openCodePane: () => {},
|
||||
sendEditFlowStart: () => {},
|
||||
scrollToError: () => {},
|
||||
sendDeleteSelection: () => {},
|
||||
},
|
||||
}).createMachine({
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QDMwEMAuBXATmAKnmAHQCWEANmAMRQD2+dA0gMYUDKduLYA2gAwBdRKAAOdWKQyk6AOxEgAHogCMAFhXF+27QDYArAGZ9AJhWGAHIYA0IAJ6q1ATkPELFkxf1qL-NQHYLNX0AXxDbVExcAiIyShpYMCoWDAB5UTAcTBlZAWEkEHFJaTkFZQQVJ00dPSNTcytbBwRnXWJ-fR0Op3cXJzUwiPRsPEIwEnIqajBZDEyAUQgpADEKOgB3PIUiqRyy1V1qmoNjM0sbe1V1TSd-XV1+XUM-EyeB8JBIkZjxuKmIJJgObpTLZORbAo7EryArlFQWI46E71c5NRD+fxqdqdfivDQmfx+QyDT7DaJjCbxWgMOjzHA4Og4CFiCS7UqwxBmRG1U4NC7NFSBYgmHH8O5VfgeR4kr7k2L0UiyKCMVgcLg4HjERLJaRK6jasApSDMwqs6H7Cr8IzEfQqby6NS4-ROK1ONEVfT6Npefr8FTmZyGXQysmjeV0RXK5hsTjcEgQOQ0E1QvYciqGbmPOpnCy6d0qe5OYjGFyBEVVExOENRMO-BVKlUx9WaugZWSRgDCdABAAU0LIaCxu2A+wOQQOIMmzanQOVDiZiA7XfwXK8MxZ857vc7Hf7DIHgx9ZbWSAaUpGtYDz3qz3NJ0JttP2bPELoLEWESK1CYTK6TBn3U9It-FeT1DCcSs-FMatvgpS8dQvBMB2oKdihnJRVH8TNkRzPNLgQJwnH0YhBScAxBQsEC7mJI9Qx+EgZjmHBI0WFY1nWeDDV1KB9SvO9ULZGEXwQIwF0MTwVDxPEN3wyTnkXL1nl0SsnmMUJaJrejiEYzIWKWDBVg2YgkKTB9ISfISMI9bDswaPCBUMDpF3En13CscSqw02DYh05ilVYgz2OIUQ8FENA8ACrsAFsov7CBqBMshZAANzoABrEhjy03y9LYoyQrAMKIv06LYtkCAEEVVKWDBXIhAE800wg1wvRFZ1XjI55-HzTwLBIlzCStbxKxooZNLgnL-P0wyOIKoqwEiugYri6Z6UZYKKEwZBGSi4gsom2ZdKmvLZtC8KFpKpayoqqq6Bq6E8ga9Dymam1lKAjqnjFfNKmI0j-EMSwfwxMUYLlX4ASobiQSyaFOOvHjb2NMyWTQ58rM9MSJO0NQHXcNR+UQLx+GFfgMw0XHcatFQwZPYzAWhjJYZyYzExQlHTTRyzyl-GzeVRfDHL65xCNXf0TGCfdaa0yGgUjGHavpqHI3YPicgSxMktSjK9rouDZcZ0E4YNlW1bkSqUru2rHo5lN0Ze79SeeXxnluKp9HdF1-EXfwyMOIiCZAw8xu8iGGflpnFZNpVVYQuRVoZHANq2nbdfG2Jo6gBXjfDmOzdkC3qut+rbYsi1+gXX9nbJldfbtd0ESxIP9AxB1nCtd4Q-Bkh6yjOlE+IVsZk7YdR0HUf+zAcdkfyVHBItZ02lFN9yy6kx3TMPrRXMAlAc6dSu7p3vGH79aTPZ2fOfntMuS0Y5bIF5pAczQHAn3Aswg+WRh3gAp9qIR8XMLQAFp7KIGARLaWcFJhgEAdfYS358xkXaFRDMmJ-TKXuFA8MkZGxqjjHAxqwl9yuAeC4ZS-QAZmAdPmNQuNiw7kopUbQv1sF1gjA2aM+CNSnjVkqQhz0iZWmLJJCmLdTCNFkkYVwPoCaVB6PoBEwdSTp3YbgrhsYeGswHAI+2VxfZaGUnvDEPRvpSMBm4HcGZCJeCUWwnuHCoyqk0S2NsI9eyT10dzRA4FNBkKDJWAI4kCxqE3BY2R1iFF2K8t3eG3EvEWnAqQlclh3ySiqADbq+E6FFh-AYZSK4XAaH8PYuJF5byRgSWmOhfiUm9HSYKRygEgztFAooqwKgVzQRiXTCpSptGwPMkAtMCJiIlg0OBZ0HhEH4SMG0Zu7SMxdJMKUyaUAAozSqcQp4i46lpPfI0rJAoyZYl0L7B0BZeYWFWYdPy6zppBT6VALZVkNC1JcPUg5mSeoZhIopR4Kk94HxUaHBitzcqBSMiZF5cICze03i7PwZFtDr1kj+LEdoKEQTuD4EpPTsrguOpC06hVzqLWWuVGFr4W5uExDY+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 type { ImportStatement } from '@rust/kcl-lib/bindings/ImportStatement'
|
||||
|
||||
export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
||||
|
||||
export type SetSelections =
|
||||
| {
|
||||
selectionType: 'singleCodeCursor'
|
||||
@ -1135,7 +1133,6 @@ export const modelingMachine = setup({
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
sceneEntitiesManager.createSketchAxis(
|
||||
sketchDetails.sketchEntryNodePath || [],
|
||||
sketchDetails.zAxis,
|
||||
sketchDetails.yAxis,
|
||||
sketchDetails.origin
|
||||
@ -3384,8 +3381,6 @@ export const modelingMachine = setup({
|
||||
target: 'normal',
|
||||
actions: 'set up draft line',
|
||||
},
|
||||
|
||||
Cancel: '#Modeling.Sketch.undo startSketchOn',
|
||||
},
|
||||
|
||||
exit: 'remove draft entities',
|
||||
@ -4208,6 +4203,7 @@ export const modelingMachine = setup({
|
||||
initial: 'Init',
|
||||
|
||||
on: {
|
||||
Cancel: '.undo startSketchOn',
|
||||
CancelSketch: '.SketchIdle',
|
||||
|
||||
'Delete segment': {
|
||||
@ -4714,41 +4710,3 @@ export function pipeHasCircle({
|
||||
)
|
||||
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