fix sketch on face (#2745)

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-06-21 21:49:12 -07:00
committed by GitHub
parent 0f3f923019
commit 226ed37c5f
4 changed files with 14 additions and 6 deletions

View File

@ -1394,7 +1394,6 @@ export class SceneEntities {
streamDimensions
)
let _entity_id = entity_id
console.log('things', _entity_id, rest)
if (!_entity_id) return
if (
engineCommandManager.defaultPlanes?.xy === _entity_id ||
@ -1423,7 +1422,6 @@ export class SceneEntities {
.sub(sceneInfra.camControls.target)
if (engineCommandManager.defaultPlanes?.xy === _entity_id) {
console.log('XY')
zAxis = [0, 0, 1]
yAxis = [0, 1, 0]
if (camVector.z < 0) {
@ -1431,7 +1429,6 @@ export class SceneEntities {
_entity_id = engineCommandManager.defaultPlanes?.negXy || ''
}
} else if (engineCommandManager.defaultPlanes?.yz === _entity_id) {
console.log('YZ')
zAxis = [1, 0, 0]
yAxis = [0, 0, 1]
if (camVector.x < 0) {
@ -1439,7 +1436,6 @@ export class SceneEntities {
_entity_id = engineCommandManager.defaultPlanes?.negYz || ''
}
} else if (engineCommandManager.defaultPlanes?.xz === _entity_id) {
console.log('XZ')
zAxis = [0, 1, 0]
yAxis = [0, 0, 1]
_entity_id = engineCommandManager.defaultPlanes?.negXz || ''
@ -1493,6 +1489,7 @@ export class SceneEntities {
kclManager.ast,
artifact.range
)
const extrudePathToNode = extrusions?.range
? getNodePathFromSourceRange(kclManager.ast, extrusions.range)
: []

View File

@ -507,6 +507,7 @@ export const ModelingMachineProvider = ({
},
'animate-to-face': async (_, { data }) => {
if (data.type === 'extrudeFace') {
console.log('data', data)
const { modifiedAst, pathToNode: pathToNewSketchNode } =
sketchOnExtrudedFace(
kclManager.ast,

View File

@ -1466,6 +1466,9 @@ export class EngineCommandManager extends EventTarget {
if (command && command.type === 'pending') {
const resolve = command.resolve
const oldArtifact = this.artifactMap[id] as ArtifactMapCommand & {
extrusions?: string[]
}
const artifact = {
type: 'result',
range: command.range,
@ -1474,7 +1477,10 @@ export class EngineCommandManager extends EventTarget {
parentId: command.parentId ? command.parentId : undefined,
data: modelingResponse,
raw,
} as const
} as ArtifactMapCommand & { extrusions?: string[] }
if (oldArtifact?.extrusions) {
artifact.extrusions = oldArtifact.extrusions
}
this.artifactMap[id] = artifact
if (
(command.commandType === 'entity_linear_pattern' &&
@ -1903,6 +1909,8 @@ export class EngineCommandManager extends EventTarget {
} else {
typedTarget.extrusions = [id]
}
// Update in the map.
this.artifactMap[command.target] = typedTarget
}
}
return promise

View File

@ -1,12 +1,14 @@
[package]
name = "kcl-test-server"
description = "A test server for KCL"
version = "0.1.0"
edition = "2021"
license = "MIT"
[dependencies]
anyhow = "1.0.86"
hyper = { version = "0.14.29", features = ["server"] }
kcl-lib = { path = "../kcl" }
kcl-lib = { version = "0.1.62", path = "../kcl" }
pico-args = "0.5.0"
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"