Skip to content

Commit 842eefb

Browse files
committed
Merge branch 'main' into franknoirot/7222/inlaid-sidebar
2 parents 65e74e9 + 6b2658d commit 842eefb

File tree

209 files changed

+728071
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+728071
-87
lines changed

.github/workflows/generate-website-docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ jobs:
4040
# cleanup old
4141
rm -rf documentation/content/pages/docs/kcl-std
4242
rm -rf documentation/content/pages/docs/kcl-lang
43+
rm -rf documentation/content/kcl-test-outputs
4344
# move new
4445
mv -f docs/kcl-std documentation/content/pages/docs
4546
mv -f docs/kcl-lang documentation/content/pages/docs
47+
mv -f rust/kcl-lib/tests/outputs documentation/content/kcl-test-outputs
4648
# We don't need the README
4749
rm documentation/content/pages/docs/kcl-std/README.md
4850
- name: move kcl-samples

docs/kcl-std/functions/std-sketch-ellipse.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ Construct a 2-dimensional ellipse, of the specified major/minor radius, centered
1111
ellipse(
1212
@sketchOrSurface: Sketch | Plane | Face,
1313
center: Point2d,
14-
majorRadius: number(Length),
1514
minorRadius: number(Length),
15+
majorRadius?: number(Length),
16+
majorAxis?: Point2d,
1617
tag?: tag,
1718
): Sketch
1819
```
@@ -25,8 +26,9 @@ ellipse(
2526
|----------|------|-------------|----------|
2627
| `sketchOrSurface` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
2728
| `center` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The center of the ellipse. | Yes |
28-
| `majorRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The major radius of the ellipse. | Yes |
2929
| `minorRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The minor radius of the ellipse. | Yes |
30+
| `majorRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The major radius of the ellipse. Equivalent to majorAxis = [majorRadius, 0]. | No |
31+
| `majorAxis` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The major axis of the ellipse. | No |
3032
| `tag` | `tag` | Create a new tag which refers to this ellipse. | No |
3133

3234
### Returns

docs/kcl-std/functions/std-sketch-elliptic.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ elliptic(
1313
center: Point2d,
1414
angleStart: number(Angle),
1515
angleEnd: number(Angle),
16-
majorRadius: number(Length),
1716
minorRadius: number(Length),
17+
majorRadius?: number(Length),
18+
majorAxis?: Point2d,
1819
tag?: tag,
1920
): Sketch
2021
```
@@ -29,8 +30,9 @@ elliptic(
2930
| `center` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The center of the ellipse. | Yes |
3031
| `angleStart` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | Where along the ellptic should this segment start? | Yes |
3132
| `angleEnd` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | Where along the ellptic should this segment end? | Yes |
32-
| `majorRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The major radius, a, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1. | Yes |
3333
| `minorRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The minor radius, b, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1. | Yes |
34+
| `majorRadius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The major radius, a, of the elliptic equation x^2 / a^2 + y^2 / b^2 = 1. Equivalent to majorAxis = [majorRadius, 0]. | No |
35+
| `majorAxis` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The major axis of the elliptic. | No |
3436
| `tag` | `tag` | Create a new tag which refers to this arc. | No |
3537

3638
### Returns

docs/kcl-std/functions/std-transform-mirror2d.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

rust/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dashmap = { version = "6.1.0" }
3636
http = "1"
3737
indexmap = "2.10.0"
3838
kittycad = { version = "0.3.37", default-features = false, features = ["js", "requests"] }
39-
kittycad-modeling-cmds = { version = "=0.2.129", features = ["ts-rs", "websocket"] }
39+
kittycad-modeling-cmds = { version = "0.2.130", features = ["ts-rs", "websocket"] }
4040
lazy_static = "1.5.0"
4141
miette = "7.6.0"
4242
pyo3 = { version = "0.25.1" }

rust/justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cnr := "cargo nextest run"
1+
cnr := "cargo nextest run --no-fail-fast"
22
cita := "cargo insta test --accept"
33
kcl_lib_flags := "-p kcl-lib --features artifact-graph"
44

