kittycad_modeling_cmds/
def_enum.rs

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