Merge remote-tracking branch 'origin' into kurt-multi-profile-again
This commit is contained in:
1
.github/workflows/e2e-tests.yml
vendored
1
.github/workflows/e2e-tests.yml
vendored
@ -3,7 +3,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 51 KiB |
@ -29,7 +29,7 @@
|
|||||||
"vscode-uri": "^3.0.8"
|
"vscode-uri": "^3.0.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^22.10.6",
|
"@types/node": "^22.13.1",
|
||||||
"ts-node": "^10.9.2"
|
"ts-node": "^10.9.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,10 +109,10 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"
|
resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"
|
||||||
integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==
|
integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==
|
||||||
|
|
||||||
"@types/node@^22.10.6":
|
"@types/node@^22.13.1":
|
||||||
version "22.10.6"
|
version "22.13.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.10.6.tgz#5c6795e71635876039f853cbccd59f523d9e4239"
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.13.1.tgz#a2a3fefbdeb7ba6b89f40371842162fac0934f33"
|
||||||
integrity sha512-qNiuwC4ZDAUNcY47xgaSuS92cjf8JbSUoaKS77bmLG1rU7MlATVSiw/IlrjtIyyskXBZ8KkNfjK/P5na7rgXbQ==
|
integrity sha512-jK8uzQlrvXqEU91UxiK5J7pKHyzgnI1Qnl0QDHIgVGuolJhRb9EEl28Cj9b3rGR8B2lhFCtvIm5os8lFnO/1Ew==
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types "~6.20.0"
|
undici-types "~6.20.0"
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ export const Stream = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
const path = getArtifactOfTypes(
|
const path = getArtifactOfTypes(
|
||||||
{ key: entity_id, types: ['path', 'solid2d', 'segment'] },
|
{ key: entity_id, types: ['path', 'solid2d', 'segment', 'helix'] },
|
||||||
engineCommandManager.artifactGraph
|
engineCommandManager.artifactGraph
|
||||||
)
|
)
|
||||||
if (err(path)) {
|
if (err(path)) {
|
||||||
|
@ -1388,6 +1388,7 @@ export async function deleteFromSelection(
|
|||||||
varDec.node.init.type === 'PipeExpression') ||
|
varDec.node.init.type === 'PipeExpression') ||
|
||||||
selection.artifact?.type === 'sweep' ||
|
selection.artifact?.type === 'sweep' ||
|
||||||
selection.artifact?.type === 'plane' ||
|
selection.artifact?.type === 'plane' ||
|
||||||
|
selection.artifact?.type === 'helix' ||
|
||||||
!selection.artifact // aka expected to be a shell at this point
|
!selection.artifact // aka expected to be a shell at this point
|
||||||
) {
|
) {
|
||||||
let extrudeNameToDelete = ''
|
let extrudeNameToDelete = ''
|
||||||
@ -1395,7 +1396,8 @@ export async function deleteFromSelection(
|
|||||||
if (
|
if (
|
||||||
selection.artifact &&
|
selection.artifact &&
|
||||||
selection.artifact.type !== 'sweep' &&
|
selection.artifact.type !== 'sweep' &&
|
||||||
selection.artifact.type !== 'plane'
|
selection.artifact.type !== 'plane' &&
|
||||||
|
selection.artifact.type !== 'helix'
|
||||||
) {
|
) {
|
||||||
const varDecName = varDec.node.id.name
|
const varDecName = varDec.node.id.name
|
||||||
traverse(astClone, {
|
traverse(astClone, {
|
||||||
@ -1434,13 +1436,17 @@ export async function deleteFromSelection(
|
|||||||
if (!pathToNode) return new Error('Could not find extrude variable')
|
if (!pathToNode) return new Error('Could not find extrude variable')
|
||||||
} else {
|
} else {
|
||||||
pathToNode = selection.codeRef.pathToNode
|
pathToNode = selection.codeRef.pathToNode
|
||||||
const extrudeVarDec = getNodeFromPath<VariableDeclarator>(
|
if (varDec.node.type !== 'VariableDeclarator') {
|
||||||
astClone,
|
const callExp = getNodeFromPath<CallExpression>(
|
||||||
pathToNode,
|
astClone,
|
||||||
'VariableDeclarator'
|
pathToNode,
|
||||||
)
|
'CallExpression'
|
||||||
if (err(extrudeVarDec)) return extrudeVarDec
|
)
|
||||||
extrudeNameToDelete = extrudeVarDec.node.id.name
|
if (err(callExp)) return callExp
|
||||||
|
extrudeNameToDelete = callExp.node.callee.name
|
||||||
|
} else {
|
||||||
|
extrudeNameToDelete = varDec.node.id.name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const expressionIndex = pathToNode[1][0] as number
|
const expressionIndex = pathToNode[1][0] as number
|
||||||
|
@ -56,6 +56,7 @@ export function revolveSketch(
|
|||||||
if (err(sketchNode)) return sketchNode
|
if (err(sketchNode)) return sketchNode
|
||||||
|
|
||||||
let generatedAxis
|
let generatedAxis
|
||||||
|
let axisDeclaration: PathToNode | null = null
|
||||||
|
|
||||||
if (axisOrEdge === 'Edge') {
|
if (axisOrEdge === 'Edge') {
|
||||||
const pathToAxisSelection = getNodePathFromSourceRange(
|
const pathToAxisSelection = getNodePathFromSourceRange(
|
||||||
@ -80,6 +81,13 @@ export function revolveSketch(
|
|||||||
const axisSelection = edge?.graphSelections[0]?.artifact
|
const axisSelection = edge?.graphSelections[0]?.artifact
|
||||||
if (!axisSelection) return new Error('Generated axis selection is missing.')
|
if (!axisSelection) return new Error('Generated axis selection is missing.')
|
||||||
generatedAxis = getEdgeTagCall(tag, axisSelection)
|
generatedAxis = getEdgeTagCall(tag, axisSelection)
|
||||||
|
if (
|
||||||
|
axisSelection.type === 'segment' ||
|
||||||
|
axisSelection.type === 'path' ||
|
||||||
|
axisSelection.type === 'edgeCut'
|
||||||
|
) {
|
||||||
|
axisDeclaration = axisSelection.codeRef.pathToNode
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
generatedAxis = createLiteral(axis)
|
generatedAxis = createLiteral(axis)
|
||||||
}
|
}
|
||||||
@ -108,11 +116,28 @@ export function revolveSketch(
|
|||||||
const VariableDeclaration = createVariableDeclaration(name, revolveCall)
|
const VariableDeclaration = createVariableDeclaration(name, revolveCall)
|
||||||
const lastSketchNodePath =
|
const lastSketchNodePath =
|
||||||
orderedSketchNodePaths[orderedSketchNodePaths.length - 1]
|
orderedSketchNodePaths[orderedSketchNodePaths.length - 1]
|
||||||
const sketchIndexInBody = Number(lastSketchNodePath[1][0])
|
let sketchIndexInBody = Number(lastSketchNodePath[1][0])
|
||||||
if (typeof sketchIndexInBody !== 'number')
|
if (typeof sketchIndexInBody !== 'number')
|
||||||
return new Error('expected sketchIndexInBody to be a number')
|
return new Error('expected sketchIndexInBody to be a number')
|
||||||
clonedAst.body.splice(sketchIndexInBody + 1, 0, VariableDeclaration)
|
clonedAst.body.splice(sketchIndexInBody + 1, 0, VariableDeclaration)
|
||||||
|
|
||||||
|
if (typeof sketchIndexInBody !== 'number')
|
||||||
|
return new Error('expected insertIndex to be a number')
|
||||||
|
|
||||||
|
// If an axis was selected in KCL, find the max index to insert the revolve command
|
||||||
|
if (axisDeclaration) {
|
||||||
|
const axisIndexInPathToNode =
|
||||||
|
axisDeclaration.findIndex((a) => a[0] === 'body') + 1
|
||||||
|
const axisIndex = axisDeclaration[axisIndexInPathToNode][0]
|
||||||
|
|
||||||
|
if (typeof axisIndex !== 'number')
|
||||||
|
return new Error('expected axisIndex to be a number')
|
||||||
|
|
||||||
|
sketchIndexInBody = Math.max(sketchIndexInBody, axisIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
clonedAst.body.splice(sketchIndexInBody + 1, 0, VariableDeclaration)
|
||||||
|
|
||||||
const pathToRevolveArg: PathToNode = [
|
const pathToRevolveArg: PathToNode = [
|
||||||
['body', ''],
|
['body', ''],
|
||||||
[sketchIndexInBody + 1, 'index'],
|
[sketchIndexInBody + 1, 'index'],
|
||||||
@ -121,6 +146,7 @@ export function revolveSketch(
|
|||||||
['arguments', 'CallExpression'],
|
['arguments', 'CallExpression'],
|
||||||
[0, 'index'],
|
[0, 'index'],
|
||||||
]
|
]
|
||||||
|
|
||||||
return {
|
return {
|
||||||
modifiedAst: clonedAst,
|
modifiedAst: clonedAst,
|
||||||
pathToSketchNode: [...pathToSketchNode.slice(0, -1), [-1, 'index']],
|
pathToSketchNode: [...pathToSketchNode.slice(0, -1), [-1, 'index']],
|
||||||
|
@ -275,6 +275,17 @@ pub struct EdgeCutEdge {
|
|||||||
pub surface_id: ArtifactId,
|
pub surface_id: ArtifactId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)]
|
||||||
|
#[ts(export_to = "Artifact.ts")]
|
||||||
|
#[serde(rename_all = "camelCase")]
|
||||||
|
pub struct Helix {
|
||||||
|
pub id: ArtifactId,
|
||||||
|
/// The axis of the helix. Currently this is always an edge ID, but we may
|
||||||
|
/// add axes to the graph.
|
||||||
|
pub axis_id: Option<ArtifactId>,
|
||||||
|
pub code_ref: CodeRef,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)]
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS)]
|
||||||
#[ts(export_to = "Artifact.ts")]
|
#[ts(export_to = "Artifact.ts")]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
@ -301,6 +312,7 @@ pub enum Artifact {
|
|||||||
SweepEdge(SweepEdge),
|
SweepEdge(SweepEdge),
|
||||||
EdgeCut(EdgeCut),
|
EdgeCut(EdgeCut),
|
||||||
EdgeCutEdge(EdgeCutEdge),
|
EdgeCutEdge(EdgeCutEdge),
|
||||||
|
Helix(Helix),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Artifact {
|
impl Artifact {
|
||||||
@ -318,6 +330,7 @@ impl Artifact {
|
|||||||
Artifact::SweepEdge(a) => a.id,
|
Artifact::SweepEdge(a) => a.id,
|
||||||
Artifact::EdgeCut(a) => a.id,
|
Artifact::EdgeCut(a) => a.id,
|
||||||
Artifact::EdgeCutEdge(a) => a.id,
|
Artifact::EdgeCutEdge(a) => a.id,
|
||||||
|
Artifact::Helix(a) => a.id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +350,7 @@ impl Artifact {
|
|||||||
Artifact::SweepEdge(_) => None,
|
Artifact::SweepEdge(_) => None,
|
||||||
Artifact::EdgeCut(a) => Some(&a.code_ref),
|
Artifact::EdgeCut(a) => Some(&a.code_ref),
|
||||||
Artifact::EdgeCutEdge(_) => None,
|
Artifact::EdgeCutEdge(_) => None,
|
||||||
|
Artifact::Helix(a) => Some(&a.code_ref),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +370,7 @@ impl Artifact {
|
|||||||
Artifact::SweepEdge(_) => Some(new),
|
Artifact::SweepEdge(_) => Some(new),
|
||||||
Artifact::EdgeCut(a) => a.merge(new),
|
Artifact::EdgeCut(a) => a.merge(new),
|
||||||
Artifact::EdgeCutEdge(_) => Some(new),
|
Artifact::EdgeCutEdge(_) => Some(new),
|
||||||
|
Artifact::Helix(_) => Some(new),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -999,6 +1014,25 @@ fn artifacts_to_update(
|
|||||||
}
|
}
|
||||||
return Ok(return_arr);
|
return Ok(return_arr);
|
||||||
}
|
}
|
||||||
|
ModelingCmd::EntityMakeHelixFromParams(_) => {
|
||||||
|
let return_arr = vec![Artifact::Helix(Helix {
|
||||||
|
id,
|
||||||
|
axis_id: None,
|
||||||
|
code_ref: CodeRef { range, path_to_node },
|
||||||
|
})];
|
||||||
|
return Ok(return_arr);
|
||||||
|
}
|
||||||
|
ModelingCmd::EntityMakeHelixFromEdge(helix) => {
|
||||||
|
let edge_id = ArtifactId::new(helix.edge_id);
|
||||||
|
let return_arr = vec![Artifact::Helix(Helix {
|
||||||
|
id,
|
||||||
|
axis_id: Some(edge_id),
|
||||||
|
code_ref: CodeRef { range, path_to_node },
|
||||||
|
})];
|
||||||
|
// We could add the reverse graph edge connecting from the edge to
|
||||||
|
// the helix here, but it's not useful right now.
|
||||||
|
return Ok(return_arr);
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +79,7 @@ impl Artifact {
|
|||||||
Artifact::SweepEdge(a) => vec![a.seg_id, a.sweep_id],
|
Artifact::SweepEdge(a) => vec![a.seg_id, a.sweep_id],
|
||||||
Artifact::EdgeCut(a) => vec![a.consumed_edge_id],
|
Artifact::EdgeCut(a) => vec![a.consumed_edge_id],
|
||||||
Artifact::EdgeCutEdge(a) => vec![a.edge_cut_id],
|
Artifact::EdgeCutEdge(a) => vec![a.edge_cut_id],
|
||||||
|
Artifact::Helix(a) => a.axis_id.map(|id| vec![id]).unwrap_or_default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +158,10 @@ impl Artifact {
|
|||||||
// Note: Don't include these since they're parents: edge_cut_id.
|
// Note: Don't include these since they're parents: edge_cut_id.
|
||||||
vec![a.surface_id]
|
vec![a.surface_id]
|
||||||
}
|
}
|
||||||
|
Artifact::Helix(_) => {
|
||||||
|
// Note: Don't include these since they're parents: axis_id.
|
||||||
|
Vec::new()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -224,7 +229,8 @@ impl ArtifactGraph {
|
|||||||
| Artifact::Cap(_)
|
| Artifact::Cap(_)
|
||||||
| Artifact::SweepEdge(_)
|
| Artifact::SweepEdge(_)
|
||||||
| Artifact::EdgeCut(_)
|
| Artifact::EdgeCut(_)
|
||||||
| Artifact::EdgeCutEdge(_) => false,
|
| Artifact::EdgeCutEdge(_)
|
||||||
|
| Artifact::Helix(_) => false,
|
||||||
};
|
};
|
||||||
if !grouped {
|
if !grouped {
|
||||||
ungrouped.push(id);
|
ungrouped.push(id);
|
||||||
@ -341,6 +347,14 @@ impl ArtifactGraph {
|
|||||||
Artifact::EdgeCutEdge(_edge_cut_edge) => {
|
Artifact::EdgeCutEdge(_edge_cut_edge) => {
|
||||||
writeln!(output, "{prefix}{}[EdgeCutEdge]", id)?;
|
writeln!(output, "{prefix}{}[EdgeCutEdge]", id)?;
|
||||||
}
|
}
|
||||||
|
Artifact::Helix(helix) => {
|
||||||
|
writeln!(
|
||||||
|
output,
|
||||||
|
"{prefix}{}[\"Helix<br>{:?}\"]",
|
||||||
|
id,
|
||||||
|
code_ref_display(&helix.code_ref)
|
||||||
|
)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -522,6 +536,9 @@ impl ArtifactGraph {
|
|||||||
Artifact::EdgeCutEdge(_edge_cut_edge) => {
|
Artifact::EdgeCutEdge(_edge_cut_edge) => {
|
||||||
writeln!(output, "{prefix}EdgeCutEdge")?;
|
writeln!(output, "{prefix}EdgeCutEdge")?;
|
||||||
}
|
}
|
||||||
|
Artifact::Helix(_) => {
|
||||||
|
writeln!(output, "{prefix}Helix")?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ids_seen.contains(&artifact.id()) {
|
if ids_seen.contains(&artifact.id()) {
|
||||||
|
@ -1943,3 +1943,24 @@ mod array_elem_pop_fail {
|
|||||||
super::execute(TEST_NAME, false).await
|
super::execute(TEST_NAME, false).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod helix_simple {
|
||||||
|
const TEST_NAME: &str = "helix_simple";
|
||||||
|
|
||||||
|
/// Test parsing KCL.
|
||||||
|
#[test]
|
||||||
|
fn parse() {
|
||||||
|
super::parse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that parsing and unparsing KCL produces the original KCL input.
|
||||||
|
#[test]
|
||||||
|
fn unparse() {
|
||||||
|
super::unparse(TEST_NAME)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Test that KCL is executed correctly.
|
||||||
|
#[tokio::test(flavor = "multi_thread")]
|
||||||
|
async fn kcl_test_execute() {
|
||||||
|
super::execute(TEST_NAME, true).await
|
||||||
|
}
|
||||||
|
}
|
||||||
|
402
src/wasm-lib/kcl/tests/helix_simple/artifact_commands.snap
Normal file
402
src/wasm-lib/kcl/tests/helix_simple/artifact_commands.snap
Normal file
@ -0,0 +1,402 @@
|
|||||||
|
---
|
||||||
|
source: kcl/src/simulation_tests.rs
|
||||||
|
description: Artifact commands helix_simple.kcl
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "plane_set_color",
|
||||||
|
"plane_id": "[uuid]",
|
||||||
|
"color": {
|
||||||
|
"r": 0.7,
|
||||||
|
"g": 0.28,
|
||||||
|
"b": 0.28,
|
||||||
|
"a": 0.4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "plane_set_color",
|
||||||
|
"plane_id": "[uuid]",
|
||||||
|
"color": {
|
||||||
|
"r": 0.28,
|
||||||
|
"g": 0.7,
|
||||||
|
"b": 0.28,
|
||||||
|
"a": 0.4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "plane_set_color",
|
||||||
|
"plane_id": "[uuid]",
|
||||||
|
"color": {
|
||||||
|
"r": 0.28,
|
||||||
|
"g": 0.28,
|
||||||
|
"b": 0.7,
|
||||||
|
"a": 0.4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": -1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": -1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"size": 100.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "edge_lines_visible",
|
||||||
|
"hidden": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "set_scene_units",
|
||||||
|
"unit": "mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "object_visible",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"hidden": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "object_visible",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"hidden": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
46,
|
||||||
|
65,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "make_plane",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"x_axis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"y_axis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"size": 60.0,
|
||||||
|
"clobber": false,
|
||||||
|
"hide": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
71,
|
||||||
|
96,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "enable_sketch_mode",
|
||||||
|
"entity_id": "[uuid]",
|
||||||
|
"ortho": false,
|
||||||
|
"animated": false,
|
||||||
|
"adjust_camera": false,
|
||||||
|
"planar_normal": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -1.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
71,
|
||||||
|
96,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
71,
|
||||||
|
96,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
102,
|
||||||
|
137,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 10.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [
|
||||||
|
151,
|
||||||
|
242,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"command": {
|
||||||
|
"type": "entity_make_helix_from_edge",
|
||||||
|
"radius": 5.0,
|
||||||
|
"length": 10.0,
|
||||||
|
"revolutions": 5.0,
|
||||||
|
"start_angle": {
|
||||||
|
"unit": "degrees",
|
||||||
|
"value": 0.0
|
||||||
|
},
|
||||||
|
"is_clockwise": false,
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart helix_simple.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,12 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[71, 96, 0]"]
|
||||||
|
3["Segment<br>[102, 137, 0]"]
|
||||||
|
end
|
||||||
|
1["Plane<br>[46, 65, 0]"]
|
||||||
|
4["Helix<br>[151, 242, 0]"]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
3 <--x 4
|
||||||
|
```
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl/src/simulation_tests.rs
|
||||||
|
description: Artifact graph mind map helix_simple.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,7 @@
|
|||||||
|
```mermaid
|
||||||
|
mindmap
|
||||||
|
root
|
||||||
|
Plane
|
||||||
|
Path
|
||||||
|
Segment
|
||||||
|
```
|
336
src/wasm-lib/kcl/tests/helix_simple/ast.snap
Normal file
336
src/wasm-lib/kcl/tests/helix_simple/ast.snap
Normal file
@ -0,0 +1,336 @@
|
|||||||
|
---
|
||||||
|
source: kcl/src/simulation_tests.rs
|
||||||
|
description: Result of parsing helix_simple.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"Ok": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"declaration": {
|
||||||
|
"end": 137,
|
||||||
|
"id": {
|
||||||
|
"end": 43,
|
||||||
|
"name": "helper001",
|
||||||
|
"start": 34,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"end": 64,
|
||||||
|
"raw": "'XZ'",
|
||||||
|
"start": 60,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": "XZ"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"end": 59,
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"start": 46,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 65,
|
||||||
|
"start": 46,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"end": 88,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 87,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 91,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 90,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 92,
|
||||||
|
"start": 86,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 95,
|
||||||
|
"start": 94,
|
||||||
|
"type": "PipeSubstitution",
|
||||||
|
"type": "PipeSubstitution"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"end": 85,
|
||||||
|
"name": "startProfileAt",
|
||||||
|
"start": 71,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 96,
|
||||||
|
"start": 71,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "end"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"end": 115,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 114,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"end": 119,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 117,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 120,
|
||||||
|
"start": 113,
|
||||||
|
"type": "ArrayExpression",
|
||||||
|
"type": "ArrayExpression"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "tag"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 136,
|
||||||
|
"start": 128,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "edge001"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"end": 106,
|
||||||
|
"name": "line",
|
||||||
|
"start": 102,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 137,
|
||||||
|
"start": 102,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 137,
|
||||||
|
"start": 46,
|
||||||
|
"type": "PipeExpression",
|
||||||
|
"type": "PipeExpression"
|
||||||
|
},
|
||||||
|
"start": 34,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 137,
|
||||||
|
"kind": "const",
|
||||||
|
"start": 34,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"declaration": {
|
||||||
|
"end": 242,
|
||||||
|
"id": {
|
||||||
|
"end": 148,
|
||||||
|
"name": "helixPath",
|
||||||
|
"start": 139,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"arguments": [
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "angleStart"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 171,
|
||||||
|
"raw": "0",
|
||||||
|
"start": 170,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 0.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "ccw"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 183,
|
||||||
|
"raw": "true",
|
||||||
|
"start": 179,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "revolutions"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 200,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 199,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "length"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 213,
|
||||||
|
"raw": "10",
|
||||||
|
"start": 211,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 10.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "radius"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 225,
|
||||||
|
"raw": "5",
|
||||||
|
"start": 224,
|
||||||
|
"type": "Literal",
|
||||||
|
"type": "Literal",
|
||||||
|
"value": {
|
||||||
|
"value": 5.0,
|
||||||
|
"suffix": "None"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "LabeledArg",
|
||||||
|
"label": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"name": "axis"
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"end": 241,
|
||||||
|
"name": "edge001",
|
||||||
|
"start": 234,
|
||||||
|
"type": "Identifier",
|
||||||
|
"type": "Identifier"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"end": 156,
|
||||||
|
"name": "helix",
|
||||||
|
"start": 151,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"end": 242,
|
||||||
|
"start": 151,
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"type": "CallExpressionKw",
|
||||||
|
"unlabeled": null
|
||||||
|
},
|
||||||
|
"start": 139,
|
||||||
|
"type": "VariableDeclarator"
|
||||||
|
},
|
||||||
|
"end": 242,
|
||||||
|
"kind": "const",
|
||||||
|
"start": 139,
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"type": "VariableDeclaration"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"end": 243,
|
||||||
|
"nonCodeMeta": {
|
||||||
|
"nonCodeNodes": {
|
||||||
|
"0": [
|
||||||
|
{
|
||||||
|
"end": 139,
|
||||||
|
"start": 137,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "newLine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"startNodes": [
|
||||||
|
{
|
||||||
|
"end": 33,
|
||||||
|
"start": 0,
|
||||||
|
"type": "NonCodeNode",
|
||||||
|
"value": {
|
||||||
|
"type": "blockComment",
|
||||||
|
"value": "Create a helix around an edge.",
|
||||||
|
"style": "line"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"start": 0
|
||||||
|
}
|
||||||
|
}
|
6
src/wasm-lib/kcl/tests/helix_simple/input.kcl
Normal file
6
src/wasm-lib/kcl/tests/helix_simple/input.kcl
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// Create a helix around an edge.
|
||||||
|
helper001 = startSketchOn('XZ')
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> line(end = [0, 10], tag = $edge001)
|
||||||
|
|
||||||
|
helixPath = helix(angleStart = 0, ccw = true, revolutions = 5, length = 10, radius = 5, axis = edge001)
|
79
src/wasm-lib/kcl/tests/helix_simple/ops.snap
Normal file
79
src/wasm-lib/kcl/tests/helix_simple/ops.snap
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
---
|
||||||
|
source: kcl/src/simulation_tests.rs
|
||||||
|
description: Operations executed helix_simple.kcl
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"data": {
|
||||||
|
"sourceRange": [
|
||||||
|
60,
|
||||||
|
64,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"sourceRange": [
|
||||||
|
46,
|
||||||
|
65,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"angleStart": {
|
||||||
|
"sourceRange": [
|
||||||
|
170,
|
||||||
|
171,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"axis": {
|
||||||
|
"sourceRange": [
|
||||||
|
234,
|
||||||
|
241,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ccw": {
|
||||||
|
"sourceRange": [
|
||||||
|
179,
|
||||||
|
183,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"length": {
|
||||||
|
"sourceRange": [
|
||||||
|
211,
|
||||||
|
213,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"radius": {
|
||||||
|
"sourceRange": [
|
||||||
|
224,
|
||||||
|
225,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"revolutions": {
|
||||||
|
"sourceRange": [
|
||||||
|
199,
|
||||||
|
200,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "helix",
|
||||||
|
"sourceRange": [
|
||||||
|
151,
|
||||||
|
242,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
}
|
||||||
|
]
|
245
src/wasm-lib/kcl/tests/helix_simple/program_memory.snap
Normal file
245
src/wasm-lib/kcl/tests/helix_simple/program_memory.snap
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
---
|
||||||
|
source: kcl/src/simulation_tests.rs
|
||||||
|
description: Program memory after executing helix_simple.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"environments": [
|
||||||
|
{
|
||||||
|
"bindings": {
|
||||||
|
"HALF_TURN": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 180.0,
|
||||||
|
"__meta": []
|
||||||
|
},
|
||||||
|
"QUARTER_TURN": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 90.0,
|
||||||
|
"__meta": []
|
||||||
|
},
|
||||||
|
"THREE_QUARTER_TURN": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 270.0,
|
||||||
|
"__meta": []
|
||||||
|
},
|
||||||
|
"ZERO": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 0.0,
|
||||||
|
"__meta": []
|
||||||
|
},
|
||||||
|
"edge001": {
|
||||||
|
"type": "TagIdentifier",
|
||||||
|
"type": "TagIdentifier",
|
||||||
|
"value": "edge001",
|
||||||
|
"info": {
|
||||||
|
"type": "TagEngineInfo",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sketch": "[uuid]",
|
||||||
|
"path": {
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [
|
||||||
|
102,
|
||||||
|
137,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"tag": {
|
||||||
|
"end": 136,
|
||||||
|
"start": 128,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "edge001"
|
||||||
|
},
|
||||||
|
"to": [
|
||||||
|
0.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint"
|
||||||
|
},
|
||||||
|
"surface": null
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
128,
|
||||||
|
136,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"helixPath": {
|
||||||
|
"type": "Helix",
|
||||||
|
"value": {
|
||||||
|
"value": "[uuid]",
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"revolutions": 5.0,
|
||||||
|
"angleStart": 0.0,
|
||||||
|
"ccw": true,
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
151,
|
||||||
|
242,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"helper001": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"paths": [
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [
|
||||||
|
102,
|
||||||
|
137,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"tag": {
|
||||||
|
"end": 136,
|
||||||
|
"start": 128,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "edge001"
|
||||||
|
},
|
||||||
|
"to": [
|
||||||
|
0.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"type": "plane",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"value": "XZ",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"zAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": -1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"__meta": []
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [
|
||||||
|
71,
|
||||||
|
96,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"edge001": {
|
||||||
|
"type": "TagIdentifier",
|
||||||
|
"value": "edge001",
|
||||||
|
"info": {
|
||||||
|
"type": "TagEngineInfo",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sketch": "[uuid]",
|
||||||
|
"path": {
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": [
|
||||||
|
102,
|
||||||
|
137,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
0.0,
|
||||||
|
0.0
|
||||||
|
],
|
||||||
|
"tag": {
|
||||||
|
"end": 136,
|
||||||
|
"start": 128,
|
||||||
|
"type": "TagDeclarator",
|
||||||
|
"value": "edge001"
|
||||||
|
},
|
||||||
|
"to": [
|
||||||
|
0.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint"
|
||||||
|
},
|
||||||
|
"surface": null
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
128,
|
||||||
|
136,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"__meta": [
|
||||||
|
{
|
||||||
|
"sourceRange": [
|
||||||
|
71,
|
||||||
|
96,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"parent": null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"currentEnv": 0,
|
||||||
|
"return": null
|
||||||
|
}
|
BIN
src/wasm-lib/kcl/tests/helix_simple/rendered_model.png
Normal file
BIN
src/wasm-lib/kcl/tests/helix_simple/rendered_model.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 89 KiB |
Reference in New Issue
Block a user