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