Compare commits
29 Commits
v0.17.0
...
derive-doc
Author | SHA1 | Date | |
---|---|---|---|
e758c6cab0 | |||
c63ea8e445 | |||
7e0e0e1ee1 | |||
db3e2879bd | |||
7804079d8c | |||
571406fca3 | |||
a9e41a616d | |||
9a0b086e07 | |||
358184c634 | |||
85ac8bf7a3 | |||
544a327ee9 | |||
868a560e1a | |||
32a2835d0e | |||
4c93346f48 | |||
bfa8b8aca4 | |||
b1fe2dddb6 | |||
6d3f6c784e | |||
4904785bbd | |||
ca30fd44bd | |||
5d69a62324 | |||
0e04e20b97 | |||
1dac62067a | |||
86de039dc4 | |||
dce5833d79 | |||
f714c19890 | |||
f52128c41a | |||
39566174e7 | |||
3688c8a05e | |||
0025349e9a |
@ -1,3 +1,3 @@
|
||||
[codespell]
|
||||
ignore-words-list: crate,everytime,inout,co-ordinate,ot,nwo,absolutey
|
||||
skip: **/target,node_modules,build,**/Cargo.lock
|
||||
skip: **/target,node_modules,build,**/Cargo.lock,./docs/kcl/*.md
|
||||
|
@ -12,6 +12,10 @@ Computes the absolute value of a number.
|
||||
abs(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the arccosine of a number (in radians).
|
||||
acos(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Computes the arcsine of a number (in radians).
|
||||
asin(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the arctangent of a number (in radians).
|
||||
atan(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Computes the smallest integer greater than or equal to a number.
|
||||
ceil(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +1,10 @@
|
||||
---
|
||||
title: "cos"
|
||||
excerpt: "Computes the sine of a number (in radians)."
|
||||
excerpt: "Computes the cosine of a number (in radians)."
|
||||
layout: manual
|
||||
---
|
||||
|
||||
Computes the sine of a number (in radians).
|
||||
Computes the cosine of a number (in radians).
|
||||
|
||||
|
||||
|
||||
@ -12,6 +12,10 @@ Computes the sine of a number (in radians).
|
||||
cos(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Return the value of Euler’s number `e`.
|
||||
e() -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Computes the largest integer less than or equal to a number.
|
||||
floor(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
180
docs/kcl/getEdge.md
Normal file
180
docs/kcl/getEdge.md
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
308
docs/kcl/helix.md
Normal file
308
docs/kcl/helix.md
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -30,10 +30,12 @@ layout: manual
|
||||
* [`extrude`](kcl/extrude)
|
||||
* [`fillet`](kcl/fillet)
|
||||
* [`floor`](kcl/floor)
|
||||
* [`getEdge`](kcl/getEdge)
|
||||
* [`getExtrudeWallTransform`](kcl/getExtrudeWallTransform)
|
||||
* [`getNextAdjacentEdge`](kcl/getNextAdjacentEdge)
|
||||
* [`getOppositeEdge`](kcl/getOppositeEdge)
|
||||
* [`getPreviousAdjacentEdge`](kcl/getPreviousAdjacentEdge)
|
||||
* [`helix`](kcl/helix)
|
||||
* [`hole`](kcl/hole)
|
||||
* [`import`](kcl/import)
|
||||
* [`lastSegX`](kcl/lastSegX)
|
||||
@ -55,6 +57,7 @@ layout: manual
|
||||
* [`patternLinear3d`](kcl/patternLinear3d)
|
||||
* [`pi`](kcl/pi)
|
||||
* [`pow`](kcl/pow)
|
||||
* [`revolve`](kcl/revolve)
|
||||
* [`segAng`](kcl/segAng)
|
||||
* [`segEndX`](kcl/segEndX)
|
||||
* [`segEndY`](kcl/segEndY)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Returns the angle of the given leg for x.
|
||||
legAngX(hypotenuse: number, leg: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `utilities`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Returns the angle of the given leg for y.
|
||||
legAngY(hypotenuse: number, leg: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `utilities`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Returns the length of the given leg.
|
||||
legLen(hypotenuse: number, leg: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `utilities`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Computes the natural logarithm of the number.
|
||||
ln(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ The result might not be correctly rounded owing to implementation details; `log2
|
||||
log(num: number, base: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the base 10 logarithm of the number.
|
||||
log10(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the base 2 logarithm of the number.
|
||||
log2(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the maximum of the given arguments.
|
||||
max(args: [number]) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the minimum of the given arguments.
|
||||
min(args: [number]) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Return the value of `pi`. Archimedes’ constant (π).
|
||||
pi() -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the number to a power.
|
||||
pow(num: number, pow: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
444
docs/kcl/revolve.md
Normal file
444
docs/kcl/revolve.md
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Computes the sine of a number (in radians).
|
||||
sin(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Computes the square root of a number.
|
||||
sqrt(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
4327
docs/kcl/std.json
4327
docs/kcl/std.json
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,10 @@ Computes the tangent of a number (in radians).
|
||||
tan(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -12,6 +12,10 @@ Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
||||
tau() -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Converts a number from radians to degrees.
|
||||
toDegrees(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
@ -12,6 +12,10 @@ Converts a number from degrees to radians.
|
||||
toRadians(num: number) -> number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `math`
|
||||
|
||||
### Examples
|
||||
|
||||
```js
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 49 KiB |
@ -67,3 +67,12 @@ echo "Versions has been bumped in relevant json files, a branch has been created
|
||||
echo ""
|
||||
echo "What's left for you to do is, push the branch and make the release PR."
|
||||
echo ""
|
||||
|
||||
echo "Suggested changelog:"
|
||||
echo "\`\`\`"
|
||||
echo "## What's Changed"
|
||||
git log $(git describe --tags --abbrev=0)..HEAD --oneline --pretty=format:%s | grep -v Bump | grep -v 'Cut release v' | awk '{print "* "toupper(substr($0,0,1))substr($0,2)}'
|
||||
echo ""
|
||||
echo "**Full Changelog**: https://github.com/KittyCAD/modeling-app/compare/${latest_tag}...${new_version}"
|
||||
echo "\`\`\`"
|
||||
echo "and would recommend removing ones that aren't related to the product (eg. CI changes)"
|
||||
|
@ -10,7 +10,7 @@
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@headlessui/react": "^1.7.18",
|
||||
"@headlessui/tailwindcss": "^0.2.0",
|
||||
"@kittycad/lib": "^0.1.0",
|
||||
"@kittycad/lib": "^0.0.56",
|
||||
"@lezer/javascript": "^1.4.9",
|
||||
"@open-rpc/client-js": "^1.8.1",
|
||||
"@react-hook/resize-observer": "^1.2.6",
|
||||
@ -22,7 +22,7 @@
|
||||
"@ts-stack/markdown": "^1.5.0",
|
||||
"@tweenjs/tween.js": "^23.1.1",
|
||||
"@types/node": "^18.19.26",
|
||||
"@types/react": "^18.2.67",
|
||||
"@types/react": "^18.2.73",
|
||||
"@types/react-dom": "^18.2.22",
|
||||
"@uiw/react-codemirror": "^4.21.24",
|
||||
"@xstate/inspect": "^0.8.0",
|
||||
|
10
src-tauri/Cargo.lock
generated
10
src-tauri/Cargo.lock
generated
@ -1664,9 +1664,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "kittycad"
|
||||
version = "0.2.61"
|
||||
version = "0.2.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "949555aa013e1cefa68f59671cfe96602a459c903376c53a410aebf3831d291f"
|
||||
checksum = "93a332250e08fd715ad3d5826e04d36da1c5bb42d0c1b1ff1f0598278b9ebf3c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -3276,9 +3276,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.114"
|
||||
version = "1.0.115"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
|
||||
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
|
||||
dependencies = [
|
||||
"indexmap 2.2.5",
|
||||
"itoa 1.0.6",
|
||||
@ -3876,7 +3876,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "tauri-plugin-fs-extra"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#8cd4a39864986ae3600be9f23d089afd3988c43a"
|
||||
source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v1#c6a5b7ae479eaa598db2430a87fe32a3429198bf"
|
||||
dependencies = [
|
||||
"log",
|
||||
"serde",
|
||||
|
@ -16,7 +16,7 @@ tauri-build = { version = "1.5.1", features = [] }
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
kittycad = "0.2.61"
|
||||
kittycad = "0.2.63"
|
||||
oauth2 = "4.4.2"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
@ -242,7 +242,6 @@ export const ModelingMachineProvider = ({
|
||||
}
|
||||
|
||||
exportFromEngine({
|
||||
source_unit: baseUnit,
|
||||
format: format as Models['OutputFormat_type'],
|
||||
}).catch((e) => toast.error('Error while exporting', e)) // TODO I think we need to throw the error from engineCommandManager
|
||||
},
|
||||
|
@ -428,17 +428,15 @@ export class KclManager {
|
||||
return this?.engineCommandManager?.defaultPlanes
|
||||
}
|
||||
|
||||
getPlaneId(axis: 'xy' | 'xz' | 'yz'): string {
|
||||
return this.defaultPlanes[axis]
|
||||
}
|
||||
|
||||
showPlanes() {
|
||||
if (!this.defaultPlanes) return
|
||||
void this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xy, false)
|
||||
void this.engineCommandManager.setPlaneHidden(this.defaultPlanes.yz, false)
|
||||
void this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xz, false)
|
||||
}
|
||||
|
||||
hidePlanes() {
|
||||
if (!this.defaultPlanes) return
|
||||
void this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xy, true)
|
||||
void this.engineCommandManager.setPlaneHidden(this.defaultPlanes.yz, true)
|
||||
void this.engineCommandManager.setPlaneHidden(this.defaultPlanes.xz, true)
|
||||
@ -464,11 +462,23 @@ function enterEditMode(
|
||||
) as SketchGroup | ExtrudeGroup
|
||||
firstSketchOrExtrudeGroup &&
|
||||
engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'edit_mode_enter',
|
||||
target: firstSketchOrExtrudeGroup.id,
|
||||
},
|
||||
type: 'modeling_cmd_batch_req',
|
||||
batch_id: uuidv4(),
|
||||
requests: [
|
||||
{
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'edit_mode_enter',
|
||||
target: firstSketchOrExtrudeGroup.id,
|
||||
},
|
||||
},
|
||||
{
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'set_selection_filter',
|
||||
filter: ['face', 'edge', 'solid2d'],
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
|
@ -843,11 +843,7 @@ export class EngineCommandManager {
|
||||
outSequence = 1
|
||||
inSequence = 1
|
||||
engineConnection?: EngineConnection
|
||||
defaultPlanes: { xy: string; yz: string; xz: string } = {
|
||||
xy: '',
|
||||
yz: '',
|
||||
xz: '',
|
||||
}
|
||||
defaultPlanes: { xy: string; yz: string; xz: string } | null = null
|
||||
_commandLogs: CommandLog[] = []
|
||||
_commandLogCallBack: (command: CommandLog[]) => void = () => {}
|
||||
// Folks should realize that wait for ready does not get called _everytime_
|
||||
@ -1245,6 +1241,7 @@ export class EngineCommandManager {
|
||||
startNewSession() {
|
||||
this.lastArtifactMap = this.artifactMap
|
||||
this.artifactMap = {}
|
||||
this.initPlanes()
|
||||
}
|
||||
subscribeTo<T extends ModelTypes>({
|
||||
event,
|
||||
@ -1289,40 +1286,15 @@ export class EngineCommandManager {
|
||||
this.callbacksEngineStateConnection.push(callback)
|
||||
}
|
||||
endSession() {
|
||||
// TODO: instead of sending a single command with `object_ids: Object.keys(this.artifactMap)`
|
||||
// we need to loop over them each individually because if the engine doesn't recognise a single
|
||||
// id the whole command fails.
|
||||
const artifactsToDelete: any = {}
|
||||
Object.entries(this.artifactMap).forEach(([id, artifact]) => {
|
||||
const artifactTypesToDelete: ArtifactMap[string]['commandType'][] = [
|
||||
// 'start_path' creates a new scene object for the path, which is why it needs to be deleted,
|
||||
// however all of the segments in the path are its children so there don't need to be deleted.
|
||||
// this fact is very opaque in the api and docs (as to what should can be deleted).
|
||||
// Using an array is the list is likely to grow.
|
||||
'start_path',
|
||||
'entity_linear_pattern',
|
||||
'entity_circular_pattern',
|
||||
]
|
||||
if (artifactTypesToDelete.includes(artifact.commandType)) {
|
||||
artifactsToDelete[id] = artifact
|
||||
}
|
||||
if (artifact.commandType === 'import_files') {
|
||||
// TODO why is this handled differently from other artifacts, i.e. why does it not use the id from the
|
||||
// modeling command? We're having to do special clean up for this one special object.
|
||||
artifactsToDelete[(artifact as any)?.data?.data?.object_id] = artifact
|
||||
}
|
||||
})
|
||||
Object.keys(artifactsToDelete).forEach((id) => {
|
||||
const deleteCmd: EngineCommand = {
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'remove_scene_objects',
|
||||
object_ids: [id],
|
||||
},
|
||||
}
|
||||
this.engineConnection?.send(deleteCmd)
|
||||
})
|
||||
const deleteCmd: EngineCommand = {
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'scene_clear_all',
|
||||
},
|
||||
}
|
||||
this.defaultPlanes = null
|
||||
this.engineConnection?.send(deleteCmd)
|
||||
}
|
||||
addCommandLog(message: CommandLog) {
|
||||
if (this._commandLogs.length > 500) {
|
||||
@ -1629,6 +1601,7 @@ export class EngineCommandManager {
|
||||
}
|
||||
}
|
||||
private async initPlanes() {
|
||||
if (this.planesInitialized()) return
|
||||
const [xy, yz, xz] = [
|
||||
await this.createPlane({
|
||||
x_axis: { x: 1, y: 0, z: 0 },
|
||||
@ -1652,20 +1625,14 @@ export class EngineCommandManager {
|
||||
event: 'select_with_point',
|
||||
callback: ({ data }) => {
|
||||
if (!data?.entity_id) return
|
||||
if (
|
||||
![
|
||||
this.defaultPlanes.xy,
|
||||
this.defaultPlanes.yz,
|
||||
this.defaultPlanes.xz,
|
||||
].includes(data.entity_id)
|
||||
)
|
||||
return
|
||||
if (![xy, yz, xz].includes(data.entity_id)) return
|
||||
this.onPlaneSelectCallback(data.entity_id)
|
||||
},
|
||||
})
|
||||
}
|
||||
planesInitialized(): boolean {
|
||||
return (
|
||||
!!this.defaultPlanes &&
|
||||
this.defaultPlanes.xy !== '' &&
|
||||
this.defaultPlanes.yz !== '' &&
|
||||
this.defaultPlanes.xz !== ''
|
||||
|
@ -127,13 +127,15 @@ export interface ProgramMemory {
|
||||
export const executor = async (
|
||||
node: Program,
|
||||
programMemory: ProgramMemory = { root: {}, return: null },
|
||||
engineCommandManager: EngineCommandManager
|
||||
engineCommandManager: EngineCommandManager,
|
||||
isMock: boolean = false
|
||||
): Promise<ProgramMemory> => {
|
||||
engineCommandManager.startNewSession()
|
||||
const _programMemory = await _executor(
|
||||
node,
|
||||
programMemory,
|
||||
engineCommandManager
|
||||
engineCommandManager,
|
||||
isMock
|
||||
)
|
||||
await engineCommandManager.waitForAllCommands()
|
||||
|
||||
@ -148,7 +150,8 @@ const getSettingsState = import('components/SettingsAuthProvider').then(
|
||||
export const _executor = async (
|
||||
node: Program,
|
||||
programMemory: ProgramMemory = { root: {}, return: null },
|
||||
engineCommandManager: EngineCommandManager
|
||||
engineCommandManager: EngineCommandManager,
|
||||
isMock: boolean
|
||||
): Promise<ProgramMemory> => {
|
||||
try {
|
||||
const baseUnit = (await getSettingsState)()?.baseUnit || 'mm'
|
||||
@ -157,7 +160,8 @@ export const _executor = async (
|
||||
JSON.stringify(programMemory),
|
||||
baseUnit,
|
||||
engineCommandManager,
|
||||
fileSystemManager
|
||||
fileSystemManager,
|
||||
isMock
|
||||
)
|
||||
return memory
|
||||
} catch (e: any) {
|
||||
|
@ -5,10 +5,8 @@ import { v4 as uuidv4 } from 'uuid'
|
||||
// Isolating a function to call the engine to export the current scene.
|
||||
// Because it has given us trouble in automated testing environments.
|
||||
export function exportFromEngine({
|
||||
source_unit,
|
||||
format,
|
||||
}: {
|
||||
source_unit: Models['UnitLength_type']
|
||||
format: Models['OutputFormat_type']
|
||||
}) {
|
||||
return engineCommandManager.sendSceneCommand({
|
||||
@ -20,7 +18,6 @@ export function exportFromEngine({
|
||||
// in the scene to export. In that case, you'd pass the IDs thru here.
|
||||
entity_ids: [],
|
||||
format,
|
||||
source_unit,
|
||||
},
|
||||
cmd_id: uuidv4(),
|
||||
})
|
||||
|
@ -66,7 +66,7 @@ export async function enginelessExecutor(
|
||||
}) as any as EngineCommandManager
|
||||
await mockEngineCommandManager.waitForReady
|
||||
mockEngineCommandManager.startNewSession()
|
||||
const programMemory = await _executor(ast, pm, mockEngineCommandManager)
|
||||
const programMemory = await _executor(ast, pm, mockEngineCommandManager, true)
|
||||
await mockEngineCommandManager.waitForAllCommands()
|
||||
return programMemory
|
||||
}
|
||||
@ -86,7 +86,7 @@ export async function executor(
|
||||
})
|
||||
await engineCommandManager.waitForReady
|
||||
engineCommandManager.startNewSession()
|
||||
const programMemory = await _executor(ast, pm, engineCommandManager)
|
||||
const programMemory = await _executor(ast, pm, engineCommandManager, false)
|
||||
await engineCommandManager.waitForAllCommands()
|
||||
return programMemory
|
||||
}
|
||||
|
@ -2,7 +2,12 @@ import { PathToNode, VariableDeclarator } from 'lang/wasm'
|
||||
import { Axis, Selection, Selections } from 'lib/selections'
|
||||
import { assign, createMachine } from 'xstate'
|
||||
import { getNodePathFromSourceRange } from 'lang/queryAst'
|
||||
import { kclManager, sceneInfra, sceneEntitiesManager } from 'lib/singletons'
|
||||
import {
|
||||
kclManager,
|
||||
sceneInfra,
|
||||
sceneEntitiesManager,
|
||||
engineCommandManager,
|
||||
} from 'lib/singletons'
|
||||
import {
|
||||
horzVertInfo,
|
||||
applyConstraintHorzVert,
|
||||
@ -37,6 +42,7 @@ import { ModelingCommandSchema } from 'lib/commandBarConfigs/modelingCommandConf
|
||||
import { DefaultPlaneStr } from 'clientSideScene/sceneEntities'
|
||||
import { Vector3 } from 'three'
|
||||
import { quaternionFromUpNForward } from 'clientSideScene/helpers'
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
export const MODELING_PERSIST_KEY = 'MODELING_PERSIST_KEY'
|
||||
|
||||
@ -127,7 +133,7 @@ export type MoveDesc = { line: number; snippet: string }
|
||||
|
||||
export const modelingMachine = createMachine(
|
||||
{
|
||||
/** @xstate-layout N4IgpgJg5mDOIC5QFkD2EwBsCWA7KAxAMICGuAxlgNoAMAuoqAA6qzYAu2qujIAHogC0AdgCsAZgB04gEyjhADnEA2GgoUAWJQBoQAT0QBGGuICckmoZkbTM42YWKAvk91oMOfAQDKYdgAJYLDByTm5aBiQQFjYwniiBBFtpGhlxDRphGg1ZURlhXQMEcRLDSVF5UwV84XEK8Rc3dCw8KElsCEwwHz9A4NCuXAjeGI5B3kTBLWF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xVBLtSlmDEdAxEUFjBqFSEBWSGdhgkd3yFlyBJr1pLrRhX8jhV80RRZIxJD3MhJVUEsGUVX1A3SjkBZFSFRDlnmFCNnXDUjVZKcSfg5AMRUGqIxELU4h2GGjUVyWOBRJEjpLnXWmNIVOXzEPxw4Vwz3DHWFF7jsjECqHzngzekc3lICy9Pbm2BWFgiESqDyEbGBjUElXhwqFUDLzqEkxRhk1GRNMXHbhZGxOtzFEbH7hJlB0BkpUcFeONBT2dNrWhVKyyzs1lMjMaULO2i7D-xBAtHAhsD9n6jJWyVrP3h1G+ybIG0V2f0wG7IzXsGXkIKNFDLWEoNUBDFRDmDrOHTUA9z2znP+0B3YAXMSX2D4XGi7BsHUHXJh2SEhBWHyQezmEBLp2BJnM9yPNZzuW-DPImRsCzTXj1EWFkEmIQHjyHMpST2tFkAPL+29193oX-LhGNGbl4TBBMDSDdksjLxDHbDRCOGULFFTxPJQuMEcgYmNCMmxI3270skrFbHMkA07BPzFNHwHAv0iU4Gv2nhQuPHlmPUtNz1tG3DyBDDWAWEow3Fpw2KIXQIgKN2wPQlgPIptB+N3lSVC2hyKCNBsgH1sGP2GnM2nI+DULYI4PROjPwKZAyDBwBHkFyloJkMsmovKAPC70yFTmsHqNSKaPSMEKstqy9JWAFCFHbztB5NdlkJshMHUCFF3k5EYPYraB6M4H8rrhaKkjaPQnIuW19mFCyAjE4lsCixZAHmLOZGtCtBcBcCAA */
|
||||
id: 'Modeling',
|
||||
|
||||
tsTypes: {} as import('./modelingMachine.typegen').Typegen0,
|
||||
@ -505,9 +511,9 @@ export const modelingMachine = createMachine(
|
||||
},
|
||||
|
||||
'Sketch no face': {
|
||||
entry: 'show default planes',
|
||||
entry: ['show default planes', 'set selection filter to faces only'],
|
||||
|
||||
exit: 'hide default planes',
|
||||
exit: ['hide default planes', 'set selection filter to defaults'],
|
||||
on: {
|
||||
'Select default plane': {
|
||||
target: 'animating to plane',
|
||||
@ -940,6 +946,24 @@ export const modelingMachine = createMachine(
|
||||
'engineToClient cam sync direction': () => {
|
||||
sceneInfra.camControls.syncDirection = 'engineToClient'
|
||||
},
|
||||
'set selection filter to faces only': () =>
|
||||
engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'set_selection_filter',
|
||||
filter: ['face'],
|
||||
},
|
||||
}),
|
||||
'set selection filter to defaults': () =>
|
||||
engineCommandManager.sendSceneCommand({
|
||||
type: 'modeling_cmd_req',
|
||||
cmd_id: uuidv4(),
|
||||
cmd: {
|
||||
type: 'set_selection_filter',
|
||||
filter: ['face', 'edge', 'solid2d'],
|
||||
},
|
||||
}),
|
||||
},
|
||||
// end actions
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ export async function executeAst({
|
||||
}
|
||||
const programMemory = await (useFakeExecutor
|
||||
? enginelessExecutor(ast, programMemoryOverride || programMemoryInit())
|
||||
: _executor(ast, programMemoryInit(), engineCommandManager))
|
||||
: _executor(ast, programMemoryInit(), engineCommandManager, false))
|
||||
|
||||
await engineCommandManager.waitForAllCommands()
|
||||
return {
|
||||
|
109
src/wasm-lib/Cargo.lock
generated
109
src/wasm-lib/Cargo.lock
generated
@ -246,18 +246,18 @@ checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "async-trait"
|
||||
version = "0.1.78"
|
||||
version = "0.1.79"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "461abc97219de0eaaf81fe3ef974a540158f3d079c2ab200f891f1a2ef201e85"
|
||||
checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -280,7 +280,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -322,6 +322,12 @@ version = "0.21.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567"
|
||||
|
||||
[[package]]
|
||||
name = "base64"
|
||||
version = "0.22.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51"
|
||||
|
||||
[[package]]
|
||||
name = "base64ct"
|
||||
version = "1.6.0"
|
||||
@ -507,9 +513,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.35"
|
||||
version = "0.4.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a"
|
||||
checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e"
|
||||
dependencies = [
|
||||
"android-tzdata",
|
||||
"iana-time-zone",
|
||||
@ -590,7 +596,7 @@ dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -840,7 +846,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -881,7 +887,7 @@ checksum = "377af281d8f23663862a7c84623bc5dcf7f8c44b13c7496a590bdc157f941a43"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
"synstructure 0.13.1",
|
||||
]
|
||||
|
||||
@ -935,7 +941,7 @@ dependencies = [
|
||||
"rustfmt-wrapper",
|
||||
"serde",
|
||||
"serde_tokenstream",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -947,7 +953,7 @@ dependencies = [
|
||||
"diesel_table_macro_syntax",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -956,7 +962,7 @@ version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5"
|
||||
dependencies = [
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -985,7 +991,7 @@ checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1067,7 +1073,7 @@ checksum = "03cdc46ec28bd728e67540c528013c6a10eb69a02eb31078a1bda695438cbfb8"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1284,7 +1290,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1389,7 +1395,7 @@ dependencies = [
|
||||
"inflections",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1724,16 +1730,15 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "insta"
|
||||
version = "1.36.1"
|
||||
version = "1.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0a7c22c4d34ef4788c351e971c52bfdfe7ea2766f8c5466bc175dd46e52ac22e"
|
||||
checksum = "1718b3f2b85bb5054baf8ce406e36401f27c3169205f4175504c4b1d98252d3f"
|
||||
dependencies = [
|
||||
"console",
|
||||
"lazy_static",
|
||||
"linked-hash-map",
|
||||
"serde",
|
||||
"similar",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1843,9 +1848,11 @@ dependencies = [
|
||||
"approx 0.5.1",
|
||||
"async-recursion",
|
||||
"async-trait",
|
||||
"base64 0.22.0",
|
||||
"bson",
|
||||
"chrono",
|
||||
"clap",
|
||||
"convert_case",
|
||||
"criterion",
|
||||
"dashmap",
|
||||
"databake",
|
||||
@ -1853,6 +1860,7 @@ dependencies = [
|
||||
"expectorate",
|
||||
"futures",
|
||||
"gltf-json",
|
||||
"image",
|
||||
"insta",
|
||||
"itertools 0.12.1",
|
||||
"js-sys",
|
||||
@ -1874,6 +1882,7 @@ dependencies = [
|
||||
"tokio-tungstenite",
|
||||
"tower-lsp",
|
||||
"ts-rs",
|
||||
"twenty-twenty",
|
||||
"uuid",
|
||||
"wasm-bindgen",
|
||||
"wasm-bindgen-futures",
|
||||
@ -1891,14 +1900,14 @@ dependencies = [
|
||||
"pretty_assertions",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kittycad"
|
||||
version = "0.2.62"
|
||||
version = "0.2.63"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4bb6a3e37a902c099f3f077f1e75814339bf5d548151a675544366841a882377"
|
||||
checksum = "93a332250e08fd715ad3d5826e04d36da1c5bb42d0c1b1ff1f0598278b9ebf3c"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -1961,7 +1970,7 @@ source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2009,7 +2018,7 @@ source = "git+https://github.com/KittyCAD/modeling-api?branch=main#a3b8df282c684
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2382,7 +2391,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2539,7 +2548,7 @@ dependencies = [
|
||||
"regex",
|
||||
"regex-syntax 0.7.5",
|
||||
"structmeta 0.2.0",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2553,7 +2562,7 @@ dependencies = [
|
||||
"regex",
|
||||
"regex-syntax 0.8.2",
|
||||
"structmeta 0.3.0",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2619,7 +2628,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3481,7 +3490,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3497,9 +3506,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.114"
|
||||
version = "1.0.115"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0"
|
||||
checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd"
|
||||
dependencies = [
|
||||
"indexmap 2.2.5",
|
||||
"itoa",
|
||||
@ -3515,7 +3524,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3536,7 +3545,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3705,7 +3714,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"structmeta-derive 0.2.0",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3717,7 +3726,7 @@ dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"structmeta-derive 0.3.0",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3728,7 +3737,7 @@ checksum = "a60bcaff7397072dca0017d1db428e30d5002e00b6847703e2e42005c95fbe00"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3739,7 +3748,7 @@ checksum = "152a0b65a590ff6c3da95cabe2353ee04e6167c896b28e3b14478c2636c922fc"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3811,9 +3820,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.53"
|
||||
version = "2.0.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032"
|
||||
checksum = "002a1b3dbf967edfafc32655d0f377ab0bb7b994aa1d32c8cc7e9b8bf3ebb8f0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -3846,7 +3855,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -3947,7 +3956,7 @@ checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4054,7 +4063,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4217,7 +4226,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4245,7 +4254,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -4320,7 +4329,7 @@ dependencies = [
|
||||
"Inflector",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
@ -4562,7 +4571,7 @@ dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
@ -4597,7 +4606,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
@ -5167,7 +5176,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -5187,7 +5196,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.53",
|
||||
"syn 2.0.55",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -14,7 +14,7 @@ bson = { version = "2.9.0", features = ["uuid-1", "chrono"] }
|
||||
gloo-utils = "0.2.0"
|
||||
kcl-lib = { path = "kcl" }
|
||||
kittycad = { workspace = true }
|
||||
serde_json = "1.0.114"
|
||||
serde_json = "1.0.115"
|
||||
uuid = { version = "1.8.0", features = ["v4", "js", "serde"] }
|
||||
wasm-bindgen = "0.2.91"
|
||||
wasm-bindgen-futures = "0.4.42"
|
||||
@ -59,7 +59,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.dependencies]
|
||||
kittycad = { version = "0.2.62", default-features = false, features = ["js", "requests"] }
|
||||
kittycad = { version = "0.2.63", default-features = false, features = ["js", "requests"] }
|
||||
kittycad-execution-plan = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
||||
kittycad-execution-plan-macros = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
||||
kittycad-execution-plan-traits = { git = "https://github.com/KittyCAD/modeling-api", branch = "main" }
|
||||
|
@ -20,7 +20,7 @@ quote = "1"
|
||||
regex = "1.10"
|
||||
serde = { version = "1.0.197", features = ["derive"] }
|
||||
serde_tokenstream = "0.2"
|
||||
syn = { version = "2.0.53", features = ["full"] }
|
||||
syn = { version = "2.0.55", features = ["full"] }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.81"
|
||||
|
@ -201,7 +201,7 @@ fn do_stdlib_inner(
|
||||
.code_blocks
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, code_block)| generate_code_block_test(&fn_name_str, code_block, index))
|
||||
.map(|(index, code_block)| generate_code_block_test(&fn_name_str, code_block, index, &metadata.tags))
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let tags = metadata
|
||||
@ -731,12 +731,18 @@ fn parse_array_type(type_name: &str) -> Option<(&str, usize)> {
|
||||
|
||||
// For each kcl code block, we want to generate a test that checks that the
|
||||
// code block is valid kcl code and compiles and executes.
|
||||
fn generate_code_block_test(fn_name: &str, code_block: &str, index: usize) -> proc_macro2::TokenStream {
|
||||
fn generate_code_block_test(
|
||||
fn_name: &str,
|
||||
code_block: &str,
|
||||
index: usize,
|
||||
tags: &[String],
|
||||
) -> proc_macro2::TokenStream {
|
||||
let test_name = format_ident!("serial_test_example_{}{}", fn_name, index);
|
||||
let test_name_str = format!("serial_test_example_{}{}", fn_name, index);
|
||||
|
||||
// TODO: We ignore import for now, because the files don't exist and we just want
|
||||
// to show easy imports.
|
||||
let ignored = if fn_name == "import" {
|
||||
let ignored = if tags.contains(&"norun".to_string()) {
|
||||
quote! { #[ignore] }
|
||||
} else {
|
||||
quote! {}
|
||||
@ -778,14 +784,58 @@ fn generate_code_block_test(fn_name: &str, code_block: &str, index: usize) -> pr
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(crate::engine::conn::EngineConnection::new(ws).await.unwrap())),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone()).await.unwrap();
|
||||
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx).await.unwrap();
|
||||
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D { x: 0.0, y: 0.0, z: 0.0 },
|
||||
up: kittycad::types::Point3D { x: 0.0, y: 0.0, z: 1.0 },
|
||||
vantage: kittycad::types::Point3D { x: 0.0, y: -x, z: y },
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await.unwrap();
|
||||
|
||||
// Send a snapshot request to the engine.
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await.unwrap();
|
||||
|
||||
// Create a temporary file to write the output to.
|
||||
let output_file = std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
// Save the snapshot locally.
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
|
||||
// Read the output file.
|
||||
let actual = image::io::Reader::open(output_file).unwrap().decode().unwrap();
|
||||
twenty_twenty::assert_image(&format!("tests/outputs/{}.png", #test_name_str), &actual, 1.0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,6 +345,7 @@ fn test_stdlib_doc_comment_with_code_on_ignored_function() {
|
||||
let (item, errors) = do_stdlib(
|
||||
quote! {
|
||||
name = "import",
|
||||
tags = ["norun"]
|
||||
},
|
||||
quote! {
|
||||
/// This is some function.
|
||||
|
@ -29,19 +29,72 @@ mod test_examples_show {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -73,19 +126,72 @@ mod test_examples_show {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_show1"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,72 @@ mod test_examples_show {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,72 @@ mod test_examples_my_func {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_my_func0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -73,19 +126,72 @@ mod test_examples_my_func {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_my_func1"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,19 +30,72 @@ mod test_examples_import {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -75,19 +128,72 @@ mod test_examples_import {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_import1"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +232,7 @@ impl crate::docs::StdLibFn for Import {
|
||||
}
|
||||
|
||||
fn tags(&self) -> Vec<String> {
|
||||
vec![]
|
||||
vec!["norun".to_string()]
|
||||
}
|
||||
|
||||
fn args(&self) -> Vec<crate::docs::StdLibFnArg> {
|
||||
|
@ -29,19 +29,72 @@ mod test_examples_line_to {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_line_to0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -73,19 +126,72 @@ mod test_examples_line_to {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_line_to1"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,72 @@ mod test_examples_min {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_min0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
@ -73,19 +126,72 @@ mod test_examples_min {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_min1"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,19 +29,72 @@ mod test_examples_show {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_show0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#[cfg(test)]
|
||||
mod test_examples_import {
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
#[ignore]
|
||||
async fn serial_test_example_import0() {
|
||||
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),);
|
||||
let http_client = reqwest::Client::builder()
|
||||
@ -30,19 +29,72 @@ mod test_examples_import {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#[cfg(test)]
|
||||
mod test_examples_import {
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
#[ignore]
|
||||
async fn serial_test_example_import0() {
|
||||
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),);
|
||||
let http_client = reqwest::Client::builder()
|
||||
@ -30,19 +29,72 @@ mod test_examples_import {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#[cfg(test)]
|
||||
mod test_examples_import {
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 5)]
|
||||
#[ignore]
|
||||
async fn serial_test_example_import0() {
|
||||
let user_agent = concat!(env!("CARGO_PKG_NAME"), ".rs/", env!("CARGO_PKG_VERSION"),);
|
||||
let http_client = reqwest::Client::builder()
|
||||
@ -30,19 +29,72 @@ mod test_examples_import {
|
||||
let parser = crate::parser::Parser::new(tokens);
|
||||
let program = parser.ast().unwrap();
|
||||
let mut mem: crate::executor::ProgramMemory = Default::default();
|
||||
let ctx = crate::executor::ExecutorContext {
|
||||
engine: std::sync::Arc::new(Box::new(
|
||||
crate::engine::conn::EngineConnection::new(ws)
|
||||
.await
|
||||
.unwrap(),
|
||||
)),
|
||||
fs: crate::fs::FileManager::new(),
|
||||
stdlib: std::sync::Arc::new(crate::std::StdLib::new()),
|
||||
units: kittycad::types::UnitLength::Mm,
|
||||
};
|
||||
let units = kittycad::types::UnitLength::Mm;
|
||||
let ctx = crate::executor::ExecutorContext::new(ws, units.clone())
|
||||
.await
|
||||
.unwrap();
|
||||
crate::executor::execute(program, &mut mem, crate::executor::BodyType::Root, &ctx)
|
||||
.await
|
||||
.unwrap();
|
||||
let (x, y) = crate::std::utils::get_camera_zoom_magnitude_per_unit_length(units);
|
||||
ctx.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::DefaultCameraLookAt {
|
||||
center: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 0.0,
|
||||
},
|
||||
up: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: 0.0,
|
||||
z: 1.0,
|
||||
},
|
||||
vantage: kittycad::types::Point3D {
|
||||
x: 0.0,
|
||||
y: -x,
|
||||
z: y,
|
||||
},
|
||||
sequence: None,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let resp = ctx
|
||||
.engine
|
||||
.send_modeling_cmd(
|
||||
false,
|
||||
uuid::Uuid::new_v4(),
|
||||
crate::executor::SourceRange::default(),
|
||||
kittycad::types::ModelingCmd::TakeSnapshot {
|
||||
format: kittycad::types::ImageFormat::Png,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
let output_file =
|
||||
std::env::temp_dir().join(format!("kcl_output_{}.png", uuid::Uuid::new_v4()));
|
||||
if let kittycad::types::OkWebSocketResponseData::Modeling {
|
||||
modeling_response: kittycad::types::OkModelingCmdResponse::TakeSnapshot { data },
|
||||
} = &resp
|
||||
{
|
||||
std::fs::write(&output_file, &data.contents.0).unwrap();
|
||||
} else {
|
||||
panic!("Unexpected response from engine: {:?}", resp);
|
||||
}
|
||||
|
||||
let actual = image::io::Reader::open(output_file)
|
||||
.unwrap()
|
||||
.decode()
|
||||
.unwrap();
|
||||
twenty_twenty::assert_image(
|
||||
&format!("tests/outputs/{}.png", "serial_test_example_import0"),
|
||||
&actual,
|
||||
1.0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user