rust/kcl-lib/src/docs/kcl_doc.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,7 @@ mod test {
13441344
if i != number {
13451345
continue;
13461346
}
1347-
let result = match crate::test_server::execute_and_snapshot(&eg.0, None).await {
1347+
let result = match crate::test_server::execute_and_snapshot_3d(&eg.0, None).await {
13481348
Err(crate::errors::ExecError::Kcl(e)) => {
13491349
panic!("Error testing example {}{i}: {}", d.name, e.error.message());
13501350
}
@@ -1359,9 +1359,18 @@ mod test {
13591359
"tests/outputs/serial_test_example_fn_{}{i}.png",
13601360
qualname.replace("::", "-")
13611361
),
1362-
&result,
1362+
&result.image,
13631363
0.99,
13641364
);
1365+
for gltf_file in result.gltf {
1366+
let path = format!(
1367+
"tests/outputs/models/serial_test_example_fn_{}{i}_{}",
1368+
qualname.replace("::", "-"),
1369+
gltf_file.name,
1370+
);
1371+
let mut f = std::fs::File::create(path).expect("could not create file");
1372+
std::io::Write::write_all(&mut f, &gltf_file.contents).expect("could not write to file");
1373+
}
13651374
return;
13661375
}
13671376

rust/kcl-lib/src/execution/geometry.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ pub(crate) enum GetTangentialInfoFromPathsResult {
742742
Ellipse {
743743
center: [f64; 2],
744744
ccw: bool,
745-
major_radius: f64,
745+
major_axis: [f64; 2],
746746
_minor_radius: f64,
747747
},
748748
}
@@ -761,10 +761,10 @@ impl GetTangentialInfoFromPathsResult {
761761
} => [center[0] + radius, center[1] + if *ccw { -1.0 } else { 1.0 }],
762762
GetTangentialInfoFromPathsResult::Ellipse {
763763
center,
764-
major_radius,
764+
major_axis,
765765
ccw,
766766
..
767-
} => [center[0] + major_radius, center[1] + if *ccw { -1.0 } else { 1.0 }],
767+
} => [center[0] + major_axis[0], center[1] + if *ccw { -1.0 } else { 1.0 }],
768768
}
769769
}
770770
}
@@ -1272,7 +1272,7 @@ pub enum Path {
12721272
#[serde(flatten)]
12731273
base: BasePath,
12741274
center: [f64; 2],
1275-
major_radius: f64,
1275+
major_axis: [f64; 2],
12761276
minor_radius: f64,
12771277
ccw: bool,
12781278
},
@@ -1524,13 +1524,13 @@ impl Path {
15241524
// TODO: (bc) fix me
15251525
Path::Ellipse {
15261526
center,
1527-
major_radius,
1527+
major_axis,
15281528
minor_radius,
15291529
ccw,
15301530
..
15311531
} => GetTangentialInfoFromPathsResult::Ellipse {
15321532
center: *center,
1533-
major_radius: *major_radius,
1533+
major_axis: *major_axis,
15341534
_minor_radius: *minor_radius,
15351535
ccw: *ccw,
15361536
},

rust/kcl-lib/src/parsing/ast/types/mod.rs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,26 @@ impl Name {
23962396
}
23972397
}
23982398

2399+
impl Name {
2400+
/// Write the full name to the given string.
2401+
pub fn write_to<W: std::fmt::Write>(&self, buf: &mut W) -> std::fmt::Result {
2402+
if self.abs_path {
2403+
buf.write_str("::")?;
2404+
};
2405+
for p in &self.path {
2406+
buf.write_str(&p.name)?;
2407+
buf.write_str("::")?;
2408+
}
2409+
buf.write_str(&self.name.name)
2410+
}
2411+
}
2412+
2413+
impl fmt::Display for Name {
2414+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2415+
self.write_to(f)
2416+
}
2417+
}
2418+
23992419
impl From<Node<Identifier>> for Node<Name> {
24002420
fn from(value: Node<Identifier>) -> Self {
24012421
let start = value.start;
@@ -2416,19 +2436,6 @@ impl From<Node<Identifier>> for Node<Name> {
24162436
}
24172437
}
24182438

2419-
impl fmt::Display for Name {
2420-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2421-
if self.abs_path {
2422-
f.write_str("::")?;
2423-
}
2424-
for p in &self.path {
2425-
f.write_str(&p.name)?;
2426-
f.write_str("::")?;
2427-
}
2428-
f.write_str(&self.name.name)
2429-
}
2430-
}
2431-
24322439
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, Eq)]
24332440
#[ts(export)]
24342441
#[serde(tag = "type")]

0 commit comments

Comments
 (0)