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