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