More types stuff (#5901)
* parse union and fancy array types Signed-off-by: Nick Cameron <nrc@ncameron.org> * type aliases Signed-off-by: Nick Cameron <nrc@ncameron.org> * Treat Helix and Face as primitive types Signed-off-by: Nick Cameron <nrc@ncameron.org> * code motion: factor our execution::types module Signed-off-by: Nick Cameron <nrc@ncameron.org> * Tests for type coercion and subtyping Signed-off-by: Nick Cameron <nrc@ncameron.org> * Add Point2D/3D to std Signed-off-by: Nick Cameron <nrc@ncameron.org> * Rebasing and fixes Signed-off-by: Nick Cameron <nrc@ncameron.org> --------- Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -12,10 +12,7 @@ use validator::Validate;
|
||||
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
execution::{
|
||||
kcl_value::{ArrayLen, RuntimeType},
|
||||
ExecState, KclValue, PrimitiveType, Solid,
|
||||
},
|
||||
execution::{types::RuntimeType, ExecState, KclValue, Solid},
|
||||
std::Args,
|
||||
};
|
||||
|
||||
@ -42,11 +39,7 @@ struct AppearanceData {
|
||||
|
||||
/// Set the appearance of a solid. This only works on solids, not sketches or individual paths.
|
||||
pub async fn appearance(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||
let solids = args.get_unlabeled_kw_arg_typed(
|
||||
"solids",
|
||||
&RuntimeType::Array(PrimitiveType::Solid, ArrayLen::NonEmpty),
|
||||
exec_state,
|
||||
)?;
|
||||
let solids = args.get_unlabeled_kw_arg_typed("solids", &RuntimeType::solids(), exec_state)?;
|
||||
|
||||
let color: String = args.get_kw_arg("color")?;
|
||||
let metalness: Option<f64> = args.get_kw_arg_opt("metalness")?;
|
||||
|
Reference in New Issue
Block a user