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