Refactoring: use typed versions of args getters (#7262)
* Replace uses of get_unlabeled_kw_arg with _typed version Signed-off-by: Nick Cameron <nrc@ncameron.org> * Remove more untyped arg getters Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -24,14 +24,17 @@ const DEFAULT_V_DEGREE: u32 = 2;
|
||||
pub async fn loft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let sketches = args.get_unlabeled_kw_arg_typed("sketches", &RuntimeType::sketches(), exec_state)?;
|
||||
let v_degree: NonZeroU32 = args
|
||||
.get_kw_arg_opt("vDegree")?
|
||||
.get_kw_arg_opt_typed("vDegree", &RuntimeType::count(), exec_state)?
|
||||
.unwrap_or(NonZeroU32::new(DEFAULT_V_DEGREE).unwrap());
|
||||
// Attempt to approximate rational curves (such as arcs) using a bezier.
|
||||
// This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios
|
||||
// Over time, this field won't be necessary.
|
||||
let bez_approximate_rational = args.get_kw_arg_opt("bezApproximateRational")?.unwrap_or(false);
|
||||
let bez_approximate_rational = args
|
||||
.get_kw_arg_opt_typed("bezApproximateRational", &RuntimeType::bool(), exec_state)?
|
||||
.unwrap_or(false);
|
||||
// This can be set to override the automatically determined topological base curve, which is usually the first section encountered.
|
||||
let base_curve_index: Option<u32> = args.get_kw_arg_opt("baseCurveIndex")?;
|
||||
let base_curve_index: Option<u32> =
|
||||
args.get_kw_arg_opt_typed("baseCurveIndex", &RuntimeType::count(), exec_state)?;
|
||||
// Tolerance for the loft operation.
|
||||
let tolerance: Option<TyF64> = args.get_kw_arg_opt_typed("tolerance", &RuntimeType::length(), exec_state)?;
|
||||
let tag_start = args.get_kw_arg_opt("tagStart")?;
|
||||
|
Reference in New Issue
Block a user