Kwargs: startProfileAt (#6424)

Previous:

```
startProfileAt([x, y], %)
startProfileAt([x, y], sketch001)
```

New:
```
startProfile(%, at = [x, y])
startProfile(sketch001, at = [x, y])
```
This commit is contained in:
Adam Chalmers
2025-04-25 16:01:35 -05:00
committed by GitHub
parent 9547e95e9d
commit ffbe20b586
573 changed files with 19805 additions and 16552 deletions

View File

@ -249,7 +249,7 @@ mod tests {
async fn test_get_changed_program_same_code() {
let new = r#"// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -280,7 +280,7 @@ shell(firstSketch, faces = [END], thickness = 0.25)"#;
async fn test_get_changed_program_same_code_changed_whitespace() {
let old = r#" // Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -292,7 +292,7 @@ shell(firstSketch, faces = [END], thickness = 0.25) "#;
let new = r#"// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -325,7 +325,7 @@ shell(firstSketch, faces = [END], thickness = 0.25)"#;
async fn test_get_changed_program_same_code_changed_code_comment_start_of_program() {
let old = r#" // Removed the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -337,7 +337,7 @@ shell(firstSketch, faces = [END], thickness = 0.25) "#;
let new = r#"// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -372,7 +372,7 @@ shell(firstSketch, faces = [END], thickness = 0.25)"#;
@bar
// Removed the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0]) // my thing
@ -386,7 +386,7 @@ shell(firstSketch, faces = [END], thickness = 0.25) "#;
@baz
// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -420,7 +420,7 @@ shell(firstSketch, faces = [END], thickness = 0.25)"#;
async fn test_get_changed_program_same_code_but_different_grid_setting() {
let new = r#"// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -457,7 +457,7 @@ shell(firstSketch, faces = [END], thickness = 0.25)"#;
async fn test_get_changed_program_same_code_but_different_edge_visiblity_setting() {
let new = r#"// Remove the end face for the extrusion.
firstSketch = startSketchOn('XY')
|> startProfileAt([-12, 12], %)
|> startProfile(at = [-12, 12])
|> line(end = [24, 0])
|> line(end = [0, -24])
|> line(end = [-24, 0])
@ -608,7 +608,7 @@ startSketchOn('XY')
importedCube
sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([-134.53, -56.17], sketch001)
profile001 = startProfile(sketch001, at = [-134.53, -56.17])
|> angledLine(angle = 0, length = 79.05, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 76.28)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001), tag = $seg01)
@ -622,7 +622,7 @@ sketch002 = startSketchOn(extrude001, face = seg01)
let other_file = (
std::path::PathBuf::from("toBeImported.kcl"),
r#"sketch001 = startSketchOn(XZ)
profile001 = startProfileAt([281.54, 305.81], sketch001)
profile001 = startProfile(sketch001, at = [281.54, 305.81])
|> angledLine(angle = 0, length = 123.43, tag = $rectangleSegmentA001)
|> angledLine(angle = segAng(rectangleSegmentA001) - 90, length = 85.99)
|> angledLine(angle = segAng(rectangleSegmentA001), length = -segLen(rectangleSegmentA001))

View File

@ -1295,7 +1295,7 @@ yo = 5 + 6
abc = 3
identifierGuy = 5
part001 = startSketchOn(XY)
|> startProfileAt([-1.2, 4.83], %)
|> startProfile(at = [-1.2, 4.83])
|> line(end = [2.8, 0])
|> angledLine(angle = 100 + 100, length = 3.01)
|> angledLine(angle = abc, length = 3.02)
@ -1312,7 +1312,7 @@ yo2 = hmm([identifierGuy + 5])"#;
async fn test_execute_with_pipe_substitutions_unary() {
let ast = r#"const myVar = 3
const part001 = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> startProfile(at = [0, 0])
|> line(end = [3, 4], tag = $seg01)
|> line(end = [
min(segLen(seg01), myVar),
@ -1327,7 +1327,7 @@ const part001 = startSketchOn(XY)
async fn test_execute_with_pipe_substitutions() {
let ast = r#"const myVar = 3
const part001 = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> startProfile(at = [0, 0])
|> line(end = [3, 4], tag = $seg01)
|> line(end = [
min(segLen(seg01), myVar),
@ -1350,7 +1350,7 @@ const arrExpShouldNotBeIncluded = [1, 2, 3]
const objExpShouldNotBeIncluded = { a: 1, b: 2, c: 3 }
const part001 = startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> startProfile(at = [0, 0])
|> yLine(endAbsolute = 1)
|> xLine(length = 3.84) // selection-range-7ish-before-this
@ -1371,7 +1371,7 @@ fn thing = () => {
}
const firstExtrude = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = [0, thing()])
@ -1392,7 +1392,7 @@ fn thing = (x) => {
}
const firstExtrude = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = [0, thing(8)])
@ -1413,7 +1413,7 @@ fn thing = (x) => {
}
const firstExtrude = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = thing(8))
@ -1438,7 +1438,7 @@ fn thing = (x) => {
}
const firstExtrude = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = [0, thing(8)])
@ -1452,7 +1452,7 @@ const firstExtrude = startSketchOn(XY)
async fn test_execute_with_function_sketch() {
let ast = r#"fn box = (h, l, w) => {
const myBox = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = [0, -l])
@ -1471,7 +1471,7 @@ const fnBox = box(3, 6, 10)"#;
async fn test_get_member_of_object_with_function_period() {
let ast = r#"fn box = (obj) => {
let myBox = startSketchOn(XY)
|> startProfileAt(obj.start, %)
|> startProfile(at = obj.start)
|> line(end = [0, obj.l])
|> line(end = [obj.w, 0])
|> line(end = [0, -obj.l])
@ -1490,7 +1490,7 @@ const thisBox = box({start: [0,0], l: 6, w: 10, h: 3})
async fn test_get_member_of_object_with_function_brace() {
let ast = r#"fn box = (obj) => {
let myBox = startSketchOn(XY)
|> startProfileAt(obj["start"], %)
|> startProfile(at = obj["start"])
|> line(end = [0, obj["l"]])
|> line(end = [obj["w"], 0])
|> line(end = [0, -obj["l"]])
@ -1509,7 +1509,7 @@ const thisBox = box({start: [0,0], l: 6, w: 10, h: 3})
async fn test_get_member_of_object_with_function_mix_period_brace() {
let ast = r#"fn box = (obj) => {
let myBox = startSketchOn(XY)
|> startProfileAt(obj["start"], %)
|> startProfile(at = obj["start"])
|> line(end = [0, obj["l"]])
|> line(end = [obj["w"], 0])
|> line(end = [10 - obj["w"], -obj.l])
@ -1531,7 +1531,7 @@ const thisBox = box({start: [0,0], l: 6, w: 10, h: 3})
fn test2 = () => {
return {
thing: startSketchOn(XY)
|> startProfileAt([0, 0], %)
|> startProfile(at = [0, 0])
|> line(end = [0, 1])
|> line(end = [1, 0])
|> line(end = [0, -1])
@ -1552,7 +1552,7 @@ x2.thing
async fn test_execute_with_function_sketch_loop_objects() {
let ast = r#"fn box = (obj) => {
let myBox = startSketchOn(XY)
|> startProfileAt(obj.start, %)
|> startProfile(at = obj.start)
|> line(end = [0, obj.l])
|> line(end = [obj.w, 0])
|> line(end = [0, -obj.l])
@ -1574,7 +1574,7 @@ for var in [{start: [0,0], l: 6, w: 10, h: 3}, {start: [-10,-10], l: 3, w: 5, h:
async fn test_execute_with_function_sketch_loop_array() {
let ast = r#"fn box = (h, l, w, start) => {
const myBox = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, l])
|> line(end = [w, 0])
|> line(end = [0, -l])
@ -1596,7 +1596,7 @@ for var in [[3, 6, 10, [0,0]], [1.5, 3, 5, [-10,-10]]] {
async fn test_get_member_of_array_with_function() {
let ast = r#"fn box = (arr) => {
let myBox =startSketchOn(XY)
|> startProfileAt(arr[0], %)
|> startProfile(at = arr[0])
|> line(end = [0, arr[1]])
|> line(end = [arr[2], 0])
|> line(end = [0, -arr[1]])
@ -1850,7 +1850,7 @@ const leg2 = 8 // inches
fn thickness = () => { return 0.56 }
const bracket = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, leg1])
|> line(end = [leg2, 0])
|> line(end = [0, -thickness()])
@ -2061,7 +2061,7 @@ const thickness_squared = distance * p * FOS * 6 / sigmaAllow
const thickness = 0.56 // inches. App does not support square root function yet
const bracket = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, leg1])
|> line(end = [leg2, 0])
|> line(end = [0, -thickness])
@ -2095,7 +2095,7 @@ const leg2 = 8 // inches
const thickness_squared = (distance * p * FOS * 6 / (sigmaAllow - width))
const thickness = 0.32 // inches. App does not support square root function yet
const bracket = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, leg1])
|> line(end = [leg2, 0])
|> line(end = [0, -thickness])
@ -2119,7 +2119,7 @@ const leg2 = 8 // inches
const thickness_squared = distance * p * FOS * 6 / (sigmaAllow - width)
const thickness = 0.32 // inches. App does not support square root function yet
const bracket = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, leg1])
|> line(end = [leg2, 0])
|> line(end = [0, -thickness])
@ -2145,7 +2145,7 @@ let w = f() + f()
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_ids_stable_between_executions() {
let code = r#"sketch001 = startSketchOn(XZ)
|> startProfileAt([61.74, 206.13], %)
|> startProfile(at = [61.74, 206.13])
|> xLine(length = 305.11, tag = $seg01)
|> yLine(length = -291.85)
|> xLine(length = -segLen(seg01))
@ -2172,7 +2172,7 @@ let w = f() + f()
let id_generator = cache::read_old_ast().await.unwrap().exec_state.mod_local.id_generator;
let code = r#"sketch001 = startSketchOn(XZ)
|> startProfileAt([62.74, 206.13], %)
|> startProfile(at = [62.74, 206.13])
|> xLine(length = 305.11, tag = $seg01)
|> yLine(length = -291.85)
|> xLine(length = -segLen(seg01))
@ -2198,7 +2198,7 @@ let w = f() + f()
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_changing_a_setting_updates_the_cached_state() {
let code = r#"sketch001 = startSketchOn('XZ')
|> startProfileAt([61.74, 206.13], %)
|> startProfile(at = [61.74, 206.13])
|> xLine(length = 305.11, tag = $seg01)
|> yLine(length = -291.85)
|> xLine(length = -segLen(seg01))
@ -2267,7 +2267,7 @@ let w = f() + f()
async fn read_tag_version() {
let ast = r#"fn bar(t) {
return startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> angledLine(
angle = -60,
length = segLen(t),
@ -2277,7 +2277,7 @@ let w = f() + f()
}
sketch = startSketchOn(XY)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, 10])
|> line(end = [10, 0], tag = $tag0)
|> line(end = [0, 0])
@ -2290,7 +2290,7 @@ fn foo() {
solid = sketch |> extrude(length = 10)
// tag0 tags a face
sketch2 = startSketchOn(solid, face = tag0)
|> startProfileAt([0,0], %)
|> startProfile(at = [0,0])
|> line(end = [0, 1])
|> line(end = [1, 0])
|> line(end = [0, 0])