diff --git a/rust/kcl-lib/src/std/fillet.rs b/rust/kcl-lib/src/std/fillet.rs index 6f9afee10..33424a055 100644 --- a/rust/kcl-lib/src/std/fillet.rs +++ b/rust/kcl-lib/src/std/fillet.rs @@ -165,7 +165,7 @@ async fn inner_fillet( edge_id, object_id: solid.id, radius: LengthUnit(radius), - tolerance: LengthUnit(tolerance.unwrap_or(default_tolerance(&args.ctx.settings.units))), + tolerance: LengthUnit(tolerance.unwrap_or_else(|| default_tolerance(&exec_state.length_unit().into()))), cut_type: CutType::Fillet, // We make this a none so that we can remove it in the future. face_id: None, diff --git a/rust/kcl-lib/src/std/loft.rs b/rust/kcl-lib/src/std/loft.rs index 490596441..22747bcc9 100644 --- a/rust/kcl-lib/src/std/loft.rs +++ b/rust/kcl-lib/src/std/loft.rs @@ -166,7 +166,7 @@ async fn inner_loft( section_ids: sketches.iter().map(|group| group.id).collect(), base_curve_index, bez_approximate_rational, - tolerance: LengthUnit(tolerance.unwrap_or(default_tolerance(&args.ctx.settings.units))), + tolerance: LengthUnit(tolerance.unwrap_or_else(|| default_tolerance(&exec_state.length_unit().into()))), v_degree, }), ) diff --git a/rust/kcl-lib/src/std/revolve.rs b/rust/kcl-lib/src/std/revolve.rs index 3e788b5e4..ded6740a9 100644 --- a/rust/kcl-lib/src/std/revolve.rs +++ b/rust/kcl-lib/src/std/revolve.rs @@ -280,7 +280,9 @@ async fn inner_revolve( target: sketch.id.into(), axis, origin, - tolerance: LengthUnit(tolerance.unwrap_or(default_tolerance(&args.ctx.settings.units))), + tolerance: LengthUnit( + tolerance.unwrap_or_else(|| default_tolerance(&exec_state.length_unit().into())), + ), axis_is_2d: true, }), ) @@ -294,7 +296,9 @@ async fn inner_revolve( angle, target: sketch.id.into(), edge_id, - tolerance: LengthUnit(tolerance.unwrap_or(default_tolerance(&args.ctx.settings.units))), + tolerance: LengthUnit( + tolerance.unwrap_or_else(|| default_tolerance(&exec_state.length_unit().into())), + ), }), ) .await?; diff --git a/rust/kcl-lib/src/std/sweep.rs b/rust/kcl-lib/src/std/sweep.rs index 68df798e1..5921b4666 100644 --- a/rust/kcl-lib/src/std/sweep.rs +++ b/rust/kcl-lib/src/std/sweep.rs @@ -180,7 +180,7 @@ async fn inner_sweep( target: sketch.id.into(), trajectory, sectional: sectional.unwrap_or(false), - tolerance: LengthUnit(tolerance.unwrap_or(default_tolerance(&args.ctx.settings.units))), + tolerance: LengthUnit(tolerance.unwrap_or_else(|| default_tolerance(&exec_state.length_unit().into()))), }), ) .await?;