Change Sketch to use the units of the module (#7076)

* Change Sketch to use the units of the module

* Update output
This commit is contained in:
Jonathan Tran
2025-05-19 20:20:47 -04:00
committed by GitHub
parent 8c24e29081
commit d0697c24fd
6 changed files with 1908 additions and 1906 deletions

View File

@ -26,7 +26,7 @@ use crate::{
args::{Args, TyF64}, args::{Args, TyF64},
utils::{ utils::{
arc_center_and_end, get_tangential_arc_to_info, get_x_component, get_y_component, arc_center_and_end, get_tangential_arc_to_info, get_x_component, get_y_component,
intersection_with_parallel_line, point_to_len_unit, point_to_mm, untype_point, untyped_point_to_mm, intersection_with_parallel_line, point_to_len_unit, point_to_mm, untyped_point_to_mm,
TangentialArcInfoInput, TangentialArcInfoInput,
}, },
}, },
@ -1396,12 +1396,14 @@ pub(crate) async fn inner_start_profile(
]) ])
.await?; .await?;
let (to, ty) = untype_point(at); // Convert to the units of the module. This is what the frontend expects.
let units = exec_state.length_unit();
let to = point_to_len_unit(at, units);
let current_path = BasePath { let current_path = BasePath {
from: to, from: to,
to, to,
tag: tag.clone(), tag: tag.clone(),
units: ty.expect_length(), units,
geo_meta: GeoMeta { geo_meta: GeoMeta {
id: move_pen_id, id: move_pen_id,
metadata: args.source_range.into(), metadata: args.source_range.into(),
@ -1414,7 +1416,7 @@ pub(crate) async fn inner_start_profile(
artifact_id: path_id.into(), artifact_id: path_id.into(),
on: sketch_surface.clone(), on: sketch_surface.clone(),
paths: vec![], paths: vec![],
units: ty.expect_length(), units,
mirror: Default::default(), mirror: Default::default(),
meta: vec![args.source_range.into()], meta: vec![args.source_range.into()],
tags: if let Some(tag) = &tag { tags: if let Some(tag) = &tag {

View File

@ -203,7 +203,7 @@ description: Artifact commands helium-tank.kcl
"path": "[uuid]", "path": "[uuid]",
"segment": { "segment": {
"type": "tangential_arc", "type": "tangential_arc",
"radius": 95.88500000000016, "radius": 95.8850000000001,
"offset": { "offset": {
"unit": "degrees", "unit": "degrees",
"value": -90.0 "value": -90.0

View File

@ -148,7 +148,7 @@ description: Artifact commands router-template-cross-bar.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 22.6312, "x": 22.6313,
"y": -10.0, "y": -10.0,
"z": 0.0 "z": 0.0
}, },
@ -182,7 +182,7 @@ description: Artifact commands router-template-cross-bar.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 32.6312, "x": 32.6313,
"y": 10.9406, "y": 10.9406,
"z": 0.0 "z": 0.0
}, },
@ -199,7 +199,7 @@ description: Artifact commands router-template-cross-bar.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 102.6312, "x": 102.6313,
"y": 10.9406, "y": 10.9406,
"z": 0.0 "z": 0.0
}, },
@ -233,7 +233,7 @@ description: Artifact commands router-template-cross-bar.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 32.6312, "x": 32.6313,
"y": 30.9406, "y": 30.9406,
"z": 0.0 "z": 0.0
}, },
@ -250,7 +250,7 @@ description: Artifact commands router-template-cross-bar.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 32.6312, "x": 32.6313,
"y": 41.8813, "y": 41.8813,
"z": 0.0 "z": 0.0
}, },
@ -284,7 +284,7 @@ description: Artifact commands router-template-cross-bar.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": -32.6312, "x": -32.6313,
"y": 0.0, "y": 0.0,
"z": 0.0 "z": 0.0
}, },