Repository: KittyCAD/modeling-app
Pull request #6604: [Feature]: Initialize engine with `view_isometric` as a user.
Author: login: nadr0
Created: 2025-04-30T19:10:14Z | Merged: 2025-05-01T17:42:44Z

# Issue

When loading into the engine the camera's view direction is not optimal for a CAD experience. It looks from an angle that hides a dimension

# Implementation

- When the user loads the engine call `view_isometric` if the code is outside playwright e2e tests
- Added a helper function in electron and the browser to check `isPlaywright()` similar to `isDesktop()`
- E2E should run with the usual `zoom_to_fit` so all the tests will be the same!

# Big Gotcha
- If you write an end to end test, your camera will be different from your local host camera. You would need to turn this on locally if you are trying to recreate the same E2E tests or write a new one



Diff:
diff --git a/e2e/playwright/point-click.spec.ts b/e2e/playwright/point-click.spec.ts
index de622bcfced..4b071f1551d 100644
--- a/e2e/playwright/point-click.spec.ts
+++ b/e2e/playwright/point-click.spec.ts
@@ -3342,7 +3342,7 @@ profile001 = startProfile(sketch001, at = [-20, 20])
       const testPoint = { x: 590, y: 400 }
       const extrudeColor: [number, number, number] = [100, 100, 100]
       const sketchColor: [number, number, number] = [140, 140, 140]
-      const defaultPlaneColor: [number, number, number] = [50, 50, 100]
+      const defaultPlaneColor: [number, number, number] = [88, 44, 45]
 
       const deleteOperation = async (operationButton: Locator) => {
         if (shouldUseKeyboard) {
@@ -3386,7 +3386,11 @@ profile001 = startProfile(sketch001, at = [-20, 20])
         )
         await deleteOperation(operationButton)
         await editor.expectEditor.toContain('')
-        await scene.expectPixelColor(defaultPlaneColor, testPoint, 20)
+        // Cannot use test point anymore because the camera's position has been
+        // reset and the rest of the test doesn't need to change just to check
+        // if the scene is cleared.
+        // Check that the scene is cleared
+        await scene.expectPixelColor(defaultPlaneColor, { x: 574, y: 342 }, 20)
       })
     })
   })
diff --git a/e2e/playwright/storageStates.ts b/e2e/playwright/storageStates.ts
index 79d7f4af1ad..345bdfdb109 100644
--- a/e2e/playwright/storageStates.ts
+++ b/e2e/playwright/storageStates.ts
@@ -5,8 +5,6 @@ import { onboardingPaths } from '@src/routes/Onboarding/paths'
 
 import type { Settings } from '@rust/kcl-lib/bindings/Settings'
 
