Skip to main content

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