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        }
840
841        /// Determines whether a brep face is planar and returns its surface-local planar axes if so
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 FaceIsPlanar {
846            /// Which face is being queried.
847            pub object_id: Uuid,
848        }
849
850        /// Determines a position on a brep face evaluated by parameters u,v
851        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
852        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
853        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
854        pub struct FaceGetPosition {
855            /// Which face is being queried.
856            pub object_id: Uuid,
857
858            /// The 2D paramter-space u,v position to evaluate the surface at
859            pub uv: Point2d<f64>,
860        }
861
862        ///Obtains the surface "center of mass"
863        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
864        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
865        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
866        pub struct FaceGetCenter {
867            /// Which face is being queried.
868            pub object_id: Uuid,
869        }
870
871        /// Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v
872        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
873        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
874        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
875        pub struct FaceGetGradient {
876            /// Which face is being queried.
877            pub object_id: Uuid,
878
879            /// The 2D paramter-space u,v position to evaluate the surface at
880            pub uv: Point2d<f64>,
881        }
882
883        /// Send object to front or back.
884        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
885        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
886        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
887        pub struct SendObject {
888            /// Which object is being changed.
889            pub object_id: Uuid,
890            /// Bring to front = true, send to back = false.
891            pub front: bool,
892        }
893        /// Set opacity of the entity.
894        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
895        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
896        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
897        pub struct EntitySetOpacity {
898            /// Which entity is being changed.
899            pub entity_id: Uuid,
900            /// How transparent should it be?
901            /// 0 or lower is totally transparent.
902            /// 1 or greater is totally opaque.
903            pub opacity: f32,
904        }
905
906        /// Fade entity in or out.
907        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
908        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
909        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
910        pub struct EntityFade {
911            /// Which entity is being changed.
912            pub entity_id: Uuid,
913            /// Fade in = true, fade out = false.
914            pub fade_in: bool,
915            /// How many seconds the animation should take.
916            #[serde(default = "default_animation_seconds")]
917            pub duration_seconds: f32,
918        }
919
920        /// Make a new plane
921        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
922        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
923        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
924        pub struct MakePlane {
925            /// Origin of the plane
926            pub origin: Point3d<LengthUnit>,
927            /// What should the plane's X axis be?
928            pub x_axis: Point3d<f64>,
929            /// What should the plane's Y axis be?
930            pub y_axis: Point3d<f64>,
931            /// What should the plane's span/extent?
932            /// When rendered visually, this is both the
933            /// width and height along X and Y axis respectively.
934            pub size: LengthUnit,
935            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
936            pub clobber: bool,
937            /// If true, the plane will be created but hidden initially.
938            pub hide: Option<bool>,
939        }
940
941        /// Set the color of a plane.
942        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
943        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
944        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
945        pub struct PlaneSetColor {
946            /// Which plane is being changed.
947            pub plane_id: Uuid,
948            /// What color it should be.
949            pub color: Color,
950        }
951
952        /// Set the current tool.
953        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
954        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
955        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
956        pub struct SetTool {
957            /// What tool should be active.
958            pub tool: SceneToolType,
959        }
960
961        /// Send a mouse move event
962        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
963        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
964        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
965        pub struct MouseMove {
966            /// Where the mouse is
967            pub window: Point2d,
968            /// Logical timestamp. The client should increment this
969            /// with every event in the current mouse drag. That way, if the
970            /// events are being sent over an unordered channel, the API
971            /// can ignore the older events.
972            pub sequence: Option<u32>,
973        }
974
975        /// Send a mouse click event
976        /// Updates modified/selected entities.
977        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
978        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
979        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
980        pub struct MouseClick {
981            /// Where the mouse is
982            pub window: Point2d,
983        }
984
985        /// Disable sketch mode.
986        /// If you are sketching on a face, be sure to not disable sketch mode until you have extruded.
987        /// Otherwise, your object will not be fused with the face.
988        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
989        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
990        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
991        pub struct SketchModeDisable {}
992
993        /// Get the plane for sketch mode.
994        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
995        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
996        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
997        pub struct GetSketchModePlane {}
998
999        /// Get the plane for sketch mode.
1000        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1001        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1002        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1003        pub struct CurveSetConstraint {
1004            /// Which curve to constrain.
1005            pub object_id: Uuid,
1006            /// Which constraint to apply.
1007            pub constraint_bound: PathComponentConstraintBound,
1008            /// What part of the curve should be constrained.
1009            pub constraint_type: PathComponentConstraintType,
1010        }
1011
1012        /// Sketch on some entity (e.g. a plane, a face).
1013        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1014        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1015        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1016        pub struct EnableSketchMode {
1017            /// Which entity to sketch on.
1018            pub entity_id: Uuid,
1019            /// Should the camera use orthographic projection?
1020            /// In other words, should an object's size in the rendered image stay constant regardless of its distance from the camera.
1021            pub ortho: bool,
1022            /// Should we animate or snap for the camera transition?
1023            pub animated: bool,
1024            /// Should the camera move at all?
1025            pub adjust_camera: bool,
1026            /// If provided, ensures that the normal of the sketch plane must be aligned with this supplied normal
1027            /// (otherwise the camera position will be used to infer the normal to point towards the viewer)
1028            pub planar_normal: Option<Point3d<f64>>,
1029        }
1030
1031        /// Sets whether or not changes to the scene or its objects will be done as a "dry run"
1032        /// In a dry run, successful commands won't actually change the model.
1033        /// This is useful for catching errors before actually making the change.
1034        #[derive(Debug, Clone, Default, 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 EnableDryRun {}
1038
1039        /// Sets whether or not changes to the scene or its objects will be done as a "dry run"
1040        /// In a dry run, successful commands won't actually change the model.
1041        /// This is useful for catching errors before actually making the change.
1042        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1043        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1044        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1045        pub struct DisableDryRun {}
1046
1047        /// Set the background color of the scene.
1048        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1049        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1050        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1051        pub struct SetBackgroundColor {
1052            /// The color to set the background to.
1053            pub color: Color,
1054        }
1055
1056        /// Set the properties of the tool lines for the scene.
1057        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1058        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1059        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1060        pub struct SetCurrentToolProperties {
1061            /// The color to set the tool line to.
1062            pub color: Option<Color>,
1063        }
1064
1065        /// Set the default system properties used when a specific property isn't set.
1066        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1067        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1068        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1069        pub struct SetDefaultSystemProperties {
1070            /// The default system color.
1071            pub color: Option<Color>,
1072        }
1073
1074        /// Get type of the given curve.
1075        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1076        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1077        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1078        pub struct CurveGetType {
1079            /// Which curve to query.
1080            pub curve_id: Uuid,
1081        }
1082
1083        /// Get control points of the given curve.
1084        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1085        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1086        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1087        pub struct CurveGetControlPoints {
1088            /// Which curve to query.
1089            pub curve_id: Uuid,
1090        }
1091
1092        /// Project an entity on to a plane.
1093        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1094        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1095        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1096        pub struct ProjectEntityToPlane {
1097            /// Which entity to project (vertex or edge).
1098            pub entity_id: Uuid,
1099            /// Which plane to project entity_id onto.
1100            pub plane_id: Uuid,
1101            /// If true: the projected points are returned in the plane_id's coordinate system,
1102            /// else: the projected points are returned in the world coordinate system.
1103            pub use_plane_coords: bool,
1104        }
1105
1106        /// Project a list of points on to a plane.
1107        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1108        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1109        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1110        pub struct ProjectPointsToPlane {
1111            /// The id of the plane used for the projection.
1112            pub plane_id: Uuid,
1113            /// The list of points that will be projected.
1114            pub points: Vec<Point3d<f64>>,
1115            /// If true: the projected points are returned in the plane_id's coordinate sysetm.
1116            /// else: the projected points are returned in the world coordinate system.
1117            pub use_plane_coords: bool,
1118        }
1119
1120        /// Enum containing the variety of image formats snapshots may be exported to.
1121        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1122        #[serde(rename_all = "snake_case")]
1123        #[display(style = "snake_case")]
1124        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1125        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1126        pub enum ImageFormat {
1127            /// .png format
1128            Png,
1129            /// .jpeg format
1130            Jpeg,
1131        }
1132
1133        /// Take a snapshot of the current view.
1134        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1135        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1136        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1137        pub struct TakeSnapshot {
1138            /// What image format to return.
1139            pub format: ImageFormat,
1140        }
1141
1142        /// Add a gizmo showing the axes.
1143        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1144        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1145        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1146        pub struct MakeAxesGizmo {
1147            /// If true, axes gizmo will be placed in the corner of the screen.
1148            /// If false, it will be placed at the origin of the scene.
1149            pub gizmo_mode: bool,
1150            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1151            pub clobber: bool,
1152        }
1153
1154        /// Query the given path.
1155        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1156        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1157        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1158        pub struct PathGetInfo {
1159            /// Which path to query
1160            pub path_id: Uuid,
1161        }
1162
1163        /// Obtain curve ids for vertex ids
1164        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1165        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1166        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1167        pub struct PathGetCurveUuidsForVertices {
1168            /// Which path to query
1169            pub path_id: Uuid,
1170
1171            /// IDs of the vertices for which to obtain curve ids from
1172            pub vertex_ids: Vec<Uuid>,
1173        }
1174
1175        /// Obtain curve id by index
1176        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1177        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1178        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1179        pub struct PathGetCurveUuid {
1180            /// Which path to query
1181            pub path_id: Uuid,
1182
1183            /// IDs of the vertices for which to obtain curve ids from
1184            pub index: u32,
1185        }
1186
1187        /// Obtain vertex ids for a path
1188        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1189        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1190        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1191        pub struct PathGetVertexUuids {
1192            /// Which path to query
1193            pub path_id: Uuid,
1194        }
1195
1196        /// Obtain the sketch target id (if the path was drawn in sketchmode) for a path
1197        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1198        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1199        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1200        pub struct PathGetSketchTargetUuid {
1201            /// Which path to query
1202            pub path_id: Uuid,
1203        }
1204
1205        /// Start dragging the mouse.
1206        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1207        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1208        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1209        pub struct HandleMouseDragStart {
1210            /// The mouse position.
1211            pub window: Point2d,
1212        }
1213
1214        /// Continue dragging the mouse.
1215        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1216        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1217        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1218        pub struct HandleMouseDragMove {
1219            /// The mouse position.
1220            pub window: Point2d,
1221            /// Logical timestamp. The client should increment this
1222            /// with every event in the current mouse drag. That way, if the
1223            /// events are being sent over an unordered channel, the API
1224            /// can ignore the older events.
1225            pub sequence: Option<u32>,
1226        }
1227
1228        /// Stop dragging the mouse.
1229        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1230        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1231        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1232        pub struct HandleMouseDragEnd {
1233            /// The mouse position.
1234            pub window: Point2d,
1235        }
1236
1237        /// Remove scene objects.
1238        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1239        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1240        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1241        pub struct RemoveSceneObjects {
1242            /// Objects to remove.
1243            pub object_ids: HashSet<Uuid>,
1244        }
1245
1246        /// Utility method. Performs both a ray cast and projection to plane-local coordinates.
1247        /// Returns the plane coordinates for the given window coordinates.
1248        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1249        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1250        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1251        pub struct PlaneIntersectAndProject {
1252            /// The plane you're intersecting against.
1253            pub plane_id: Uuid,
1254            /// Window coordinates where the ray cast should be aimed.
1255            pub window: Point2d,
1256        }
1257
1258        /// Find the start and end of a curve.
1259        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1260        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1261        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1262        pub struct CurveGetEndPoints {
1263            /// ID of the curve being queried.
1264            pub curve_id: Uuid,
1265        }
1266
1267        /// Reconfigure the stream.
1268        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1269        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1270        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1271        pub struct ReconfigureStream {
1272            /// Width of the stream.
1273            pub width: u32,
1274            /// Height of the stream.
1275            pub height: u32,
1276            /// Frames per second.
1277            pub fps: u32,
1278            /// Video feed's constant bitrate (CBR)
1279            #[serde(default)]
1280            pub bitrate: Option<u32>,
1281        }
1282
1283        /// Import files to the current model.
1284        #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1285        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1286        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1287        pub struct ImportFiles {
1288            /// Files to import.
1289            pub files: Vec<super::ImportFile>,
1290            /// Input file format.
1291            pub format: crate::format::InputFormat3d,
1292        }
1293
1294        /// Set the units of the scene.
1295        /// For all following commands, the units will be interpreted as the given units.
1296        /// Any previously executed commands will not be affected or have their units changed.
1297        /// They will remain in the units they were originally executed in.
1298        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1299        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1300        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1301        pub struct SetSceneUnits {
1302            /// Which units the scene uses.
1303            pub unit: units::UnitLength,
1304        }
1305
1306        /// Get the mass of entities in the scene or the default scene.
1307        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1308        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1309        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1310        pub struct Mass {
1311            /// IDs of the entities to get the mass of. If this is empty, then the default scene is included in
1312            /// the mass.
1313            pub entity_ids: Vec<Uuid>,
1314            /// The material density.
1315            pub material_density: f64,
1316            /// The material density unit.
1317            pub material_density_unit: units::UnitDensity,
1318            /// The output unit for the mass.
1319            pub output_unit: units::UnitMass,
1320        }
1321
1322        /// Get the density of entities in the scene or the default scene.
1323        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1324        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1325        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1326        pub struct Density {
1327            /// IDs of the entities to get the density of. If this is empty, then the default scene is included in
1328            /// the density.
1329            pub entity_ids: Vec<Uuid>,
1330            /// The material mass.
1331            pub material_mass: f64,
1332            /// The material mass unit.
1333            pub material_mass_unit: units::UnitMass,
1334            /// The output unit for the density.
1335            pub output_unit: units::UnitDensity,
1336        }
1337
1338        /// Get the volume of entities in the scene or the default scene.
1339        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1340        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1341        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1342        pub struct Volume {
1343            /// IDs of the entities to get the volume of. If this is empty, then the default scene is included in
1344            /// the volume.
1345            pub entity_ids: Vec<Uuid>,
1346            /// The output unit for the volume.
1347            pub output_unit: units::UnitVolume,
1348        }
1349
1350        /// Get the center of mass of entities in the scene or the default scene.
1351        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1352        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1353        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1354        pub struct CenterOfMass {
1355            /// IDs of the entities to get the center of mass of. If this is empty, then the default scene is included in
1356            /// the center of mass.
1357            pub entity_ids: Vec<Uuid>,
1358            /// The output unit for the center of mass.
1359            pub output_unit: units::UnitLength,
1360        }
1361
1362        /// Get the surface area of entities in the scene or the default scene.
1363        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1364        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1365        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1366        pub struct SurfaceArea {
1367            /// IDs of the entities to get the surface area of. If this is empty, then the default scene is included in
1368            /// the surface area.
1369            pub entity_ids: Vec<Uuid>,
1370            /// The output unit for the surface area.
1371            pub output_unit: units::UnitArea,
1372        }
1373
1374        /// Focus the default camera upon an object in the scene.
1375        #[derive(
1376            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1377        )]
1378        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1379        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1380        pub struct DefaultCameraFocusOn {
1381            /// UUID of object to focus on.
1382            pub uuid: Uuid,
1383        }
1384        /// When you select some entity with the current tool, what should happen to the entity?
1385        #[derive(
1386            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1387        )]
1388        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1389        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1390        pub struct SetSelectionType {
1391            /// What type of selection should occur when you select something?
1392            pub selection_type: SceneSelectionType,
1393        }
1394
1395        /// What kind of entities can be selected?
1396        #[derive(
1397            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1398        )]
1399        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1400        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1401        pub struct SetSelectionFilter {
1402            /// If vector is empty, clear all filters.
1403            /// If vector is non-empty, only the given entity types will be selectable.
1404            pub filter: Vec<EntityType>,
1405        }
1406
1407        /// Use orthographic projection.
1408        #[derive(
1409            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1410        )]
1411        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1412        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1413        pub struct DefaultCameraSetOrthographic {}
1414
1415        /// Use perspective projection.
1416        #[derive(
1417            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1418        )]
1419        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1420        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1421        pub struct DefaultCameraSetPerspective {
1422            /// If this is not given, use the same parameters as last time the perspective camera was used.
1423            pub parameters: Option<PerspectiveCameraParameters>,
1424        }
1425
1426        ///Updates the camera to center to the center of the current selection
1427        ///(or the origin if nothing is selected)
1428        #[derive(
1429            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1430        )]
1431        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1432        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1433        pub struct DefaultCameraCenterToSelection {
1434            /// Dictates whether or not the camera position should be adjusted during this operation
1435            /// If no movement is requested, the camera will orbit around the new center from its current position
1436            #[serde(default)]
1437            pub camera_movement: CameraMovement,
1438        }
1439
1440        ///Updates the camera to center to the center of the current scene's bounds
1441        #[derive(
1442            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1443        )]
1444        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1445        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1446        pub struct DefaultCameraCenterToScene {
1447            /// Dictates whether or not the camera position should be adjusted during this operation
1448            /// If no movement is requested, the camera will orbit around the new center from its current position
1449            #[serde(default)]
1450            pub camera_movement: CameraMovement,
1451        }
1452
1453        /// Fit the view to the specified object(s).
1454        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1455        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1456        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1457        pub struct ZoomToFit {
1458            /// Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector.
1459            #[serde(default = "default_uuid_vector")]
1460            pub object_ids: Vec<Uuid>,
1461            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
1462            /// Negative padding will crop the view of the object proportionally.
1463            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
1464            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
1465            #[serde(default)]
1466            pub padding: f32,
1467            /// Whether or not to animate the camera movement.
1468            #[serde(default)]
1469            pub animated: bool,
1470        }
1471
1472        /// Looks along the normal of the specified face (if it is planar!), and fits the view to it.
1473        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1474        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1475        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1476        pub struct OrientToFace {
1477            /// Which face to orient camera to. If the face is not planar, no action will occur.
1478            pub face_id: Uuid,
1479            /// How much to pad the view frame by, as a fraction of the face bounding box size.
1480            /// Negative padding will crop the view of the face proportionally.
1481            /// e.g. padding = 0.2 means the view will span 120% of the face bounding box,
1482            /// and padding = -0.2 means the view will span 80% of the face bounding box.
1483            #[serde(default)]
1484            pub padding: f32,
1485            /// Whether or not to animate the camera movement. (Animation is currently not supported.)
1486            #[serde(default)]
1487            pub animated: bool,
1488        }
1489
1490        /// Fit the view to the scene with an isometric view.
1491        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1492        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1493        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1494        pub struct ViewIsometric {
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 = "f32::default")]
1500            pub padding: f32,
1501        }
1502
1503        /// Get a concise description of all of an extrusion's faces.
1504        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1505        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1506        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1507        pub struct Solid3dGetExtrusionFaceInfo {
1508            /// The Solid3d object whose extrusion is being queried.
1509            pub object_id: Uuid,
1510            /// Any edge that lies on the extrusion base path.
1511            pub edge_id: Uuid,
1512        }
1513
1514        /// Clear the selection
1515        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1516        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1517        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1518        pub struct SelectClear {}
1519
1520        /// Find all IDs of selected entities
1521        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1522        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1523        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1524        pub struct SelectGet {}
1525
1526        /// Get the number of objects in the scene
1527        #[derive(
1528            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1529        )]
1530        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1531        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1532        pub struct GetNumObjects {}
1533
1534        ///Set the transform of an object.
1535        #[derive(
1536            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1537        )]
1538        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1539        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1540        pub struct SetObjectTransform
1541        {
1542            /// Id of the object whose transform is to be set.
1543            pub object_id: Uuid,
1544            /// List of transforms to be applied to the object.
1545            pub transforms: Vec<ComponentTransform>,
1546        }
1547        /// Make a new path by offsetting an object by a given distance.
1548        /// The new path's ID will be the ID of this command.
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 MakeOffsetPath {
1553            /// The object that will be offset (can be a path, sketch, or a solid)
1554            pub object_id: Uuid,
1555            /// If the object is a solid, this is the ID of the face to base the offset on.
1556            /// If given, and `object_id` refers to a solid, then this face on the solid will be offset.
1557            /// If given but `object_id` doesn't refer to a solid, responds with an error.
1558            /// If not given, then `object_id` itself will be offset directly.
1559            #[serde(default)]
1560            pub face_id: Option<Uuid>,
1561            /// The distance to offset the path (positive for outset, negative for inset)
1562            pub offset: LengthUnit,
1563        }
1564
1565        /// Add a hole to a closed path by offsetting it a uniform distance inward.
1566        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1567        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1568        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1569        pub struct AddHoleFromOffset {
1570            /// The closed path to add a hole to.
1571            pub object_id: Uuid,
1572            /// The distance to offset the path (positive for outset, negative for inset)
1573            pub offset: LengthUnit,
1574        }
1575
1576        /// Align the grid with a plane or a planar face.
1577        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1578        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1579        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1580        pub struct SetGridReferencePlane {
1581            /// The grid to be moved.
1582            pub grid_id: Uuid,
1583            /// The plane or face that the grid will be aligned to.
1584            /// If a face, it must be planar to succeed.
1585            pub reference_id: Uuid,
1586        }
1587
1588    }
1589}
1590
1591impl ModelingCmd {
1592    /// Is this command safe to run in an engine batch?
1593    pub fn is_safe_to_batch(&self) -> bool {
1594        use ModelingCmd::*;
1595        matches!(
1596            self,
1597            MovePathPen(_)
1598                | ExtendPath(_)
1599                | Extrude(_)
1600                | Revolve(_)
1601                | Solid3dFilletEdge(_)
1602                | ClosePath(_)
1603                | UpdateAnnotation(_)
1604                | ObjectVisible(_)
1605                | ObjectBringToFront(_)
1606                | Solid2dAddHole(_)
1607                | SendObject(_)
1608                | EntitySetOpacity(_)
1609                | PlaneSetColor(_)
1610                | SetTool(_)
1611        )
1612    }
1613}
1614
1615/// File to import into the current model.
1616/// If you are sending binary data for a file, be sure to send the WebSocketRequest as
1617/// binary/bson, not text/json.
1618#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1619#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1620#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1621pub struct ImportFile {
1622    /// The file's full path, including file extension.
1623    pub path: String,
1624    /// The raw bytes of the file
1625    #[serde(
1626        serialize_with = "serde_bytes::serialize",
1627        deserialize_with = "serde_bytes::deserialize"
1628    )]
1629    pub data: Vec<u8>,
1630}