Turn on units of measure (BREAKING CHANGE) (#6343)

* Turn on uom checks

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* Convert all lengths to mm for engine calls

Signed-off-by: Nick Cameron <nrc@ncameron.org>

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-04-23 10:58:35 +12:00
committed by GitHub
parent 3d22f6cd66
commit b7385d5f25
339 changed files with 35471 additions and 17237 deletions

View File

@ -40,9 +40,9 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
let result = inner_extrude(
sketches,
length.n,
length,
symmetric,
bidirectional_length.map(|t| t.n),
bidirectional_length,
tag_start,
tag_end,
exec_state,
@ -164,9 +164,9 @@ pub async fn extrude(exec_state: &mut ExecState, args: Args) -> Result<KclValue,
#[allow(clippy::too_many_arguments)]
async fn inner_extrude(
sketches: Vec<Sketch>,
length: f64,
length: TyF64,
symmetric: Option<bool>,
bidirectional_length: Option<f64>,
bidirectional_length: Option<TyF64>,
tag_start: Option<TagNode>,
tag_end: Option<TagNode>,
exec_state: &mut ExecState,
@ -183,7 +183,7 @@ async fn inner_extrude(
}));
}
let bidirection = bidirectional_length.map(LengthUnit);
let bidirection = bidirectional_length.map(|l| LengthUnit(l.to_mm()));
let opposite = match (symmetric, bidirection) {
(Some(true), _) => Opposite::Symmetric,
@ -201,7 +201,7 @@ async fn inner_extrude(
cmd_id: id.into(),
cmd: ModelingCmd::from(mcmd::Extrude {
target: sketch.id.into(),
distance: LengthUnit(length),
distance: LengthUnit(length.to_mm()),
faces: Default::default(),
opposite: opposite.clone(),
}),
@ -213,7 +213,7 @@ async fn inner_extrude(
do_post_extrude(
sketch,
id.into(),
length,
length.clone(),
false,
&NamedCapTags {
start: tag_start.as_ref(),
@ -238,7 +238,7 @@ pub(crate) struct NamedCapTags<'a> {
pub(crate) async fn do_post_extrude<'a>(
sketch: &Sketch,
solid_id: ArtifactId,
length: f64,
length: TyF64,
sectional: bool,
named_cap_tags: &'a NamedCapTags<'a>,
exec_state: &mut ExecState,
@ -470,8 +470,8 @@ pub(crate) async fn do_post_extrude<'a>(
value: new_value,
meta: sketch.meta.clone(),
units: sketch.units,
height: length.to_length_units(sketch.units),
sketch,
height: length,
start_cap_id,
end_cap_id,
edge_cuts: vec![],