More propagation of numeric types (#6177)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -111321,7 +111321,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
@ -113005,7 +113005,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
@ -258515,14 +258515,19 @@
|
|||||||
"type": "[number]",
|
"type": "[number]",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "Array_size_2_of_double",
|
"title": "Array_size_2_of_TyF64",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "number",
|
"$ref": "#/components/schemas/TyF64"
|
||||||
"format": "double"
|
|
||||||
},
|
},
|
||||||
"maxItems": 2,
|
"maxItems": 2,
|
||||||
"minItems": 2
|
"minItems": 2,
|
||||||
|
"definitions": {
|
||||||
|
"TyF64": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"required": true,
|
"required": true,
|
||||||
"includeInSnippet": true,
|
"includeInSnippet": true,
|
||||||
@ -258568,7 +258573,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
@ -258616,7 +258621,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
@ -258664,7 +258669,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
@ -258712,14 +258717,19 @@
|
|||||||
"type": "[number]",
|
"type": "[number]",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "Array_size_2_of_double",
|
"title": "Array_size_2_of_TyF64",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "number",
|
"$ref": "#/components/schemas/TyF64"
|
||||||
"format": "double"
|
|
||||||
},
|
},
|
||||||
"maxItems": 2,
|
"maxItems": 2,
|
||||||
"minItems": 2
|
"minItems": 2,
|
||||||
|
"definitions": {
|
||||||
|
"TyF64": {
|
||||||
|
"type": "number",
|
||||||
|
"format": "double"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"required": true,
|
"required": true,
|
||||||
"includeInSnippet": true,
|
"includeInSnippet": true,
|
||||||
@ -258765,7 +258775,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
@ -258813,7 +258823,7 @@
|
|||||||
"type": "number",
|
"type": "number",
|
||||||
"schema": {
|
"schema": {
|
||||||
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
|
||||||
"title": "double",
|
"title": "TyF64",
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"format": "double"
|
"format": "double"
|
||||||
},
|
},
|
||||||
|
@ -97,11 +97,11 @@ keyWay = startSketchOn(body, 'END')
|
|||||||
|> xLine(length = -keywayDepth)
|
|> xLine(length = -keywayDepth)
|
||||||
|> arc({
|
|> arc({
|
||||||
angleEnd = 180,
|
angleEnd = 180,
|
||||||
angleStart = -1 * 180 / PI * startAngle + 360,
|
angleStart = -1 * toDegrees(startAngle) + 360,
|
||||||
radius = holeRadius
|
radius = holeRadius
|
||||||
}, %)
|
}, %)
|
||||||
|> arc({
|
|> arc({
|
||||||
angleEnd = 180 / PI * startAngle,
|
angleEnd = toDegrees(startAngle),
|
||||||
angleStart = 180,
|
angleStart = 180,
|
||||||
radius = holeRadius
|
radius = holeRadius
|
||||||
}, %)
|
}, %)
|
||||||
|
@ -764,14 +764,14 @@ fn rust_type_to_openapi_type(t: &str) -> String {
|
|||||||
t = format!("[{inner_type}]")
|
t = format!("[{inner_type}]")
|
||||||
}
|
}
|
||||||
|
|
||||||
if t == "f64" {
|
if t == "f64" || t == "TyF64" {
|
||||||
return "number".to_string();
|
return "number".to_string();
|
||||||
} else if t == "u32" {
|
} else if t == "u32" {
|
||||||
return "integer".to_string();
|
return "integer".to_string();
|
||||||
} else if t == "str" {
|
} else if t == "str" {
|
||||||
return "string".to_string();
|
return "string".to_string();
|
||||||
} else {
|
} else {
|
||||||
return t.replace("f64", "number").to_string();
|
return t.replace("f64", "number").replace("TyF64", "number").to_string();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ fn add_to_types(
|
|||||||
return Err(anyhow::anyhow!("Empty type name"));
|
return Err(anyhow::anyhow!("Empty type name"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if DECLARED_TYPES.contains(&name) {
|
if DECLARED_TYPES.contains(&name) || name == "TyF64" {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -769,7 +769,7 @@ fn generate_type(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip over TagDeclarator and TagIdentifier since they have custom docs.
|
// Skip over TagDeclarator and TagIdentifier since they have custom docs.
|
||||||
if name == "TagDeclarator" || name == "TagIdentifier" || name == "TagNode" {
|
if name == "TagDeclarator" || name == "TagIdentifier" || name == "TagNode" || name == "TyF64" {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -930,7 +930,7 @@ fn recurse_and_create_references(
|
|||||||
schema: &schemars::schema::Schema,
|
schema: &schemars::schema::Schema,
|
||||||
types: &BTreeMap<String, schemars::schema::Schema>,
|
types: &BTreeMap<String, schemars::schema::Schema>,
|
||||||
) -> Result<schemars::schema::Schema> {
|
) -> Result<schemars::schema::Schema> {
|
||||||
if DECLARED_TYPES.contains(&name) {
|
if DECLARED_TYPES.contains(&name) || name == "TyF64" {
|
||||||
return Ok(schema.clone());
|
return Ok(schema.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,7 +944,7 @@ fn recurse_and_create_references(
|
|||||||
if let Some(reference) = &o.reference {
|
if let Some(reference) = &o.reference {
|
||||||
let mut obj = o.clone();
|
let mut obj = o.clone();
|
||||||
let reference = reference.trim_start_matches("#/components/schemas/");
|
let reference = reference.trim_start_matches("#/components/schemas/");
|
||||||
if DECLARED_TYPES.contains(&reference) {
|
if DECLARED_TYPES.contains(&reference) || reference == "TyF64" {
|
||||||
return Ok(schema.clone());
|
return Ok(schema.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,16 +10,16 @@ use serde::{Deserialize, Serialize};
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::KclError,
|
errors::KclError,
|
||||||
execution::{ArtifactId, ExecState, Metadata, TagEngineInfo, TagIdentifier, UnitLen},
|
execution::{types::NumericType, ArtifactId, ExecState, Metadata, TagEngineInfo, TagIdentifier, UnitLen},
|
||||||
parsing::ast::types::{Node, NodeRef, TagDeclarator, TagNode},
|
parsing::ast::types::{Node, NodeRef, TagDeclarator, TagNode},
|
||||||
std::sketch::PlaneData,
|
std::{args::TyF64, sketch::PlaneData},
|
||||||
};
|
};
|
||||||
|
|
||||||
type Point2D = kcmc::shared::Point2d<f64>;
|
type Point2D = kcmc::shared::Point2d<f64>;
|
||||||
type Point3D = kcmc::shared::Point3d<f64>;
|
type Point3D = kcmc::shared::Point3d<f64>;
|
||||||
|
|
||||||
/// A geometry.
|
/// A geometry.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum Geometry {
|
pub enum Geometry {
|
||||||
@ -47,7 +47,7 @@ impl Geometry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A set of geometry.
|
/// A set of geometry.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
#[allow(clippy::vec_box)]
|
#[allow(clippy::vec_box)]
|
||||||
@ -66,7 +66,7 @@ impl From<Geometry> for Geometries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Data for an imported geometry.
|
/// Data for an imported geometry.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ImportedGeometry {
|
pub struct ImportedGeometry {
|
||||||
@ -79,7 +79,7 @@ pub struct ImportedGeometry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Data for a solid or an imported geometry.
|
/// Data for a solid or an imported geometry.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
#[allow(clippy::vec_box)]
|
#[allow(clippy::vec_box)]
|
||||||
@ -159,7 +159,7 @@ pub struct Helix {
|
|||||||
pub meta: Vec<Metadata>,
|
pub meta: Vec<Metadata>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Plane {
|
pub struct Plane {
|
||||||
@ -353,7 +353,7 @@ impl Plane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A face.
|
/// A face.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct Face {
|
pub struct Face {
|
||||||
@ -377,7 +377,7 @@ pub struct Face {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Type for a plane.
|
/// Type for a plane.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema, FromStr, Display)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema, FromStr, Display)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[display(style = "camelCase")]
|
#[display(style = "camelCase")]
|
||||||
pub enum PlaneType {
|
pub enum PlaneType {
|
||||||
@ -398,7 +398,7 @@ pub enum PlaneType {
|
|||||||
Uninit,
|
Uninit,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
pub struct Sketch {
|
pub struct Sketch {
|
||||||
@ -463,7 +463,7 @@ impl Sketch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A sketch type.
|
/// A sketch type.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
pub enum SketchSurface {
|
pub enum SketchSurface {
|
||||||
@ -582,7 +582,7 @@ impl Sketch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
pub struct Solid {
|
pub struct Solid {
|
||||||
@ -616,7 +616,7 @@ impl Solid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A fillet or a chamfer.
|
/// A fillet or a chamfer.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
pub enum EdgeCut {
|
pub enum EdgeCut {
|
||||||
@ -678,6 +678,12 @@ impl From<[f64; 2]> for Point2d {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<[TyF64; 2]> for Point2d {
|
||||||
|
fn from(p: [TyF64; 2]) -> Self {
|
||||||
|
Self { x: p[0].n, y: p[1].n }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl From<&[f64; 2]> for Point2d {
|
impl From<&[f64; 2]> for Point2d {
|
||||||
fn from(p: &[f64; 2]) -> Self {
|
fn from(p: &[f64; 2]) -> Self {
|
||||||
Self { x: p[0], y: p[1] }
|
Self { x: p[0], y: p[1] }
|
||||||
@ -767,7 +773,7 @@ impl Mul<f64> for Point3d {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A base path.
|
/// A base path.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct BasePath {
|
pub struct BasePath {
|
||||||
@ -786,7 +792,7 @@ pub struct BasePath {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Geometry metadata.
|
/// Geometry metadata.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct GeoMeta {
|
pub struct GeoMeta {
|
||||||
@ -798,7 +804,7 @@ pub struct GeoMeta {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// A path.
|
/// A path.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type")]
|
#[serde(tag = "type")]
|
||||||
pub enum Path {
|
pub enum Path {
|
||||||
@ -979,19 +985,23 @@ impl Path {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Where does this path segment start?
|
/// Where does this path segment start?
|
||||||
pub fn get_from(&self) -> &[f64; 2] {
|
pub fn get_from(&self) -> [TyF64; 2] {
|
||||||
&self.get_base().from
|
let p = &self.get_base().from;
|
||||||
|
let ty: NumericType = self.get_base().units.into();
|
||||||
|
[TyF64::new(p[0], ty.clone()), TyF64::new(p[1], ty)]
|
||||||
}
|
}
|
||||||
/// Where does this path segment end?
|
/// Where does this path segment end?
|
||||||
pub fn get_to(&self) -> &[f64; 2] {
|
pub fn get_to(&self) -> [TyF64; 2] {
|
||||||
&self.get_base().to
|
let p = &self.get_base().to;
|
||||||
|
let ty: NumericType = self.get_base().units.into();
|
||||||
|
[TyF64::new(p[0], ty.clone()), TyF64::new(p[1], ty)]
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Length of this path segment, in cartesian plane.
|
/// Length of this path segment, in cartesian plane.
|
||||||
pub fn length(&self) -> f64 {
|
pub fn length(&self) -> TyF64 {
|
||||||
match self {
|
let n = match self {
|
||||||
Self::ToPoint { .. } | Self::Base { .. } | Self::Horizontal { .. } | Self::AngledLineTo { .. } => {
|
Self::ToPoint { .. } | Self::Base { .. } | Self::Horizontal { .. } | Self::AngledLineTo { .. } => {
|
||||||
linear_distance(self.get_from(), self.get_to())
|
linear_distance(&self.get_base().from, &self.get_base().to)
|
||||||
}
|
}
|
||||||
Self::TangentialArc {
|
Self::TangentialArc {
|
||||||
base: _,
|
base: _,
|
||||||
@ -1005,10 +1015,10 @@ impl Path {
|
|||||||
} => {
|
} => {
|
||||||
// The radius can be calculated as the linear distance between `to` and `center`,
|
// The radius can be calculated as the linear distance between `to` and `center`,
|
||||||
// or between `from` and `center`. They should be the same.
|
// or between `from` and `center`. They should be the same.
|
||||||
let radius = linear_distance(self.get_from(), center);
|
let radius = linear_distance(&self.get_base().from, center);
|
||||||
debug_assert_eq!(radius, linear_distance(self.get_to(), center));
|
debug_assert_eq!(radius, linear_distance(&self.get_base().to, center));
|
||||||
// TODO: Call engine utils to figure this out.
|
// TODO: Call engine utils to figure this out.
|
||||||
linear_distance(self.get_from(), self.get_to())
|
linear_distance(&self.get_base().from, &self.get_base().to)
|
||||||
}
|
}
|
||||||
Self::Circle { radius, .. } => 2.0 * std::f64::consts::PI * radius,
|
Self::Circle { radius, .. } => 2.0 * std::f64::consts::PI * radius,
|
||||||
Self::CircleThreePoint { .. } => {
|
Self::CircleThreePoint { .. } => {
|
||||||
@ -1022,13 +1032,14 @@ impl Path {
|
|||||||
}
|
}
|
||||||
Self::Arc { .. } => {
|
Self::Arc { .. } => {
|
||||||
// TODO: Call engine utils to figure this out.
|
// TODO: Call engine utils to figure this out.
|
||||||
linear_distance(self.get_from(), self.get_to())
|
linear_distance(&self.get_base().from, &self.get_base().to)
|
||||||
}
|
}
|
||||||
Self::ArcThreePoint { .. } => {
|
Self::ArcThreePoint { .. } => {
|
||||||
// TODO: Call engine utils to figure this out.
|
// TODO: Call engine utils to figure this out.
|
||||||
linear_distance(self.get_from(), self.get_to())
|
linear_distance(&self.get_base().from, &self.get_base().to)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
TyF64::new(n, self.get_base().units.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_base_mut(&mut self) -> Option<&mut BasePath> {
|
pub fn get_base_mut(&mut self) -> Option<&mut BasePath> {
|
||||||
@ -1103,7 +1114,7 @@ fn linear_distance(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An extrude surface.
|
/// An extrude surface.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
pub enum ExtrudeSurface {
|
pub enum ExtrudeSurface {
|
||||||
@ -1115,7 +1126,7 @@ pub enum ExtrudeSurface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Chamfer surface.
|
// Chamfer surface.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ChamferSurface {
|
pub struct ChamferSurface {
|
||||||
@ -1129,7 +1140,7 @@ pub struct ChamferSurface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fillet surface.
|
// Fillet surface.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct FilletSurface {
|
pub struct FilletSurface {
|
||||||
@ -1143,7 +1154,7 @@ pub struct FilletSurface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An extruded plane.
|
/// An extruded plane.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ExtrudePlane {
|
pub struct ExtrudePlane {
|
||||||
@ -1157,7 +1168,7 @@ pub struct ExtrudePlane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// An extruded arc.
|
/// An extruded arc.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
pub struct ExtrudeArc {
|
pub struct ExtrudeArc {
|
||||||
|
@ -175,7 +175,7 @@ impl std::hash::Hash for TagIdentifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Engine information for a tag.
|
/// Engine information for a tag.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(tag = "type", rename_all = "camelCase")]
|
#[serde(tag = "type", rename_all = "camelCase")]
|
||||||
pub struct TagEngineInfo {
|
pub struct TagEngineInfo {
|
||||||
|
@ -22,6 +22,8 @@ use crate::{
|
|||||||
CompilationError,
|
CompilationError,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use super::types::NumericType;
|
||||||
|
|
||||||
/// State for executing a program.
|
/// State for executing a program.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct ExecState {
|
pub struct ExecState {
|
||||||
@ -228,6 +230,13 @@ impl ExecState {
|
|||||||
self.global.module_infos.insert(id, module_info);
|
self.global.module_infos.insert(id, module_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn current_default_units(&self) -> NumericType {
|
||||||
|
NumericType::Default {
|
||||||
|
len: self.length_unit(),
|
||||||
|
angle: self.angle_unit(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn length_unit(&self) -> UnitLen {
|
pub fn length_unit(&self) -> UnitLen {
|
||||||
self.mod_local.settings.default_length_units
|
self.mod_local.settings.default_length_units
|
||||||
}
|
}
|
||||||
|
@ -371,14 +371,22 @@ impl Default for NumericType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl NumericType {
|
impl NumericType {
|
||||||
pub fn count() -> Self {
|
pub const fn count() -> Self {
|
||||||
NumericType::Known(UnitType::Count)
|
NumericType::Known(UnitType::Count)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mm() -> Self {
|
pub const fn mm() -> Self {
|
||||||
NumericType::Known(UnitType::Length(UnitLen::Mm))
|
NumericType::Known(UnitType::Length(UnitLen::Mm))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const fn radians() -> Self {
|
||||||
|
NumericType::Known(UnitType::Angle(UnitAngle::Radians))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const fn degrees() -> Self {
|
||||||
|
NumericType::Known(UnitType::Angle(UnitAngle::Degrees))
|
||||||
|
}
|
||||||
|
|
||||||
/// Combine two types when we expect them to be equal.
|
/// Combine two types when we expect them to be equal.
|
||||||
pub fn combine_eq(a: TyF64, b: TyF64) -> (f64, f64, NumericType) {
|
pub fn combine_eq(a: TyF64, b: TyF64) -> (f64, f64, NumericType) {
|
||||||
use NumericType::*;
|
use NumericType::*;
|
||||||
|
@ -503,19 +503,19 @@ impl Args {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn make_user_val_from_point(&self, p: [f64; 2]) -> Result<KclValue, KclError> {
|
pub(crate) fn make_user_val_from_point(&self, p: [TyF64; 2]) -> Result<KclValue, KclError> {
|
||||||
let meta = Metadata {
|
let meta = Metadata {
|
||||||
source_range: self.source_range,
|
source_range: self.source_range,
|
||||||
};
|
};
|
||||||
let x = KclValue::Number {
|
let x = KclValue::Number {
|
||||||
value: p[0],
|
value: p[0].n,
|
||||||
meta: vec![meta],
|
meta: vec![meta],
|
||||||
ty: NumericType::Unknown,
|
ty: p[0].ty.clone(),
|
||||||
};
|
};
|
||||||
let y = KclValue::Number {
|
let y = KclValue::Number {
|
||||||
value: p[1],
|
value: p[1].n,
|
||||||
meta: vec![meta],
|
meta: vec![meta],
|
||||||
ty: NumericType::Unknown,
|
ty: p[1].ty.clone(),
|
||||||
};
|
};
|
||||||
Ok(KclValue::MixedArray {
|
Ok(KclValue::MixedArray {
|
||||||
value: vec![x, y],
|
value: vec![x, y],
|
||||||
@ -696,10 +696,9 @@ impl Args {
|
|||||||
FromArgs::from_args(self, 0)
|
FromArgs::from_args(self, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_data_and_optional_tag<'a, T>(&'a self) -> Result<(T, Option<FaceTag>), KclError>
|
pub(crate) fn get_sketch_data_and_optional_tag(
|
||||||
where
|
&self,
|
||||||
T: serde::de::DeserializeOwned + FromKclValue<'a> + Sized,
|
) -> Result<(super::sketch::SketchData, Option<FaceTag>), KclError> {
|
||||||
{
|
|
||||||
FromArgs::from_args(self, 0)
|
FromArgs::from_args(self, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use kcl_derive_docs::stdlib;
|
|||||||
use super::args::FromArgs;
|
use super::args::FromArgs;
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
execution::{ExecState, KclValue},
|
execution::{types::NumericType, ExecState, KclValue},
|
||||||
std::args::{Args, TyF64},
|
std::args::{Args, TyF64},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ pub async fn tan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
|||||||
pub async fn pi(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn pi(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_pi()?;
|
let result = inner_pi()?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::count(result)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the value of `pi`. Archimedes’ constant (π).
|
/// Return the value of `pi`. Archimedes’ constant (π).
|
||||||
@ -96,7 +96,7 @@ pub async fn sqrt(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_sqrt(num)?;
|
let result = inner_sqrt(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::Unknown)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the square root of a number.
|
/// Compute the square root of a number.
|
||||||
@ -123,10 +123,10 @@ fn inner_sqrt(num: f64) -> Result<f64, KclError> {
|
|||||||
|
|
||||||
/// Compute the absolute value of a number.
|
/// Compute the absolute value of a number.
|
||||||
pub async fn abs(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn abs(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number_with_type()?;
|
||||||
let result = inner_abs(num)?;
|
let result = inner_abs(num.n)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(num.map_value(result)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the absolute value of a number.
|
/// Compute the absolute value of a number.
|
||||||
@ -160,10 +160,10 @@ fn inner_abs(num: f64) -> Result<f64, KclError> {
|
|||||||
|
|
||||||
/// Round a number to the nearest integer.
|
/// Round a number to the nearest integer.
|
||||||
pub async fn round(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn round(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number_with_type()?;
|
||||||
let result = inner_round(num)?;
|
let result = inner_round(num.n)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(num.map_value(result)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Round a number to the nearest integer.
|
/// Round a number to the nearest integer.
|
||||||
@ -188,10 +188,10 @@ fn inner_round(num: f64) -> Result<f64, KclError> {
|
|||||||
|
|
||||||
/// Compute the largest integer less than or equal to a number.
|
/// Compute the largest integer less than or equal to a number.
|
||||||
pub async fn floor(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn floor(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number_with_type()?;
|
||||||
let result = inner_floor(num)?;
|
let result = inner_floor(num.n)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(num.map_value(result)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the largest integer less than or equal to a number.
|
/// Compute the largest integer less than or equal to a number.
|
||||||
@ -216,10 +216,10 @@ fn inner_floor(num: f64) -> Result<f64, KclError> {
|
|||||||
|
|
||||||
/// Compute the smallest integer greater than or equal to a number.
|
/// Compute the smallest integer greater than or equal to a number.
|
||||||
pub async fn ceil(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn ceil(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let num = args.get_number()?;
|
let num = args.get_number_with_type()?;
|
||||||
let result = inner_ceil(num)?;
|
let result = inner_ceil(num.n)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(num.map_value(result)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the smallest integer greater than or equal to a number.
|
/// Compute the smallest integer greater than or equal to a number.
|
||||||
@ -335,7 +335,7 @@ pub async fn pow(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
|||||||
|
|
||||||
let result = inner_pow(nums[0], nums[1])?;
|
let result = inner_pow(nums[0], nums[1])?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::Unknown)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the number to a power.
|
/// Compute the number to a power.
|
||||||
@ -365,7 +365,7 @@ pub async fn acos(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_acos(num)?;
|
let result = inner_acos(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::radians())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the arccosine of a number (in radians).
|
/// Compute the arccosine of a number (in radians).
|
||||||
@ -396,7 +396,7 @@ pub async fn asin(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_asin(num)?;
|
let result = inner_asin(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::radians())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the arcsine of a number (in radians).
|
/// Compute the arcsine of a number (in radians).
|
||||||
@ -426,7 +426,7 @@ pub async fn atan(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_atan(num)?;
|
let result = inner_atan(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::radians())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the arctangent of a number (in radians).
|
/// Compute the arctangent of a number (in radians).
|
||||||
@ -456,7 +456,7 @@ pub async fn atan2(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
let (y, x) = FromArgs::from_args(&args, 0)?;
|
let (y, x) = FromArgs::from_args(&args, 0)?;
|
||||||
let result = inner_atan2(y, x)?;
|
let result = inner_atan2(y, x)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::radians())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the four quadrant arctangent of Y and X (in radians).
|
/// Compute the four quadrant arctangent of Y and X (in radians).
|
||||||
@ -503,7 +503,7 @@ pub async fn log(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kc
|
|||||||
}
|
}
|
||||||
let result = inner_log(nums[0], nums[1])?;
|
let result = inner_log(nums[0], nums[1])?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::Unknown)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the logarithm of the number with respect to an arbitrary base.
|
/// Compute the logarithm of the number with respect to an arbitrary base.
|
||||||
@ -535,7 +535,7 @@ pub async fn log2(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, K
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_log2(num)?;
|
let result = inner_log2(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::Unknown)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the base 2 logarithm of the number.
|
/// Compute the base 2 logarithm of the number.
|
||||||
@ -563,7 +563,7 @@ pub async fn log10(_exec_state: &mut ExecState, args: Args) -> Result<KclValue,
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_log10(num)?;
|
let result = inner_log10(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::Unknown)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the base 10 logarithm of the number.
|
/// Compute the base 10 logarithm of the number.
|
||||||
@ -591,7 +591,7 @@ pub async fn ln(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, Kcl
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_ln(num)?;
|
let result = inner_ln(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::Unknown)))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the natural logarithm of the number.
|
/// Compute the natural logarithm of the number.
|
||||||
@ -618,7 +618,7 @@ fn inner_ln(num: f64) -> Result<f64, KclError> {
|
|||||||
pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn e(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_e()?;
|
let result = inner_e()?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::count())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the value of Euler’s number `e`.
|
/// Return the value of Euler’s number `e`.
|
||||||
@ -650,7 +650,7 @@ fn inner_e() -> Result<f64, KclError> {
|
|||||||
pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn tau(_exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_tau()?;
|
let result = inner_tau()?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::count())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
/// Return the value of `tau`. The full circle constant (τ). Equal to 2π.
|
||||||
@ -683,7 +683,7 @@ pub async fn to_radians(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_to_radians(num)?;
|
let result = inner_to_radians(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::radians())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts a number from degrees to radians.
|
/// Converts a number from degrees to radians.
|
||||||
@ -713,7 +713,7 @@ pub async fn to_degrees(_exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
|||||||
let num = args.get_number()?;
|
let num = args.get_number()?;
|
||||||
let result = inner_to_degrees(num)?;
|
let result = inner_to_degrees(num)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::degrees())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts a number from radians to degrees.
|
/// Converts a number from radians to degrees.
|
||||||
|
@ -7,10 +7,10 @@ use kittycad_modeling_cmds::shared::Angle;
|
|||||||
use crate::{
|
use crate::{
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
execution::{
|
execution::{
|
||||||
types::{PrimitiveType, RuntimeType},
|
types::{NumericType, PrimitiveType, RuntimeType},
|
||||||
ExecState, KclValue, Point2d, Sketch, TagIdentifier,
|
ExecState, KclValue, Point2d, Sketch, TagIdentifier,
|
||||||
},
|
},
|
||||||
std::{utils::between, Args},
|
std::{args::TyF64, utils::between, Args},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Returns the point at the end of the given segment.
|
/// Returns the point at the end of the given segment.
|
||||||
@ -54,7 +54,7 @@ pub async fn segment_end(exec_state: &mut ExecState, args: Args) -> Result<KclVa
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[f64; 2], KclError> {
|
fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[TyF64; 2], KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -63,7 +63,7 @@ fn inner_segment_end(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(path.get_base().to)
|
Ok(path.get_to().clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the segment end of x.
|
/// Returns the segment end of x.
|
||||||
@ -71,7 +71,7 @@ pub async fn segment_end_x(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
let result = inner_segment_end_x(&tag, exec_state, args.clone())?;
|
let result = inner_segment_end_x(&tag, exec_state, args.clone())?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the ending point of the provided line segment along the 'x' axis.
|
/// Compute the ending point of the provided line segment along the 'x' axis.
|
||||||
@ -95,7 +95,7 @@ pub async fn segment_end_x(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_end_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
fn inner_segment_end_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<TyF64, KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -104,7 +104,7 @@ fn inner_segment_end_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(path.get_base().to[0])
|
Ok(TyF64::new(path.get_base().to[0], path.get_base().units.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the segment end of y.
|
/// Returns the segment end of y.
|
||||||
@ -112,7 +112,7 @@ pub async fn segment_end_y(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
let result = inner_segment_end_y(&tag, exec_state, args.clone())?;
|
let result = inner_segment_end_y(&tag, exec_state, args.clone())?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the ending point of the provided line segment along the 'y' axis.
|
/// Compute the ending point of the provided line segment along the 'y' axis.
|
||||||
@ -137,7 +137,7 @@ pub async fn segment_end_y(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_end_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
fn inner_segment_end_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<TyF64, KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -146,7 +146,7 @@ fn inner_segment_end_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Ar
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(path.get_to()[1])
|
Ok(path.get_to()[1].clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the point at the start of the given segment.
|
/// Returns the point at the start of the given segment.
|
||||||
@ -190,7 +190,7 @@ pub async fn segment_start(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[f64; 2], KclError> {
|
fn inner_segment_start(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<[TyF64; 2], KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -207,7 +207,7 @@ pub async fn segment_start_x(exec_state: &mut ExecState, args: Args) -> Result<K
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
let result = inner_segment_start_x(&tag, exec_state, args.clone())?;
|
let result = inner_segment_start_x(&tag, exec_state, args.clone())?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the starting point of the provided line segment along the 'x' axis.
|
/// Compute the starting point of the provided line segment along the 'x' axis.
|
||||||
@ -231,7 +231,7 @@ pub async fn segment_start_x(exec_state: &mut ExecState, args: Args) -> Result<K
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_start_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
fn inner_segment_start_x(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<TyF64, KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -240,7 +240,7 @@ fn inner_segment_start_x(tag: &TagIdentifier, exec_state: &mut ExecState, args:
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(path.get_from()[0])
|
Ok(path.get_from()[0].clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the segment start of y.
|
/// Returns the segment start of y.
|
||||||
@ -248,7 +248,7 @@ pub async fn segment_start_y(exec_state: &mut ExecState, args: Args) -> Result<K
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
let result = inner_segment_start_y(&tag, exec_state, args.clone())?;
|
let result = inner_segment_start_y(&tag, exec_state, args.clone())?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the starting point of the provided line segment along the 'y' axis.
|
/// Compute the starting point of the provided line segment along the 'y' axis.
|
||||||
@ -273,7 +273,7 @@ pub async fn segment_start_y(exec_state: &mut ExecState, args: Args) -> Result<K
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_start_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
fn inner_segment_start_y(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<TyF64, KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -282,7 +282,7 @@ fn inner_segment_start_y(tag: &TagIdentifier, exec_state: &mut ExecState, args:
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Ok(path.get_from()[1])
|
Ok(path.get_from()[1].clone())
|
||||||
}
|
}
|
||||||
/// Returns the last segment of x.
|
/// Returns the last segment of x.
|
||||||
pub async fn last_segment_x(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn last_segment_x(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
@ -290,7 +290,7 @@ pub async fn last_segment_x(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
|||||||
args.get_unlabeled_kw_arg_typed("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
args.get_unlabeled_kw_arg_typed("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||||
let result = inner_last_segment_x(sketch, args.clone())?;
|
let result = inner_last_segment_x(sketch, args.clone())?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the 'x' axis value of the last line segment in the provided 2-d
|
/// Extract the 'x' axis value of the last line segment in the provided 2-d
|
||||||
@ -315,7 +315,7 @@ pub async fn last_segment_x(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
|||||||
sketch = { docs = "The sketch whose line segment is being queried"},
|
sketch = { docs = "The sketch whose line segment is being queried"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_last_segment_x(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
fn inner_last_segment_x(sketch: Sketch, args: Args) -> Result<TyF64, KclError> {
|
||||||
let last_line = sketch
|
let last_line = sketch
|
||||||
.paths
|
.paths
|
||||||
.last()
|
.last()
|
||||||
@ -327,7 +327,7 @@ fn inner_last_segment_x(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
|||||||
})?
|
})?
|
||||||
.get_base();
|
.get_base();
|
||||||
|
|
||||||
Ok(last_line.to[0])
|
Ok(TyF64::new(last_line.to[0], last_line.units.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the last segment of y.
|
/// Returns the last segment of y.
|
||||||
@ -336,7 +336,7 @@ pub async fn last_segment_y(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
|||||||
args.get_unlabeled_kw_arg_typed("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
args.get_unlabeled_kw_arg_typed("sketch", &RuntimeType::Primitive(PrimitiveType::Sketch), exec_state)?;
|
||||||
let result = inner_last_segment_y(sketch, args.clone())?;
|
let result = inner_last_segment_y(sketch, args.clone())?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the 'y' axis value of the last line segment in the provided 2-d
|
/// Extract the 'y' axis value of the last line segment in the provided 2-d
|
||||||
@ -361,7 +361,7 @@ pub async fn last_segment_y(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
|||||||
sketch = { docs = "The sketch whose line segment is being queried"},
|
sketch = { docs = "The sketch whose line segment is being queried"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_last_segment_y(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
fn inner_last_segment_y(sketch: Sketch, args: Args) -> Result<TyF64, KclError> {
|
||||||
let last_line = sketch
|
let last_line = sketch
|
||||||
.paths
|
.paths
|
||||||
.last()
|
.last()
|
||||||
@ -373,14 +373,14 @@ fn inner_last_segment_y(sketch: Sketch, args: Args) -> Result<f64, KclError> {
|
|||||||
})?
|
})?
|
||||||
.get_base();
|
.get_base();
|
||||||
|
|
||||||
Ok(last_line.to[1])
|
Ok(TyF64::new(last_line.to[1], last_line.units.into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the length of the segment.
|
/// Returns the length of the segment.
|
||||||
pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
let result = inner_segment_length(&tag, exec_state, args.clone())?;
|
let result = inner_segment_length(&tag, exec_state, args.clone())?;
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(result))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the length of the provided line segment.
|
/// Compute the length of the provided line segment.
|
||||||
@ -412,7 +412,7 @@ pub async fn segment_length(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
|||||||
tag = { docs = "The line segment being queried by its tag"},
|
tag = { docs = "The line segment being queried by its tag"},
|
||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
fn inner_segment_length(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<f64, KclError> {
|
fn inner_segment_length(tag: &TagIdentifier, exec_state: &mut ExecState, args: Args) -> Result<TyF64, KclError> {
|
||||||
let line = args.get_tag_engine_info(exec_state, tag)?;
|
let line = args.get_tag_engine_info(exec_state, tag)?;
|
||||||
let path = line.path.clone().ok_or_else(|| {
|
let path = line.path.clone().ok_or_else(|| {
|
||||||
KclError::Type(KclErrorDetails {
|
KclError::Type(KclErrorDetails {
|
||||||
@ -421,9 +421,7 @@ fn inner_segment_length(tag: &TagIdentifier, exec_state: &mut ExecState, args: A
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let result = path.length();
|
Ok(path.length())
|
||||||
|
|
||||||
Ok(result)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the angle of the segment.
|
/// Returns the angle of the segment.
|
||||||
@ -431,7 +429,7 @@ pub async fn segment_angle(exec_state: &mut ExecState, args: Args) -> Result<Kcl
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
|
|
||||||
let result = inner_segment_angle(&tag, exec_state, args.clone())?;
|
let result = inner_segment_angle(&tag, exec_state, args.clone())?;
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::degrees())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the angle (in degrees) of the provided line segment.
|
/// Compute the angle (in degrees) of the provided line segment.
|
||||||
@ -476,7 +474,7 @@ pub async fn tangent_to_end(exec_state: &mut ExecState, args: Args) -> Result<Kc
|
|||||||
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
let tag: TagIdentifier = args.get_unlabeled_kw_arg("tag")?;
|
||||||
|
|
||||||
let result = inner_tangent_to_end(&tag, exec_state, args.clone()).await?;
|
let result = inner_tangent_to_end(&tag, exec_state, args.clone()).await?;
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::degrees())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the angle coming out of the end of the segment in degrees.
|
/// Returns the angle coming out of the end of the segment in degrees.
|
||||||
@ -586,7 +584,7 @@ async fn inner_tangent_to_end(tag: &TagIdentifier, exec_state: &mut ExecState, a
|
|||||||
pub async fn angle_to_match_length_x(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn angle_to_match_length_x(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let (tag, to, sketch) = args.get_tag_to_number_sketch()?;
|
let (tag, to, sketch) = args.get_tag_to_number_sketch()?;
|
||||||
let result = inner_angle_to_match_length_x(&tag, to, sketch, exec_state, args.clone())?;
|
let result = inner_angle_to_match_length_x(&tag, to, sketch, exec_state, args.clone())?;
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::degrees())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the angle to match the given length for x.
|
/// Returns the angle to match the given length for x.
|
||||||
@ -621,7 +619,7 @@ fn inner_angle_to_match_length_x(
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let length = path.length();
|
let length = path.length().n;
|
||||||
|
|
||||||
let last_line = sketch
|
let last_line = sketch
|
||||||
.paths
|
.paths
|
||||||
@ -634,6 +632,7 @@ fn inner_angle_to_match_length_x(
|
|||||||
})?
|
})?
|
||||||
.get_base();
|
.get_base();
|
||||||
|
|
||||||
|
// TODO assumption about the units of to
|
||||||
let diff = (to - last_line.to[0]).abs();
|
let diff = (to - last_line.to[0]).abs();
|
||||||
|
|
||||||
let angle_r = (diff / length).acos();
|
let angle_r = (diff / length).acos();
|
||||||
@ -649,7 +648,7 @@ fn inner_angle_to_match_length_x(
|
|||||||
pub async fn angle_to_match_length_y(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn angle_to_match_length_y(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let (tag, to, sketch) = args.get_tag_to_number_sketch()?;
|
let (tag, to, sketch) = args.get_tag_to_number_sketch()?;
|
||||||
let result = inner_angle_to_match_length_y(&tag, to, sketch, exec_state, args.clone())?;
|
let result = inner_angle_to_match_length_y(&tag, to, sketch, exec_state, args.clone())?;
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, NumericType::degrees())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the angle to match the given length for y.
|
/// Returns the angle to match the given length for y.
|
||||||
@ -685,7 +684,7 @@ fn inner_angle_to_match_length_y(
|
|||||||
})
|
})
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let length = path.length();
|
let length = path.length().n;
|
||||||
|
|
||||||
let last_line = sketch
|
let last_line = sketch
|
||||||
.paths
|
.paths
|
||||||
@ -698,6 +697,7 @@ fn inner_angle_to_match_length_y(
|
|||||||
})?
|
})?
|
||||||
.get_base();
|
.get_base();
|
||||||
|
|
||||||
|
// TODO assumption about the units of to
|
||||||
let diff = (to - last_line.to[1]).abs();
|
let diff = (to - last_line.to[1]).abs();
|
||||||
|
|
||||||
let angle_r = (diff / length).asin();
|
let angle_r = (diff / length).asin();
|
||||||
|
@ -25,7 +25,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// A sketch surface or a sketch.
|
/// A sketch surface or a sketch.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum SketchOrSurface {
|
pub enum SketchOrSurface {
|
||||||
|
@ -840,7 +840,7 @@ async fn inner_angled_line_that_intersects(
|
|||||||
|
|
||||||
/// Data for start sketch on.
|
/// Data for start sketch on.
|
||||||
/// You can start a sketch on a plane or an solid.
|
/// You can start a sketch on a plane or an solid.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(rename_all = "camelCase", untagged)]
|
#[serde(rename_all = "camelCase", untagged)]
|
||||||
#[allow(clippy::large_enum_variant)]
|
#[allow(clippy::large_enum_variant)]
|
||||||
@ -892,7 +892,7 @@ pub enum PlaneData {
|
|||||||
|
|
||||||
/// Start a sketch on a specific plane or face.
|
/// Start a sketch on a specific plane or face.
|
||||||
pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn start_sketch_on(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let (data, tag): (SketchData, Option<FaceTag>) = args.get_data_and_optional_tag()?;
|
let (data, tag) = args.get_sketch_data_and_optional_tag()?;
|
||||||
|
|
||||||
match inner_start_sketch_on(data, tag, exec_state, &args).await? {
|
match inner_start_sketch_on(data, tag, exec_state, &args).await? {
|
||||||
SketchSurface::Plane(value) => Ok(KclValue::Plane { value }),
|
SketchSurface::Plane(value) => Ok(KclValue::Plane { value }),
|
||||||
|
@ -5,7 +5,7 @@ use kcl_derive_docs::stdlib;
|
|||||||
use kcmc::{each_cmd as mcmd, length_unit::LengthUnit, ModelingCmd};
|
use kcmc::{each_cmd as mcmd, length_unit::LengthUnit, ModelingCmd};
|
||||||
use kittycad_modeling_cmds::{self as kcmc};
|
use kittycad_modeling_cmds::{self as kcmc};
|
||||||
use schemars::JsonSchema;
|
use schemars::JsonSchema;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::Serialize;
|
||||||
|
|
||||||
use super::DEFAULT_TOLERANCE;
|
use super::DEFAULT_TOLERANCE;
|
||||||
use crate::{
|
use crate::{
|
||||||
@ -16,7 +16,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// A path to sweep along.
|
/// A path to sweep along.
|
||||||
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
#[derive(Debug, Clone, Serialize, PartialEq, ts_rs::TS, JsonSchema)]
|
||||||
#[ts(export)]
|
#[ts(export)]
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum SweepPath {
|
pub enum SweepPath {
|
||||||
|
@ -6,14 +6,14 @@ use kcl_derive_docs::stdlib;
|
|||||||
use crate::{
|
use crate::{
|
||||||
errors::KclError,
|
errors::KclError,
|
||||||
execution::{types::UnitLen, ExecState, KclValue},
|
execution::{types::UnitLen, ExecState, KclValue},
|
||||||
std::Args,
|
std::{args::TyF64, Args},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Millimeters conversion factor for current projects units.
|
/// Millimeters conversion factor for current projects units.
|
||||||
pub async fn mm(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn mm(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_mm(exec_state)?;
|
let result = inner_mm(exec_state)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, exec_state.current_default_units())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Millimeters conversion factor for current projects units.
|
/// Millimeters conversion factor for current projects units.
|
||||||
@ -54,7 +54,7 @@ fn inner_mm(exec_state: &ExecState) -> Result<f64, KclError> {
|
|||||||
pub async fn inch(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn inch(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_inch(exec_state)?;
|
let result = inner_inch(exec_state)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, exec_state.current_default_units())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inches conversion factor for current projects units.
|
/// Inches conversion factor for current projects units.
|
||||||
@ -95,7 +95,7 @@ fn inner_inch(exec_state: &ExecState) -> Result<f64, KclError> {
|
|||||||
pub async fn ft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn ft(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_ft(exec_state)?;
|
let result = inner_ft(exec_state)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, exec_state.current_default_units())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Feet conversion factor for current projects units.
|
/// Feet conversion factor for current projects units.
|
||||||
@ -137,7 +137,7 @@ fn inner_ft(exec_state: &ExecState) -> Result<f64, KclError> {
|
|||||||
pub async fn m(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn m(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_m(exec_state)?;
|
let result = inner_m(exec_state)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, exec_state.current_default_units())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Meters conversion factor for current projects units.
|
/// Meters conversion factor for current projects units.
|
||||||
@ -179,7 +179,7 @@ fn inner_m(exec_state: &ExecState) -> Result<f64, KclError> {
|
|||||||
pub async fn cm(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn cm(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_cm(exec_state)?;
|
let result = inner_cm(exec_state)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, exec_state.current_default_units())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Centimeters conversion factor for current projects units.
|
/// Centimeters conversion factor for current projects units.
|
||||||
@ -221,7 +221,7 @@ fn inner_cm(exec_state: &ExecState) -> Result<f64, KclError> {
|
|||||||
pub async fn yd(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
pub async fn yd(exec_state: &mut ExecState, args: Args) -> Result<KclValue, KclError> {
|
||||||
let result = inner_yd(exec_state)?;
|
let result = inner_yd(exec_state)?;
|
||||||
|
|
||||||
Ok(args.make_user_val_from_f64(result))
|
Ok(args.make_user_val_from_f64_with_type(TyF64::new(result, exec_state.current_default_units())))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Yards conversion factor for current projects units.
|
/// Yards conversion factor for current projects units.
|
||||||
|
@ -2153,14 +2153,21 @@ description: Operations executed car-wheel-assembly.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 2.25,
|
"value": 2.25,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"y": {
|
"y": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": -1.1811023622047243,
|
"value": -1.1811023622047243,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"z": {
|
"z": {
|
||||||
|
@ -145,14 +145,26 @@ description: Variables in memory after executing car-wheel-assembly.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.9449,
|
"value": 0.9449,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lugHeadLength": {
|
"lugHeadLength": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.4724,
|
"value": 0.4724,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lugHolePatternDia": {
|
"lugHolePatternDia": {
|
||||||
@ -172,7 +184,13 @@ description: Variables in memory after executing car-wheel-assembly.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 1.1811,
|
"value": 1.1811,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lugNut": {
|
"lugNut": {
|
||||||
@ -183,28 +201,52 @@ description: Variables in memory after executing car-wheel-assembly.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 4.5,
|
"value": 4.5,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lugThreadDepth": {
|
"lugThreadDepth": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.6811,
|
"value": 0.6811,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lugThreadDiameter": {
|
"lugThreadDiameter": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 0.4016,
|
"value": 0.4016,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"offset": {
|
"offset": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": -1.378,
|
"value": -1.378,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rotorDiameter": {
|
"rotorDiameter": {
|
||||||
|
@ -1765,7 +1765,9 @@ description: Variables in memory after executing dodecahedron.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 2.0344,
|
"value": 2.0344,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Angle",
|
||||||
|
"type": "Radians"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"edgeL": {
|
"edgeL": {
|
||||||
|
@ -4315,12 +4315,6 @@ description: Result of parsing gear.kcl
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "ObjectProperty",
|
"type": "ObjectProperty",
|
||||||
"value": {
|
"value": {
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"left": {
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"left": {
|
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 0,
|
"end": 0,
|
||||||
"left": {
|
"left": {
|
||||||
@ -4348,44 +4342,8 @@ description: Result of parsing gear.kcl
|
|||||||
},
|
},
|
||||||
"operator": "*",
|
"operator": "*",
|
||||||
"right": {
|
"right": {
|
||||||
"commentStart": 0,
|
"arguments": [
|
||||||
"end": 0,
|
{
|
||||||
"raw": "180",
|
|
||||||
"start": 0,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 180.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"start": 0,
|
|
||||||
"type": "BinaryExpression",
|
|
||||||
"type": "BinaryExpression"
|
|
||||||
},
|
|
||||||
"operator": "/",
|
|
||||||
"right": {
|
|
||||||
"abs_path": false,
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"name": "PI",
|
|
||||||
"start": 0,
|
|
||||||
"type": "Identifier"
|
|
||||||
},
|
|
||||||
"path": [],
|
|
||||||
"start": 0,
|
|
||||||
"type": "Name",
|
|
||||||
"type": "Name"
|
|
||||||
},
|
|
||||||
"start": 0,
|
|
||||||
"type": "BinaryExpression",
|
|
||||||
"type": "BinaryExpression"
|
|
||||||
},
|
|
||||||
"operator": "*",
|
|
||||||
"right": {
|
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 0,
|
"end": 0,
|
||||||
@ -4400,6 +4358,28 @@ description: Result of parsing gear.kcl
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "Name",
|
"type": "Name",
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": "toDegrees",
|
||||||
|
"start": 0,
|
||||||
|
"type": "Identifier"
|
||||||
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
},
|
},
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "BinaryExpression",
|
"type": "BinaryExpression",
|
||||||
@ -4505,46 +4485,8 @@ description: Result of parsing gear.kcl
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "ObjectProperty",
|
"type": "ObjectProperty",
|
||||||
"value": {
|
"value": {
|
||||||
"commentStart": 0,
|
"arguments": [
|
||||||
"end": 0,
|
{
|
||||||
"left": {
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"left": {
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"raw": "180",
|
|
||||||
"start": 0,
|
|
||||||
"type": "Literal",
|
|
||||||
"type": "Literal",
|
|
||||||
"value": {
|
|
||||||
"value": 180.0,
|
|
||||||
"suffix": "None"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"operator": "/",
|
|
||||||
"right": {
|
|
||||||
"abs_path": false,
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"name": {
|
|
||||||
"commentStart": 0,
|
|
||||||
"end": 0,
|
|
||||||
"name": "PI",
|
|
||||||
"start": 0,
|
|
||||||
"type": "Identifier"
|
|
||||||
},
|
|
||||||
"path": [],
|
|
||||||
"start": 0,
|
|
||||||
"type": "Name",
|
|
||||||
"type": "Name"
|
|
||||||
},
|
|
||||||
"start": 0,
|
|
||||||
"type": "BinaryExpression",
|
|
||||||
"type": "BinaryExpression"
|
|
||||||
},
|
|
||||||
"operator": "*",
|
|
||||||
"right": {
|
|
||||||
"abs_path": false,
|
"abs_path": false,
|
||||||
"commentStart": 0,
|
"commentStart": 0,
|
||||||
"end": 0,
|
"end": 0,
|
||||||
@ -4559,10 +4501,28 @@ description: Result of parsing gear.kcl
|
|||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "Name",
|
"type": "Name",
|
||||||
"type": "Name"
|
"type": "Name"
|
||||||
},
|
}
|
||||||
|
],
|
||||||
|
"callee": {
|
||||||
|
"abs_path": false,
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": {
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"name": "toDegrees",
|
||||||
"start": 0,
|
"start": 0,
|
||||||
"type": "BinaryExpression",
|
"type": "Identifier"
|
||||||
"type": "BinaryExpression"
|
},
|
||||||
|
"path": [],
|
||||||
|
"start": 0,
|
||||||
|
"type": "Name"
|
||||||
|
},
|
||||||
|
"commentStart": 0,
|
||||||
|
"end": 0,
|
||||||
|
"start": 0,
|
||||||
|
"type": "CallExpression",
|
||||||
|
"type": "CallExpression"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -25,7 +25,13 @@ description: Operations executed i-beam.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 72.00000000000001,
|
"value": 72.00000000000001,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sourceRange": []
|
"sourceRange": []
|
||||||
|
@ -20,7 +20,13 @@ description: Variables in memory after executing i-beam.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 72.0,
|
"value": 72.0,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Inches"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flangeThickness": {
|
"flangeThickness": {
|
||||||
|
@ -20,7 +20,8 @@ description: Variables in memory after executing router-template-cross-bar.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 32.6313,
|
"value": 32.6313,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extrude001": {
|
"extrude001": {
|
||||||
@ -7938,14 +7939,21 @@ description: Variables in memory after executing router-template-cross-bar.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 17.4625,
|
"value": 17.4625,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"templateGap": {
|
"templateGap": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 1.8812,
|
"value": 1.8812,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"templateThickness": {
|
"templateThickness": {
|
||||||
|
@ -3721,14 +3721,21 @@ description: Variables in memory after executing router-template-slate.kcl
|
|||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 17.4625,
|
"value": 17.4625,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"templateGap": {
|
"templateGap": {
|
||||||
"type": "Number",
|
"type": "Number",
|
||||||
"value": 1.8812,
|
"value": 1.8812,
|
||||||
"ty": {
|
"ty": {
|
||||||
"type": "Unknown"
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"templateThickness": {
|
"templateThickness": {
|
||||||
|
Reference in New Issue
Block a user