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        use crate::shared::MirrorAcross;
21
22        use crate::{
23            format::{OutputFormat2d, OutputFormat3d},
24            id::ModelingCmdId,
25            length_unit::LengthUnit,
26            kcl_project::KclProject,
27            shared::{
28                Angle,
29                RegionVersion,
30                BlendType,
31                BodyType,
32                EdgeCutVersion,
33                ComponentTransform,
34                RelativeTo,
35                CutType, CutTypeV2,
36                CutStrategy,
37                CameraMovement,
38                DirectionType,
39                EdgeSpecifier,
40                EntityReference,
41                ExtrudedFaceInfo, ExtrudeMethod,
42                AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
43                PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
44                Point2d, Point3d, ExtrudeReference, SceneSelectionType, SceneToolType, SurfaceEdgeReference, Opposite,
45                Tolerance,
46            },
47            units,
48        };
49
50        /// Mike says this usually looks nice.
51        fn default_animation_seconds() -> f64 {
52            0.4
53        }
54
55        fn mm() -> crate::units::UnitLength {
56            crate::units::UnitLength::Millimeters
57        }
58
59        /// Evaluates the position of a path in one shot (engine utility for kcl executor)
60        #[derive(
61            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
62        )]
63        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
64        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
65        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
66        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
67        pub struct EngineUtilEvaluatePath {
68            /// The path in json form (the serialized result of the kcl Sketch/Path object
69            pub path_json: String,
70
71            /// The evaluation parameter (path curve parameter in the normalized domain [0, 1])
72            pub t: f64,
73        }
74
75        /// Start a new path.
76        #[derive(
77            Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
78            Builder
79        )]
80        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
81        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
82        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
83        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
84        pub struct StartPath {}
85
86        /// Move the path's "pen".
87        /// If you're in sketch mode, these coordinates are in the local coordinate system,
88        /// not the world's coordinate system.
89        /// For example, say you're sketching on the plane {x: (1,0,0), y: (0,1,0), origin: (0, 0, 50)}.
90        /// In other words, the plane 50 units above the default XY plane. Then, moving the pen
91        /// to (1, 1, 0) with this command uses local coordinates. So, it would move the pen to
92        /// (1, 1, 50) in global coordinates.
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 = "arbitrary", derive(arbitrary::Arbitrary))]
98        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
99        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
100        pub struct MovePathPen {
101            /// The ID of the command which created the path.
102            pub path: ModelingCmdId,
103            /// Where the path's pen should be.
104            pub to: Point3d<LengthUnit>,
105        }
106
107        /// Extend a path by adding a new segment which starts at the path's "pen".
108        /// If no "pen" location has been set before (via `MovePen`), then the pen is at the origin.
109        #[derive(
110            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
111        )]
112        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
113        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
114        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
115        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
116        pub struct ExtendPath {
117            /// The ID of the command which created the path.
118            pub path: ModelingCmdId,
119            /// Segment to append to the path.
120            /// This segment will implicitly begin at the current "pen" location.
121            pub segment: PathSegment,
122            /// Optional label to associate with the new path segment.
123            #[serde(default, skip_serializing_if = "Option::is_none")]
124            pub label: Option<String>,
125        }
126
127        /// Command for extruding a solid 2d.
128        #[derive(
129            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
130        )]
131        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
132        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
133        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
134        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
135        pub struct Extrude {
136            /// Which sketch to extrude (legacy API).
137            /// Must be a closed 2D solid. If `target_reference` is provided, the reference takes precedence.
138            #[serde(default, skip_serializing_if = "Option::is_none")]
139            pub target: Option<ModelingCmdId>,
140            /// Edge specifier identifying the edge to extrude. If provided, this takes precedence over `target`.
141            #[serde(default, skip_serializing_if = "Option::is_none")]
142            pub target_reference: Option<EdgeSpecifier>,
143            /// How far off the plane to extrude
144            /// This distance is relative to the target's plane, not an absolute coordinate.
145            /// Symmetric extrusions will extrude outwards from both sides of the sketch to the length specified.
146            pub distance: LengthUnit,
147            /// What direction to extrude in. If None, the engine will extrude in the direction normal of the target's plane.
148            /// Legacy field; if `direction_reference` is provided, the reference takes precedence.
149            #[serde(default, skip_serializing_if = "Option::is_none")]
150            pub direction: Option<DirectionType>,
151            /// Edge specifier identifying the edge direction to use. If provided, this takes precedence over `direction`.
152            #[serde(default, skip_serializing_if = "Option::is_none")]
153            pub direction_reference: Option<EdgeSpecifier>,
154            /// What draft angle should be used in this extrusion?
155            /// Negative values indicate an outward draft,
156            /// while positive values indicate an inward draft
157            #[serde(default, skip_serializing_if = "Option::is_none")]
158            pub draft_angle: Option<Angle>,
159            /// Which IDs should the new faces have?
160            /// If this isn't given, the engine will generate IDs.
161            #[serde(default)]
162            pub faces: Option<ExtrudedFaceInfo>,
163            /// Should the extrusion also extrude in the opposite direction?
164            /// If so, this specifies its distance.
165            #[serde(default)]
166            #[builder(default)]
167            pub opposite: Opposite<LengthUnit>,
168            /// Should the extrusion create a new object or be part of the existing object.
169            #[builder(default)]
170            #[serde(default)]
171            pub extrude_method: ExtrudeMethod,
172            /// Only used if the extrusion is created from a face and extrude_method = Merge
173            /// If true, coplanar faces will be merged and seams will be hidden.
174            /// Otherwise, seams between the extrusion and original body will be shown.
175            #[serde(default, skip_serializing_if = "Option::is_none")]
176            pub merge_coplanar_faces: Option<bool>,
177
178            /// Should this extrude create a solid body or a surface?
179            #[serde(default)]
180            #[builder(default)]
181            pub body_type: BodyType,
182        }
183
184        /// Command for extruding a solid 2d to a reference geometry.
185        #[derive(
186            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
187        )]
188        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
189        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
190        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
191        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
192        pub struct ExtrudeToReference {
193            /// Which sketch or edge to extrude (legacy API).
194            ///
195            /// Must be a closed 2D solid, or an edge for surface extrusions. Either
196            /// `target` or `target_reference` must be provided.
197            #[serde(default, skip_serializing_if = "Option::is_none")]
198            pub target: Option<ModelingCmdId>,
199            /// Edge specifier identifying the source edge to extrude. If provided, this
200            /// takes precedence over `target`.
201            #[serde(default, skip_serializing_if = "Option::is_none")]
202            pub target_reference: Option<EdgeSpecifier>,
203            /// Reference to extrude to.
204            /// Extrusion occurs along the target's normal until it is as close to the reference as possible.
205            pub reference: ExtrudeReference,
206            /// Which IDs should the new faces have?
207            /// If this isn't given, the engine will generate IDs.
208            #[serde(default)]
209            pub faces: Option<ExtrudedFaceInfo>,
210            /// Should the extrusion create a new object or be part of the existing object.
211            #[serde(default)]
212            #[builder(default)]
213            pub extrude_method: ExtrudeMethod,
214            /// Should this extrude create a solid body or a surface?
215            #[serde(default)]
216            #[builder(default)]
217            pub body_type: BodyType,
218        }
219
220        fn default_twist_extrude_section_interval() -> Angle {
221            Angle::from_degrees(15.0)
222        }
223
224        /// Command for twist extruding a solid 2d.
225        #[derive(
226            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
227        )]
228        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
229        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
230        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
231        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
232        pub struct TwistExtrude {
233            /// Which sketch to extrude.
234            /// Must be a closed 2D solid.
235            pub target: ModelingCmdId,
236            /// How far off the plane to extrude
237            pub distance: LengthUnit,
238            /// Which IDs should the new faces have?
239            /// If this isn't given, the engine will generate IDs.
240            #[serde(default)]
241            pub faces: Option<ExtrudedFaceInfo>,
242            /// Center to twist about (relative to plane's origin)
243            /// Defaults to `[0, 0]` i.e. the plane's origin
244            #[serde(default)]
245            #[builder(default)]
246            pub center_2d: Point2d<f64>,
247            /// Total rotation of the section
248            pub total_rotation_angle: Angle,
249            /// Angle step interval (converted to whole number degrees and bounded between 4° and 90°)
250            #[serde(default = "default_twist_extrude_section_interval")]
251            #[builder(default = default_twist_extrude_section_interval())]
252            pub angle_step_size: Angle,
253            /// The twisted surface loft tolerance
254            pub tolerance: LengthUnit,
255            /// Should this extrude create a solid body or a surface?
256            #[serde(default)]
257            #[builder(default)]
258            pub body_type: BodyType,
259        }
260
261        /// Extrude the object along a path.
262        #[derive(
263            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder
264        )]
265        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
266        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
267        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
268        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
269        pub struct Sweep {
270            /// Which sketch to sweep.
271            /// Must be a closed 2D solid.
272            pub target: ModelingCmdId,
273            /// Path along which to sweep.
274            pub trajectory: ModelingCmdId,
275            /// If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components.
276            pub sectional: bool,
277            /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
278            pub tolerance: LengthUnit,
279            /// Should this sweep create a solid body or a surface?
280            #[serde(default)]
281            #[builder(default)]
282            pub body_type: BodyType,
283            /// What is this sweep relative to?
284            /// Deprecated; please use `translate_profile_to_path` and `orient_profile_perpendicular` instead.
285            #[serde(default)]
286            pub relative_to: Option<RelativeTo>,
287            /// What version of the sweeping algorithm to use. If None, or zero, the engine's
288            /// default algorithm will be used
289            #[serde(default, skip_serializing_if = "Option::is_none")]
290            pub version: Option<u8>,
291            /// If true, the profile being swept will be moved to the path being swept along,
292            /// before the sweep starts.
293            /// If false, the profile stays where it is, and the sweep starts from there.
294            /// Defaults to false.
295            #[serde(default, skip_serializing_if = "Option::is_none")]
296            pub translate_profile_to_path: Option<bool>,
297            /// If true, before the sweep starts, the profile will be re-oriented
298            /// so that it is perpendicular to the path being swept along.
299            /// If false, the profile is left in its current orientation.
300            /// Defaults to false.
301            #[serde(default, skip_serializing_if = "Option::is_none")]
302            pub orient_profile_perpendicular: Option<bool>,
303            /// If orient_profile_perpendicular is true, the sketch shall be oriented such that the
304            /// local Y axis of the sketch will be oriented to align with this element as much as
305            /// possible.
306            /// Defaults to +Z if not set
307            #[serde(default, skip_serializing_if = "Option::is_none")]
308            pub projected_axis: Option<DirectionType>,
309        }
310
311        /// Command for revolving a solid 2d.
312        #[derive(
313            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
314        )]
315        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
316        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
317        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
318        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
319        pub struct Revolve {
320            /// Which sketch to revolve.
321            /// Must be a closed 2D solid.
322            pub target: ModelingCmdId,
323            /// The origin of the extrusion axis
324            pub origin: Point3d<LengthUnit>,
325            /// The axis of the extrusion (taken from the origin)
326            pub axis: Point3d<f64>,
327            /// If true, the axis is interpreted within the 2D space of the solid 2D's plane
328            pub axis_is_2d: bool,
329            /// The signed angle of revolution (in degrees, must be <= 360 in either direction)
330            pub angle: Angle,
331            /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
332            pub tolerance: LengthUnit,
333            /// Should the revolution also revolve in the opposite direction along the given axis?
334            /// If so, this specifies its angle.
335            #[serde(default)]
336            #[builder(default)]
337            pub opposite: Opposite<Angle>,
338            /// Should this extrude create a solid body or a surface?
339            #[serde(default)]
340            #[builder(default)]
341            pub body_type: BodyType,
342        }
343
344        /// Command for shelling a solid3d face
345        #[derive(
346            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
347        )]
348        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
349        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
350        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
351        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
352        pub struct Solid3dShellFace {
353            /// Which Solid3D is being shelled.
354            pub object_id: Uuid,
355            /// Which faces to remove, leaving only the shell.
356            pub face_ids: Vec<Uuid>,
357            /// How thick the shell should be.
358            /// Smaller values mean a thinner shell.
359            pub shell_thickness: LengthUnit,
360            /// If true, the Solid3D is made hollow instead of removing the selected faces
361            #[serde(default)]
362            #[builder(default)]
363            pub hollow: bool,
364        }
365
366        /// Command for joining a Surface (non-manifold) body back to a Solid.
367        /// All of the surfaces should already be contained within the body mated topologically.
368        /// This operation should be the final step after a sequence of Solid modeling commands such as
369        /// BooleanImprint, EntityDeleteChildren, Solid3dFlipFace
370        /// If successful, the new body type will become "Solid".
371        #[derive(
372            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
373        )]
374        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
375        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
376        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
377        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
378        pub struct Solid3dJoin {
379            /// Which Solid3D is being joined.
380            pub object_id: Uuid,
381        }
382
383        /// Command for joining multiple Surfaces (non-manifold) to a Solid.
384        #[derive(
385            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
386        )]
387        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
388        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
389        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
390        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
391        pub struct Solid3dMultiJoin {
392            /// Which bodies are being joined.
393            pub object_ids: Vec<Uuid>,
394            /// The maximum acceptable surface gap computed between the joints. Must be positive (i.e. greater than zero).
395            pub tolerance: LengthUnit,
396        }
397
398
399        /// Command for creating a blend between the edge of two given surfaces
400        #[derive(
401            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
402        )]
403        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
404        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
405        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
406        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
407        pub struct SurfaceBlend {
408            /// The two surfaces that the blend will span between
409            #[schemars(length(min = 2, max = 2))]
410            pub surfaces: Vec<SurfaceEdgeReference>,
411            /// The type of blend to use.
412            #[serde(default)]
413            #[builder(default)]
414            pub blend_type: BlendType,
415        }
416
417        /// What is the UUID of this body's n-th edge?
418        #[derive(
419            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
420        )]
421        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
422        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
423        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
424        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
425        pub struct Solid3dGetEdgeUuid {
426            /// The Solid3D parent who owns the edge
427            pub object_id: Uuid,
428
429            /// The primitive index of the edge being queried.
430            pub edge_index: u32,
431        }
432
433        /// What is the UUID of this body's n-th face?
434        #[derive(
435            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
436        )]
437        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
438        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
439        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
440        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
441        pub struct Solid3dGetFaceUuid {
442            /// The Solid3D parent who owns the face
443            pub object_id: Uuid,
444
445            /// The primitive index of the face being queried.
446            pub face_index: u32,
447        }
448
449        /// Retrieves the body type.
450        #[derive(
451            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
452        )]
453        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
454        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
455        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
456        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
457        pub struct Solid3dGetBodyType {
458            /// The Solid3D whose body type is being queried.
459            pub object_id: Uuid,
460        }
461
462        /// Command for revolving a solid 2d about a brep edge
463        #[derive(
464            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
465        )]
466        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
467        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
468        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
469        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
470        pub struct RevolveAboutEdge {
471            /// Which sketch to revolve.
472            /// Must be a closed 2D solid.
473            pub target: ModelingCmdId,
474            /// The edge to use as the axis of revolution, must be linear and lie in the plane of the solid
475            #[serde(default, skip_serializing_if = "Option::is_none")]
476            pub edge_id: Option<Uuid>,
477            /// Edge reference to use as the axis of revolution (new API).
478            /// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
479            #[serde(default, skip_serializing_if = "Option::is_none")]
480            pub edge_reference: Option<EdgeSpecifier>,
481            /// The signed angle of revolution (in degrees, must be <= 360 in either direction)
482            pub angle: Angle,
483            /// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
484            pub tolerance: LengthUnit,
485            /// Should the revolution also revolve in the opposite direction along the given axis?
486            /// If so, this specifies its angle.
487            #[serde(default)]
488            #[builder(default)]
489            pub opposite: Opposite<Angle>,
490            /// Should this extrude create a solid body or a surface?
491            #[serde(default)]
492            #[builder(default)]
493            pub body_type: BodyType,
494        }
495
496        /// Command for lofting sections to create a solid
497        #[derive(
498            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
499        )]
500        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
501        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
502        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
503        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
504        pub struct Loft {
505            /// The closed section curves to create a lofted solid from.
506            /// Currently, these must be Solid2Ds
507            pub section_ids: Vec<Uuid>,
508            /// Degree of the interpolation. Must be greater than zero.
509            /// For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction.
510            pub v_degree: std::num::NonZeroU32,
511            /// Attempt to approximate rational curves (such as arcs) using a bezier.
512            /// This will remove banding around interpolations between arcs and non-arcs.  It may produce errors in other scenarios
513            /// Over time, this field won't be necessary.
514            pub bez_approximate_rational: bool,
515            /// This can be set to override the automatically determined topological base curve, which is usually the first section encountered.
516            pub base_curve_index: Option<u32>,
517            /// Tolerance
518            pub tolerance: LengthUnit,
519            /// Should this loft create a solid body or a surface?
520            #[serde(default)]
521            #[builder(default)]
522            pub body_type: BodyType,
523        }
524
525
526        /// Closes a path, converting it to a 2D solid.
527        #[derive(
528            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
529        )]
530        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
531        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
532        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
533        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
534        pub struct ClosePath {
535            /// Which path to close.
536            pub path_id: Uuid,
537        }
538
539        /// Camera drag started.
540        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
541        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
542        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
543        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
544        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
545        pub struct CameraDragStart {
546            /// The type of camera drag interaction.
547            pub interaction: CameraDragInteractionType,
548            /// The initial mouse position.
549            pub window: Point2d,
550        }
551
552        /// Camera drag continued.
553        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
554        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
555        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
556        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
557        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
558        pub struct CameraDragMove {
559            /// The type of camera drag interaction.
560            pub interaction: CameraDragInteractionType,
561            /// The current mouse position.
562            pub window: Point2d,
563            /// Logical timestamp. The client should increment this
564            /// with every event in the current mouse drag. That way, if the
565            /// events are being sent over an unordered channel, the API
566            /// can ignore the older events.
567            pub sequence: Option<u32>,
568        }
569
570        /// Camera drag ended
571        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
572        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
573        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
574        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
575        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
576        pub struct CameraDragEnd {
577            /// The type of camera drag interaction.
578            pub interaction: CameraDragInteractionType,
579            /// The final mouse position.
580            pub window: Point2d,
581        }
582
583        /// Gets the default camera's camera settings
584        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
585        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
586        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
587        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
588        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
589        pub struct DefaultCameraGetSettings {}
590
591        /// Gets the default camera's view state
592        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
593        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
594        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
595        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
596        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
597        pub struct DefaultCameraGetView {}
598
599        /// Sets the default camera's view state
600        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
601        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
602        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
603        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
604        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
605        pub struct DefaultCameraSetView {
606            /// Camera view state
607            pub view: CameraViewState,
608        }
609
610        /// Change what the default camera is looking at.
611        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
612        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
613        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
614        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
615        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
616        pub struct DefaultCameraLookAt {
617            /// Where the camera is positioned
618            pub vantage: Point3d,
619            /// What the camera is looking at. Center of the camera's field of vision
620            pub center: Point3d,
621            /// Which way is "up", from the camera's point of view.
622            pub up: Point3d,
623            /// Logical timestamp. The client should increment this
624            /// with every event in the current mouse drag. That way, if the
625            /// events are being sent over an unordered channel, the API
626            /// can ignore the older events.
627            pub sequence: Option<u32>,
628        }
629
630        /// Change what the default camera is looking at.
631        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
632        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
633        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
634        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
635        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
636        pub struct DefaultCameraPerspectiveSettings {
637            /// Where the camera is positioned
638            pub vantage: Point3d,
639            /// What the camera is looking at. Center of the camera's field of vision
640            pub center: Point3d,
641            /// Which way is "up", from the camera's point of view.
642            pub up: Point3d,
643            /// The field of view angle in the y direction, in degrees.
644            pub fov_y: Option<f32>,
645            /// The distance to the near clipping plane.
646            pub z_near: Option<f32>,
647            /// The distance to the far clipping plane.
648            pub z_far: Option<f32>,
649            /// Logical timestamp. The client should increment this
650            /// with every event in the current mouse drag. That way, if the
651            /// events are being sent over an unordered channel, the API
652            /// can ignore the older events.
653            pub sequence: Option<u32>,
654        }
655
656        /// Adjust zoom of the default camera.
657        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
658        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
659        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
660        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
661        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
662        pub struct DefaultCameraZoom {
663            /// Move the camera forward along the vector it's looking at,
664            /// by this magnitude.
665            /// Basically, how much should the camera move forward by.
666            pub magnitude: f32,
667        }
668
669        /// Export a sketch to a file.
670        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
671        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
672        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
673        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
674        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
675        pub struct Export2d {
676            /// IDs of the entities to be exported.
677            pub entity_ids: Vec<Uuid>,
678            /// The file format to export to.
679            pub format: OutputFormat2d,
680        }
681
682        /// Export the scene to a file.
683        ///
684        /// The response is a MsgPack-encoded message in a WebSocket binary frame.
685        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
686        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
687        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
688        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
689        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
690        pub struct Export3d {
691            /// IDs of the entities to be exported. If this is empty, then all entities are exported.
692            #[builder(default)]
693            pub entity_ids: Vec<Uuid>,
694            /// The file format to export to.
695            pub format: OutputFormat3d,
696            /// KCL source to embed in formats that support source metadata.
697            #[serde(default, skip_serializing_if = "Option::is_none")]
698            pub kcl_source: Option<KclProject>,
699            /// Optional compression for the binary response. Defaults to uncompressed.
700            #[serde(default, skip_serializing_if = "Option::is_none")]
701            pub compression: Option<crate::shared::CompressionType>,
702        }
703
704        /// Export the scene to a file.
705        ///
706        /// The response is a MsgPack-encoded message in a WebSocket binary frame.
707        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
708        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
709        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
710        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
711        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
712        pub struct Export {
713            /// IDs of the entities to be exported. If this is empty, then all entities are exported.
714            #[builder(default)]
715            pub entity_ids: Vec<Uuid>,
716            /// The file format to export to.
717            pub format: OutputFormat3d,
718            /// KCL source to embed in formats that support source metadata.
719            #[serde(default, skip_serializing_if = "Option::is_none")]
720            pub kcl_source: Option<KclProject>,
721        }
722
723        /// What is this entity's parent?
724        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
725        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
726        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
727        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
728        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
729        pub struct EntityGetParentId {
730            /// ID of the entity being queried.
731            pub entity_id: Uuid,
732        }
733
734        /// How many children does the entity have?
735        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
736        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
737        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
738        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
739        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
740        pub struct EntityGetNumChildren {
741            /// ID of the entity being queried.
742            pub entity_id: Uuid,
743        }
744
745        /// What is the UUID of this entity's n-th child?
746        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
747        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
748        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
749        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
750        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
751        pub struct EntityGetChildUuid {
752            /// ID of the entity being queried.
753            pub entity_id: Uuid,
754            /// Index into the entity's list of children.
755            pub child_index: u32,
756        }
757
758        /// What is this entity's child index within its parent
759        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
760        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
761        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
762        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
763        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
764        pub struct EntityGetIndex {
765            /// ID of the entity being queried.
766            pub entity_id: Uuid,
767        }
768
769        /// What is this edge or face entity's primitive index within its parent body's edges or faces array respectively
770        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
771        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
772        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
773        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
774        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
775        pub struct EntityGetPrimitiveIndex {
776            /// ID of the entity being queried.
777            pub entity_id: Uuid,
778        }
779
780        /// Attempts to delete children entity from an entity.
781        /// Note that this API may change the body type of certain entities from Solid to Surface.
782        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
783        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
784        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
785        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
786        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
787        pub struct EntityDeleteChildren {
788            /// ID of the entity being modified
789            pub entity_id: Uuid,
790            /// ID of the entity's child being deleted
791            pub child_entity_ids: HashSet<Uuid>,
792        }
793
794        /// What are all UUIDs of this entity's children?
795        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
796        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
797        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
798        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
799        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
800        pub struct EntityGetAllChildUuids {
801            /// ID of the entity being queried.
802            pub entity_id: Uuid,
803        }
804
805        /// What are all UUIDs of all the paths sketched on top of this entity?
806        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
807        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
808        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
809        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
810        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
811        pub struct EntityGetSketchPaths {
812            /// ID of the entity being queried.
813            pub entity_id: Uuid,
814        }
815
816        /// What is the distance between these two entities?
817        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
818        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
819        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
820        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
821        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
822        pub struct EntityGetDistance {
823            /// ID of the first entity being queried.
824            pub entity_id1: Uuid,
825            /// ID of the second entity being queried.
826            pub entity_id2: Uuid,
827            /// Type of distance to be measured.
828            pub distance_type: DistanceType,
829        }
830
831        /// What is the length of this edge?
832        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
833        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
834        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
835        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
836        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
837        pub struct EdgeGetLength {
838            /// ID of the edge being queried.
839            pub edge_id: Uuid,
840        }
841
842        /// Create a pattern using this entity by specifying the transform for each desired repetition.
843        /// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
844        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
845        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
846        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
847        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
848        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
849        pub struct EntityClone {
850            /// ID of the entity being cloned.
851            pub entity_id: Uuid,
852        }
853
854        /// Create a pattern using this entity by specifying the transform for each desired repetition.
855        /// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
856        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
857        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
858        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
859        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
860        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
861        pub struct EntityLinearPatternTransform {
862            /// ID of the entity being copied.
863            pub entity_id: Uuid,
864            /// How to transform each repeated solid.
865            /// The 0th transform will create the first copy of the entity.
866            /// The total number of (optional) repetitions equals the size of this list.
867            #[serde(default)]
868            #[builder(default)]
869            pub transform: Vec<crate::shared::Transform>,
870            /// Alternatively, you could set this key instead.
871            /// If you want to use multiple transforms per item.
872            /// If this is non-empty then the `transform` key must be empty, and vice-versa.
873            #[serde(default)]
874            #[builder(default)]
875            pub transforms: Vec<Vec<crate::shared::Transform>>,
876        }
877
878        /// Create a linear pattern using this entity.
879        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
880        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
881        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
882        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
883        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
884        pub struct EntityLinearPattern {
885            /// ID of the entity being copied.
886            pub entity_id: Uuid,
887            /// Axis along which to make the copies.
888            /// For Solid2d patterns, the z component is ignored.
889            pub axis: Point3d<f64>,
890            /// Number of repetitions to make.
891            pub num_repetitions: u32,
892            /// Spacing between repetitions.
893            pub spacing: LengthUnit,
894        }
895        /// Create a circular pattern using this entity.
896        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
897        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
898        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
899        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
900        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
901        pub struct EntityCircularPattern {
902            /// ID of the entity being copied.
903            pub entity_id: Uuid,
904            /// Axis around which to make the copies.
905            /// For Solid2d patterns, this is ignored.
906            pub axis: Point3d<f64>,
907            /// Point around which to make the copies.
908            /// For Solid2d patterns, the z component is ignored.
909            pub center: Point3d<LengthUnit>,
910            /// Number of repetitions to make.
911            pub num_repetitions: u32,
912            /// Arc angle (in degrees) to place repetitions along.
913            pub arc_degrees: f64,
914            /// Whether or not to rotate the objects as they are copied.
915            pub rotate_duplicates: bool,
916        }
917
918        /// Create a helix using the input cylinder and other specified parameters.
919        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
920        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
921        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
922        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
923        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
924        pub struct EntityMakeHelix {
925            /// ID of the cylinder.
926            pub cylinder_id: Uuid,
927            /// Number of revolutions.
928            pub revolutions: f64,
929            /// Start angle.
930            #[serde(default)]
931            #[builder(default)]
932            pub start_angle: Angle,
933            /// Is the helix rotation clockwise?
934            pub is_clockwise: bool,
935            /// Length of the helix. If None, the length of the cylinder will be used instead.
936            pub length: Option<LengthUnit>,
937        }
938
939        /// Create a helix using the specified parameters.
940        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
941        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
942        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
943        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
944        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
945        pub struct EntityMakeHelixFromParams {
946            /// Radius of the helix.
947            pub radius: LengthUnit,
948            /// Length of the helix.
949            pub length: LengthUnit,
950            /// Number of revolutions.
951            pub revolutions: f64,
952            /// Start angle.
953            #[serde(default)]
954            #[builder(default)]
955            pub start_angle: Angle,
956            /// Is the helix rotation clockwise?
957            pub is_clockwise: bool,
958            /// Center of the helix at the base of the helix.
959            pub center: Point3d<LengthUnit>,
960            /// Axis of the helix. The helix will be created around and in the direction of this axis.
961            pub axis: Point3d<f64>,
962        }
963
964        /// Create a helix using the specified parameters.
965        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
966        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
967        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
968        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
969        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
970        pub struct EntityMakeHelixFromEdge {
971            /// Radius of the helix.
972            pub radius: LengthUnit,
973            /// Length of the helix. If None, the length of the edge will be used instead.
974            pub length: Option<LengthUnit>,
975            /// Number of revolutions.
976            pub revolutions: f64,
977            /// Start angle.
978            #[serde(default)]
979            #[builder(default)]
980            pub start_angle: Angle,
981            /// Is the helix rotation clockwise?
982            pub is_clockwise: bool,
983            /// Edge ID about which to make the helix (legacy API, for backwards compatibility).
984            /// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
985            #[serde(default, skip_serializing_if = "Option::is_none")]
986            pub edge_id: Option<Uuid>,
987            /// Edge reference about which to make the helix (new API).
988            /// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
989            #[serde(default, skip_serializing_if = "Option::is_none")]
990            pub edge_reference: Option<EdgeSpecifier>,
991        }
992
993        /// Mirror the input entities over the specified axis, edge, or plane.
994        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
995        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
996        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
997        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
998        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
999        pub struct EntityMirrorAcross {
1000            /// ID of the mirror entities.
1001            pub ids: Vec<Uuid>,
1002            /// What to mirror across
1003            pub across: MirrorAcross,
1004        }
1005
1006
1007        /// Mirror the input entities over the specified axis.
1008        /// Deprecated; please use `EntityMirrorAcross`
1009        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1010        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1011        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1012        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1013        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1014        pub struct EntityMirror {
1015            /// ID of the mirror entities.
1016            pub ids: Vec<Uuid>,
1017            /// Axis to use as mirror.
1018            pub axis: Point3d<f64>,
1019            /// Point through which the mirror axis passes.
1020            pub point: Point3d<LengthUnit>,
1021        }
1022
1023        /// Mirror the input entities over the specified edge.
1024        /// Deprecated; please use `EntityMirrorAcross`
1025        #[derive(
1026            Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
1027        )]
1028        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1029        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1030        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1031        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1032        pub struct EntityMirrorAcrossEdge {
1033            /// ID of the mirror entities.
1034            pub ids: Vec<Uuid>,
1035            /// The edge to use as the mirror axis (legacy API). Must be linear and lie in the plane of the solid.
1036            /// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
1037            #[serde(default, skip_serializing_if = "Option::is_none")]
1038            pub edge_id: Option<Uuid>,
1039            /// Edge reference to use as the mirror axis (new API).
1040            /// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
1041            #[serde(default, skip_serializing_if = "Option::is_none")]
1042            pub edge_reference: Option<EdgeSpecifier>,
1043        }
1044
1045        /// Modifies the selection by simulating a "mouse click" at the given x,y window coordinate
1046        /// Returns ID of whatever was selected.
1047        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1048        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1049        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1050        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1051        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1052        pub struct SelectWithPoint {
1053            /// Where in the window was selected
1054            pub selected_at_window: Point2d,
1055            /// What entity was selected?
1056            pub selection_type: SceneSelectionType,
1057        }
1058
1059        /// Query the type of entity that was selected. E.g. if a face is selected the face id is
1060        /// returned, if an edge/vertex is selected then the face ids that uniquely define the edge/vertex are
1061        /// returned (typically two).
1062        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1063        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1064        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1065        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1066        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1067        pub struct QueryEntityTypeWithPoint {
1068            /// Where in the window was selected
1069            pub selected_at_window: Point2d,
1070            /// What entity was selected?
1071            pub selection_type: SceneSelectionType,
1072        }
1073
1074        /// Query the type of entity given its id. E.g. if a face is selected the face id is
1075        /// returned, if an edge/vertex is selected then the face ids that uniquely define the edge/vertex are
1076        /// returned (typically two).
1077        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1078        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1079        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1080        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1081        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1082        pub struct QueryEntityType {
1083            /// The entity id to query
1084            pub entity_id: Uuid,
1085        }
1086
1087        /// Adds one or more entities (by UUID) to the selection.
1088        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1089        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1090        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1091        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1092        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1093        pub struct SelectAdd {
1094            /// Which entities to select
1095            pub entities: Vec<Uuid>,
1096        }
1097
1098        /// Removes one or more entities (by UUID) from the selection.
1099        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1100        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1101        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1102        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1103        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1104        pub struct SelectRemove {
1105            /// Which entities to unselect
1106            pub entities: Vec<Uuid>,
1107        }
1108
1109        /// Removes all of the Objects in the scene
1110        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1111        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1112        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1113        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1114        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1115        pub struct SceneClearAll {}
1116
1117        /// Replaces current selection with these entities (by UUID).
1118        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1119        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1120        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1121        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1122        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1123        pub struct SelectReplace {
1124            /// Which entities to select
1125            pub entities: Vec<Uuid>,
1126        }
1127
1128        /// Changes the current highlighted entity to whichever one is at the given window coordinate.
1129        /// If there's no entity at this location, clears the highlight.
1130        #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1131        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1132        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1133        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1134        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1135        pub struct HighlightSetEntity {
1136            /// Coordinates of the window being clicked
1137            pub selected_at_window: Point2d,
1138            /// Logical timestamp. The client should increment this
1139            /// with every event in the current mouse drag. That way, if the
1140            /// events are being sent over an unordered channel, the API
1141            /// can ignore the older events.
1142            pub sequence: Option<u32>,
1143        }
1144
1145        /// Changes the current highlighted entity to these entities.
1146        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1147        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1148        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1149        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1150        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1151        pub struct HighlightSetEntities {
1152            /// Highlight these entities.
1153            pub entities: Vec<Uuid>,
1154        }
1155
1156        /// Create a new annotation
1157        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1158        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1159        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1160        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1161        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1162        pub struct NewAnnotation {
1163            /// What should the annotation contain?
1164            pub options: AnnotationOptions,
1165            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1166            pub clobber: bool,
1167            /// What type of annotation to create.
1168            pub annotation_type: AnnotationType,
1169        }
1170
1171        /// Update an annotation
1172        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1173        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1174        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1175        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1176        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1177        pub struct UpdateAnnotation {
1178            /// Which annotation to update
1179            pub annotation_id: Uuid,
1180            /// If any of these fields are set, they will overwrite the previous options for the
1181            /// annotation.
1182            pub options: AnnotationOptions,
1183        }
1184
1185        /// Changes visibility of scene-wide edge lines on brep solids
1186        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1187        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1188        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1189        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1190        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1191        pub struct EdgeLinesVisible {
1192            /// Whether or not the edge lines should be hidden.
1193            pub hidden: bool,
1194        }
1195
1196        /// Hide or show an object
1197        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1198        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1199        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1200        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1201        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1202        pub struct ObjectVisible {
1203            /// Which object to change
1204            pub object_id: Uuid,
1205            /// Whether or not the object should be hidden.
1206            pub hidden: bool,
1207        }
1208
1209        /// Query whether each object is hidden, preserving input order.
1210        /// Missing objects are reported as `no_such_object` in the response.
1211        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1212        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1213        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1214        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1215        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1216        pub struct ObjectIsHidden {
1217            /// The IDs of the objects to query. Order and duplicates are preserved.
1218            /// An empty list returns an empty result.
1219            pub object_ids: Vec<Uuid>,
1220        }
1221
1222        /// Bring an object to the front of the scene
1223        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1224        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1225        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1226        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1227        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1228        pub struct ObjectBringToFront {
1229            /// Which object to change
1230            pub object_id: Uuid,
1231        }
1232
1233        /// Set the material properties of an object
1234        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1235        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1236        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1237        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1238        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1239        pub struct ObjectSetMaterialParamsPbr {
1240            /// Which object to change
1241            pub object_id: Uuid,
1242            /// Color of the new material
1243            pub color: Color,
1244            /// Metalness of the new material
1245            pub metalness: f32,
1246            /// Roughness of the new material
1247            pub roughness: f32,
1248            /// Ambient Occlusion of the new material
1249            pub ambient_occlusion: f32,
1250            /// Color of the backface
1251            #[serde(default, skip_serializing_if = "Option::is_none")]
1252            pub backface_color: Option<Color>,
1253        }
1254
1255        /// Set the name of an object
1256        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1257        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1258        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1259        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1260        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1261        pub struct ObjectSetName {
1262            /// Which object to change
1263            pub object_id: Uuid,
1264            /// Name of the object. Using a zero-length name unsets the name.
1265            #[serde(default, skip_serializing_if = "String::is_empty")]
1266            pub name: String,
1267        }
1268
1269        /// What type of entity is this?
1270        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1271        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1272        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1273        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1274        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1275        pub struct GetEntityType {
1276            /// ID of the entity being queried.
1277            pub entity_id: Uuid,
1278        }
1279
1280        /// Gets all faces which use the given edge.
1281        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1282        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1283        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1284        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1285        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1286        pub struct Solid3dGetAllEdgeFaces {
1287            /// Which object is being queried.
1288            pub object_id: Uuid,
1289            /// Which edge you want the faces of.
1290            pub edge_id: Uuid,
1291        }
1292
1293        /// Flips (reverses) a brep that is "inside-out".
1294        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1295        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1296        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1297        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1298        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1299        pub struct Solid3dFlip {
1300            /// Which object is being flipped.
1301            pub object_id: Uuid,
1302        }
1303
1304        /// Flips (reverses) a face.  If the solid3d body type is "Solid",
1305        /// then body type will become non-manifold ("Surface").
1306        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1307        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1308        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1309        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1310        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1311        pub struct Solid3dFlipFace {
1312            /// Which object is being queried.
1313            pub object_id: Uuid,
1314            /// Which face you want to flip.
1315            pub face_id: Uuid,
1316        }
1317
1318        /// Add a hole to a Solid2d object before extruding it.
1319        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1320        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1321        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1322        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1323        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1324        pub struct Solid2dAddHole {
1325            /// Which object to add the hole to.
1326            pub object_id: Uuid,
1327            /// The id of the path to use as the inner profile (hole).
1328            pub hole_id: Uuid,
1329        }
1330
1331        /// Gets all edges which are opposite the given edge, across all possible faces.
1332        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1333        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1334        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1335        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1336        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1337        pub struct Solid3dGetAllOppositeEdges {
1338            /// Which object is being queried.
1339            pub object_id: Uuid,
1340            /// Which edge you want the opposites of.
1341            pub edge_id: Uuid,
1342            /// If given, only faces parallel to this vector will be considered.
1343            pub along_vector: Option<Point3d<f64>>,
1344        }
1345
1346        /// Gets the edge opposite the given edge, along the given face.
1347        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1348        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1349        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1350        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1351        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1352        pub struct Solid3dGetOppositeEdge {
1353            /// Which object is being queried.
1354            pub object_id: Uuid,
1355            /// Which edge you want the opposite of.
1356            pub edge_id: Uuid,
1357            /// Which face is used to figure out the opposite edge?
1358            pub face_id: Uuid,
1359        }
1360
1361        /// Gets the next adjacent edge for the given edge, along the given face.
1362        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1363        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1364        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1365        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1366        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1367        pub struct Solid3dGetNextAdjacentEdge {
1368            /// Which object is being queried.
1369            pub object_id: Uuid,
1370            /// Which edge you want the next edge of.
1371            pub edge_id: Uuid,
1372            /// Which face is used to figure out the opposite edge?
1373            pub face_id: Uuid,
1374        }
1375
1376        /// Gets the previous adjacent edge for the given edge, along the given face.
1377        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1378        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1379        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1380        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1381        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1382        pub struct Solid3dGetPrevAdjacentEdge {
1383            /// Which object is being queried.
1384            pub object_id: Uuid,
1385            /// Which edge you want the previous edge of.
1386            pub edge_id: Uuid,
1387            /// Which face is used to figure out the opposite edge?
1388            pub face_id: Uuid,
1389        }
1390
1391        /// Gets the shared edge between these two faces if it exists
1392        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1393        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1394        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1395        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1396        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1397        pub struct Solid3dGetCommonEdge {
1398            /// Which object is being queried.
1399            pub object_id: Uuid,
1400            /// The faces being queried
1401            pub face_ids: [Uuid; 2]
1402        }
1403
1404        /// Fillets the given edge with the specified radius.
1405        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1406        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1407        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1408        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1409        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1410        pub struct Solid3dFilletEdge {
1411            /// Which object is being filletted.
1412            pub object_id: Uuid,
1413            /// Which edge you want to fillet.
1414            #[serde(default)]
1415            pub edge_id: Option<Uuid>,
1416            /// Which edges you want to fillet.
1417            #[serde(default)]
1418            #[builder(default)]
1419            pub edge_ids: Vec<Uuid>,
1420            /// A struct containing the information required to reference an edge.
1421            #[serde(default, skip_serializing_if = "Vec::is_empty")]
1422            #[builder(default)]
1423            pub edges_references: Vec<EdgeSpecifier>,
1424            /// 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).
1425            pub radius: LengthUnit,
1426            /// The maximum acceptable surface gap computed between the filleted surfaces. Must be positive (i.e. greater than zero).
1427            pub tolerance: LengthUnit,
1428            /// How to apply the cut.
1429            #[serde(default)]
1430            #[builder(default)]
1431            pub cut_type: CutType,
1432            /// Which cutting algorithm to use.
1433            #[serde(default)]
1434            #[builder(default)]
1435            pub strategy: CutStrategy,
1436            /// What IDs should the resulting faces have?
1437            /// If you've only passed one edge ID, its ID will
1438            /// be the command ID used to send this command, and this
1439            /// field should be empty.
1440            /// If you've passed `n` IDs (to fillet `n` edges), then
1441            /// this should be length `n-1`, and the first edge will use
1442            /// the command ID used to send this command.
1443            #[serde(default)]
1444            #[builder(default)]
1445            pub extra_face_ids: Vec<Uuid>,
1446            /// If true, use the legacy CSG algorithm.
1447            #[serde(default, skip_serializing_if = "super::is_false")]
1448            #[builder(default)]
1449            pub use_legacy: bool,
1450            /// Which version of the edge cut algorithm to use.
1451            #[serde(default, skip_serializing_if = "EdgeCutVersion::is_default")]
1452            #[builder(default)]
1453            pub version: EdgeCutVersion,
1454        }
1455
1456        /// Cut the list of edge references with the given cut parameters
1457        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1458        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1459        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1460        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1461        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1462        pub struct Solid3dCutEdgeReferences {
1463            /// Which object is being cut.
1464            pub object_id: Uuid,
1465            /// A struct containing the information required to reference an edge.
1466            #[serde(default)]
1467            #[builder(default)]
1468            pub edges_references: Vec<EdgeSpecifier>,
1469            /// The cut type and information required to perform the cut.
1470            pub cut_type: CutTypeV2,
1471            /// The maximum acceptable surface gap computed between the cut surfaces. Must be
1472            /// positive (i.e. greater than zero).
1473            pub tolerance: LengthUnit,
1474            /// Which cutting algorithm to use.
1475            #[serde(default)]
1476            #[builder(default)]
1477            pub strategy: CutStrategy,
1478            /// What IDs should the resulting faces have?
1479            /// If you've only passed one edge ID, its ID will
1480            /// be the command ID used to send this command, and this
1481            /// field should be empty.
1482            /// If you've passed `n` IDs (to cut `n` edges), then
1483            /// this should be length `n-1`, and the first edge will use
1484            /// the command ID used to send this command.
1485            #[serde(default)]
1486            #[builder(default)]
1487            pub extra_face_ids: Vec<Uuid>,
1488            /// If true, use the legacy CSG algorithm.
1489            #[serde(default, skip_serializing_if = "super::is_false")]
1490            #[builder(default)]
1491            pub use_legacy: bool,
1492            /// Which version of the edge cut algorithm to use.
1493            #[serde(default, skip_serializing_if = "EdgeCutVersion::is_default")]
1494            #[builder(default)]
1495            pub version: EdgeCutVersion,
1496            /// If true, also cut edges that are tangent to the selected edges.
1497            #[serde(default, skip_serializing_if = "super::is_false")]
1498            #[builder(default)]
1499            pub tangent_chain: bool,
1500        }
1501
1502        /// Cut the list of given edges with the given cut parameters.
1503        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1504        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1505        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1506        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1507        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1508        pub struct Solid3dCutEdges {
1509            /// Which object is being cut.
1510            pub object_id: Uuid,
1511            /// Which edges you want to cut.
1512            #[serde(default)]
1513            #[builder(default)]
1514            pub edge_ids: Vec<Uuid>,
1515            /// The cut type and information required to perform the cut.
1516            pub cut_type: CutTypeV2,
1517            /// The maximum acceptable surface gap computed between the cut surfaces. Must be
1518            /// positive (i.e. greater than zero).
1519            pub tolerance: LengthUnit,
1520            /// Which cutting algorithm to use.
1521            #[serde(default)]
1522            #[builder(default)]
1523            pub strategy: CutStrategy,
1524            /// What IDs should the resulting faces have?
1525            /// If you've only passed one edge ID, its ID will
1526            /// be the command ID used to send this command, and this
1527            /// field should be empty.
1528            /// If you've passed `n` IDs (to cut `n` edges), then
1529            /// this should be length `n-1`, and the first edge will use
1530            /// the command ID used to send this command.
1531            #[serde(default)]
1532            #[builder(default)]
1533            pub extra_face_ids: Vec<Uuid>,
1534            /// If true, use the legacy CSG algorithm.
1535            #[serde(default, skip_serializing_if = "super::is_false")]
1536            #[builder(default)]
1537            pub use_legacy: bool,
1538            /// Which version of the edge cut algorithm to use.
1539            #[serde(default, skip_serializing_if = "EdgeCutVersion::is_default")]
1540            #[builder(default)]
1541            pub version: EdgeCutVersion,
1542            /// If true, also cut edges that are tangent to the selected edges.
1543            #[serde(default, skip_serializing_if = "super::is_false")]
1544            #[builder(default)]
1545            pub tangent_chain: bool,
1546        }
1547
1548        /// Determines whether a brep face is planar and returns its surface-local planar axes if so
1549        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1550        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1551        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1552        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1553        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1554        pub struct FaceIsPlanar {
1555            /// Which face is being queried.
1556            pub object_id: Uuid,
1557        }
1558
1559        /// Determines a position on a brep face evaluated by parameters u,v
1560        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1561        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1562        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1563        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1564        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1565        pub struct FaceGetPosition {
1566            /// Which face is being queried.
1567            pub object_id: Uuid,
1568
1569            /// The 2D parameter-space u,v position to evaluate the surface at
1570            pub uv: Point2d<f64>,
1571        }
1572
1573        ///Obtains the surface "center of mass"
1574        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1575        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1576        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1577        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1578        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1579        pub struct FaceGetCenter {
1580            /// Which face is being queried.
1581            pub object_id: Uuid,
1582        }
1583
1584        /// Determines the gradient (dFdu, dFdv) + normal vector on a brep face evaluated by parameters u,v
1585        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1586        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1587        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1588        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1589        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1590        pub struct FaceGetGradient {
1591            /// Which face is being queried.
1592            pub object_id: Uuid,
1593
1594            /// The 2D parameter-space u,v position to evaluate the surface at
1595            pub uv: Point2d<f64>,
1596        }
1597
1598        /// Send object to front or back.
1599        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1600        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1601        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1602        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1603        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1604        pub struct SendObject {
1605            /// Which object is being changed.
1606            pub object_id: Uuid,
1607            /// Bring to front = true, send to back = false.
1608            pub front: bool,
1609        }
1610        /// Set opacity of the entity.
1611        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1612        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1613        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1614        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1615        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1616        pub struct EntitySetOpacity {
1617            /// Which entity is being changed.
1618            pub entity_id: Uuid,
1619            /// How transparent should it be?
1620            /// 0 or lower is totally transparent.
1621            /// 1 or greater is totally opaque.
1622            pub opacity: f32,
1623        }
1624
1625        /// Fade entity in or out.
1626        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1627        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1628        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1629        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1630        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1631        pub struct EntityFade {
1632            /// Which entity is being changed.
1633            pub entity_id: Uuid,
1634            /// Fade in = true, fade out = false.
1635            pub fade_in: bool,
1636            /// How many seconds the animation should take.
1637            #[serde(default = "default_animation_seconds")]
1638            #[builder(default = default_animation_seconds())]
1639            pub duration_seconds: f64,
1640        }
1641
1642        /// Make a new plane
1643        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1644        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1645        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1646        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1647        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1648        pub struct MakePlane {
1649            /// Origin of the plane
1650            pub origin: Point3d<LengthUnit>,
1651            /// What should the plane's X axis be?
1652            pub x_axis: Point3d<f64>,
1653            /// What should the plane's Y axis be?
1654            pub y_axis: Point3d<f64>,
1655            /// What should the plane's span/extent?
1656            /// When rendered visually, this is both the
1657            /// width and height along X and Y axis respectively.
1658            pub size: LengthUnit,
1659            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1660            pub clobber: bool,
1661            /// If true, the plane will be created but hidden initially.
1662            pub hide: Option<bool>,
1663        }
1664
1665        /// Set the color of a plane.
1666        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1667        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1668        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1669        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1670        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1671        pub struct PlaneSetColor {
1672            /// Which plane is being changed.
1673            pub plane_id: Uuid,
1674            /// What color it should be.
1675            pub color: Color,
1676        }
1677
1678        /// Set the current tool.
1679        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1680        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1681        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1682        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1683        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1684        pub struct SetTool {
1685            /// What tool should be active.
1686            pub tool: SceneToolType,
1687        }
1688
1689        /// Send a mouse move event
1690        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1691        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1692        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1693        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1694        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1695        pub struct MouseMove {
1696            /// Where the mouse is
1697            pub window: Point2d,
1698            /// Logical timestamp. The client should increment this
1699            /// with every event in the current mouse drag. That way, if the
1700            /// events are being sent over an unordered channel, the API
1701            /// can ignore the older events.
1702            pub sequence: Option<u32>,
1703        }
1704
1705        /// Send a mouse click event
1706        /// Updates modified/selected entities.
1707        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1708        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1709        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1710        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1711        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1712        pub struct MouseClick {
1713            /// Where the mouse is
1714            pub window: Point2d,
1715        }
1716
1717        /// Disable sketch mode.
1718        /// If you are sketching on a face, be sure to not disable sketch mode until you have extruded.
1719        /// Otherwise, your object will not be fused with the face.
1720        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1721        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1722        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1723        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1724        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1725        pub struct SketchModeDisable {}
1726
1727        /// Get the plane for sketch mode.
1728        #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1729        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1730        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1731        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1732        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1733        pub struct GetSketchModePlane {}
1734
1735        /// Get the plane for sketch mode.
1736        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1737        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1738        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1739        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1740        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1741        pub struct CurveSetConstraint {
1742            /// Which curve to constrain.
1743            pub object_id: Uuid,
1744            /// Which constraint to apply.
1745            pub constraint_bound: PathComponentConstraintBound,
1746            /// What part of the curve should be constrained.
1747            pub constraint_type: PathComponentConstraintType,
1748        }
1749
1750        /// Sketch on some entity (e.g. a plane, a face).
1751        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1752        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1753        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1754        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1755        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1756        pub struct EnableSketchMode {
1757            /// Which entity to sketch on.
1758            pub entity_id: Uuid,
1759            /// Should the camera use orthographic projection?
1760            /// In other words, should an object's size in the rendered image stay constant regardless of its distance from the camera.
1761            pub ortho: bool,
1762            /// Should we animate or snap for the camera transition?
1763            pub animated: bool,
1764            /// Should the camera move at all?
1765            pub adjust_camera: bool,
1766            /// If provided, ensures that the normal of the sketch plane must be aligned with this supplied normal
1767            /// (otherwise the camera position will be used to infer the normal to point towards the viewer)
1768            pub planar_normal: Option<Point3d<f64>>,
1769        }
1770
1771        /// Set the background color of the scene.
1772        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1773        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1774        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1775        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1776        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1777        pub struct SetBackgroundColor {
1778            /// The color to set the background to.
1779            pub color: Color,
1780        }
1781
1782        /// Set the properties of the tool lines for the scene.
1783        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1784        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1785        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1786        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1787        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1788        pub struct SetCurrentToolProperties {
1789            /// The color to set the tool line to.
1790            pub color: Option<Color>,
1791        }
1792
1793        /// Set the default system properties used when a specific property isn't set.
1794        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1795        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1796        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1797        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1798        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1799        pub struct SetDefaultSystemProperties {
1800            /// The default tolerance values.
1801            #[serde(default)]
1802            pub tolerance: Option<Tolerance>,
1803            /// The default system color.
1804            #[serde(default)]
1805            pub color: Option<Color>,
1806            /// The default color to use for all backfaces
1807            #[serde(default)]
1808            pub backface_color: Option<Color>,
1809            /// The default color to use for highlight
1810            #[serde(default)]
1811            pub highlight_color: Option<Color>,
1812            /// The default color to use for selection
1813            #[serde(default)]
1814            pub selection_color: Option<Color>,
1815            /// The default color to use for the edges of 3D bodies.
1816            #[serde(default)]
1817            pub edge_3d_color: Option<Color>,
1818        }
1819
1820        /// Get type of the given curve.
1821        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1822        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1823        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1824        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1825        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1826        pub struct CurveGetType {
1827            /// Which curve to query.
1828            pub curve_id: Uuid,
1829        }
1830
1831        /// Get control points of the given curve.
1832        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1833        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1834        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1835        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1836        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1837        pub struct CurveGetControlPoints {
1838            /// Which curve to query.
1839            pub curve_id: Uuid,
1840        }
1841
1842        /// Project an entity on to a plane.
1843        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1844        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1845        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1846        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1847        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1848        pub struct ProjectEntityToPlane {
1849            /// Which entity to project (vertex or edge). Legacy; if both `entity_id` and `entity_reference` are provided, `entity_reference` takes precedence.
1850            #[serde(default, skip_serializing_if = "Option::is_none")]
1851            pub entity_id: Option<Uuid>,
1852            /// Entity reference (e.g. edge by side_faces, vertex, face) to project. If both `entity_id` and `entity_reference` are provided, `entity_reference` takes precedence.
1853            #[serde(default, skip_serializing_if = "Option::is_none")]
1854            pub entity_reference: Option<EntityReference>,
1855            /// Which plane to project the entity onto.
1856            pub plane_id: Uuid,
1857            /// If true: the projected points are returned in the plane_id's coordinate system,
1858            /// else: the projected points are returned in the world coordinate system.
1859            pub use_plane_coords: bool,
1860        }
1861
1862        /// Project a list of points on to a plane.
1863        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1864        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1865        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1866        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1867        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1868        pub struct ProjectPointsToPlane {
1869            /// The id of the plane used for the projection.
1870            pub plane_id: Uuid,
1871            /// The list of points that will be projected.
1872            pub points: Vec<Point3d<f64>>,
1873            /// If true: the projected points are returned in the plane_id's coordinate sysetm.
1874            /// else: the projected points are returned in the world coordinate system.
1875            pub use_plane_coords: bool,
1876        }
1877
1878        /// Enum containing the variety of image formats snapshots may be exported to.
1879        #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1880        #[serde(rename_all = "snake_case")]
1881        #[display(style = "snake_case")]
1882        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1883        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1884        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1885        #[cfg_attr(feature = "python", pyo3::pyclass(from_py_object), pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1886        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1887        pub enum ImageFormat {
1888            /// .png format
1889            Png,
1890            /// .jpeg format
1891            Jpeg,
1892        }
1893
1894        /// Take a snapshot of the current view.
1895        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1896        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1897        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1898        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1899        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1900        pub struct TakeSnapshot {
1901            /// What image format to return.
1902            pub format: ImageFormat,
1903        }
1904
1905        /// Add a gizmo showing the axes.
1906        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1907        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1908        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1909        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1910        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1911        pub struct MakeAxesGizmo {
1912            /// If true, axes gizmo will be placed in the corner of the screen.
1913            /// If false, it will be placed at the origin of the scene.
1914            pub gizmo_mode: bool,
1915            /// If true, any existing drawables within the obj will be replaced (the object will be reset)
1916            pub clobber: bool,
1917        }
1918
1919        /// Query the given path.
1920        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1921        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1922        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1923        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1924        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1925        pub struct PathGetInfo {
1926            /// Which path to query
1927            pub path_id: Uuid,
1928        }
1929
1930        /// Obtain curve ids for vertex ids
1931        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1932        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1933        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1934        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1935        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1936        pub struct PathGetCurveUuidsForVertices {
1937            /// Which path to query
1938            pub path_id: Uuid,
1939
1940            /// IDs of the vertices for which to obtain curve ids from
1941            pub vertex_ids: Vec<Uuid>,
1942        }
1943
1944        /// Obtain curve id by index
1945        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1946        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1947        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1948        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1949        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1950        pub struct PathGetCurveUuid {
1951            /// Which path to query
1952            pub path_id: Uuid,
1953
1954            /// IDs of the vertices for which to obtain curve ids from
1955            pub index: u32,
1956        }
1957
1958        /// Obtain vertex ids for a path
1959        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1960        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1961        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1962        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1963        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1964        pub struct PathGetVertexUuids {
1965            /// Which path to query
1966            pub path_id: Uuid,
1967        }
1968
1969        /// Obtain the sketch target id (if the path was drawn in sketchmode) for a path
1970        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1971        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1972        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1973        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1974        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1975        pub struct PathGetSketchTargetUuid {
1976            /// Which path to query
1977            pub path_id: Uuid,
1978        }
1979
1980        /// Start dragging the mouse.
1981        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1982        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1983        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1984        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1985        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1986        pub struct HandleMouseDragStart {
1987            /// The mouse position.
1988            pub window: Point2d,
1989        }
1990
1991        /// Continue dragging the mouse.
1992        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
1993        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1994        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1995        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1996        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1997        pub struct HandleMouseDragMove {
1998            /// The mouse position.
1999            pub window: Point2d,
2000            /// Logical timestamp. The client should increment this
2001            /// with every event in the current mouse drag. That way, if the
2002            /// events are being sent over an unordered channel, the API
2003            /// can ignore the older events.
2004            pub sequence: Option<u32>,
2005        }
2006
2007        /// Stop dragging the mouse.
2008        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2009        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2010        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2011        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2012        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2013        pub struct HandleMouseDragEnd {
2014            /// The mouse position.
2015            pub window: Point2d,
2016        }
2017
2018        /// Remove scene objects.
2019        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2020        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2021        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2022        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2023        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2024        pub struct RemoveSceneObjects {
2025            /// Objects to remove.
2026            pub object_ids: HashSet<Uuid>,
2027        }
2028
2029        /// Utility method. Performs both a ray cast and projection to plane-local coordinates.
2030        /// Returns the plane coordinates for the given window coordinates.
2031        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2032        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2033        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2034        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2035        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2036        pub struct PlaneIntersectAndProject {
2037            /// The plane you're intersecting against.
2038            pub plane_id: Uuid,
2039            /// Window coordinates where the ray cast should be aimed.
2040            pub window: Point2d,
2041        }
2042
2043        /// Find the start and end of a curve.
2044        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2045        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2046        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2047        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2048        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2049        pub struct CurveGetEndPoints {
2050            /// ID of the curve being queried.
2051            pub curve_id: Uuid,
2052        }
2053
2054        /// Reconfigure the stream.
2055        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2056        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2057        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2058        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2059        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2060        pub struct ReconfigureStream {
2061            /// Width of the stream.
2062            pub width: u32,
2063            /// Height of the stream.
2064            pub height: u32,
2065            /// Frames per second.
2066            pub fps: u32,
2067            /// Video feed's constant bitrate (CBR)
2068            #[serde(default)]
2069            pub bitrate: Option<u32>,
2070        }
2071
2072        /// Import CAD files to the current scene.
2073        ///
2074        /// Send a request containing binary file data as a MsgPack-encoded message in a WebSocket binary frame.
2075        ///
2076        /// Note: These imports are non-editable. In the future we may expose a proprietary-to-KCL function
2077        /// to resolve this. The main intention today is to use imports as design references.
2078        ///
2079        #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2080        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2081        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2082        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2083        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2084        pub struct ImportFiles {
2085            /// Files to import.
2086            pub files: Vec<super::ImportFile>,
2087            /// Input file format.
2088            pub format: crate::format::InputFormat3d,
2089        }
2090
2091        /// Set the units of the scene.
2092        /// For all following commands, the units will be interpreted as the given units.
2093        /// Any previously executed commands will not be affected or have their units changed.
2094        /// They will remain in the units they were originally executed in.
2095        /// If not set, engine units default to mm.
2096        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2097        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2098        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2099        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2100        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2101        pub struct SetSceneUnits {
2102            /// Which units the scene uses.
2103            pub unit: units::UnitLength,
2104        }
2105
2106        /// Get the mass of entities in the scene or the default scene.
2107        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2108        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2109        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2110        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2111        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2112        pub struct Mass {
2113            /// IDs of the entities to get the mass of. If this is empty, then the default scene is included in
2114            /// the mass.
2115            #[builder(default)]
2116            pub entity_ids: Vec<Uuid>,
2117            /// The material density.
2118            pub material_density: f64,
2119            /// The material density unit.
2120            pub material_density_unit: units::UnitDensity,
2121            /// The output unit for the mass.
2122            pub output_unit: units::UnitMass,
2123        }
2124
2125        /// Get the density of entities in the scene or the default scene.
2126        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2127        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2128        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2129        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2130        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2131        pub struct Density {
2132            /// IDs of the entities to get the density of. If this is empty, then the default scene is included in
2133            /// the density.
2134            #[builder(default)]
2135            pub entity_ids: Vec<Uuid>,
2136            /// The material mass.
2137            pub material_mass: f64,
2138            /// The material mass unit.
2139            pub material_mass_unit: units::UnitMass,
2140            /// The output unit for the density.
2141            pub output_unit: units::UnitDensity,
2142        }
2143
2144        /// Get the volume of entities in the scene or the default scene.
2145        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2146        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2147        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2148        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2149        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2150        pub struct Volume {
2151            /// IDs of the entities to get the volume of. If this is empty, then the default scene is included in
2152            /// the volume.
2153            #[builder(default)]
2154            pub entity_ids: Vec<Uuid>,
2155            /// The output unit for the volume.
2156            pub output_unit: units::UnitVolume,
2157        }
2158
2159        /// Get the center of mass of entities in the scene or the default scene.
2160        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2161        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2162        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2163        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2164        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2165        pub struct CenterOfMass {
2166            /// IDs of the entities to get the center of mass of. If this is empty, then the default scene is included in
2167            /// the center of mass.
2168            #[builder(default)]
2169            pub entity_ids: Vec<Uuid>,
2170            /// The output unit for the center of mass.
2171            pub output_unit: units::UnitLength,
2172        }
2173
2174        /// Get the surface area of entities in the scene or the default scene.
2175        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2176        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2177        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2178        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2179        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2180        pub struct SurfaceArea {
2181            /// IDs of the entities to get the surface area of. If this is empty, then the default scene is included in
2182            /// the surface area.
2183            #[builder(default)]
2184            pub entity_ids: Vec<Uuid>,
2185            /// The output unit for the surface area.
2186            pub output_unit: units::UnitArea,
2187        }
2188
2189        /// Get mass, density, volume, center of mass, surface area, and bounding box together.
2190        /// Equivalent to querying each property separately for the same entities, while allowing
2191        /// the engine to share the intermediate geometry used by the calculations.
2192        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2193        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2194        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2195        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2196        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2197        pub struct PhysicalProperties {
2198            /// IDs of the entities to query. If empty, query the default scene, as with the
2199            /// individual property commands.
2200            #[builder(default)]
2201            pub entity_ids: Vec<Uuid>,
2202            /// The material density used to calculate mass.
2203            pub material_density: f64,
2204            /// The material density unit.
2205            pub material_density_unit: units::UnitDensity,
2206            /// The material mass used to calculate density, independently of the calculated mass.
2207            pub material_mass: f64,
2208            /// The material mass unit.
2209            pub material_mass_unit: units::UnitMass,
2210            /// The output unit for mass.
2211            pub mass_output_unit: units::UnitMass,
2212            /// The output unit for density.
2213            pub density_output_unit: units::UnitDensity,
2214            /// The output unit for volume.
2215            pub volume_output_unit: units::UnitVolume,
2216            /// The output unit for center of mass.
2217            pub center_of_mass_output_unit: units::UnitLength,
2218            /// The output unit for surface area.
2219            pub surface_area_output_unit: units::UnitArea,
2220            /// The output unit for the bounding box's dimensions.
2221            pub bounding_box_output_unit: units::UnitLength,
2222        }
2223
2224        /// Focus the default camera upon an object in the scene.
2225        #[derive(
2226            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2227            Builder
2228        )]
2229        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2230        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2231        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2232        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2233        pub struct DefaultCameraFocusOn {
2234            /// UUID of object to focus on.
2235            pub uuid: Uuid,
2236        }
2237        /// When you select some entity with the current tool, what should happen to the entity?
2238        #[derive(
2239            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2240            Builder
2241        )]
2242        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2243        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2244        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2245        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2246        pub struct SetSelectionType {
2247            /// What type of selection should occur when you select something?
2248            pub selection_type: SceneSelectionType,
2249        }
2250
2251        /// What kind of entities can be selected?
2252        #[derive(
2253            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2254            Builder
2255        )]
2256        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2257        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2258        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2259        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2260        pub struct SetSelectionFilter {
2261            /// If vector is empty, clear all filters.
2262            /// If vector is non-empty, only the given entity types will be selectable.
2263            pub filter: Vec<EntityType>,
2264        }
2265
2266        /// Get the ids of a given entity type.
2267        #[derive(
2268            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2269            Builder
2270        )]
2271        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2272        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2273        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2274        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2275        pub struct SceneGetEntityIds {
2276            /// The entity types to be queried.
2277            pub filter: Vec<EntityType>,
2278            /// Skip the first n returned ids. If multiple filters are provided, this skip will
2279            /// apply to each filter individually.
2280            pub skip: u32,
2281            /// Take n ids after any ids skipped. This value must be greater than zero and not
2282            /// exceed 1000. If multiple filters are provided, this take will apply to each filter
2283            /// individually. If there are fewer than `take` items of the provided filter type then the
2284            /// returned list's length will be the smaller value.
2285            #[schemars(range(min = 1, max = 1000))]
2286            pub take: u32,
2287        }
2288
2289        /// Use orthographic projection.
2290        #[derive(
2291            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2292            Builder
2293        )]
2294        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2295        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2296        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2297        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2298        pub struct DefaultCameraSetOrthographic {}
2299
2300        /// Use perspective projection.
2301        #[derive(
2302            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2303            Builder
2304        )]
2305        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2306        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2307        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2308        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2309        pub struct DefaultCameraSetPerspective {
2310            /// If this is not given, use the same parameters as last time the perspective camera was used.
2311            pub parameters: Option<PerspectiveCameraParameters>,
2312        }
2313
2314        ///Updates the camera to center to the center of the current selection
2315        ///(or the origin if nothing is selected)
2316        #[derive(
2317            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder
2318        )]
2319        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2320        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2321        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2322        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2323        pub struct DefaultCameraCenterToSelection {
2324            /// Dictates whether or not the camera position should be adjusted during this operation
2325            /// If no movement is requested, the camera will orbit around the new center from its current position
2326            #[serde(default)]
2327            #[builder(default)]
2328            pub camera_movement: CameraMovement,
2329        }
2330
2331        ///Updates the camera to center to the center of the current scene's bounds
2332        #[derive(
2333            Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder
2334        )]
2335        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2336        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2337        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2338        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2339        pub struct DefaultCameraCenterToScene {
2340            /// Dictates whether or not the camera position should be adjusted during this operation
2341            /// If no movement is requested, the camera will orbit around the new center from its current position
2342            #[serde(default)]
2343            #[builder(default)]
2344            pub camera_movement: CameraMovement,
2345        }
2346
2347        /// Fit the view to the specified object(s).
2348        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2349        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2350        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2351        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2352        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2353        pub struct ZoomToFit {
2354            /// Which objects to fit camera to; if empty, fit to all non-default objects. Defaults to empty vector.
2355            #[serde(default)]
2356            #[builder(default)]
2357            pub object_ids: Vec<Uuid>,
2358            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
2359            /// Negative padding will crop the view of the object proportionally.
2360            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
2361            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
2362            #[serde(default)]
2363            #[builder(default)]
2364            pub padding: f32,
2365            /// Whether or not to animate the camera movement.
2366            #[serde(default)]
2367            #[builder(default)]
2368            pub animated: bool,
2369        }
2370
2371        /// Looks along the normal of the specified face (if it is planar!), and fits the view to it.
2372        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2373        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2374        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2375        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2376        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2377        pub struct OrientToFace {
2378            /// Which face to orient camera to. If the face is not planar, no action will occur.
2379            pub face_id: Uuid,
2380            /// How much to pad the view frame by, as a fraction of the face bounding box size.
2381            /// Negative padding will crop the view of the face proportionally.
2382            /// e.g. padding = 0.2 means the view will span 120% of the face bounding box,
2383            /// and padding = -0.2 means the view will span 80% of the face bounding box.
2384            #[serde(default)]
2385            #[builder(default)]
2386            pub padding: f32,
2387            /// Whether or not to animate the camera movement. (Animation is currently not supported.)
2388            #[serde(default)]
2389            #[builder(default)]
2390            pub animated: bool,
2391        }
2392
2393        /// Fit the view to the scene with an isometric view.
2394        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2395        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2396        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2397        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2398        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2399        pub struct ViewIsometric {
2400            /// How much to pad the view frame by, as a fraction of the object(s) bounding box size.
2401            /// Negative padding will crop the view of the object proportionally.
2402            /// e.g. padding = 0.2 means the view will span 120% of the object(s) bounding box,
2403            /// and padding = -0.2 means the view will span 80% of the object(s) bounding box.
2404            #[serde(default)]
2405            #[builder(default)]
2406            pub padding: f32,
2407        }
2408
2409        /// Get a concise description of all of an extrusion's faces.
2410        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2411        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2412        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2413        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2414        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2415        pub struct Solid3dGetExtrusionFaceInfo {
2416            /// The Solid3d object whose extrusion is being queried.
2417            pub object_id: Uuid,
2418            /// Any edge that lies on the extrusion base path.
2419            #[serde(default, skip_serializing_if = "Option::is_none")]
2420            pub edge_id: Option<Uuid>,
2421        }
2422
2423        /// Get a concise description of all of solids edges.
2424        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2425        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2426        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2427        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2428        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2429        pub struct Solid3dGetAdjacencyInfo {
2430            /// The Solid3d object whose info is being queried.
2431            pub object_id: Uuid,
2432            /// Any edge that lies on the extrusion base path.
2433            #[serde(default, skip_serializing_if = "Option::is_none")]
2434            pub edge_id: Option<Uuid>,
2435        }
2436
2437
2438        /// Clear the selection
2439        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2440        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2441        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2442        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2443        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2444        pub struct SelectClear {}
2445
2446        /// Set the selection to exactly these entities (replaces previous selection).
2447        /// Empty array clears the selection.
2448        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2449        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2450        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2451        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2452        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2453        pub struct SelectEntity {
2454            /// Which entities to select (face-based references for edges/vertices, face_id for faces)
2455            pub entities: Vec<EntityReference>,
2456        }
2457
2458        /// Find all IDs of selected entities
2459        #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2460        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2461        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2462        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2463        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2464        pub struct SelectGet {}
2465
2466        /// Get the number of objects in the scene
2467        #[derive(
2468            Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
2469            Builder
2470        )]
2471        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2472        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2473        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2474        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2475        pub struct GetNumObjects {}
2476
2477        ///Set the transform of an object.
2478        #[derive(
2479            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
2480            Builder
2481        )]
2482        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2483        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2484        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2485        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2486        pub struct SetObjectTransform
2487        {
2488            /// Id of the object whose transform is to be set.
2489            pub object_id: Uuid,
2490            /// List of transforms to be applied to the object.
2491            pub transforms: Vec<ComponentTransform>,
2492        }
2493
2494        /// Given a set of overlapping solids, create a new single solid.
2495        ///
2496        /// Most successful unions come from solids who's faces do not overlap
2497        /// aka non-coplanar.
2498        ///
2499        /// Failure cases:
2500        /// * A common failure is unsupported coincident faces try to be unioned.
2501        ///
2502        /// Warning cases:
2503        /// * When an element of the set doesn't overlap.
2504        ///
2505        /// Notable behaviors:
2506        /// * What appear to be coincident points will succeed and not give a "no overlap" warning, even if they're not.
2507        /// * Elements' top or bottom faces may not combine into one new face, which can seem like the union failed. You can tell they succeeded from side faces not extending into the original solids.
2508        /// * When exporting to STEP, if the above behavior is observed, will merged the faces.
2509        ///
2510        #[derive(
2511            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
2512            Builder
2513        )]
2514        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2515        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2516        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2517        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2518        pub struct BooleanUnion
2519        {
2520            /// Which solids to union together.
2521            /// Cannot be empty.
2522            pub solid_ids: Vec<Uuid>,
2523            /// If true, non-contiguous bodies in the result will be returned as separate objects
2524            #[serde(default)]
2525            #[builder(default)]
2526            pub separate_bodies: bool,
2527            /// If true, use the legacy CSG algorithm.
2528            #[serde(default, skip_serializing_if = "super::is_false")]
2529            #[builder(default)]
2530            pub use_legacy: bool,
2531            /// The maximum acceptable surface gap computed between the joined solids. Must be positive (i.e. greater than zero).
2532            pub tolerance: LengthUnit,
2533        }
2534
2535        /// Create a new solid from intersecting several other solids.
2536        /// In other words, the part of the input solids where they all overlap will be the output solid.
2537        #[derive(
2538            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
2539            Builder
2540        )]
2541        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2542        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2543        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2544        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2545        pub struct BooleanIntersection
2546        {
2547            /// Which solids to intersect together
2548            pub solid_ids: Vec<Uuid>,
2549            /// If true, non-contiguous bodies in the result will be returned as separate objects
2550            #[serde(default)]
2551            #[builder(default)]
2552            pub separate_bodies: bool,
2553            /// If true, use the legacy CSG algorithm.
2554            #[serde(default, skip_serializing_if = "super::is_false")]
2555            #[builder(default)]
2556            pub use_legacy: bool,
2557            /// The maximum acceptable surface gap computed between the joined solids. Must be positive (i.e. greater than zero).
2558            pub tolerance: LengthUnit,
2559        }
2560
2561        /// Given a target solid, subtract a set of "tool solids" to create a new solid.
2562        ///
2563        /// Most successful subtracts come from solids who's faces do not overlap
2564        /// aka non-coplanar.
2565        ///
2566        /// Prefer one `tool` over multiple when calling this feature.
2567        ///
2568        /// Failure cases:
2569        /// * A common failure is unsupported coplanar faces try to be unioned.
2570        ///
2571        /// Warning cases:
2572        ///
2573        /// Notable behaviors:
2574        /// If two tools occupy the same vertical range and overlap, like two cubes of the same height,
2575        /// the subtract of the first will cause the second tool to fail because the first leaves behind
2576        /// coplanar faces, causing an aforementioned failure case.
2577        ///
2578        /// Unlike `boolean_union`, if one tool in the set overlaps, any OTHER tool in the set
2579        /// that doesn't WILL NOT signal a non-overlap warning.
2580        ///
2581        #[derive(
2582            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
2583            Builder
2584        )]
2585        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2586        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2587        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2588        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2589        pub struct BooleanSubtract
2590        {
2591            /// Geometry to cut out from.
2592            pub target_ids: Vec<Uuid>,
2593            /// Will be cut out from the 'target'.
2594            pub tool_ids: Vec<Uuid>,
2595            /// If true, non-contiguous bodies in the result will be returned as separate objects
2596            #[serde(default)]
2597            #[builder(default)]
2598            pub separate_bodies: bool,
2599            /// If true, use the legacy CSG algorithm.
2600            #[serde(default, skip_serializing_if = "super::is_false")]
2601            #[builder(default)]
2602            pub use_legacy: bool,
2603            /// The maximum acceptable surface gap computed between the target and the solids cut out from it. Must be positive (i.e. greater than zero).
2604            pub tolerance: LengthUnit,
2605        }
2606
2607        /// Create a new non-manifold body by intersecting all the input bodies, cutting and splitting all the faces at the intersection boundaries.
2608        #[derive(
2609            Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
2610            Builder
2611        )]
2612        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2613        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2614        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2615        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2616        pub struct BooleanImprint
2617        {
2618            /// Which target input bodies to intersect. Inputs with non-solid body types are permitted
2619            #[serde(alias = "target_ids")]
2620            pub body_ids: Vec<Uuid>,
2621            ///If provided, only these bodies will be used to intersect with the target bodies in body_ids,
2622            ///Otherwise, all bodies in body_ids will be intersected with themselves.
2623            #[serde(default)]
2624            pub tool_ids: Option<Vec<Uuid>>,
2625            /// If true, target bodies will be separated into multiple objects at their intersection boundaries.
2626            #[serde(default)]
2627            #[builder(default)]
2628            pub separate_bodies: bool,
2629            /// If true, use the legacy CSG algorithm.
2630            #[serde(default, skip_serializing_if = "super::is_false")]
2631            #[builder(default)]
2632            pub use_legacy: bool,
2633            /// If true, the provided tool bodies will not be modified
2634            #[serde(default)]
2635            #[builder(default)]
2636            pub keep_tools: bool,
2637            /// The maximum acceptable surface gap between the intersected bodies. Must be positive (i.e. greater than zero).
2638            pub tolerance: LengthUnit,
2639        }
2640
2641        /// Make a new path by offsetting an object by a given distance.
2642        /// The new path's ID will be the ID of this command.
2643        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2644        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2645        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2646        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2647        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2648        pub struct MakeOffsetPath {
2649            /// The object that will be offset (can be a path, sketch, or a solid)
2650            pub object_id: Uuid,
2651            /// If the object is a solid, this is the ID of the face to base the offset on.
2652            /// If given, and `object_id` refers to a solid, then this face on the solid will be offset.
2653            /// If given but `object_id` doesn't refer to a solid, responds with an error.
2654            /// If not given, then `object_id` itself will be offset directly.
2655            #[serde(default)]
2656            pub face_id: Option<Uuid>,
2657            /// The distance to offset the path (positive for outset, negative for inset)
2658            pub offset: LengthUnit,
2659        }
2660
2661        /// Add a hole to a closed path by offsetting it a uniform distance inward.
2662        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2663        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2664        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2665        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2666        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2667        pub struct AddHoleFromOffset {
2668            /// The closed path to add a hole to.
2669            pub object_id: Uuid,
2670            /// The distance to offset the path (positive for outset, negative for inset)
2671            pub offset: LengthUnit,
2672        }
2673
2674        /// Align the grid with a plane or a planar face.
2675        #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder)]
2676        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2677        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2678        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2679        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2680        pub struct SetGridReferencePlane {
2681            /// The grid to be moved.
2682            pub grid_id: Uuid,
2683            /// The plane or face that the grid will be aligned to.
2684            /// If a face, it must be planar to succeed.
2685            pub reference_id: Uuid,
2686        }
2687
2688        /// Set the scale of the grid lines in the video feed.
2689        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2690        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2691        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2692        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2693        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2694        pub struct SetGridScale {
2695            /// Distance between grid lines represents this much distance.
2696            pub value: f32,
2697            /// Which units the `value` field uses.
2698            pub units: units::UnitLength,
2699        }
2700
2701        /// Set the grid lines to auto scale. The grid will get larger the further you zoom out,
2702        /// and smaller the more you zoom in.
2703        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2704        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2705        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2706        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2707        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2708        pub struct SetGridAutoScale {
2709        }
2710
2711        /// Render transparent surfaces more accurately, but this might make rendering slower.
2712        /// Because it can interfere with runtime performance, it defaults to false.
2713        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2714        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2715        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2716        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2717        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2718        pub struct SetOrderIndependentTransparency {
2719            /// Enables or disables OIT.
2720            /// If not given, toggles it.
2721            pub enabled: Option<bool>,
2722        }
2723
2724        /// Create a region bounded by the intersection of various paths.
2725        /// The region should have an ID taken from the ID of the
2726        /// 'CreateRegion' modeling command.
2727        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2728        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2729        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2730        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2731        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2732        pub struct CreateRegion {
2733            /// Which sketch object to create the region from.
2734            pub object_id: Uuid,
2735            /// First segment to follow to find the region.
2736            pub segment: Uuid,
2737            /// Second segment to follow to find the region.
2738            /// Intersects the first segment.
2739            pub intersection_segment: Uuid,
2740            /// At which intersection between `segment` and `intersection_segment`
2741            /// should we stop following the `segment` and start following `intersection_segment`?
2742            /// Defaults to -1, which means the last intersection.
2743            #[serde(default = "super::negative_one")]
2744            #[builder(default = super::negative_one())]
2745            pub intersection_index: i32,
2746            /// By default, curve counterclockwise at intersections.
2747            /// If this is true, instead curve clockwise.
2748            #[serde(default)]
2749            #[builder(default)]
2750            pub curve_clockwise: bool,
2751            /// Which version of the Region endpoint to call.
2752            #[serde(default, skip_serializing_if = "RegionVersion::is_zero")]
2753            #[builder(default)]
2754            pub version: RegionVersion,
2755        }
2756
2757        /// Enable or disable graphics.
2758        /// Warning: enabling graphics slows down the engine.
2759        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2760        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2761        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2762        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2763        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2764        pub struct ToggleGraphics {
2765            /// Should graphics be enabled?
2766            pub graphics_enabled: bool,
2767        }
2768
2769        /// Create a planar surface bounded by the connection of various paths and curves.
2770        /// 'CreatePlanarSurface' modeling command.
2771        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2772        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2773        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2774        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2775        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2776        pub struct CreatePlanarSurface {
2777            /// Which curves to create the planar surface(s) from.
2778            /// Curves must be provided in the order they are connected to each other
2779            /// They must form a closed loop, either by themselves or in a group
2780            pub curve_ids: Vec<Uuid>,
2781            /// Tolerance for the planar surface creation. Must be positive (i.e. greater than zero).
2782            pub tolerance: LengthUnit,
2783           }
2784
2785        /// Finds a suitable set of arguments that can be passed to CreateRegion to resolve this very region.
2786        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2787        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2788        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2789        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2790        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2791        pub struct RegionGetResolvableIntersectionInfo {
2792            /// Which region to resolve
2793            pub region_id: Uuid,
2794        }
2795
2796        /// Create a region with a query point.
2797        /// The region should have an ID taken from the ID of the
2798        /// 'CreateRegionFromQueryPoint' modeling command.
2799        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2800        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2801        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2802        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2803        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2804        pub struct CreateRegionFromQueryPoint {
2805            /// Which sketch object to create the region from.
2806            pub object_id: Uuid,
2807
2808            /// The query point (in the same coordinates as the sketch itself)
2809            /// if a possible sketch region contains this point, then that region will be created
2810            pub query_point: Point2d<LengthUnit>,
2811            /// Which version of the Region endpoint to call.
2812            #[serde(default, skip_serializing_if = "RegionVersion::is_zero")]
2813            #[builder(default)]
2814            pub version: RegionVersion,
2815        }
2816
2817        /// Finds a suitable point inside the region for calling such that CreateRegionFromQueryPoint will generate an identical region.
2818        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2819        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2820        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2821        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2822        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2823        pub struct RegionGetQueryPoint {
2824            /// Which region to search within
2825            pub region_id: Uuid,
2826        }
2827
2828        /// The user clicked on a point in the window,
2829        /// returns the region the user clicked on, if any.
2830        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2831        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2832        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2833        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2834        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2835        pub struct SelectRegionFromPoint {
2836            /// Where in the window was selected
2837            pub selected_at_window: Point2d,
2838        }
2839
2840        /// Get the smallest box that could contain the given parts.
2841        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2842        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2843        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2844        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2845        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2846        pub struct BoundingBox {
2847            /// IDs of the entities to be included in the box.
2848            /// If this is empty, then all entities are included (the entire scene).
2849            #[builder(default)]
2850            pub entity_ids: Vec<Uuid>,
2851            /// The output unit for the box's dimensions. Defaults to millimeters.
2852            #[builder(default = mm())]
2853            #[serde(default = "mm")]
2854            pub output_unit: units::UnitLength,
2855        }
2856
2857        ///Offset a surface by a given distance.
2858        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2859        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2860        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2861        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2862        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2863        pub struct OffsetSurface {
2864            /// The surface to offset.
2865            pub surface_id: Uuid,
2866            /// The distance to offset the surface by.
2867            pub distance: LengthUnit,
2868            /// Flip the newly created face.
2869            pub flip: bool,
2870        }
2871
2872        /// Tell the engine you're beginning execution,
2873        /// and will be sending many API calls shortly.
2874        /// The engine will render your geometry in
2875        /// reduced detail, to make execution faster.
2876        /// Call EndExecution to restore high quality
2877        /// once you're done sending commands.
2878        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2879        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2880        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2881        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2882        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2883        pub struct BeginExecution {
2884            /// Should rendering occur, or not?
2885            /// If enabled, rendering will be low resolution until you call
2886            /// EndExecution.
2887            pub enable_render: bool,
2888        }
2889
2890        /// Tell the engine you're finished execution,
2891        /// and it should resume rendering at high resolution.
2892        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder, Default)]
2893        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2894        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2895        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2896        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2897        pub struct EndExecution {
2898        }
2899
2900        /// Returns the closest edge to this point.
2901        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2902        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2903        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2904        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2905        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2906        pub struct ClosestEdge {
2907            /// The body whose edges are being queried.
2908            /// If not given, will search all bodies in the scene.
2909            #[serde(default)]
2910            pub object_id: Option<Uuid>,
2911            /// Find the edge closest to this point.
2912            /// Assumed to be in absolute coordinates, relative to global (scene) origin.
2913            pub closest_to: Point3d<f64>,
2914        }
2915
2916        /// Gets debug information about a sketch
2917        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2918        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2919        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2920        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2921        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2922        pub struct SketchGetInfo {
2923            /// Which path to query
2924            pub path_id: ModelingCmdId,
2925        }
2926
2927        /// Sets the KCL Version used by the engine.
2928        #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
2929        #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2930        #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2931        #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2932        #[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2933        pub struct SetKclVersion {
2934            /// Which KCL version the following commands should be executed with.
2935            pub kcl_version: crate::KclVersion,
2936        }
2937    }
2938}
2939
2940pub(crate) fn is_false(b: &bool) -> bool {
2941    !b
2942}
2943
2944pub(crate) fn negative_one() -> i32 {
2945    -1
2946}
2947
2948impl ModelingCmd {
2949    /// Is this command safe to run in an engine batch?
2950    pub fn is_safe_to_batch(&self) -> bool {
2951        use ModelingCmd::*;
2952        matches!(
2953            self,
2954            MovePathPen(_)
2955                | ExtendPath(_)
2956                | Extrude(_)
2957                | Revolve(_)
2958                | Solid3dFilletEdge(_)
2959                | ClosePath(_)
2960                | UpdateAnnotation(_)
2961                | ObjectVisible(_)
2962                | ObjectBringToFront(_)
2963                | Solid2dAddHole(_)
2964                | SendObject(_)
2965                | EntitySetOpacity(_)
2966                | PlaneSetColor(_)
2967                | SetTool(_)
2968        )
2969    }
2970}
2971
2972/// File to import into the current scene.
2973#[derive(Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq, bon::Builder)]
2974#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2975#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2976#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2977#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2978pub struct ImportFile {
2979    /// The file's full path, including file extension.
2980    pub path: String,
2981    /// The raw bytes of the file
2982    #[serde(
2983        serialize_with = "serde_bytes::serialize",
2984        deserialize_with = "serde_bytes::deserialize"
2985    )]
2986    pub data: Vec<u8>,
2987}
2988
2989impl std::fmt::Debug for ImportFile {
2990    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2991        f.debug_struct("ImportFile")
2992            .field("path", &self.path)
2993            .field("data", &"<redacted>")
2994            .finish()
2995    }
2996}
2997
2998impl ToggleGraphics {
2999    /// Enable graphics if true. Disable if false.
3000    pub fn enabled(graphics_enabled: bool) -> Self {
3001        Self::builder().graphics_enabled(graphics_enabled).build()
3002    }
3003}