BREAKING: Change polygon to keyword args (#6385)

* Change polygon to keyword args

* Update docs

* Update generated output

* Update docs to mention the default for inscribed

* Appease clippy

* Remove tag parameter

* Update docs since removing tag

* Remove inscribed from autocomplete snippet since the default is true
This commit is contained in:
Jonathan Tran
2025-04-21 14:29:32 -04:00
committed by GitHub
parent 7a90d029e1
commit f8ca6ad746
17 changed files with 5386 additions and 698 deletions

View File

@ -775,19 +775,6 @@ impl Args {
source_ranges: vec![self.source_range],
}))
}
pub(crate) fn get_polygon_args(
&self,
) -> Result<
(
crate::std::shapes::PolygonData,
crate::std::shapes::SketchOrSurface,
Option<TagNode>,
),
KclError,
> {
FromArgs::from_args(self, 0)
}
}
/// Types which impl this trait can be read out of the `Args` passed into a KCL function.
@ -963,28 +950,6 @@ macro_rules! let_field_of {
};
}
impl<'a> FromKclValue<'a> for super::shapes::PolygonData {
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
let obj = arg.as_object()?;
let_field_of!(obj, radius);
let_field_of!(obj, num_sides "numSides");
let_field_of!(obj, center);
let_field_of!(obj, inscribed);
let polygon_type = if inscribed {
PolygonType::Inscribed
} else {
PolygonType::Circumscribed
};
Some(Self {
radius,
num_sides,
center,
polygon_type,
inscribed,
})
}
}
impl<'a> FromKclValue<'a> for crate::execution::Plane {
fn from_kcl_val(arg: &'a KclValue) -> Option<Self> {
arg.as_plane().cloned()