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:
|
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`
|
1. [User Settings](/docs/kcl-lang/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`
|
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
|
3. Per-file Settings: Settings that apply to a single KCL file, specified using the `@settings` attribute
|
||||||
|
|
||||||
## Configuration Files
|
## Configuration Files
|
||||||
|
|
||||||
Zoo Design Studio uses TOML files for configuration:
|
Zoo Design Studio uses TOML files for configuration:
|
||||||
|
|
||||||
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl/settings/user)
|
* **User Settings**: `user.toml` - See [complete documentation](/docs/kcl-lang/settings/user)
|
||||||
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl/settings/project)
|
* **Project Settings**: `project.toml` - See [complete documentation](/docs/kcl-lang/settings/project)
|
||||||
|
|
||||||
## Per-file settings
|
## Per-file settings
|
||||||
|
|
||||||
|
@ -197,5 +197,10 @@ test.describe('Basic sketch', () => {
|
|||||||
)
|
)
|
||||||
}, PERSIST_MODELING_CONTEXT)
|
}, PERSIST_MODELING_CONTEXT)
|
||||||
await doBasicSketch(page, [], { cmdBar, scene, homePage, editor })
|
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()
|
).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 ({
|
test('adding a syntax error, recovers after fixing', async ({
|
||||||
page,
|
page,
|
||||||
homePage,
|
homePage,
|
||||||
|
@ -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()])
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -148,6 +148,8 @@ function CommandBarHeader({ children }: React.PropsWithChildren<object>) {
|
|||||||
),
|
),
|
||||||
4
|
4
|
||||||
)
|
)
|
||||||
|
) : arg.inputType === 'text' && !arg.valueSummary ? (
|
||||||
|
`${argValue.slice(0, 12)}${argValue.length > 12 ? '...' : ''}`
|
||||||
) : typeof argValue === 'object' ? (
|
) : typeof argValue === 'object' ? (
|
||||||
arg.valueSummary ? (
|
arg.valueSummary ? (
|
||||||
arg.valueSummary(argValue)
|
arg.valueSummary(argValue)
|
||||||
|
@ -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
|
||||||
|
@ -37,6 +37,7 @@ import {
|
|||||||
} from '@src/lib/utils'
|
} from '@src/lib/utils'
|
||||||
import { DEFAULT_DEFAULT_LENGTH_UNIT } from '@src/lib/constants'
|
import { DEFAULT_DEFAULT_LENGTH_UNIT } from '@src/lib/constants'
|
||||||
import { createThumbnailPNGOnDesktop } from '@src/lib/screenshot'
|
import { createThumbnailPNGOnDesktop } from '@src/lib/screenshot'
|
||||||
|
import type { SettingsViaQueryString } from '@src/lib/settings/settingsTypes'
|
||||||
|
|
||||||
export const EngineStream = (props: {
|
export const EngineStream = (props: {
|
||||||
pool: string | null
|
pool: string | null
|
||||||
@ -54,12 +55,17 @@ export const EngineStream = (props: {
|
|||||||
const last = useRef<number>(Date.now())
|
const last = useRef<number>(Date.now())
|
||||||
const videoWrapperRef = useRef<HTMLDivElement>(null)
|
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,
|
theme: settings.app.theme.current,
|
||||||
enableSSAO: settings.modeling.enableSSAO.current,
|
enableSSAO: settings.modeling.enableSSAO.current,
|
||||||
highlightEdges: settings.modeling.highlightEdges.current,
|
highlightEdges: settings.modeling.highlightEdges.current,
|
||||||
showScaleGrid: settings.modeling.showScaleGrid.current,
|
showScaleGrid: settings.modeling.showScaleGrid.current,
|
||||||
cameraProjection: settings.modeling.cameraProjection.current,
|
cameraProjection: settings.modeling.cameraProjection.current,
|
||||||
|
cameraOrbit: settings.modeling.cameraOrbit.current,
|
||||||
}
|
}
|
||||||
|
|
||||||
const { state: modelingMachineState, send: modelingMachineActorSend } =
|
const { state: modelingMachineState, send: modelingMachineActorSend } =
|
||||||
|
@ -24,7 +24,7 @@ import { sortFilesAndDirectories } from '@src/lib/desktopFS'
|
|||||||
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
import useHotkeyWrapper from '@src/lib/hotkeyWrapper'
|
||||||
import { PATHS } from '@src/lib/paths'
|
import { PATHS } from '@src/lib/paths'
|
||||||
import type { FileEntry } from '@src/lib/project'
|
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 { reportRejection } from '@src/lib/trap'
|
||||||
import type { IndexLoaderData } from '@src/lib/types'
|
import type { IndexLoaderData } from '@src/lib/types'
|
||||||
|
|
||||||
@ -32,7 +32,6 @@ import { ToastInsert } from '@src/components/ToastInsert'
|
|||||||
import { commandBarActor } from '@src/lib/singletons'
|
import { commandBarActor } from '@src/lib/singletons'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
import styles from './FileTree.module.css'
|
import styles from './FileTree.module.css'
|
||||||
import { jsAppSettings } from '@src/lib/settings/settingsUtils'
|
|
||||||
|
|
||||||
function getIndentationCSS(level: number) {
|
function getIndentationCSS(level: number) {
|
||||||
return `calc(1rem * ${level + 1})`
|
return `calc(1rem * ${level + 1})`
|
||||||
@ -229,10 +228,6 @@ const FileTreeItem = ({
|
|||||||
code = normalizeLineEndings(code)
|
code = normalizeLineEndings(code)
|
||||||
codeManager.updateCodeStateEditor(code)
|
codeManager.updateCodeStateEditor(code)
|
||||||
} else if (isImportedInCurrentFile && eventType === 'change') {
|
} else if (isImportedInCurrentFile && eventType === 'change') {
|
||||||
await rustContext.clearSceneAndBustCache(
|
|
||||||
await jsAppSettings(),
|
|
||||||
codeManager?.currentFilePath || undefined
|
|
||||||
)
|
|
||||||
await kclManager.executeAst()
|
await kclManager.executeAst()
|
||||||
}
|
}
|
||||||
fileSend({ type: 'Refresh' })
|
fileSend({ type: 'Refresh' })
|
||||||
|
@ -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
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
|
|
||||||
import { BSON } from 'bson'
|
|
||||||
import type { Configuration } from '@rust/kcl-lib/bindings/Configuration'
|
import type { Configuration } from '@rust/kcl-lib/bindings/Configuration'
|
||||||
import type { DefaultPlanes } from '@rust/kcl-lib/bindings/DefaultPlanes'
|
import type { DefaultPlanes } from '@rust/kcl-lib/bindings/DefaultPlanes'
|
||||||
import type { KclError as RustKclError } from '@rust/kcl-lib/bindings/KclError'
|
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 { Node } from '@rust/kcl-lib/bindings/Node'
|
||||||
import type { Program } from '@rust/kcl-lib/bindings/Program'
|
import type { Program } from '@rust/kcl-lib/bindings/Program'
|
||||||
import type { Context } from '@rust/kcl-wasm-lib/pkg/kcl_wasm_lib'
|
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 type { EngineCommandManager } from '@src/lang/std/engineConnection'
|
||||||
import { fileSystemManager } from '@src/lang/std/fileSystemManager'
|
import { fileSystemManager } from '@src/lang/std/fileSystemManager'
|
||||||
import type { ExecState } from '@src/lang/wasm'
|
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 { DeepPartial } from '@src/lib/types'
|
||||||
import type { ModuleType } from '@src/lib/wasm_lib_wrapper'
|
import type { ModuleType } from '@src/lib/wasm_lib_wrapper'
|
||||||
import { getModule } 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 {
|
export default class RustContext {
|
||||||
private wasmInitFailed: boolean = true
|
private wasmInitFailed: boolean = true
|
||||||
@ -155,6 +155,19 @@ export default class RustContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Clear/reset the scene and bust the cache.
|
// 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(
|
async clearSceneAndBustCache(
|
||||||
settings: DeepPartial<Configuration>,
|
settings: DeepPartial<Configuration>,
|
||||||
path?: string
|
path?: string
|
||||||
|
@ -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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BkKDJWAI4kCxqE3BY2R1iFF2K8t3eG3EvEWnAqQlclh3ySiqADbq+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 { 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
|
||||||
@ -3384,8 +3381,6 @@ export const modelingMachine = setup({
|
|||||||
target: 'normal',
|
target: 'normal',
|
||||||
actions: 'set up draft line',
|
actions: 'set up draft line',
|
||||||
},
|
},
|
||||||
|
|
||||||
Cancel: '#Modeling.Sketch.undo startSketchOn',
|
|
||||||
},
|
},
|
||||||
|
|
||||||
exit: 'remove draft entities',
|
exit: 'remove draft entities',
|
||||||
@ -4208,6 +4203,7 @@ export const modelingMachine = setup({
|
|||||||
initial: 'Init',
|
initial: 'Init',
|
||||||
|
|
||||||
on: {
|
on: {
|
||||||
|
Cancel: '.undo startSketchOn',
|
||||||
CancelSketch: '.SketchIdle',
|
CancelSketch: '.SketchIdle',
|
||||||
|
|
||||||
'Delete segment': {
|
'Delete segment': {
|
||||||
@ -4714,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