kittycad_modeling_cmds/
def_enum.rs

1use kittycad_modeling_cmds_macros::define_modeling_cmd_enum;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5pub use self::each_cmd::*;
6use crate::{self as kittycad_modeling_cmds};
7
8define_modeling_cmd_enum! {
9    pub mod each_cmd {
10        use std::collections::HashSet;
11
12        use crate::{self as kittycad_modeling_cmds};
13        use kittycad_modeling_cmds_macros::{ModelingCmdVariant};
14        use parse_display_derive::{Display, FromStr};
15        use schemars::JsonSchema;
16        use serde::{Deserialize, Serialize};
17        use uuid::Uuid;
18        use crate::shared::CameraViewState;
19
20        use crate::{
21            format::{OutputFormat2d, OutputFormat3d},
22            id::ModelingCmdId,
23            length_unit::LengthUnit,
24            shared::{
25                Angle,
26                ComponentTransform,
27                RelativeTo,
28                CutType, CutTypeV2,
29                CutStrategy,
30                CameraMovement,
31                ExtrudedFaceInfo, ExtrudeMethod,
32                AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
33                PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
34                Point2d, Point3d, ExtrudeReference, SceneSelectionType, SceneToolType, Opposite,
35            },
36            units,
37        };
38
39        /// Mike says this usually looks nice.
40        fn default_animation_seconds() -> f64 {
41            0.4
42        }
43
44        /// Default empty uuid vector.
45        fn default_uuid_vector() -> Vec<Uuid> {
46            Vec::new()
47        }
48
49        /// Evaluates the position of a path in one shot (engine utility for kcl executor)
50        #[derive(
51            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
52        )]
53        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
54        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
55        pub struct EngineUtilEvaluatePath {
56            /// The path in json form (the serialized result of the kcl Sketch/Path object
57            pub path_json: String,
58
59            /// The evaluation parameter (path curve parameter in the normalized domain [0, 1])
60            pub t: f64,
61        }
62
63        /// Start a new path.
64        #[derive(
65            Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
66        )]
67        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
68        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
69        pub struct StartPath {}
70
71        /// Move the path's "pen".
72        /// If you're in sketch mode, these coordinates are in the local coordinate system,
73        /// not the world's coordinate system.
74        /// For example, say you're sketching on the plane {x: (1,0,0), y: (0,1,0), origin: (0, 0, 50)}.
75        /// In other words, the plane 50 units above the default XY plane. Then, moving the pen
76        /// to (1, 1, 0) with this command uses local coordinates. So, it would move the pen to
77        /// (1, 1, 50) in global coordinates.
78        #[derive(
79            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
80        )]
81        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
82        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
83        pub struct MovePathPen {
84            /// The ID of the command which created the path.
85            pub path: ModelingCmdId,
86            /// Where the path's pen should be.
87            pub to: Point3d<LengthUnit>,
88        }
89
90        /// Extend a path by adding a new segment which starts at the path's "pen".
91        /// If no "pen" location has been set before (via `MovePen`), then the pen is at the origin.
92        #[derive(
93            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
94        )]
95        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
96        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
97        pub struct ExtendPath {
98            /// The ID of the command which created the path.
99            pub path: ModelingCmdId,
100            /// Segment to append to the path.
101            /// This segment will implicitly begin at the current "pen" location.
102            pub segment: PathSegment,
103            /// Optional label to associate with the new path segment.
104            #[serde(default, skip_serializing_if = "Option::is_none")]
105            pub label: Option<String>,
106        }
107
108        /// Command for extruding a solid 2d.
109        #[derive(
110            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
111        )]
112        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
113        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
114        pub struct Extrude {
115            /// Which sketch to extrude.
116            /// Must be a closed 2D solid.
117            pub target: ModelingCmdId,
118            /// How far off the plane to extrude
119            pub distance: LengthUnit,
120            /// Which IDs should the new faces have?
121            /// If this isn't given, the engine will generate IDs.
122            #[serde(default)]
123            pub faces: Option<ExtrudedFaceInfo>,
124            /// Should the extrusion also extrude in the opposite direction?
125            /// If so, this specifies its distance.
126            #[serde(default)]
127            pub opposite: Opposite<LengthUnit>,
128            /// Should the extrusion create a new object or be part of the existing object.
129            #[serde(default)]
130            pub extrude_method: ExtrudeMethod,
131        }
132
133        /// Command for extruding a solid 2d to a reference geometry.
134        #[derive(
135            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
136        )]
137        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
138        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
139        pub struct ExtrudeToReference {
140            /// Which sketch to extrude.
141            /// Must be a closed 2D solid.
142            pub target: ModelingCmdId,
143            /// Reference to extrude to.
144            /// Extrusion occurs along the target's normal until it is as close to the reference as possible.
145            pub reference: ExtrudeReference,
146            /// Which IDs should the new faces have?
147            /// If this isn't given, the engine will generate IDs.
148            #[serde(default)]
149            pub faces: Option<ExtrudedFaceInfo>,
150            /// Should the extrusion create a new object or be part of the existing object.
151            #[serde(default)]
152            pub extrude_method: ExtrudeMethod,
153        }
154
155        fn default_twist_extrude_section_interval() -> Angle {
156            Angle::from_degrees(15.0)
157        }
158
159        /// Command for twist extruding a solid 2d.
160        #[derive(
161            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
162        )]
163        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
164        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
165        pub struct TwistExtrude {
166            /// Which sketch to extrude.
167            /// Must be a closed 2D solid.
168            pub target: ModelingCmdId,
169            /// How far off the plane to extrude
170            pub distance: LengthUnit,
171            /// Which IDs should the new faces have?
172            /// If this isn't given, the engine will generate IDs.
173            #[serde(default)]
174            pub faces: Option<ExtrudedFaceInfo>,
175            /// Center to twist about (relative to 2D sketch)
176            #[serde(default)]
177            pub center_2d: Point2d<f64>,
178            /// Total rotation of the section
179            pub total_rotation_angle: Angle,
180            ///Angle step interval (converted to whole number degrees and bounded between 4° and 90°)
181            #[serde(default = "default_twist_extrude_section_interval")]
182            pub angle_step_size: Angle,
183            ///The twisted surface loft tolerance
184            pub tolerance: LengthUnit,
185        }
186
187        /// Extrude the object along a path.
188        #[derive(
189            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
190        )]
191        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
192        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
193        pub struct Sweep {
194            /// Which sketch to sweep.
195            /// Must be a closed 2D solid.
196            pub target: ModelingCmdId,
197            /// Path along which to sweep.
198            pub trajectory: ModelingCmdId,
199            /// If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components.
200            pub sectional: bool,
201            /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
202            pub tolerance: LengthUnit,
203            /// What is this sweep relative to?
204            #[serde(default)]
205            pub relative_to: RelativeTo,
206        }
207
208        /// Command for revolving a solid 2d.
209        #[derive(
210            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
211        )]
212        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
213        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
214        pub struct Revolve {
215            /// Which sketch to revolve.
216            /// Must be a closed 2D solid.
217            pub target: ModelingCmdId,
218            /// The origin of the extrusion axis
219            pub origin: Point3d<LengthUnit>,
220            /// The axis of the extrusion (taken from the origin)
221            pub axis: Point3d<f64>,
222            /// If true, the axis is interpreted within the 2D space of the solid 2D's plane
223            pub axis_is_2d: bool,
224            /// The signed angle of revolution (in degrees, must be <= 360 in either direction)
225            pub angle: Angle,
226            /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
227            pub tolerance: LengthUnit,
228            /// Should the revolution also revolve in the opposite direction along the given axis?
229            /// If so, this specifies its angle.
230            #[serde(default)]
231            pub opposite: Opposite<Angle>,
232        }
233
234        /// Command for shelling a solid3d face
235        #[derive(
236            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
237        )]
238        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
239        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
240        pub struct Solid3dShellFace {
241            /// Which Solid3D is being shelled.
242            pub object_id: Uuid,
243            /// Which faces to remove, leaving only the shell.
244            pub face_ids: Vec<Uuid>,
245            /// How thick the shell should be.
246            /// Smaller values mean a thinner shell.
247            pub shell_thickness: LengthUnit,
248            /// If true, the Solid3D is made hollow instead of removing the selected faces
249            #[serde(default)]
250            pub hollow: bool,
251        }
252
253        /// Command for revolving a solid 2d about a brep edge
254        #[derive(
255            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
256        )]
257        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
258        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
259        pub struct RevolveAboutEdge {
260            /// Which sketch to revolve.
261            /// Must be a closed 2D solid.
262            pub target: ModelingCmdId,
263            /// The edge to use as the axis of revolution, must be linear and lie in the plane of the solid
264            pub edge_id: Uuid,
265            /// The signed angle of revolution (in degrees, must be <= 360 in either direction)
266            pub angle: Angle,
267            /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
268            pub tolerance: LengthUnit,
269            /// Should the revolution also revolve in the opposite direction along the given axis?
270            /// If so, this specifies its angle.
271            #[serde(default)]
272            pub opposite: Opposite<Angle>,
273        }
274
275        /// Command for lofting sections to create a solid
276        #[derive(
277            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
278        )]
279        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
280        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
281        pub struct Loft {
282            /// The closed section curves to create a lofted solid from.
283            /// Currently, these must be Solid2Ds
284            pub section_ids: Vec<Uuid>,
285            /// Degree of the interpolation. Must be greater than zero.
286            /// For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction.
287            pub v_degree: std::num::NonZeroU32,
288            /// Attempt to approximate rational curves (such as arcs) using a bezier.
289            /// This will remove banding around interpolations between arcs and non-arcs.  It may produce errors in other scenarios
290            /// Over time, this field won't be necessary.
291            pub bez_approximate_rational: bool,
292            /// This can be set to override the automatically determined topological base curve, which is usually the first section encountered.
293            pub base_curve_index: Option<u32>,
294            /// Tolerance
295            pub tolerance: LengthUnit,
296        }
297
298
299        /// Closes a path, converting it to a 2D solid.
300        #[derive(
301            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
302        )]
303        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
304        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
305        pub struct ClosePath {
306            /// Which path to close.
307            pub path_id: Uuid,
308        }
309
310        /// Camera drag started.
311        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
312        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
313        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
314        pub struct CameraDragStart {
315            /// The type of camera drag interaction.
316            pub interaction: CameraDragInteractionType,
317            /// The initial mouse position.
318            pub window: Point2d,
319        }
320
321        /// Camera drag continued.
322        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
323        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
324        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
325        pub struct CameraDragMove {
326            /// The type of camera drag interaction.
327            pub interaction: CameraDragInteractionType,
328            /// The current mouse position.
329            pub window: Point2d,
330            /// Logical timestamp. The client should increment this
331            /// with every event in the current mouse drag. That way, if the
332            /// events are being sent over an unordered channel, the API
333            /// can ignore the older events.
334            pub sequence: Option<u32>,
335        }
336
337        /// Camera drag ended
338        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
339        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
340        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
341        pub struct CameraDragEnd {
342            /// The type of camera drag interaction.
343            pub interaction: CameraDragInteractionType,
344            /// The final mouse position.
345            pub window: Point2d,
346        }
347
348        /// Gets the default camera's camera settings
349        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
350        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
351        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
352        pub struct DefaultCameraGetSettings {}
353
354        /// Gets the default camera's view state
355        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
356        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
357        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
358        pub struct DefaultCameraGetView {}
359
360        /// Sets the default camera's view state
361        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
362        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
363        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
364        pub struct DefaultCameraSetView {
365            /// Camera view state
366            pub view: CameraViewState,
367        }
368
369        /// Change what the default camera is looking at.
370        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
371        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
372        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
373        pub struct DefaultCameraLookAt {
374            /// Where the camera is positioned
375            pub vantage: Point3d,
376            /// What the camera is looking at. Center of the camera's field of vision
377            pub center: Point3d,
378            /// Which way is "up", from the camera's point of view.
379            pub up: Point3d,
380            /// Logical timestamp. The client should increment this
381            /// with every event in the current mouse drag. That way, if the
382            /// events are being sent over an unordered channel, the API
383            /// can ignore the older events.
384            pub sequence: Option<u32>,
385        }
386
387        /// Change what the default camera is looking at.
388        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
389        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
390        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
391        pub struct DefaultCameraPerspectiveSettings {
392            /// Where the camera is positioned
393            pub vantage: Point3d,
394            /// What the camera is looking at. Center of the camera's field of vision
395            pub center: Point3d,
396            /// Which way is "up", from the camera's point of view.
397            pub up: Point3d,
398            /// The field of view angle in the y direction, in degrees.
399            pub fov_y: Option<f32>,
400            /// The distance to the near clipping plane.
401            pub z_near: Option<f32>,
402            /// The distance to the far clipping plane.
403            pub z_far: Option<f32>,
404            /// Logical timestamp. The client should increment this
405            /// with every event in the current mouse drag. That way, if the
406            /// events are being sent over an unordered channel, the API
407            /// can ignore the older events.
408            pub sequence: Option<u32>,
409        }
410
411        /// Adjust zoom of the default camera.
412        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
413        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
414        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
415        pub struct DefaultCameraZoom {
416            /// Move the camera forward along the vector it's looking at,
417            /// by this magnitudedefaultCameraZoom.
418            /// Basically, how much should the camera move forward by.
419            pub magnitude: f32,
420        }
421
422        /// Export a sketch to a file.
423        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
424        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
425        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
426        pub struct Export2d {
427            /// IDs of the entities to be exported.
428            pub entity_ids: Vec<Uuid>,
429            /// The file format to export to.
430            pub format: OutputFormat2d,
431        }
432
433        /// Export the scene to a file.
434        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
435        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
436        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
437        pub struct Export3d {
438            /// IDs of the entities to be exported. If this is empty, then all entities are exported.
439            pub entity_ids: Vec<Uuid>,
440            /// The file format to export to.
441            pub format: OutputFormat3d,
442        }
443
444        /// Export the scene to a file.
445        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
446        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
447        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
448        pub struct Export {
449            /// IDs of the entities to be exported. If this is empty, then all entities are exported.
450            pub entity_ids: Vec<Uuid>,
451            /// The file format to export to.
452            pub format: OutputFormat3d,
453        }
454
455        /// What is this entity's parent?
456        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
457        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
458        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
459        pub struct EntityGetParentId {
460            /// ID of the entity being queried.
461            pub entity_id: Uuid,
462        }
463
464        /// How many children does the entity have?
465        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
466        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
467        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
468        pub struct EntityGetNumChildren {
469            /// ID of the entity being queried.
470            pub entity_id: Uuid,
471        }
472
473        /// What is the UUID of this entity's n-th child?
474        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
475        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
476        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
477        pub struct EntityGetChildUuid {
478            /// ID of the entity being queried.
479            pub entity_id: Uuid,
480            /// Index into the entity's list of children.
481            pub child_index: u32,
482        }
483
484        /// What are all UUIDs of this entity's children?
485        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
486        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
487        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
488        pub struct EntityGetAllChildUuids {
489            /// ID of the entity being queried.
490            pub entity_id: Uuid,
491        }
492
493        /// What are all UUIDs of all the paths sketched on top of this entity?
494        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
495        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
496        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
497        pub struct EntityGetSketchPaths {
498            /// ID of the entity being queried.
499            pub entity_id: Uuid,
500        }
501
502        /// What is the distance between these two entities?
503        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
504        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
505        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
506        pub struct EntityGetDistance {
507            /// ID of the first entity being queried.
508            pub entity_id1: Uuid,
509            /// ID of the second entity being queried.
510            pub entity_id2: Uuid,
511            /// Type of distance to be measured.
512            pub distance_type: DistanceType,
513        }
514
515        /// Create a pattern using this entity by specifying the transform for each desired repetition.
516        /// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
517        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
518        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
519        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
520        pub struct EntityClone {
521            /// ID of the entity being cloned.
522            pub entity_id: Uuid,
523        }
524
525        /// Create a pattern using this entity by specifying the transform for each desired repetition.
526        /// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
527        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
528        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
529        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
530        pub struct EntityLinearPatternTransform {
531            /// ID of the entity being copied.
532            pub entity_id: Uuid,
533            /// How to transform each repeated solid.
534            /// The 0th transform will create the first copy of the entity.
535            /// The total number of (optional) repetitions equals the size of this list.
536            #[serde(default)]
537            pub transform: Vec<crate::shared::Transform>,
538            /// Alternatively, you could set this key instead.
539            /// If you want to use multiple transforms per item.
540            /// If this is non-empty then the `transform` key must be empty, and vice-versa.
541            #[serde(default)]
542            pub transforms: Vec<Vec<crate::shared::Transform>>,
543        }
544
545        /// Create a linear pattern using this entity.
546        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
547        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
548        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
549        pub struct EntityLinearPattern {
550            /// ID of the entity being copied.
551            pub entity_id: Uuid,
552            /// Axis along which to make the copies.
553            /// For Solid2d patterns, the z component is ignored.
554            pub axis: Point3d<f64>,
555            /// Number of repetitions to make.
556            pub num_repetitions: u32,
557            /// Spacing between repetitions.
558            pub spacing: LengthUnit,
559        }
560        /// Create a circular pattern using this entity.
561        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
562        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
563        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
564        pub struct EntityCircularPattern {
565            /// ID of the entity being copied.
566            pub entity_id: Uuid,
567            /// Axis around which to make the copies.
568            /// For Solid2d patterns, this is ignored.
569            pub axis: Point3d<f64>,
570            /// Point around which to make the copies.
571            /// For Solid2d patterns, the z component is ignored.
572            pub center: Point3d<LengthUnit>,
573            /// Number of repetitions to make.
574            pub num_repetitions: u32,
575            /// Arc angle (in degrees) to place repetitions along.
576            pub arc_degrees: f64,
577            /// Whether or not to rotate the objects as they are copied.
578            pub rotate_duplicates: bool,
579        }
580
581        /// Create a helix using the input cylinder and other specified parameters.
582        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
583        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
584        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
585        pub struct EntityMakeHelix {
586            /// ID of the cylinder.
587            pub cylinder_id: Uuid,
588            /// Number of revolutions.
589            pub revolutions: f64,
590            /// Start angle.
591            #[serde(default)]
592            pub start_angle: Angle,
593            /// Is the helix rotation clockwise?
594            pub is_clockwise: bool,
595            /// Length of the helix. If None, the length of the cylinder will be used instead.
596            pub length: Option<LengthUnit>,
597        }
598
599        /// Create a helix using the specified parameters.
600        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
601        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
602        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
603        pub struct EntityMakeHelixFromParams {
604            /// Radius of the helix.
605            pub radius: LengthUnit,
606            /// Length of the helix.
607            pub length: LengthUnit,
608            /// Number of revolutions.
609            pub revolutions: f64,
610            /// Start angle.
611            #[serde(default)]
612            pub start_angle: Angle,
613            /// Is the helix rotation clockwise?
614            pub is_clockwise: bool,
615            /// Center of the helix at the base of the helix.
616            pub center: Point3d<LengthUnit>,
617            /// Axis of the helix. The helix will be created around and in the direction of this axis.
618            pub axis: Point3d<f64>,
619        }
620
621        /// Create a helix using the specified parameters.
622        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
623        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
624        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
625        pub struct EntityMakeHelixFromEdge {
626            /// Radius of the helix.
627            pub radius: LengthUnit,
628            /// Length of the helix. If None, the length of the edge will be used instead.
629            pub length: Option<LengthUnit>,
630            /// Number of revolutions.
631            pub revolutions: f64,
632            /// Start angle.
633            #[serde(default)]
634            pub start_angle: Angle,
635            /// Is the helix rotation clockwise?
636            pub is_clockwise: bool,
637            /// Edge about which to make the helix.
638            pub edge_id: Uuid,
639        }
640
641        /// Mirror the input entities over the specified axis. (Currently only supports sketches)
642        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
643        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
644        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
645        pub struct EntityMirror {
646            /// ID of the mirror entities.
647            pub ids: Vec<Uuid>,
648            /// Axis to use as mirror.
649            pub axis: Point3d<f64>,
650            /// Point through which the mirror axis passes.
651            pub point: Point3d<LengthUnit>,
652        }
653
654        /// Mirror the input entities over the specified edge. (Currently only supports sketches)
655        #[derive(
656            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
657        )]
658        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
659        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
660        pub struct EntityMirrorAcrossEdge {
661            /// ID of the mirror entities.
662            pub ids: Vec<Uuid>,
663            /// The edge to use as the mirror axis, must be linear and lie in the plane of the solid
664            pub edge_id: Uuid,
665        }
666
667        /// Modifies the selection by simulating a "mouse click" at the given x,y window coordinate
668        /// Returns ID of whatever was selected.
669        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
670        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
671        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
672        pub struct SelectWithPoint {
673            /// Where in the window was selected
674            pub selected_at_window: Point2d,
675            /// What entity was selected?
676            pub selection_type: SceneSelectionType,
677        }
678
679        /// Adds one or more entities (by UUID) to the selection.
680        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
681        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
682        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
683        pub struct SelectAdd {
684            /// Which entities to select
685            pub entities: Vec<Uuid>,
686        }
687
688        /// Removes one or more entities (by UUID) from the selection.
689        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
690        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
691        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
692        pub struct SelectRemove {
693            /// Which entities to unselect
694            pub entities: Vec<Uuid>,
695        }
696
697        /// Removes all of the Objects in the scene
698        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
699        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
700        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
701        pub struct SceneClearAll {}
702
703        /// Replaces current selection with these entities (by UUID).
704        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
705        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
706        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
707        pub struct SelectReplace {
708            /// Which entities to select
709            pub entities: Vec<Uuid>,
710        }
711
712        /// Changes the current highlighted entity to whichever one is at the given window coordinate.
713        /// If there's no entity at this location, clears the highlight.
714        #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
715        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
716        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
717        pub struct HighlightSetEntity {
718            /// Coordinates of the window being clicked
719            pub selected_at_window: Point2d,
720            /// Logical timestamp. The client should increment this
721            /// with every event in the current mouse drag. That way, if the
722            /// events are being sent over an unordered channel, the API
723            /// can ignore the older events.
724            pub sequence: Option<u32>,
725        }
726
727        /// Changes the current highlighted entity to these entities.
728        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
729        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
730        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
731        pub struct HighlightSetEntities {
732            /// Highlight these entities.
733            pub entities: Vec<Uuid>,
734        }
735
736        /// Create a new annotation
737        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
738        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
739        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
740        pub struct NewAnnotation {
741            /// What should the annotation contain?
742            pub options: AnnotationOptions,
743            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
744            pub clobber: bool,
745            /// What type of annotation to create.
746            pub annotation_type: AnnotationType,
747        }
748
749        /// Update an annotation
750        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
751        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
752        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
753        pub struct UpdateAnnotation {
754            /// Which annotation to update
755            pub annotation_id: Uuid,
756            /// If any of these fields are set, they will overwrite the previous options for the
757            /// annotation.
758            pub options: AnnotationOptions,
759        }
760
761        /// Changes visibility of scene-wide edge lines on brep solids
762        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
763        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
764        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
765        pub struct EdgeLinesVisible {
766            /// Whether or not the edge lines should be hidden.
767            pub hidden: bool,
768        }
769
770        /// Hide or show an object
771        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
772        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
773        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
774        pub struct ObjectVisible {
775            /// Which object to change
776            pub object_id: Uuid,
777            /// Whether or not the object should be hidden.
778            pub hidden: bool,
779        }
780
781        /// Bring an object to the front of the scene
782        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
783        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
784        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
785        pub struct ObjectBringToFront {
786            /// Which object to change
787            pub object_id: Uuid,
788        }
789
790        /// Set the material properties of an object
791        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
792        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
793        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
794        pub struct ObjectSetMaterialParamsPbr {
795            /// Which object to change
796            pub object_id: Uuid,
797            /// Color of the new material
798            pub color: Color,
799            /// Metalness of the new material
800            pub metalness: f32,
801            /// Roughness of the new material
802            pub roughness: f32,
803            /// Ambient Occlusion of the new material
804            pub ambient_occlusion: f32,
805        }
806        /// What type of entity is this?
807        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
808        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
809        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
810        pub struct GetEntityType {
811            /// ID of the entity being queried.
812            pub entity_id: Uuid,
813        }
814
815        /// Gets all faces which use the given edge.
816        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
817        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
818        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
819        pub struct Solid3dGetAllEdgeFaces {
820            /// Which object is being queried.
821            pub object_id: Uuid,
822            /// Which edge you want the faces of.
823            pub edge_id: Uuid,
824        }
825
826        /// Add a hole to a Solid2d object before extruding it.
827        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
828        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
829        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
830        pub struct Solid2dAddHole {
831            /// Which object to add the hole to.
832            pub object_id: Uuid,
833            /// The id of the path to use as the inner profile (hole).
834            pub hole_id: Uuid,
835        }
836
837        /// Gets all edges which are opposite the given edge, across all possible faces.
838        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
839        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
840        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
841        pub struct Solid3dGetAllOppositeEdges {
842            /// Which object is being queried.
843            pub object_id: Uuid,
844            /// Which edge you want the opposites of.
845            pub edge_id: Uuid,
846            /// If given, only faces parallel to this vector will be considered.
847            pub along_vector: Option<Point3d<f64>>,
848        }
849
850        /// Gets the edge opposite the given edge, along the given face.
851        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
852        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
853        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
854        pub struct Solid3dGetOppositeEdge {
855            /// Which object is being queried.
856            pub object_id: Uuid,
857            /// Which edge you want the opposite of.
858            pub edge_id: Uuid,
859            /// Which face is used to figure out the opposite edge?
860            pub face_id: Uuid,
861        }
862
863        /// Gets the next adjacent edge for the given edge, along the given face.
864        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
865        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
866        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
867        pub struct Solid3dGetNextAdjacentEdge {
868            /// Which object is being queried.
869            pub object_id: Uuid,
870            /// Which edge you want the opposite of.
871            pub edge_id: Uuid,
872            /// Which face is used to figure out the opposite edge?
873            pub face_id: Uuid,
874        }
875
876        /// Gets the previous adjacent edge for the given edge, along the given face.
877        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
878        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
879        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
880        pub struct Solid3dGetPrevAdjacentEdge {
881            /// Which object is being queried.
882            pub object_id: Uuid,
883            /// Which edge you want the opposite of.
884            pub edge_id: Uuid,
885            /// Which face is used to figure out the opposite edge?
886            pub face_id: Uuid,
887        }
888
889        /// Gets the shared edge between these two faces if it exists
890        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
891        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
892        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
893        pub struct Solid3dGetCommonEdge {
894            /// Which object is being queried.
895            pub object_id: Uuid,
896            /// The faces being queried
897            pub face_ids: [Uuid; 2]
898        }
899
900        /// Fillets the given edge with the specified radius.
901        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
902        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
903        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
904        pub struct Solid3dFilletEdge {
905            /// Which object is being filletted.
906            pub object_id: Uuid,
907            /// Which edge you want to fillet.
908            #[serde(default)]
909            pub edge_id: Option<Uuid>,
910            /// Which edges you want to fillet.
911            #[serde(default)]
912            pub edge_ids: Vec<Uuid>,
913            /// The radius of the fillet. Measured in length (using the same units that the current sketch uses). Must be positive (i.e. greater than zero).
914            pub radius: LengthUnit,
915            /// The maximum acceptable surface gap computed between the filleted surfaces. Must be positive (i.e. greater than zero).
916            pub tolerance: LengthUnit,
917            /// How to apply the cut.
918            #[serde(default)]
919            pub cut_type: CutType,
920            /// Which cutting algorithm to use.
921            #[serde(default)]
922            pub strategy: CutStrategy,
923            /// What IDs should the resulting faces have?
924            /// If you've only passed one edge ID, its ID will
925            /// be the command ID used to send this command, and this
926            /// field should be empty.
927            /// If you've passed `n` IDs (to fillet `n` edges), then
928            /// this should be length `n-1`, and the first edge will use
929            /// the command ID used to send this command.
930            #[serde(default)]
931            pub extra_face_ids: Vec<Uuid>,
932        }
933
934        /// Cut the list of given edges with the given cut parameters.
935        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
936        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
937        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
938        pub struct Solid3dCutEdges {
939            /// Which object is being cut.
940            pub object_id: Uuid,
941            /// Which edges you want to cut.
942            #[serde(default)]
943            pub edge_ids: Vec<Uuid>,
944            /// The cut type and information required to perform the cut.
945            pub cut_type: CutTypeV2,
946            /// The maximum acceptable surface gap computed between the cut surfaces. Must be
947            /// positive (i.e. greater than zero).
948            pub tolerance: LengthUnit,
949            /// Which cutting algorithm to use.
950            #[serde(default)]
951            pub strategy: CutStrategy,
952            /// What IDs should the resulting faces have?
953            /// If you've only passed one edge ID, its ID will
954            /// be the command ID used to send this command, and this
955            /// field should be empty.
956            /// If you've passed `n` IDs (to cut `n` edges), then
957            /// this should be length `n-1`, and the first edge will use
958            /// the command ID used to send this command.
959            #[serde(default)]
960            pub extra_face_ids: Vec<Uuid>,
961        }
962
963        /// Determines whether a brep face is planar and returns its surface-local planar axes if so
964        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
965        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
966        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
967        pub struct FaceIsPlanar {
968            /// Which face is being queried.
969            pub object_id: Uuid,
970        }
971
972        /// Determines a position on a brep face evaluated by parameters u,v
973        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
974        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
975        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
976        pub struct FaceGetPosition {
977            /// Which face is being queried.
978            pub object_id: Uuid,
979
980            /// The 2D parameter-space u,v position to evaluate the surface at
981            pub uv: Point2d<f64>,
982        }
983
984        ///Obtains the surface "center of mass"
985        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
986        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
987        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
988        pub struct FaceGetCenter {
989            /// Which face is being queried.
990            pub object_id: Uuid,
991        }
992
993        /// Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v
994        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
995        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
996        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
997        pub struct FaceGetGradient {
998            /// Which face is being queried.
999            pub object_id: Uuid,
1000
1001            /// The 2D parameter-space u,v position to evaluate the surface at
1002            pub uv: Point2d<f64>,
1003        }
1004
1005        /// Send object to front or back.
1006        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1007        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1008        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1009        pub struct SendObject {
1010            /// Which object is being changed.
1011            pub object_id: Uuid,
1012            /// Bring to front = true, send to back = false.
1013            pub front: bool,
1014        }
1015        /// Set opacity of the entity.
1016        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1017        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1018        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1019        pub struct EntitySetOpacity {
1020            /// Which entity is being changed.
1021            pub entity_id: Uuid,
1022            /// How transparent should it be?
1023            /// 0 or lower is totally transparent.
1024            /// 1 or greater is totally opaque.
1025            pub opacity: f32,
1026        }
1027
1028        /// Fade entity in or out.
1029        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1030        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1031        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1032        pub struct EntityFade {
1033            /// Which entity is being changed.
1034            pub entity_id: Uuid,
1035            /// Fade in = true, fade out = false.
1036            pub fade_in: bool,
1037            /// How many seconds the animation should take.
1038            #[serde(default = "default_animation_seconds")]
1039            pub duration_seconds: f64,
1040        }
1041
1042        /// Make a new plane
1043        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1044        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1045        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1046        pub struct MakePlane {
1047            /// Origin of the plane
1048            pub origin: Point3d<LengthUnit>,
1049            /// What should the plane's X axis be?
1050            pub x_axis: Point3d<f64>,
1051            /// What should the plane's Y axis be?
1052            pub y_axis: Point3d<f64>,
1053            /// What should the plane's span/extent?
1054            /// When rendered visually, this is both the
1055            /// width and height along X and Y axis respectively.
1056            pub size: LengthUnit,
1057            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1058            pub clobber: bool,
1059            /// If true, the plane will be created but hidden initially.
1060            pub hide: Option<bool>,
1061        }
1062
1063        /// Set the color of a plane.
1064        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1065        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1066        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1067        pub struct PlaneSetColor {
1068            /// Which plane is being changed.
1069            pub plane_id: Uuid,
1070            /// What color it should be.
1071            pub color: Color,
1072        }
1073
1074        /// Set the current tool.
1075        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1076        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1077        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1078        pub struct SetTool {
1079            /// What tool should be active.
1080            pub tool: SceneToolType,
1081        }
1082
1083        /// Send a mouse move event
1084        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1085        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1086        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1087        pub struct MouseMove {
1088            /// Where the mouse is
1089            pub window: Point2d,
1090            /// Logical timestamp. The client should increment this
1091            /// with every event in the current mouse drag. That way, if the
1092            /// events are being sent over an unordered channel, the API
1093            /// can ignore the older events.
1094            pub sequence: Option<u32>,
1095        }
1096
1097        /// Send a mouse click event
1098        /// Updates modified/selected entities.
1099        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1100        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1101        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1102        pub struct MouseClick {
1103            /// Where the mouse is
1104            pub window: Point2d,
1105        }
1106
1107        /// Disable sketch mode.
1108        /// If you are sketching on a face, be sure to not disable sketch mode until you have extruded.
1109        /// Otherwise, your object will not be fused with the face.
1110        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1111        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1112        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1113        pub struct SketchModeDisable {}
1114
1115        /// Get the plane for sketch mode.
1116        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1117        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1118        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1119        pub struct GetSketchModePlane {}
1120
1121        /// Get the plane for sketch mode.
1122        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1123        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1124        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1125        pub struct CurveSetConstraint {
1126            /// Which curve to constrain.
1127            pub object_id: Uuid,
1128            /// Which constraint to apply.
1129            pub constraint_bound: PathComponentConstraintBound,
1130            /// What part of the curve should be constrained.
1131            pub constraint_type: PathComponentConstraintType,
1132        }
1133
1134        /// Sketch on some entity (e.g. a plane, a face).
1135        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1136        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1137        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1138        pub struct EnableSketchMode {
1139            /// Which entity to sketch on.
1140            pub entity_id: Uuid,
1141            /// Should the camera use orthographic projection?
1142            /// In other words, should an object's size in the rendered image stay constant regardless of its distance from the camera.
1143            pub ortho: bool,
1144            /// Should we animate or snap for the camera transition?
1145            pub animated: bool,
1146            /// Should the camera move at all?
1147            pub adjust_camera: bool,
1148            /// If provided, ensures that the normal of the sketch plane must be aligned with this supplied normal
1149            /// (otherwise the camera position will be used to infer the normal to point towards the viewer)
1150            pub planar_normal: Option<Point3d<f64>>,
1151        }
1152
1153        /// Sets whether or not changes to the scene or its objects will be done as a "dry run"
1154        /// In a dry run, successful commands won't actually change the model.
1155        /// This is useful for catching errors before actually making the change.
1156        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1157        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1158        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1159        pub struct EnableDryRun {}
1160
1161        /// Sets whether or not changes to the scene or its objects will be done as a "dry run"
1162        /// In a dry run, successful commands won't actually change the model.
1163        /// This is useful for catching errors before actually making the change.
1164        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1165        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1166        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1167        pub struct DisableDryRun {}
1168
1169        /// Set the background color of the scene.
1170        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1171        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1172        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1173        pub struct SetBackgroundColor {
1174            /// The color to set the background to.
1175            pub color: Color,
1176        }
1177
1178        /// Set the properties of the tool lines for the scene.
1179        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1180        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1181        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1182        pub struct SetCurrentToolProperties {
1183            /// The color to set the tool line to.
1184            pub color: Option<Color>,
1185        }
1186
1187        /// Set the default system properties used when a specific property isn't set.
1188        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1189        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1190        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1191        pub struct SetDefaultSystemProperties {
1192            /// The default system color.
1193            pub color: Option<Color>,
1194        }
1195
1196        /// Get type of the given curve.
1197        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1198        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1199        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1200        pub struct CurveGetType {
1201            /// Which curve to query.
1202            pub curve_id: Uuid,
1203        }
1204
1205        /// Get control points of the given curve.
1206        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1207        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1208        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1209        pub struct CurveGetControlPoints {
1210            /// Which curve to query.
1211            pub curve_id: Uuid,
1212        }
1213
1214        /// Project an entity on to a plane.
1215        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1216        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1217        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1218        pub struct ProjectEntityToPlane {
1219            /// Which entity to project (vertex or edge).
1220            pub entity_id: Uuid,
1221            /// Which plane to project entity_id onto.
1222            pub plane_id: Uuid,
1223            /// If true: the projected points are returned in the plane_id's coordinate system,
1224            /// else: the projected points are returned in the world coordinate system.
1225            pub use_plane_coords: bool,
1226        }
1227
1228        /// Project a list of points on to a plane.
1229        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1230        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1231        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1232        pub struct ProjectPointsToPlane {
1233            /// The id of the plane used for the projection.
1234            pub plane_id: Uuid,
1235            /// The list of points that will be projected.
1236            pub points: Vec<Point3d<f64>>,
1237            /// If true: the projected points are returned in the plane_id's coordinate sysetm.
1238            /// else: the projected points are returned in the world coordinate system.
1239            pub use_plane_coords: bool,
1240        }
1241
1242        /// Enum containing the variety of image formats snapshots may be exported to.
1243        #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1244        #[serde(rename_all = "snake_case")]
1245        #[display(style = "snake_case")]
1246        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1247        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1248        #[cfg_attr(feature = "python", pyo3::pyclass, pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1249        pub enum ImageFormat {
1250            /// .png format
1251            Png,
1252            /// .jpeg format
1253            Jpeg,
1254        }
1255
1256        /// Take a snapshot of the current view.
1257        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1258        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1259        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1260        pub struct TakeSnapshot {
1261            /// What image format to return.
1262            pub format: ImageFormat,
1263        }
1264
1265        /// Add a gizmo showing the axes.
1266        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1267        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1268        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1269        pub struct MakeAxesGizmo {
1270            /// If true, axes gizmo will be placed in the corner of the screen.
1271            /// If false, it will be placed at the origin of the scene.
1272            pub gizmo_mode: bool,
1273            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1274            pub clobber: bool,
1275        }
1276
1277        /// Query the given path.
1278        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1279        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1280        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1281        pub struct PathGetInfo {
1282            /// Which path to query
1283            pub path_id: Uuid,
1284        }
1285
1286        /// Obtain curve ids for vertex ids
1287        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1288        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1289        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1290        pub struct PathGetCurveUuidsForVertices {
1291            /// Which path to query
1292            pub path_id: Uuid,
1293
1294            /// IDs of the vertices for which to obtain curve ids from
1295            pub vertex_ids: Vec<Uuid>,
1296        }
1297
1298        /// Obtain curve id by index
1299        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1300        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1301        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1302        pub struct PathGetCurveUuid {
1303            /// Which path to query
1304            pub path_id: Uuid,
1305
1306            /// IDs of the vertices for which to obtain curve ids from
1307            pub index: u32,
1308        }
1309
1310        /// Obtain vertex ids for a path
1311        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1312        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1313        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1314        pub struct PathGetVertexUuids {
1315            /// Which path to query
1316            pub path_id: Uuid,
1317        }
1318
1319        /// Obtain the sketch target id (if the path was drawn in sketchmode) for a path
1320        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1321        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1322        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1323        pub struct PathGetSketchTargetUuid {
1324            /// Which path to query
1325            pub path_id: Uuid,
1326        }
1327
1328        /// Start dragging the mouse.
1329        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1330        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1331        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1332        pub struct HandleMouseDragStart {
1333            /// The mouse position.
1334            pub window: Point2d,
1335        }
1336
1337        /// Continue dragging the mouse.
1338        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1339        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1340        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1341        pub struct HandleMouseDragMove {
1342            /// The mouse position.
1343            pub window: Point2d,
1344            /// Logical timestamp. The client should increment this
1345            /// with every event in the current mouse drag. That way, if the
1346            /// events are being sent over an unordered channel, the API
1347            /// can ignore the older events.
1348            pub sequence: Option<u32>,
1349        }
1350
1351        /// Stop dragging the mouse.
1352        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1353        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1354        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1355        pub struct HandleMouseDragEnd {
1356            /// The mouse position.
1357            pub window: Point2d,
1358        }
1359
1360        /// Remove scene objects.
1361        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1362        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1363        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1364        pub struct RemoveSceneObjects {
1365            /// Objects to remove.
1366            pub object_ids: HashSet<Uuid>,
1367        }
1368
1369        /// Utility method. Performs both a ray cast and projection to plane-local coordinates.
1370        /// Returns the plane coordinates for the given window coordinates.
1371        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1372        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1373        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1374        pub struct PlaneIntersectAndProject {
1375            /// The plane you're intersecting against.
1376            pub plane_id: Uuid,
1377            /// Window coordinates where the ray cast should be aimed.
1378            pub window: Point2d,
1379        }
1380
1381        /// Find the start and end of a curve.
1382        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1383        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1384        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1385        pub struct CurveGetEndPoints {
1386            /// ID of the curve being queried.
1387            pub curve_id: Uuid,
1388        }
1389
1390        /// Reconfigure the stream.
1391        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1392        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1393        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1394        pub struct ReconfigureStream {
1395            /// Width of the stream.
1396            pub width: u32,
1397            /// Height of the stream.
1398            pub height: u32,
1399            /// Frames per second.
1400            pub fps: u32,
1401            /// Video feed's constant bitrate (CBR)
1402            #[serde(default)]
1403            pub bitrate: Option<u32>,
1404        }
1405
1406        /// Import files to the current model.
1407        #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1408        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1409        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1410        pub struct ImportFiles {
1411            /// Files to import.
1412            pub files: Vec<super::ImportFile>,
1413            /// Input file format.
1414            pub format: crate::format::InputFormat3d,
1415        }
1416
1417        /// Set the units of the scene.
1418        /// For all following commands, the units will be interpreted as the given units.
1419        /// Any previously executed commands will not be affected or have their units changed.
1420        /// They will remain in the units they were originally executed in.
1421        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1422        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1423        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1424        pub struct SetSceneUnits {
1425            /// Which units the scene uses.
1426            pub unit: units::UnitLength,
1427        }
1428
1429        /// Get the mass of entities in the scene or the default scene.
1430        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1431        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1432        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1433        pub struct Mass {
1434            /// IDs of the entities to get the mass of. If this is empty, then the default scene is included in
1435            /// the mass.
1436            pub entity_ids: Vec<Uuid>,
1437            /// The material density.
1438            pub material_density: f64,
1439            /// The material density unit.
1440            pub material_density_unit: units::UnitDensity,
1441            /// The output unit for the mass.
1442            pub output_unit: units::UnitMass,
1443        }
1444
1445        /// Get the density of entities in the scene or the default scene.
1446        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1447        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1448        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1449        pub struct Density {
1450            /// IDs of the entities to get the density of. If this is empty, then the default scene is included in
1451            /// the density.
1452            pub entity_ids: Vec<Uuid>,
1453            /// The material mass.
1454            pub material_mass: f64,
1455            /// The material mass unit.
1456            pub material_mass_unit: units::UnitMass,
1457            /// The output unit for the density.
1458            pub output_unit: units::UnitDensity,
1459        }
1460
1461        /// Get the volume of entities in the scene or the default scene.
1462        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1463        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1464        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1465        pub struct Volume {
1466            /// IDs of the entities to get the volume of. If this is empty, then the default scene is included in
1467            /// the volume.
1468            pub entity_ids: Vec<Uuid>,
1469            /// The output unit for the volume.
1470            pub output_unit: units::UnitVolume,
1471        }
1472
1473        /// Get the center of mass of entities in the scene or the default scene.
1474        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1475        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1476        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1477        pub struct CenterOfMass {
1478            /// IDs of the entities to get the center of mass of. If this is empty, then the default scene is included in
1479            /// the center of mass.
1480            pub entity_ids: Vec<Uuid>,
1481            /// The output unit for the center of mass.
1482            pub output_unit: units::UnitLength,
1483        }
1484
1485        /// Get the surface area of entities in the scene or the default scene.
1486        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1487        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1488        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1489        pub struct SurfaceArea {
1490            /// IDs of the entities to get the surface area of. If this is empty, then the default scene is included in
1491            /// the surface area.
1492            pub entity_ids: Vec<Uuid>,
1493            /// The output unit for the surface area.
1494            pub output_unit: units::UnitArea,
1495        }
1496
1497        /// Focus the default camera upon an object in the scene.
1498        #[derive(
1499            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1500        )]
1501        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1502        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1503        pub struct DefaultCameraFocusOn {
1504            /// UUID of object to focus on.
1505            pub uuid: Uuid,
1506        }
1507        /// When you select some entity with the current tool, what should happen to the entity?
1508        #[derive(
1509            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1510        )]
1511        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1512        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1513        pub struct SetSelectionType {
1514            /// What type of selection should occur when you select something?
1515            pub selection_type: SceneSelectionType,
1516        }
1517
1518        /// What kind of entities can be selected?
1519        #[derive(
1520            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1521        )]
1522        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1523        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1524        pub struct SetSelectionFilter {
1525            /// If vector is empty, clear all filters.
1526            /// If vector is non-empty, only the given entity types will be selectable.
1527            pub filter: Vec<EntityType>,
1528        }
1529
1530        /// Get the ids of a given entity type.
1531        #[derive(
1532            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1533        )]
1534        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1535        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1536        pub struct SceneGetEntityIds {
1537            /// The entity types to be queried.
1538            pub filter: Vec<EntityType>,
1539            /// Skip the first n returned ids. If multiple filters are provided, this skip will
1540            /// apply to each filter individually.
1541            pub skip: u32,
1542            /// Take n ids after any ids skipped. This value must be greater than zero and not
1543            /// exceed 1000. If multiple filters are provided, this take will apply to each filter
1544            /// individually. If there are fewer than `take` items of the provided filter type then the
1545            /// returned list's length will be the smaller value.
1546            #[schemars(range(min = 1, max = 1000))]
1547            pub take: u32,
1548        }
1549
1550        /// Use orthographic projection.
1551        #[derive(
1552            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1553        )]
1554        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1555        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1556        pub struct DefaultCameraSetOrthographic {}
1557
1558        /// Use perspective projection.
1559        #[derive(
1560            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1561        )]
1562        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1563        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1564        pub struct DefaultCameraSetPerspective {
1565            /// If this is not given, use the same parameters as last time the perspective camera was used.
1566            pub parameters: Option<PerspectiveCameraParameters>,
1567        }
1568
1569        ///Updates the camera to center to the center of the current selection
1570        ///(or the origin if nothing is selected)
1571        #[derive(
1572            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1573        )]
1574        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1575        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1576        pub struct DefaultCameraCenterToSelection {
1577            /// Dictates whether or not the camera position should be adjusted during this operation
1578            /// If no movement is requested, the camera will orbit around the new center from its current position
1579            #[serde(default)]
1580            pub camera_movement: CameraMovement,
1581        }
1582
1583        ///Updates the camera to center to the center of the current scene's bounds
1584        #[derive(
1585            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1586        )]
1587        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1588        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1589        pub struct DefaultCameraCenterToScene {
1590            /// Dictates whether or not the camera position should be adjusted during this operation
1591            /// If no movement is requested, the camera will orbit around the new center from its current position
1592            #[serde(default)]
1593            pub camera_movement: CameraMovement,
1594        }
1595
1596        /// Fit the view to the specified object(s).
1597        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1598        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1599        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1600        pub struct ZoomToFit {
1601            /// Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector.
1602            #[serde(default = "default_uuid_vector")]
1603            pub object_ids: Vec<Uuid>,
1604            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
1605            /// Negative padding will crop the view of the object proportionally.
1606            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
1607            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
1608            #[serde(default)]
1609            pub padding: f32,
1610            /// Whether or not to animate the camera movement.
1611            #[serde(default)]
1612            pub animated: bool,
1613        }
1614
1615        /// Looks along the normal of the specified face (if it is planar!), and fits the view to it.
1616        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1617        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1618        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1619        pub struct OrientToFace {
1620            /// Which face to orient camera to. If the face is not planar, no action will occur.
1621            pub face_id: Uuid,
1622            /// How much to pad the view frame by, as a fraction of the face bounding box size.
1623            /// Negative padding will crop the view of the face proportionally.
1624            /// e.g. padding = 0.2 means the view will span 120% of the face bounding box,
1625            /// and padding = -0.2 means the view will span 80% of the face bounding box.
1626            #[serde(default)]
1627            pub padding: f32,
1628            /// Whether or not to animate the camera movement. (Animation is currently not supported.)
1629            #[serde(default)]
1630            pub animated: bool,
1631        }
1632
1633        /// Fit the view to the scene with an isometric view.
1634        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1635        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1636        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1637        pub struct ViewIsometric {
1638            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
1639            /// Negative padding will crop the view of the object proportionally.
1640            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
1641            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
1642            #[serde(default = "f32::default")]
1643            pub padding: f32,
1644        }
1645
1646        /// Get a concise description of all of an extrusion's faces.
1647        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1648        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1649        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1650        pub struct Solid3dGetExtrusionFaceInfo {
1651            /// The Solid3d object whose extrusion is being queried.
1652            pub object_id: Uuid,
1653            /// Any edge that lies on the extrusion base path.
1654            pub edge_id: Uuid,
1655        }
1656
1657        /// Get a concise description of all of solids edges.
1658        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1659        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1660        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1661        pub struct Solid3dGetAdjacencyInfo {
1662            /// The Solid3d object whose info is being queried.
1663            pub object_id: Uuid,
1664            /// Any edge that lies on the extrusion base path.
1665            pub edge_id: Uuid,
1666        }
1667
1668
1669        /// Clear the selection
1670        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1671        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1672        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1673        pub struct SelectClear {}
1674
1675        /// Find all IDs of selected entities
1676        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1677        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1678        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1679        pub struct SelectGet {}
1680
1681        /// Get the number of objects in the scene
1682        #[derive(
1683            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1684        )]
1685        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1686        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1687        pub struct GetNumObjects {}
1688
1689        ///Set the transform of an object.
1690        #[derive(
1691            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1692        )]
1693        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1694        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1695        pub struct SetObjectTransform
1696        {
1697            /// Id of the object whose transform is to be set.
1698            pub object_id: Uuid,
1699            /// List of transforms to be applied to the object.
1700            pub transforms: Vec<ComponentTransform>,
1701        }
1702
1703        /// Create a new solid from combining other smaller solids.
1704        /// In other words, every part of the input solids will be included in the output solid.
1705        #[derive(
1706            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1707        )]
1708        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1709        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1710        pub struct BooleanUnion
1711        {
1712            /// Which solids to union together.
1713            /// Cannot be empty.
1714            pub solid_ids: Vec<Uuid>,
1715            /// The maximum acceptable surface gap computed between the joined solids. Must be positive (i.e. greater than zero).
1716            pub tolerance: LengthUnit,
1717        }
1718
1719        /// Create a new solid from intersecting several other solids.
1720        /// In other words, the part of the input solids where they all overlap will be the output solid.
1721        #[derive(
1722            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1723        )]
1724        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1725        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1726        pub struct BooleanIntersection
1727        {
1728            /// Which solids to intersect together
1729            pub solid_ids: Vec<Uuid>,
1730            /// The maximum acceptable surface gap computed between the joined solids. Must be positive (i.e. greater than zero).
1731            pub tolerance: LengthUnit,
1732        }
1733
1734        /// Create a new solid from subtracting several other solids.
1735        /// The 'target' is what will be cut from.
1736        /// The 'tool' is what will be cut out from 'target'.
1737        #[derive(
1738            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1739        )]
1740        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1741        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1742        pub struct BooleanSubtract
1743        {
1744            /// Geometry to cut out from.
1745            pub target_ids: Vec<Uuid>,
1746            /// Will be cut out from the 'target'.
1747            pub tool_ids: Vec<Uuid>,
1748            /// The maximum acceptable surface gap computed between the target and the solids cut out from it. Must be positive (i.e. greater than zero).
1749            pub tolerance: LengthUnit,
1750        }
1751
1752        /// Make a new path by offsetting an object by a given distance.
1753        /// The new path's ID will be the ID of this command.
1754        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1755        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1756        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1757        pub struct MakeOffsetPath {
1758            /// The object that will be offset (can be a path, sketch, or a solid)
1759            pub object_id: Uuid,
1760            /// If the object is a solid, this is the ID of the face to base the offset on.
1761            /// If given, and `object_id` refers to a solid, then this face on the solid will be offset.
1762            /// If given but `object_id` doesn't refer to a solid, responds with an error.
1763            /// If not given, then `object_id` itself will be offset directly.
1764            #[serde(default)]
1765            pub face_id: Option<Uuid>,
1766            /// The distance to offset the path (positive for outset, negative for inset)
1767            pub offset: LengthUnit,
1768        }
1769
1770        /// Add a hole to a closed path by offsetting it a uniform distance inward.
1771        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1772        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1773        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1774        pub struct AddHoleFromOffset {
1775            /// The closed path to add a hole to.
1776            pub object_id: Uuid,
1777            /// The distance to offset the path (positive for outset, negative for inset)
1778            pub offset: LengthUnit,
1779        }
1780
1781        /// Align the grid with a plane or a planar face.
1782        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1783        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1784        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1785        pub struct SetGridReferencePlane {
1786            /// The grid to be moved.
1787            pub grid_id: Uuid,
1788            /// The plane or face that the grid will be aligned to.
1789            /// If a face, it must be planar to succeed.
1790            pub reference_id: Uuid,
1791        }
1792
1793        /// Set the scale of the grid lines in the video feed.
1794        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1795        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1796        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1797        pub struct SetGridScale {
1798            /// Distance between grid lines represents this much distance.
1799            pub value: f32,
1800            /// Which units the `value` field uses.
1801            pub units: units::UnitLength,
1802        }
1803        /// Set the grid lines to auto scale. The grid will get larger the further you zoom out,
1804        /// and smaller the more you zoom in.
1805        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1806        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1807        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1808        pub struct SetGridAutoScale {
1809        }
1810    }
1811}
1812
1813impl ModelingCmd {
1814    /// Is this command safe to run in an engine batch?
1815    pub fn is_safe_to_batch(&self) -> bool {
1816        use ModelingCmd::*;
1817        matches!(
1818            self,
1819            MovePathPen(_)
1820                | ExtendPath(_)
1821                | Extrude(_)
1822                | Revolve(_)
1823                | Solid3dFilletEdge(_)
1824                | ClosePath(_)
1825                | UpdateAnnotation(_)
1826                | ObjectVisible(_)
1827                | ObjectBringToFront(_)
1828                | Solid2dAddHole(_)
1829                | SendObject(_)
1830                | EntitySetOpacity(_)
1831                | PlaneSetColor(_)
1832                | SetTool(_)
1833        )
1834    }
1835}
1836
1837/// File to import into the current model.
1838/// If you are sending binary data for a file, be sure to send the WebSocketRequest as
1839/// binary/bson, not text/json.
1840#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1841#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1842#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1843pub struct ImportFile {
1844    /// The file's full path, including file extension.
1845    pub path: String,
1846    /// The raw bytes of the file
1847    #[serde(
1848        serialize_with = "serde_bytes::serialize",
1849        deserialize_with = "serde_bytes::deserialize"
1850    )]
1851    pub data: Vec<u8>,
1852}