kittycad_modeling_cmds/
def_enum.rs

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