diff --git a/docs/kcl/std.json b/docs/kcl/std.json index e617a5d3a..83c414b38 100644 --- a/docs/kcl/std.json +++ b/docs/kcl/std.json @@ -17481,16 +17481,16 @@ "deprecated": false }, { - "name": "tangentalArc", + "name": "tangentialArc", "summary": "Draw an arc.", "description": "", "tags": [], "args": [ { "name": "data", - "type": "TangentalArcData", + "type": "TangentialArcData", "schema": { - "description": "Data to draw a tangental arc.", + "description": "Data to draw a tangential arc.", "anyOf": [ { "type": "object", @@ -18432,16 +18432,16 @@ "deprecated": false }, { - "name": "tangentalArcTo", + "name": "tangentialArcTo", "summary": "Draw an arc.", "description": "", "tags": [], "args": [ { "name": "data", - "type": "TangentalArcToData", + "type": "TangentialArcToData", "schema": { - "description": "Data to draw a tangental arc to a specific point.", + "description": "Data to draw a tangential arc to a specific point.", "anyOf": [ { "description": "A point with a tag.", diff --git a/docs/kcl/std.md b/docs/kcl/std.md index b455b62a6..b439c358b 100644 --- a/docs/kcl/std.md +++ b/docs/kcl/std.md @@ -52,8 +52,8 @@ * [`startSketchAt`](#startSketchAt) * [`startSketchOn`](#startSketchOn) * [`tan`](#tan) - * [`tangentalArc`](#tangentalArc) - * [`tangentalArcTo`](#tangentalArcTo) + * [`tangentialArc`](#tangentialArc) + * [`tangentialArcTo`](#tangentialArcTo) * [`tau`](#tau) * [`xLine`](#xLine) * [`xLineTo`](#xLineTo) @@ -3520,19 +3520,19 @@ tan(num: number) -> number -### tangentalArc +### tangentialArc Draw an arc. ``` -tangentalArc(data: TangentalArcData, sketch_group: SketchGroup) -> SketchGroup +tangentialArc(data: TangentialArcData, sketch_group: SketchGroup) -> SketchGroup ``` #### Arguments -* `data`: `TangentalArcData` - Data to draw a tangental arc. +* `data`: `TangentialArcData` - Data to draw a tangential arc. ``` { // Offset of the arc, in degrees. @@ -3684,19 +3684,19 @@ tangentalArc(data: TangentalArcData, sketch_group: SketchGroup) -> SketchGroup -### tangentalArcTo +### tangentialArcTo Draw an arc. ``` -tangentalArcTo(data: TangentalArcToData, sketch_group: SketchGroup) -> SketchGroup +tangentialArcTo(data: TangentialArcToData, sketch_group: SketchGroup) -> SketchGroup ``` #### Arguments -* `data`: `TangentalArcToData` - Data to draw a tangental arc to a specific point. +* `data`: `TangentialArcToData` - Data to draw a tangential arc to a specific point. ``` { // The tag. diff --git a/src/lib/exampleKcl.ts b/src/lib/exampleKcl.ts index 3a07b8ea4..639782387 100644 --- a/src/lib/exampleKcl.ts +++ b/src/lib/exampleKcl.ts @@ -11,14 +11,14 @@ const wallMountL = 8 const bracket = startSketchOn('XY') |> startProfileAt([0, 0], %) |> line([0, wallMountL], %) - |> tangentalArc({ + |> tangentialArc({ radius: filletR, offset: 90 }, %) |> line([-shelfMountL, 0], %) |> line([0, -thickness], %) |> line([shelfMountL, 0], %) - |> tangentalArc({ + |> tangentialArc({ radius: filletR - thickness, offset: -90 }, %) diff --git a/src/wasm-lib/kcl/src/parser/parser_impl.rs b/src/wasm-lib/kcl/src/parser/parser_impl.rs index 77afc0cd7..2d2c5121f 100644 --- a/src/wasm-lib/kcl/src/parser/parser_impl.rs +++ b/src/wasm-lib/kcl/src/parser/parser_impl.rs @@ -1682,7 +1682,7 @@ const mySk1 = startSketchAt([0, 0])"#; for (i, test_program) in [ r#"const boxSketch = startSketchAt([0, 0]) |> line([0, 10], %) - |> tangentalArc([-5, 5], %) + |> tangentialArc([-5, 5], %) |> line([5, -15], %) |> extrude(10, %) "#, diff --git a/src/wasm-lib/kcl/src/std/mod.rs b/src/wasm-lib/kcl/src/std/mod.rs index 421cb3133..e813441b4 100644 --- a/src/wasm-lib/kcl/src/std/mod.rs +++ b/src/wasm-lib/kcl/src/std/mod.rs @@ -63,8 +63,8 @@ impl StdLib { Box::new(crate::std::sketch::StartProfileAt), Box::new(crate::std::sketch::Close), Box::new(crate::std::sketch::Arc), - Box::new(crate::std::sketch::TangentalArc), - Box::new(crate::std::sketch::TangentalArcTo), + Box::new(crate::std::sketch::TangentialArc), + Box::new(crate::std::sketch::TangentialArcTo), Box::new(crate::std::sketch::BezierCurve), Box::new(crate::std::math::Cos), Box::new(crate::std::math::Sin), diff --git a/src/wasm-lib/kcl/src/std/sketch.rs b/src/wasm-lib/kcl/src/std/sketch.rs index 0e424854f..b48f84247 100644 --- a/src/wasm-lib/kcl/src/std/sketch.rs +++ b/src/wasm-lib/kcl/src/std/sketch.rs @@ -1080,11 +1080,11 @@ async fn inner_arc(data: ArcData, sketch_group: Box, args: Args) -> Ok(new_sketch_group) } -/// Data to draw a tangental arc. +/// Data to draw a tangential arc. #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)] #[ts(export)] #[serde(rename_all = "camelCase", untagged)] -pub enum TangentalArcData { +pub enum TangentialArcData { RadiusAndOffset { /// Radius of the arc. /// Not to be confused with Raiders of the Lost Ark. @@ -1103,20 +1103,20 @@ pub enum TangentalArcData { Point([f64; 2]), } -/// Draw a tangental arc. -pub async fn tangental_arc(args: Args) -> Result { - let (data, sketch_group): (TangentalArcData, Box) = args.get_data_and_sketch_group()?; +/// Draw a tangential arc. +pub async fn tangential_arc(args: Args) -> Result { + let (data, sketch_group): (TangentialArcData, Box) = args.get_data_and_sketch_group()?; - let new_sketch_group = inner_tangental_arc(data, sketch_group, args).await?; + let new_sketch_group = inner_tangential_arc(data, sketch_group, args).await?; Ok(MemoryItem::SketchGroup(new_sketch_group)) } /// Draw an arc. #[stdlib { - name = "tangentalArc", + name = "tangentialArc", }] -async fn inner_tangental_arc( - data: TangentalArcData, +async fn inner_tangential_arc( + data: TangentialArcData, sketch_group: Box, args: Args, ) -> Result, KclError> { @@ -1125,7 +1125,7 @@ async fn inner_tangental_arc( let id = uuid::Uuid::new_v4(); let to = match &data { - TangentalArcData::RadiusAndOffset { radius, offset } => { + TangentialArcData::RadiusAndOffset { radius, offset } => { // Calculate the end point from the angle and radius. let end_angle = Angle::from_degrees(*offset); let start_angle = Angle::from_degrees(0.0); @@ -1147,7 +1147,7 @@ async fn inner_tangental_arc( .await?; to.into() } - TangentalArcData::PointWithTag { to, .. } => { + TangentialArcData::PointWithTag { to, .. } => { args.send_modeling_cmd( id, ModelingCmd::ExtendPath { @@ -1166,7 +1166,7 @@ async fn inner_tangental_arc( *to } - TangentalArcData::Point(to) => { + TangentialArcData::Point(to) => { args.send_modeling_cmd( id, ModelingCmd::ExtendPath { @@ -1207,11 +1207,11 @@ async fn inner_tangental_arc( Ok(new_sketch_group) } -/// Data to draw a tangental arc to a specific point. +/// Data to draw a tangential arc to a specific point. #[derive(Debug, Clone, Deserialize, Serialize, PartialEq, JsonSchema, ts_rs::TS)] #[ts(export)] #[serde(rename_all = "camelCase", untagged)] -pub enum TangentalArcToData { +pub enum TangentialArcToData { /// A point with a tag. PointWithTag { /// Where the arc should end. Must lie in the same plane as the current path pen position. Must not be colinear with current path pen position. @@ -1223,27 +1223,27 @@ pub enum TangentalArcToData { Point([f64; 2]), } -/// Draw a tangental arc to a specific point. -pub async fn tangental_arc_to(args: Args) -> Result { - let (data, sketch_group): (TangentalArcToData, Box) = args.get_data_and_sketch_group()?; +/// Draw a tangential arc to a specific point. +pub async fn tangential_arc_to(args: Args) -> Result { + let (data, sketch_group): (TangentialArcToData, Box) = args.get_data_and_sketch_group()?; - let new_sketch_group = inner_tangental_arc_to(data, sketch_group, args).await?; + let new_sketch_group = inner_tangential_arc_to(data, sketch_group, args).await?; Ok(MemoryItem::SketchGroup(new_sketch_group)) } /// Draw an arc. #[stdlib { - name = "tangentalArcTo", + name = "tangentialArcTo", }] -async fn inner_tangental_arc_to( - data: TangentalArcToData, +async fn inner_tangential_arc_to( + data: TangentialArcToData, sketch_group: Box, args: Args, ) -> Result, KclError> { let from: Point2d = sketch_group.get_coords_from_paths()?; let to = match &data { - TangentalArcToData::PointWithTag { to, .. } => to, - TangentalArcToData::Point(to) => to, + TangentialArcToData::PointWithTag { to, .. } => to, + TangentialArcToData::Point(to) => to, }; let delta = [to[0] - from.x, to[1] - from.y]; @@ -1270,7 +1270,7 @@ async fn inner_tangental_arc_to( base: BasePath { from: from.into(), to: *to, - name: if let TangentalArcToData::PointWithTag { tag, .. } = data { + name: if let TangentialArcToData::PointWithTag { tag, .. } = data { tag.to_string() } else { "".to_string() diff --git a/src/wasm-lib/tests/executor/main.rs b/src/wasm-lib/tests/executor/main.rs index fec083e67..66d9ffabb 100644 --- a/src/wasm-lib/tests/executor/main.rs +++ b/src/wasm-lib/tests/executor/main.rs @@ -173,14 +173,14 @@ const wallMountL = 8 const bracket = startSketchAt([0, 0]) |> line([0, wallMountL], %) - |> tangentalArc({ + |> tangentialArc({ radius: filletR, offset: 90 }, %) |> line([-shelfMountL, 0], %) |> line([0, -thickness], %) |> line([shelfMountL, 0], %) - |> tangentalArc({ + |> tangentialArc({ radius: filletR - thickness, offset: -90 }, %) @@ -231,7 +231,7 @@ async fn serial_test_execute_kittycad_svg() { } #[tokio::test(flavor = "multi_thread")] -async fn test_member_expression_sketch_group() { +async fn serial_test_member_expression_sketch_group() { let code = r#"fn cube = (pos, scale) => { const sg = startSketchOn('XY') |> startProfileAt(pos, %) @@ -260,7 +260,7 @@ show(b2)"#; } #[tokio::test(flavor = "multi_thread")] -async fn test_close_arc() { +async fn serial_test_close_arc() { let code = r#"const center = [0,0] const radius = 40 const height = 3 @@ -278,7 +278,7 @@ show(body)"#; } #[tokio::test(flavor = "multi_thread")] -async fn test_negative_args() { +async fn serial_test_negative_args() { let code = r#"const width = 5 const height = 10 const length = 12 @@ -304,46 +304,46 @@ box(-20, -5, 10)"#; } #[tokio::test(flavor = "multi_thread")] -async fn test_basic_tangental_arc() { +async fn serial_test_basic_tangential_arc() { let code = r#"const boxSketch = startSketchAt([0, 0]) |> line([0, 10], %) - |> tangentalArc({radius: 5, offset: 90}, %) + |> tangentialArc({radius: 5, offset: 90}, %) |> line([5, -15], %) |> extrude(10, %) "#; let result = execute_and_snapshot(code).await.unwrap(); - twenty_twenty::assert_image("tests/executor/outputs/tangental_arc.png", &result, 0.999); + twenty_twenty::assert_image("tests/executor/outputs/tangential_arc.png", &result, 0.999); } #[tokio::test(flavor = "multi_thread")] -async fn test_basic_tangental_arc_with_point() { +async fn serial_test_basic_tangential_arc_with_point() { let code = r#"const boxSketch = startSketchAt([0, 0]) |> line([0, 10], %) - |> tangentalArc([-5, 5], %) + |> tangentialArc([-5, 5], %) |> line([5, -15], %) |> extrude(10, %) "#; let result = execute_and_snapshot(code).await.unwrap(); - twenty_twenty::assert_image("tests/executor/outputs/tangental_arc_with_point.png", &result, 0.999); + twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_with_point.png", &result, 0.999); } #[tokio::test(flavor = "multi_thread")] -async fn test_basic_tangental_arc_to() { +async fn serial_test_basic_tangential_arc_to() { let code = r#"const boxSketch = startSketchAt([0, 0]) |> line([0, 10], %) - |> tangentalArcTo([-5, 15], %) + |> tangentialArcTo([-5, 15], %) |> line([5, -15], %) |> extrude(10, %) "#; let result = execute_and_snapshot(code).await.unwrap(); - twenty_twenty::assert_image("tests/executor/outputs/tangental_arc_to.png", &result, 0.999); + twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_to.png", &result, 0.999); } #[tokio::test(flavor = "multi_thread")] -async fn test_different_planes_same_drawing() { +async fn serial_test_different_planes_same_drawing() { let code = r#"const width = 5 const height = 10 const length = 12 @@ -374,7 +374,7 @@ box(-20, -5, 10, 'xy')"#; } #[tokio::test(flavor = "multi_thread")] -async fn test_lots_of_planes() { +async fn serial_test_lots_of_planes() { let code = r#"const sigmaAllow = 15000 // psi const width = 11 // inch const p = 150 // Force on shelf - lbs @@ -388,11 +388,11 @@ const wallMountL = 8 const bracket = startSketchOn('XY') |> startProfileAt([0, 0], %) |> line([0, wallMountL], %) - |> tangentalArc({ radius: filletR, offset: 90 }, %) + |> tangentialArc({ radius: filletR, offset: 90 }, %) |> line([-shelfMountL, 0], %) |> line([0, -thickness], %) |> line([shelfMountL, 0], %) - |> tangentalArc({ + |> tangentialArc({ radius: filletR - thickness, offset: -90 }, %) diff --git a/src/wasm-lib/tests/executor/outputs/tangental_arc.png b/src/wasm-lib/tests/executor/outputs/tangential_arc.png similarity index 100% rename from src/wasm-lib/tests/executor/outputs/tangental_arc.png rename to src/wasm-lib/tests/executor/outputs/tangential_arc.png diff --git a/src/wasm-lib/tests/executor/outputs/tangental_arc_to.png b/src/wasm-lib/tests/executor/outputs/tangential_arc_to.png similarity index 100% rename from src/wasm-lib/tests/executor/outputs/tangental_arc_to.png rename to src/wasm-lib/tests/executor/outputs/tangential_arc_to.png diff --git a/src/wasm-lib/tests/executor/outputs/tangental_arc_with_point.png b/src/wasm-lib/tests/executor/outputs/tangential_arc_with_point.png similarity index 100% rename from src/wasm-lib/tests/executor/outputs/tangental_arc_with_point.png rename to src/wasm-lib/tests/executor/outputs/tangential_arc_with_point.png