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, Copy, 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        #[cfg_attr(feature = "python", pyo3::pyclass, pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1196        pub enum ImageFormat {
1197            /// .png format
1198            Png,
1199            /// .jpeg format
1200            Jpeg,
1201        }
1202
1203        /// Take a snapshot of the current view.
1204        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1205        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1206        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1207        pub struct TakeSnapshot {
1208            /// What image format to return.
1209            pub format: ImageFormat,
1210        }
1211
1212        /// Add a gizmo showing the axes.
1213        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1214        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1215        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1216        pub struct MakeAxesGizmo {
1217            /// If true, axes gizmo will be placed in the corner of the screen.
1218            /// If false, it will be placed at the origin of the scene.
1219            pub gizmo_mode: bool,
1220            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1221            pub clobber: bool,
1222        }
1223
1224        /// Query the given path.
1225        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1226        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1227        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1228        pub struct PathGetInfo {
1229            /// Which path to query
1230            pub path_id: Uuid,
1231        }
1232
1233        /// Obtain curve ids for vertex ids
1234        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1235        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1236        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1237        pub struct PathGetCurveUuidsForVertices {
1238            /// Which path to query
1239            pub path_id: Uuid,
1240
1241            /// IDs of the vertices for which to obtain curve ids from
1242            pub vertex_ids: Vec<Uuid>,
1243        }
1244
1245        /// Obtain curve id by index
1246        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1247        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1248        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1249        pub struct PathGetCurveUuid {
1250            /// Which path to query
1251            pub path_id: Uuid,
1252
1253            /// IDs of the vertices for which to obtain curve ids from
1254            pub index: u32,
1255        }
1256
1257        /// Obtain vertex ids for a path
1258        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1259        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1260        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1261        pub struct PathGetVertexUuids {
1262            /// Which path to query
1263            pub path_id: Uuid,
1264        }
1265
1266        /// Obtain the sketch target id (if the path was drawn in sketchmode) for a path
1267        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1268        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1269        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1270        pub struct PathGetSketchTargetUuid {
1271            /// Which path to query
1272            pub path_id: Uuid,
1273        }
1274
1275        /// Start dragging the mouse.
1276        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1277        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1278        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1279        pub struct HandleMouseDragStart {
1280            /// The mouse position.
1281            pub window: Point2d,
1282        }
1283
1284        /// Continue dragging the mouse.
1285        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1286        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1287        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1288        pub struct HandleMouseDragMove {
1289            /// The mouse position.
1290            pub window: Point2d,
1291            /// Logical timestamp. The client should increment this
1292            /// with every event in the current mouse drag. That way, if the
1293            /// events are being sent over an unordered channel, the API
1294            /// can ignore the older events.
1295            pub sequence: Option<u32>,
1296        }
1297
1298        /// Stop dragging the mouse.
1299        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1300        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1301        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1302        pub struct HandleMouseDragEnd {
1303            /// The mouse position.
1304            pub window: Point2d,
1305        }
1306
1307        /// Remove scene objects.
1308        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1309        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1310        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1311        pub struct RemoveSceneObjects {
1312            /// Objects to remove.
1313            pub object_ids: HashSet<Uuid>,
1314        }
1315
1316        /// Utility method. Performs both a ray cast and projection to plane-local coordinates.
1317        /// Returns the plane coordinates for the given window coordinates.
1318        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1319        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1320        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1321        pub struct PlaneIntersectAndProject {
1322            /// The plane you're intersecting against.
1323            pub plane_id: Uuid,
1324            /// Window coordinates where the ray cast should be aimed.
1325            pub window: Point2d,
1326        }
1327
1328        /// Find the start and end of a curve.
1329        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1330        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1331        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1332        pub struct CurveGetEndPoints {
1333            /// ID of the curve being queried.
1334            pub curve_id: Uuid,
1335        }
1336
1337        /// Reconfigure the stream.
1338        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1339        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1340        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1341        pub struct ReconfigureStream {
1342            /// Width of the stream.
1343            pub width: u32,
1344            /// Height of the stream.
1345            pub height: u32,
1346            /// Frames per second.
1347            pub fps: u32,
1348            /// Video feed's constant bitrate (CBR)
1349            #[serde(default)]
1350            pub bitrate: Option<u32>,
1351        }
1352
1353        /// Import files to the current model.
1354        #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1355        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1356        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1357        pub struct ImportFiles {
1358            /// Files to import.
1359            pub files: Vec<super::ImportFile>,
1360            /// Input file format.
1361            pub format: crate::format::InputFormat3d,
1362        }
1363
1364        /// Set the units of the scene.
1365        /// For all following commands, the units will be interpreted as the given units.
1366        /// Any previously executed commands will not be affected or have their units changed.
1367        /// They will remain in the units they were originally executed in.
1368        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1369        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1370        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1371        pub struct SetSceneUnits {
1372            /// Which units the scene uses.
1373            pub unit: units::UnitLength,
1374        }
1375
1376        /// Get the mass of entities in the scene or the default scene.
1377        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1378        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1379        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1380        pub struct Mass {
1381            /// IDs of the entities to get the mass of. If this is empty, then the default scene is included in
1382            /// the mass.
1383            pub entity_ids: Vec<Uuid>,
1384            /// The material density.
1385            pub material_density: f64,
1386            /// The material density unit.
1387            pub material_density_unit: units::UnitDensity,
1388            /// The output unit for the mass.
1389            pub output_unit: units::UnitMass,
1390        }
1391
1392        /// Get the density of entities in the scene or the default scene.
1393        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1394        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1395        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1396        pub struct Density {
1397            /// IDs of the entities to get the density of. If this is empty, then the default scene is included in
1398            /// the density.
1399            pub entity_ids: Vec<Uuid>,
1400            /// The material mass.
1401            pub material_mass: f64,
1402            /// The material mass unit.
1403            pub material_mass_unit: units::UnitMass,
1404            /// The output unit for the density.
1405            pub output_unit: units::UnitDensity,
1406        }
1407
1408        /// Get the volume of entities in the scene or the default scene.
1409        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1410        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1411        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1412        pub struct Volume {
1413            /// IDs of the entities to get the volume of. If this is empty, then the default scene is included in
1414            /// the volume.
1415            pub entity_ids: Vec<Uuid>,
1416            /// The output unit for the volume.
1417            pub output_unit: units::UnitVolume,
1418        }
1419
1420        /// Get the center of mass of entities in the scene or the default scene.
1421        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1422        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1423        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1424        pub struct CenterOfMass {
1425            /// IDs of the entities to get the center of mass of. If this is empty, then the default scene is included in
1426            /// the center of mass.
1427            pub entity_ids: Vec<Uuid>,
1428            /// The output unit for the center of mass.
1429            pub output_unit: units::UnitLength,
1430        }
1431
1432        /// Get the surface area of entities in the scene or the default scene.
1433        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1434        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1435        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1436        pub struct SurfaceArea {
1437            /// IDs of the entities to get the surface area of. If this is empty, then the default scene is included in
1438            /// the surface area.
1439            pub entity_ids: Vec<Uuid>,
1440            /// The output unit for the surface area.
1441            pub output_unit: units::UnitArea,
1442        }
1443
1444        /// Focus the default camera upon an object in the scene.
1445        #[derive(
1446            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1447        )]
1448        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1449        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1450        pub struct DefaultCameraFocusOn {
1451            /// UUID of object to focus on.
1452            pub uuid: Uuid,
1453        }
1454        /// When you select some entity with the current tool, what should happen to the entity?
1455        #[derive(
1456            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1457        )]
1458        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1459        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1460        pub struct SetSelectionType {
1461            /// What type of selection should occur when you select something?
1462            pub selection_type: SceneSelectionType,
1463        }
1464
1465        /// What kind of entities can be selected?
1466        #[derive(
1467            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1468        )]
1469        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1470        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1471        pub struct SetSelectionFilter {
1472            /// If vector is empty, clear all filters.
1473            /// If vector is non-empty, only the given entity types will be selectable.
1474            pub filter: Vec<EntityType>,
1475        }
1476
1477        /// Use orthographic projection.
1478        #[derive(
1479            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1480        )]
1481        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1482        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1483        pub struct DefaultCameraSetOrthographic {}
1484
1485        /// Use perspective projection.
1486        #[derive(
1487            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1488        )]
1489        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1490        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1491        pub struct DefaultCameraSetPerspective {
1492            /// If this is not given, use the same parameters as last time the perspective camera was used.
1493            pub parameters: Option<PerspectiveCameraParameters>,
1494        }
1495
1496        ///Updates the camera to center to the center of the current selection
1497        ///(or the origin if nothing is selected)
1498        #[derive(
1499            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1500        )]
1501        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1502        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1503        pub struct DefaultCameraCenterToSelection {
1504            /// Dictates whether or not the camera position should be adjusted during this operation
1505            /// If no movement is requested, the camera will orbit around the new center from its current position
1506            #[serde(default)]
1507            pub camera_movement: CameraMovement,
1508        }
1509
1510        ///Updates the camera to center to the center of the current scene's bounds
1511        #[derive(
1512            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1513        )]
1514        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1515        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1516        pub struct DefaultCameraCenterToScene {
1517            /// Dictates whether or not the camera position should be adjusted during this operation
1518            /// If no movement is requested, the camera will orbit around the new center from its current position
1519            #[serde(default)]
1520            pub camera_movement: CameraMovement,
1521        }
1522
1523        /// Fit the view to the specified object(s).
1524        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1525        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1526        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1527        pub struct ZoomToFit {
1528            /// Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector.
1529            #[serde(default = "default_uuid_vector")]
1530            pub object_ids: Vec<Uuid>,
1531            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
1532            /// Negative padding will crop the view of the object proportionally.
1533            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
1534            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
1535            #[serde(default)]
1536            pub padding: f32,
1537            /// Whether or not to animate the camera movement.
1538            #[serde(default)]
1539            pub animated: bool,
1540        }
1541
1542        /// Looks along the normal of the specified face (if it is planar!), and fits the view to it.
1543        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1544        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1545        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1546        pub struct OrientToFace {
1547            /// Which face to orient camera to. If the face is not planar, no action will occur.
1548            pub face_id: Uuid,
1549            /// How much to pad the view frame by, as a fraction of the face bounding box size.
1550            /// Negative padding will crop the view of the face proportionally.
1551            /// e.g. padding = 0.2 means the view will span 120% of the face bounding box,
1552            /// and padding = -0.2 means the view will span 80% of the face bounding box.
1553            #[serde(default)]
1554            pub padding: f32,
1555            /// Whether or not to animate the camera movement. (Animation is currently not supported.)
1556            #[serde(default)]
1557            pub animated: bool,
1558        }
1559
1560        /// Fit the view to the scene with an isometric view.
1561        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1562        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1563        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1564        pub struct ViewIsometric {
1565            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
1566            /// Negative padding will crop the view of the object proportionally.
1567            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
1568            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
1569            #[serde(default = "f32::default")]
1570            pub padding: f32,
1571        }
1572
1573        /// Get a concise description of all of an extrusion's faces.
1574        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1575        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1576        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1577        pub struct Solid3dGetExtrusionFaceInfo {
1578            /// The Solid3d object whose extrusion is being queried.
1579            pub object_id: Uuid,
1580            /// Any edge that lies on the extrusion base path.
1581            pub edge_id: Uuid,
1582        }
1583
1584        /// Get a concise description of all of solids edges.
1585        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1586        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1587        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1588        pub struct Solid3dGetAdjacencyInfo {
1589            /// The Solid3d object whose info is being queried.
1590            pub object_id: Uuid,
1591            /// Any edge that lies on the extrusion base path.
1592            pub edge_id: Uuid,
1593        }
1594
1595
1596        /// Clear the selection
1597        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1598        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1599        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1600        pub struct SelectClear {}
1601
1602        /// Find all IDs of selected entities
1603        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1604        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1605        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1606        pub struct SelectGet {}
1607
1608        /// Get the number of objects in the scene
1609        #[derive(
1610            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1611        )]
1612        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1613        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1614        pub struct GetNumObjects {}
1615
1616        ///Set the transform of an object.
1617        #[derive(
1618            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1619        )]
1620        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1621        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1622        pub struct SetObjectTransform
1623        {
1624            /// Id of the object whose transform is to be set.
1625            pub object_id: Uuid,
1626            /// List of transforms to be applied to the object.
1627            pub transforms: Vec<ComponentTransform>,
1628        }
1629
1630        /// Create a new solid from combining other smaller solids.
1631        /// In other words, every part of the input solids will be included in the output solid.
1632        #[derive(
1633            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1634        )]
1635        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1636        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1637        pub struct BooleanUnion
1638        {
1639            /// Which solids to union together.
1640            /// Cannot be empty.
1641            pub solid_ids: Vec<Uuid>,
1642            /// The maximum acceptable surface gap computed between the joined solids. Must be positive (i.e. greater than zero).
1643            pub tolerance: LengthUnit,
1644        }
1645
1646        /// Create a new solid from intersecting several other solids.
1647        /// In other words, the part of the input solids where they all overlap will be the output solid.
1648        #[derive(
1649            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1650        )]
1651        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1652        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1653        pub struct BooleanIntersection
1654        {
1655            /// Which solids to intersect together
1656            pub solid_ids: Vec<Uuid>,
1657            /// The maximum acceptable surface gap computed between the joined solids. Must be positive (i.e. greater than zero).
1658            pub tolerance: LengthUnit,
1659        }
1660
1661        /// Create a new solid from subtracting several other solids.
1662        /// The 'target' is what will be cut from.
1663        /// The 'tool' is what will be cut out from 'target'.
1664        #[derive(
1665            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1666        )]
1667        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1668        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1669        pub struct BooleanSubtract
1670        {
1671            /// Geometry to cut out from.
1672            pub target_ids: Vec<Uuid>,
1673            /// Will be cut out from the 'target'.
1674            pub tool_ids: Vec<Uuid>,
1675            /// The maximum acceptable surface gap computed between the target and the solids cut out from it. Must be positive (i.e. greater than zero).
1676            pub tolerance: LengthUnit,
1677        }
1678
1679        /// Make a new path by offsetting an object by a given distance.
1680        /// The new path's ID will be the ID of this command.
1681        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1682        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1683        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1684        pub struct MakeOffsetPath {
1685            /// The object that will be offset (can be a path, sketch, or a solid)
1686            pub object_id: Uuid,
1687            /// If the object is a solid, this is the ID of the face to base the offset on.
1688            /// If given, and `object_id` refers to a solid, then this face on the solid will be offset.
1689            /// If given but `object_id` doesn't refer to a solid, responds with an error.
1690            /// If not given, then `object_id` itself will be offset directly.
1691            #[serde(default)]
1692            pub face_id: Option<Uuid>,
1693            /// The distance to offset the path (positive for outset, negative for inset)
1694            pub offset: LengthUnit,
1695        }
1696
1697        /// Add a hole to a closed path by offsetting it a uniform distance inward.
1698        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1699        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1700        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1701        pub struct AddHoleFromOffset {
1702            /// The closed path to add a hole to.
1703            pub object_id: Uuid,
1704            /// The distance to offset the path (positive for outset, negative for inset)
1705            pub offset: LengthUnit,
1706        }
1707
1708        /// Align the grid with a plane or a planar face.
1709        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1710        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1711        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1712        pub struct SetGridReferencePlane {
1713            /// The grid to be moved.
1714            pub grid_id: Uuid,
1715            /// The plane or face that the grid will be aligned to.
1716            /// If a face, it must be planar to succeed.
1717            pub reference_id: Uuid,
1718        }
1719
1720        /// Set the scale of the grid lines in the video feed.
1721        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1722        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1723        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1724        pub struct SetGridScale {
1725            /// Distance between grid lines represents this much distance.
1726            pub value: f32,
1727            /// Which units the `value` field uses.
1728            pub units: units::UnitLength,
1729        }
1730        /// Set the grid lines to auto scale. The grid will get larger the further you zoom out,
1731        /// and smaller the more you zoom in.
1732        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1733        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1734        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1735        pub struct SetGridAutoScale {
1736        }
1737    }
1738}
1739
1740impl ModelingCmd {
1741    /// Is this command safe to run in an engine batch?
1742    pub fn is_safe_to_batch(&self) -> bool {
1743        use ModelingCmd::*;
1744        matches!(
1745            self,
1746            MovePathPen(_)
1747                | ExtendPath(_)
1748                | Extrude(_)
1749                | Revolve(_)
1750                | Solid3dFilletEdge(_)
1751                | ClosePath(_)
1752                | UpdateAnnotation(_)
1753                | ObjectVisible(_)
1754                | ObjectBringToFront(_)
1755                | Solid2dAddHole(_)
1756                | SendObject(_)
1757                | EntitySetOpacity(_)
1758                | PlaneSetColor(_)
1759                | SetTool(_)
1760        )
1761    }
1762}
1763
1764/// File to import into the current model.
1765/// If you are sending binary data for a file, be sure to send the WebSocketRequest as
1766/// binary/bson, not text/json.
1767#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1768#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1769#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1770pub struct ImportFile {
1771    /// The file's full path, including file extension.
1772    pub path: String,
1773    /// The raw bytes of the file
1774    #[serde(
1775        serialize_with = "serde_bytes::serialize",
1776        deserialize_with = "serde_bytes::deserialize"
1777    )]
1778    pub data: Vec<u8>,
1779}