Skip to content

Commit 25b2ced

Browse files
committed
New API
1 parent 75b5162 commit 25b2ced

4 files changed

Lines changed: 58 additions & 19 deletions

File tree

modeling-cmds/openapi/api.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8066,6 +8066,30 @@
80668066
"closest_to",
80678067
"type"
80688068
]
8069+
},
8070+
{
8071+
"description": "Returns the closest edge to this point.",
8072+
"type": "object",
8073+
"properties": {
8074+
"path_id": {
8075+
"description": "Which path to query",
8076+
"allOf": [
8077+
{
8078+
"$ref": "#/components/schemas/ModelingCmdId"
8079+
}
8080+
]
8081+
},
8082+
"type": {
8083+
"type": "string",
8084+
"enum": [
8085+
"sketch_get_info"
8086+
]
8087+
}
8088+
},
8089+
"required": [
8090+
"path_id",
8091+
"type"
8092+
]
80698093
}
80708094
]
80718095
},

modeling-cmds/src/def_enum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2758,7 +2758,7 @@ define_modeling_cmd_enum! {
27582758
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
27592759
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
27602760
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2761-
pub struct PathGetInfoV2 {
2761+
pub struct SketchGetInfo {
27622762
/// Which path to query
27632763
pub path_id: ModelingCmdId,
27642764
}

modeling-cmds/src/ok_response.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ define_ok_modeling_cmd_response_enum! {
2020
use bon::Builder;
2121
use uuid::Uuid;
2222
use crate::shared::{
23+
CurveDebug,
2324
CameraSettings,
2425
CameraViewState,
2526
BodyType,
@@ -1407,24 +1408,9 @@ define_ok_modeling_cmd_response_enum! {
14071408
/// The response from the 'PathGetInfoV2'.
14081409
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema, ModelingCmdOutput)]
14091410
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1410-
pub struct PathGetInfoV2 {
1411-
/// All points in the path
1412-
pub points: Vec<PathSegmentDebug>,
1413-
/// The OBJ file representation from the engine's toolpaths library.
1414-
pub toolpaths_obj: String,
1415-
}
1416-
1417-
/// A debug-view of the segment of a path.
1418-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema, ModelingCmdOutput)]
1419-
pub struct PathSegmentDebug {
1420-
/// Start point of segment.
1421-
pub start: Point2d<f64>,
1422-
/// End point of segment.
1423-
pub end: Point2d<f64>,
1424-
/// What kind of segment is it (line, arc, etc)
1425-
pub segment_type: PathCommand,
1426-
/// ID for this segment.
1427-
pub id: ModelingCmdId,
1411+
pub struct SketchGetInfo {
1412+
/// All curves in this sketch.
1413+
pub curves: Vec<CurveDebug>
14281414
}
14291415
}
14301416
}

modeling-cmds/src/shared.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use uuid::Uuid;
1010
use crate::impl_extern_type;
1111
use crate::{
1212
def_enum::negative_one,
13+
id::ModelingCmdId,
1314
length_unit::LengthUnit,
1415
output::ExtrusionFaceInfo,
1516
units::{self, UnitAngle},
@@ -2207,3 +2208,31 @@ impl From<BodiesUpdated> for BodiesCreated {
22072208
fn one() -> f32 {
22082209
1.0
22092210
}
2211+
2212+
/// A debug-view of the segment of a curve.
2213+
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
2214+
pub struct CurveDebug {
2215+
/// Start point of segment.
2216+
pub start: Option<Point2d<f64>>,
2217+
/// End point of segment.
2218+
pub end: Option<Point2d<f64>>,
2219+
/// Center point of segment.
2220+
pub center: Option<Point2d<f64>>,
2221+
/// Point on the circle's radius
2222+
pub point: Option<Point2d<f64>>,
2223+
/// What kind of segment is it (line, arc, etc)
2224+
pub segment_type: CurveTypeDebug,
2225+
/// ID for this segment.
2226+
pub id: ModelingCmdId,
2227+
}
2228+
2229+
/// What type of curve is being viewed?
2230+
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
2231+
pub enum CurveTypeDebug {
2232+
/// Line with a start and end.
2233+
Line,
2234+
/// Arc with a start, end and center.
2235+
ThreePointArc,
2236+
/// Circle with a center and radius.
2237+
Circle,
2238+
}

0 commit comments

Comments
 (0)