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