-export const IS_PLAYWRIGHT_KEY = 'playwright'
-
 export const TEST_SETTINGS_KEY = '/settings.toml'
 export const TEST_SETTINGS: DeepPartial<Settings> = {
   app: {
diff --git a/e2e/playwright/test-utils.ts b/e2e/playwright/test-utils.ts
index 55dcf9eff43..9ef93263ff4 100644
--- a/e2e/playwright/test-utils.ts
+++ b/e2e/playwright/test-utils.ts
@@ -18,11 +18,8 @@ import type { ProjectConfiguration } from '@rust/kcl-lib/bindings/ProjectConfigu
 
 import { isErrorWhitelisted } from '@e2e/playwright/lib/console-error-whitelist'
 import { secrets } from '@e2e/playwright/secrets'
-import {
-  IS_PLAYWRIGHT_KEY,
-  TEST_SETTINGS,
-  TEST_SETTINGS_KEY,
-} from '@e2e/playwright/storageStates'
+import { TEST_SETTINGS, TEST_SETTINGS_KEY } from '@e2e/playwright/storageStates'
+import { IS_PLAYWRIGHT_KEY } from '@src/lib/constants'
 import { test } from '@e2e/playwright/zoo-test'
 
 const toNormalizedCode = (text: string) => {
diff --git a/src/components/EngineStream.tsx b/src/components/EngineStream.tsx
index 0c8553fbdb5..25ce5282790 100644
--- a/src/components/EngineStream.tsx
+++ b/src/components/EngineStream.tsx
@@ -29,6 +29,13 @@ import { useSelector } from '@xstate/react'
 import type { MouseEventHandler } from 'react'
 import { useEffect, useRef, useState } from 'react'
 import { useRouteLoaderData } from 'react-router-dom'
+import { isPlaywright } from '@src/lib/isPlaywright'
+import {
+  engineStreamZoomToFit,
+  engineViewIsometricWithGeometryPresent,
+  engineViewIsometricWithoutGeometryPresent,
+} from '@src/lib/utils'
+import { DEFAULT_DEFAULT_LENGTH_UNIT } from '@src/lib/constants'
 
 export const EngineStream = (props: {
   pool: string | null
@@ -89,21 +96,33 @@ export const EngineStream = (props: {
     console.log('scene is ready, fire!')
 
     kmp
-      .then(() =>
-        // It makes sense to also call zoom to fit here, when a new file is
-        // loaded for the first time, but not overtaking the work kevin did
-        // so the camera isn't moving all the time.
-        engineCommandManager.sendSceneCommand({
-          type: 'modeling_cmd_req',
-          cmd_id: uuidv4(),
-          cmd: {
-            type: 'zoom_to_fit',
-            object_ids: [], // leave empty to zoom to all objects
-            padding: 0.1, // padding around the objects
-            animated: false, // don't animate the zoom for now
-          },
-        })
-      )
+      .then(async () => {
+        // Gotcha: Playwright E2E tests will be zoom_to_fit, when you try to recreate the e2e test manually
+        // your localhost will do view_isometric. Turn this boolean on to have the same experience when manually
+        // debugging e2e tests
+
+        // We need a padding of 0.1 for zoom_to_fit for all E2E tests since they were originally
+        // written with zoom_to_fit with padding 0.1
+        const padding = 0.1
+        if (isPlaywright()) {
+          await engineStreamZoomToFit({ engineCommandManager, padding })
+        } else {
+          // If the scene is empty you cannot use view_isometric, it will not move the camera
+          if (kclManager.isAstBodyEmpty(kclManager.ast)) {
+            await engineViewIsometricWithoutGeometryPresent({
+              engineCommandManager,
+              unit:
+                kclManager.fileSettings.defaultLengthUnit ||
+                DEFAULT_DEFAULT_LENGTH_UNIT,
+            })
+          } else {
+            await engineViewIsometricWithGeometryPresent({
+              engineCommandManager,
+              padding,
+            })
+          }
+        }
+      })
       .catch(trap)
   }
 
diff --git a/src/lang/KclSingleton.ts b/src/lang/KclSingleton.ts
index 86ee4377b05..2a8480e9343 100644
--- a/src/lang/KclSingleton.ts
+++ b/src/lang/KclSingleton.ts
@@ -738,6 +738,18 @@ export class KclManager {
     return ast.start === 0 && ast.end === 0 && ast.body.length === 0
   }
 
+  /**
+   * Determines if there is no code to execute. If there is a @settings annotation
+   * that adds to the overall ast.start and ast.end but not the body which is the program
+   *
+   *
+   * If you need to know if there is any program code or not, use this function otherwise
+   * use _isAstEmpty
+   */
+  isAstBodyEmpty(ast: Node<Program>) {
+    return ast.body.length === 0
+  }
+
   get fileSettings() {
     return this._fileSettings
   }
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
index 4a527381d4c..b438fd9dd26 100644
--- a/src/lib/constants.ts
+++ b/src/lib/constants.ts
@@ -187,3 +187,6 @@ export type ExecutionType =
   | typeof EXECUTION_TYPE_REAL
   | typeof EXECUTION_TYPE_MOCK
   | typeof EXECUTION_TYPE_NONE
+
+/** Key for setting window.localStorage.setItem and .getItem to determine if the runtime is playwright for browsers */
+export const IS_PLAYWRIGHT_KEY = 'playwright'
diff --git a/src/lib/isPlaywright.ts b/src/lib/isPlaywright.ts
new file mode 100644
index 00000000000..7828c5e970d
--- /dev/null
+++ b/src/lib/isPlaywright.ts
@@ -0,0 +1,10 @@
+import { IS_PLAYWRIGHT_KEY } from '@src/lib/constants'
+
+export function isPlaywright(): boolean {
+  // ? checks for browser
+  const electronRunTimePlaywright =
+    window?.electron?.process?.env.IS_PLAYWRIGHT == 'true'
+  const browserRuntimePlaywright =
+    localStorage.getItem(IS_PLAYWRIGHT_KEY) === 'true'
+  return electronRunTimePlaywright || browserRuntimePlaywright
+}
diff --git a/src/lib/paths.ts b/src/lib/paths.ts
index 4ad514f197e..45bb8d09626 100644
--- a/src/lib/paths.ts
+++ b/src/lib/paths.ts
@@ -1,8 +1,6 @@
 import type { PlatformPath } from 'path'
-
 import type { Configuration } from '@rust/kcl-lib/bindings/Configuration'
-
-import { IS_PLAYWRIGHT_KEY } from '@e2e/playwright/storageStates'
+import { IS_PLAYWRIGHT_KEY } from '@src/lib/constants'
 
 import {
   BROWSER_FILE_NAME,
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index dc13bcd98bb..0ee06f6efaf 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -6,6 +6,14 @@ import type { CallExpressionKw, SourceRange } from '@src/lang/wasm'
 import { isDesktop } from '@src/lib/isDesktop'
 import type { AsyncFn } from '@src/lib/types'
 
+import * as THREE from 'three'
+
+import type { EngineCommandManager } from '@src/lang/std/engineConnection'
+import type {
+  CameraViewState_type,
+  UnitLength_type,
+} from '@kittycad/lib/dist/types/src/models'
+
 export const uuidv4 = v4
 
 /**
@@ -533,3 +541,132 @@ export function getInVariableCase(name: string, prefixIfDigit = 'm') {
 
   return likelyPascalCase.slice(0, 1).toLowerCase() + likelyPascalCase.slice(1)
 }
+
+export function computeIsometricQuaternionForEmptyScene() {
+  // Create the direction vector you want to look from
+  const isoDir = new THREE.Vector3(1, 1, 1).normalize() // isometric look direction
+
+  // Target is the point you want to look at (e.g., origin)
+  const target = new THREE.Vector3(0, 0, 0)
+
+  // Compute quaternion for isometric view
+  const up = new THREE.Vector3(0, 0, 1) // default up direction
+  const quaternion = new THREE.Quaternion()
+  quaternion.setFromUnitVectors(new THREE.Vector3(0, 0, 1), isoDir) // align -Z with isoDir
+
+  // Align up vector using a lookAt matrix
+  const m = new THREE.Matrix4()
+  m.lookAt(new THREE.Vector3().addVectors(target, isoDir), target, up)
+  quaternion.setFromRotationMatrix(m)
+  return quaternion
+}
+
+export async function engineStreamZoomToFit({
+  engineCommandManager,
+  padding,
+}: {
+  engineCommandManager: EngineCommandManager
+  padding: number
+}) {
+  // It makes sense to also call zoom to fit here, when a new file is
+  // loaded for the first time, but not overtaking the work kevin did
+  // so the camera isn't moving all the time.
+  await engineCommandManager.sendSceneCommand({
+    type: 'modeling_cmd_req',
+    cmd_id: uuidv4(),
+    cmd: {
+      type: 'zoom_to_fit',
+      object_ids: [], // leave empty to zoom to all objects
+      padding, // padding around the objects
+      animated: false, // don't animate the zoom for now
+    },
+  })
+}
+
+export async function engineViewIsometricWithGeometryPresent({
+  engineCommandManager,
+  padding,
+}: {
+  engineCommandManager: EngineCommandManager
+  padding: number
+}) {
+  /**
+   * Default all users to view_isometric when loading into the engine.
+   * This works for perspective projection and orthographic projection
+   * This does not change the projection of the camera only the view direction which makes
+   * it safe to use with either projection defaulted
+   */
+  await engineCommandManager.sendSceneCommand({
+    type: 'modeling_cmd_req',
+    cmd_id: uuidv4(),
+    cmd: {
+      type: 'view_isometric',
+      padding, // padding around the objects
+    },
+  })
+
+  /**
+   * HACK: We need to update the gizmo, the command above doesn't trigger gizmo
+   * to render which makes the axis point in an old direction.
+   */
+  await engineCommandManager.sendSceneCommand({
+    type: 'modeling_cmd_req',
+    cmd_id: uuidv4(),
+    cmd: {
+      type: 'default_camera_get_settings',
+    },
+  })
+}
+
+export async function engineViewIsometricWithoutGeometryPresent({
+  engineCommandManager,
+  unit,
+}: {
+  engineCommandManager: EngineCommandManager
+  unit?: UnitLength_type
+}) {
+  // If you load an empty scene with any file unit it will have an eye offset of this
+  const MAGIC_ENGINE_EYE_OFFSET = 1378.0057
+  const quat = computeIsometricQuaternionForEmptyScene()
+  const isometricView: CameraViewState_type = {
+    pivot_rotation: {
+      x: quat.x,
+      y: quat.y,
+      z: quat.z,
+      w: quat.w,
+    },
+    pivot_position: {
+      x: 0,
+      y: 0,
+      z: 0,
+    },
+    eye_offset: MAGIC_ENGINE_EYE_OFFSET,
+    fov_y: 45,
+    ortho_scale_factor: 1.4063792,
+    is_ortho: true,
+    ortho_scale_enabled: true,
+    world_coord_system: 'right_handed_up_z',
+  }
+  await engineCommandManager.sendSceneCommand({
+    type: 'modeling_cmd_req',
+    cmd_id: uuidv4(),
+    cmd: {
+      type: 'default_camera_set_view',
+      view: {
+        ...isometricView,
+      },
+    },
+  })
+
+  /**
+   * HACK: We need to update the gizmo, the command above doesn't trigger gizmo
+   * to render which makes the axis point in an old direction.
+   */
+  await engineCommandManager.sendSceneCommand({
+    type: 'modeling_cmd_req',
+    cmd_id: uuidv4(),
+    cmd: {
+      type: 'default_camera_get_settings',
+    },
+  })
+}
diff --git a/src/machines/modelingMachine.ts b/src/machines/modelingMachine.ts
index 15d3a02a0cf..0def5f8a5ff 100644
--- a/src/machines/modelingMachine.ts
+++ b/src/machines/modelingMachine.ts
@@ -2435,7 +2435,9 @@ export const modelingMachine = setup({
           'VariableDeclarator'
         )
         if (err(extrudeNode)) {
-          return new Error("Couldn't find extrude node", { cause: extrudeNode })
+          return new Error("Couldn't find extrude node", {
+            cause: extrudeNode,
+          })
         }
 
         // Perform the shell op
@@ -3326,11 +3328,7 @@ export const modelingMachine = setup({
             'Artifact graph emptied': 'hidePlanes',
           },
 
-          entry: [
-            'show default planes',
-            'reset camera position',
-            'set selection filter to curves only',
-          ],
+          entry: ['show default planes', 'set selection filter to curves only'],
           description: `We want to disable selections and hover highlights here, because users can't do anything with that information until they actually add something to the scene. The planes are just for orientation here.`,
           exit: 'set selection filter to defaults',
         },
diff --git a/src/routes/utils.ts b/src/routes/utils.ts
index 5cadccea19e..441bc164aca 100644
--- a/src/routes/utils.ts
+++ b/src/routes/utils.ts
@@ -1,7 +1,6 @@
 import { NODE_ENV } from '@src/env'
 import { isDesktop } from '@src/lib/isDesktop'
-
-import { IS_PLAYWRIGHT_KEY } from '@e2e/playwright/storageStates'
+import { IS_PLAYWRIGHT_KEY } from '@src/lib/constants'
 
 const isTestEnv = window?.localStorage.getItem(IS_PLAYWRIGHT_KEY) === 'true'
 


Reviews:
user: login: graphite-app[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-30T19:12:26Z
user: login: graphite-app[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-30T19:14:20Z
user: login: graphite-app[bot]
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-30T20:50:35Z
user: login: nadr0
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-30T20:52:59Z
user: login: pierremtb
body: Thank you so much, been waiting on this for so long! https://kittycadworkspace.slack.com/archives/C04KFV6NKL0/p1746110623854779?thread_ts=1746036878.572349&cid=C04KFV6NKL0
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-05-01T14:59:30Z
user: login: nadr0
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-01T17:04:25Z
user: login: nadr0
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-01T17:05:18Z

Review comments:
diff_hunk: @@ -89,21 +90,41 @@ export const EngineStream = (props: {
     console.log('scene is ready, fire!')
 
     kmp
-      .then(() =>
-        // It makes sense to also call zoom to fit here, when a new file is
-        // loaded for the first time, but not overtaking the work kevin did
-        // so the camera isn't moving all the time.
-        engineCommandManager.sendSceneCommand({
-          type: 'modeling_cmd_req',
-          cmd_id: uuidv4(),
-          cmd: {
-            type: 'zoom_to_fit',
-            object_ids: [], // leave empty to zoom to all objects
-            padding: 0.1, // padding around the objects
-            animated: false, // don't animate the zoom for now
-          },
-        })
-      )
+      .then(async () => {
+        // We need a padding of 0.1 for zoom_to_fit for all E2E tests since they were originally
+        // written with zoom_to_fit with padding 0.1
+        const padding = 0.1
+        if (isPlaywright()) {
+          // It makes sense to also call zoom to fit here, when a new file is
+          // loaded for the first time, but not overtaking the work kevin did
+          // so the camera isn't moving all the time.
+          await engineCommandManager.sendSceneCommand({
+            type: 'modeling_cmd_req',
+            cmd_id: uuidv4(),
+            cmd: {
+              type: 'zoom_to_fit',
+              object_ids: [], // leave empty to zoom to all objects
+              padding, // padding around the objects
+              animated: false, // don't animate the zoom for now
+            },
+          })
+        } else {
+          /**
+           * Default all users to view_isometric when loading into the engine.
+           * This works for perspective projection and orthographic projection
+           * This does not change the projection of the camera only the view direction which makes
+           * it safe to use with wither projection defaulted
path: src/components/EngineStream.tsx
user: login: graphite-app[bot]
body: There's a typo in this comment: `wither` should be `either`.
```suggestion
+           * it safe to use with either projection defaulted
```
  

*Spotted by [Diamond](https://app.graphite.dev/diamond/?org=KittyCAD&ref=ai-review-comment)*<i class='graphite__hidden'><br /><br />Is this helpful? React 👍 or 👎 to let us know.</i>
created_at: 2025-04-30T19:12:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -89,21 +90,45 @@ export const EngineStream = (props: {
     console.log('scene is ready, fire!')
 
     kmp
-      .then(() =>
-        // It makes sense to also call zoom to fit here, when a new file is
-        // loaded for the first time, but not overtaking the work kevin did
-        // so the camera isn't moving all the time.
-        engineCommandManager.sendSceneCommand({
-          type: 'modeling_cmd_req',
-          cmd_id: uuidv4(),
-          cmd: {
-            type: 'zoom_to_fit',
-            object_ids: [], // leave empty to zoom to all objects
-            padding: 0.1, // padding around the objects
-            animated: false, // don't animate the zoom for now
-          },
-        })
-      )
+      .then(async () => {
+        // Gotcha: Playwright E2E tests will be zoom_to_fit, when you try to recreate the e2e test manually
+        // your localhost will do view_isometric. Turn this boolean on to have the same exeperience when manually
path: src/components/EngineStream.tsx
user: login: graphite-app[bot]
body: There's a typo in the comment: `exeperience` should be spelled `experience`.
```suggestion
        // your localhost will do view_isometric. Turn this boolean on to have the same experience when manually
```
  

*Spotted by [Diamond](https://app.graphite.dev/diamond/?org=KittyCAD&ref=ai-review-comment)*<i class='graphite__hidden'><br /><br />Is this helpful? React 👍 or 👎 to let us know.</i>
created_at: 2025-04-30T19:14:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -78,6 +85,7 @@ export const EngineStream = (props: {
 
   // When the scene is ready play the stream and execute!
   const play = () => {
+    console.log('PALY PLAY PLAYPLAYPLAYPALYAPY')
path: src/components/EngineStream.tsx
user: login: graphite-app[bot]
body: This debug console.log statement should be removed before merging to production. It appears to be a development artifact that doesn't provide value in the codebase.

*Spotted by [Diamond](https://app.graphite.dev/diamond/?org=KittyCAD&ref=ai-review-comment)*<i class='graphite__hidden'><br /><br />Is this helpful? React 👍 or 👎 to let us know.</i>
created_at: 2025-04-30T20:50:34Z
author_association: CONTRIBUTOR
diff_hunk: @@ -3326,11 +3328,7 @@ export const modelingMachine = setup({
             'Artifact graph emptied': 'hidePlanes',
           },
 
-          entry: [
-            'show default planes',
-            'reset camera position',
-            'set selection filter to curves only',
-          ],
+          entry: ['show default planes', 'set selection filter to curves only'],
path: src/machines/modelingMachine.ts
user: login: nadr0
body: I don't know why showing planes moves the camera?

I deleted this because after we initialize the scene the initial camera view code fights this because this does `reset camera position`
created_at: 2025-04-30T20:52:56Z
author_association: CONTRIBUTOR
diff_hunk: @@ -89,21 +96,33 @@ export const EngineStream = (props: {
     console.log('scene is ready, fire!')
 
     kmp
-      .then(() =>
-        // It makes sense to also call zoom to fit here, when a new file is
-        // loaded for the first time, but not overtaking the work kevin did
-        // so the camera isn't moving all the time.
-        engineCommandManager.sendSceneCommand({
-          type: 'modeling_cmd_req',
-          cmd_id: uuidv4(),
-          cmd: {
-            type: 'zoom_to_fit',
-            object_ids: [], // leave empty to zoom to all objects
-            padding: 0.1, // padding around the objects
-            animated: false, // don't animate the zoom for now
-          },
-        })
-      )
+      .then(async () => {
+        // Gotcha: Playwright E2E tests will be zoom_to_fit, when you try to recreate the e2e test manually
+        // your localhost will do view_isometric. Turn this boolean on to have the same experience when manually
+        // debugging e2e tests
+
+        // We need a padding of 0.1 for zoom_to_fit for all E2E tests since they were originally
+        // written with zoom_to_fit with padding 0.1
+        const padding = 0.1
+        if (isPlaywright()) {
path: src/components/EngineStream.tsx
user: login: pierremtb
body: This is so clean, thanks for adding that!
created_at: 2025-05-01T14:49:56Z
author_association: CONTRIBUTOR
diff_hunk: @@ -738,6 +738,11 @@ export class KclManager {
     return ast.start === 0 && ast.end === 0 && ast.body.length === 0
   }
 
+  // Determines if there is no KCL code which means it is executing a blank KCL file
+  isAstBodyEmpty(ast: Node<Program>) {
+    return ast.body.length === 0
+  }
path: src/lang/KclSingleton.ts
user: login: pierremtb
body: Nit: do you mind updating the comment to make it clearer that this is different than the private method right above?
created_at: 2025-05-01T14:51:42Z
author_association: CONTRIBUTOR
diff_hunk: @@ -533,3 +541,132 @@ export function getInVariableCase(name: string, prefixIfDigit = 'm') {
 
   return likelyPascalCase.slice(0, 1).toLowerCase() + likelyPascalCase.slice(1)
 }
+
+export function computeIsometricQuaternionForEmptyScene() {
+  // Create the direction vector you want to look from
+  const isoDir = new THREE.Vector3(1, 1, 1).normalize() // isometric look direction
+
+  // Target is the point you want to look at (e.g., origin)
+  const target = new THREE.Vector3(0, 0, 0)
+
+  // Compute quaternion for isometric view
+  const up = new THREE.Vector3(0, 0, 1) // default up direction
+  const quaternion = new THREE.Quaternion()
+  quaternion.setFromUnitVectors(new THREE.Vector3(0, 0, 1), isoDir) // align -Z with isoDir
+
+  // Optionally align up vector using a lookAt matrix
path: src/lib/utils.ts
user: login: pierremtb
body: Curious, why do we say 'Optionally' here?
created_at: 2025-05-01T14:53:40Z
author_association: CONTRIBUTOR
diff_hunk: @@ -3326,11 +3328,7 @@ export const modelingMachine = setup({
             'Artifact graph emptied': 'hidePlanes',
           },
 
-          entry: [
-            'show default planes',
-            'reset camera position',
-            'set selection filter to curves only',
-          ],
+          entry: ['show default planes', 'set selection filter to curves only'],
path: src/machines/modelingMachine.ts
user: login: pierremtb
body: You're right it shouldn't. Idk if this could be related to @andrewvarga's work on the plane toggles?
created_at: 2025-05-01T14:55:55Z
author_association: CONTRIBUTOR
diff_hunk: @@ -738,6 +738,11 @@ export class KclManager {
     return ast.start === 0 && ast.end === 0 && ast.body.length === 0
   }
 
+  // Determines if there is no KCL code which means it is executing a blank KCL file
+  isAstBodyEmpty(ast: Node<Program>) {
+    return ast.body.length === 0
+  }
path: src/lang/KclSingleton.ts
user: login: nadr0
body: Updated the comment, thanks! 
created_at: 2025-05-01T17:04:25Z
author_association: CONTRIBUTOR
diff_hunk: @@ -533,3 +541,132 @@ export function getInVariableCase(name: string, prefixIfDigit = 'm') {
 
   return likelyPascalCase.slice(0, 1).toLowerCase() + likelyPascalCase.slice(1)
 }
+
+export function computeIsometricQuaternionForEmptyScene() {
+  // Create the direction vector you want to look from
+  const isoDir = new THREE.Vector3(1, 1, 1).normalize() // isometric look direction
+
+  // Target is the point you want to look at (e.g., origin)
+  const target = new THREE.Vector3(0, 0, 0)
+
+  // Compute quaternion for isometric view
+  const up = new THREE.Vector3(0, 0, 1) // default up direction
+  const quaternion = new THREE.Quaternion()
+  quaternion.setFromUnitVectors(new THREE.Vector3(0, 0, 1), isoDir) // align -Z with isoDir
+
+  // Optionally align up vector using a lookAt matrix
path: src/lib/utils.ts
user: login: nadr0
body: CHAT GPT BABY, I got doxxed. I'll remove that
created_at: 2025-05-01T17:05:17Z
author_association: CONTRIBUTOR

PR comments:
user: login: qa-wolf[bot]
created_at: 2025-04-30T19:10:17Z
body: QA Wolf here! As you write new code it's important that your test coverage is keeping up.
[Click here to request test coverage for this PR!](https://app.qawolf.com/api/coverage-requests/new/eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJwdWxsUmVxdWVzdElkIjoiYTRzcWNobGhrNjB5OGxibTA3OGtzOTBjb3ByIiwiaWF0IjoxNzQ2MDQwMjE2LCJleHAiOjE3NDg2MzIyMTZ9.X7gROzU22tpQBS_xiIOgdEi0VtYGunwlfznZchHT_S5nx2fMeJGjHS-ZXnEjqhtexedWRFZJRkGw38Qe1dJao-hzqPfDOwaCLoAFn515RV4QsL3k7HJJMLX-ArgA7ORgJse8R1H75d7zx2nt_27Ed_z58rYCA8QcxNzNncOzsOWjo-dm-es9Rw4g9Y-0Cba15cEHP3S7RbgAf5xnTM5i77mMi1mhcb-tGHF0nN-6ucBG7Ji7bt8k66o2fjtccteM5wz-GQunoNIiiPZpudU27DnaQaef1MNygMDUoklnLTYdzlt_tV8Cdya1yao6DcpN9uk9SxyvkE3zB0vALkMAkQ)
author_association: NONE
user: login: vercel[bot]
created_at: 2025-04-30T19:10:18Z
body: [vc]: #UIxgex2SUdV461CMm4RG8KhHxFaQ8fQRGunH09jXlDE=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJtb2RlbGluZy1hcHAiLCJpbnNwZWN0b3JVcmwiOiJodHRwczovL3ZlcmNlbC5jb20va2l0dHljYWQvbW9kZWxpbmctYXBwL0hwanhjU2hzTEFWNFpKWm9uM1FnZHplcnZBUEsiLCJwcmV2aWV3VXJsIjoibW9kZWxpbmctYXBwLWdpdC1uYWRyby1hZGhvY2luaXRpYWxpemUtdG8tbmV3LWQtNGU0ZmVkLWtpdHR5Y2FkLnZlcmNlbC5hcHAiLCJuZXh0Q29tbWl0U3RhdHVzIjoiREVQTE9ZRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoibW9kZWxpbmctYXBwLWdpdC1uYWRyby1hZGhvY2luaXRpYWxpemUtdG8tbmV3LWQtNGU0ZmVkLWtpdHR5Y2FkLnZlcmNlbC5hcHAifSwicm9vdERpcmVjdG9yeSI6bnVsbH1dfQ==
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **modeling-app** | ✅ Ready ([Inspect](https://vercel.com/kittycad/modeling-app/HpjxcShsLAV4ZJZon3QgdzervAPK)) | [Visit Preview](https://modeling-app-git-nadro-adhocinitialize-to-new-d-4e4fed-kittycad.vercel.app) | 💬 [**Add feedback**](https://vercel.live/open-feedback/modeling-app-git-nadro-adhocinitialize-to-new-d-4e4fed-kittycad.vercel.app?via=pr-comment-feedback-link) | May 1, 2025 5:17pm |


author_association: NONE
user: login: nadr0
created_at: 2025-05-01T17:07:20Z
body: > You're right it shouldn't. Idk if this could be related to @andrewvarga's work on the plane toggles?

Yeah I purged this code it makes absolutely no sense to me. The whole test suite passes except the 2 tests I updated. Those two tests are correct they just had their camera shift so it didn't find the pixel for empty scene even though the scene is empty.

I think this is safe to delete. It fights with the initialization of the engine stream and my engine code to set the camera.

I cannot have a `resteCameraPosition` run during the initialization, we should only have 1 engine camera API call when the stream boots and the KCL file loads if possible. 
author_association: CONTRIBUTOR
user: login: pierremtb
created_at: 2025-05-01T17:42:57Z
body: Thanks for the updates, I'm merging this beauty @nadr0 
author_association: CONTRIBUTOR