1use kittycad_modeling_cmds_macros::define_modeling_cmd_enum;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5pub use self::each_cmd::*;
6use crate::{self as kittycad_modeling_cmds};
7
8define_modeling_cmd_enum! {
9 pub mod each_cmd {
10 use std::collections::HashSet;
11
12 use crate::{self as kittycad_modeling_cmds};
13 use kittycad_modeling_cmds_macros::{ModelingCmdVariant};
14 use parse_display_derive::{Display, FromStr};
15 use schemars::JsonSchema;
16 use serde::{Deserialize, Serialize};
17 use uuid::Uuid;
18 use crate::shared::CameraViewState;
19
20 use crate::{
21 format::{OutputFormat2d, OutputFormat3d},
22 id::ModelingCmdId,
23 length_unit::LengthUnit,
24 shared::{
25 Angle,
26 ComponentTransform,
27 RelativeTo,
28 CutType,
29 CutStrategy,
30 CameraMovement,
31 ExtrudedFaceInfo,
32 AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
33 PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
34 Point2d, Point3d, SceneSelectionType, SceneToolType, Opposite,
35 },
36 units,
37 };
38
39 fn default_animation_seconds() -> f32 {
41 0.4
42 }
43
44 fn default_uuid_vector() -> Vec<Uuid> {
46 Vec::new()
47 }
48
49 #[derive(
51 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
52 )]
53 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
54 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
55 pub struct EngineUtilEvaluatePath {
56 pub path_json: String,
58
59 pub t: f64,
61 }
62
63 #[derive(
65 Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
66 )]
67 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
68 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
69 pub struct StartPath {}
70
71 #[derive(
79 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
80 )]
81 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
82 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
83 pub struct MovePathPen {
84 pub path: ModelingCmdId,
86 pub to: Point3d<LengthUnit>,
88 }
89
90 #[derive(
93 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
94 )]
95 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
96 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
97 pub struct ExtendPath {
98 pub path: ModelingCmdId,
100 pub segment: PathSegment,
103 }
104
105
106 #[derive(
108 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
109 )]
110 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
111 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
112 pub struct Extrude {
113 pub target: ModelingCmdId,
116 pub distance: LengthUnit,
118 #[serde(default)]
121 pub faces: Option<ExtrudedFaceInfo>,
122 #[serde(default)]
125 pub opposite: Opposite<LengthUnit>,
126 }
127
128 #[derive(
130 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
131 )]
132 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
133 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
134 pub struct Sweep {
135 pub target: ModelingCmdId,
138 pub trajectory: ModelingCmdId,
140 pub sectional: bool,
142 pub tolerance: LengthUnit,
144 #[serde(default)]
146 pub relative_to: RelativeTo,
147 }
148
149 #[derive(
151 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
152 )]
153 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
154 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
155 pub struct Revolve {
156 pub target: ModelingCmdId,
159 pub origin: Point3d<LengthUnit>,
161 pub axis: Point3d<f64>,
163 pub axis_is_2d: bool,
165 pub angle: Angle,
167 pub tolerance: LengthUnit,
169 #[serde(default)]
172 pub opposite: Opposite<Angle>,
173 }
174
175 #[derive(
177 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
178 )]
179 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
180 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
181 pub struct Solid3dShellFace {
182 pub object_id: Uuid,
184 pub face_ids: Vec<Uuid>,
186 pub shell_thickness: LengthUnit,
189 #[serde(default)]
191 pub hollow: bool,
192 }
193
194 #[derive(
196 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
197 )]
198 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
199 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
200 pub struct RevolveAboutEdge {
201 pub target: ModelingCmdId,
204 pub edge_id: Uuid,
206 pub angle: Angle,
208 pub tolerance: LengthUnit,
210 #[serde(default)]
213 pub opposite: Opposite<Angle>,
214 }
215
216 #[derive(
218 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
219 )]
220 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
221 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
222 pub struct Loft {
223 pub section_ids: Vec<Uuid>,
226 pub v_degree: std::num::NonZeroU32,
229 pub bez_approximate_rational: bool,
233 pub base_curve_index: Option<u32>,
235 pub tolerance: LengthUnit,
237 }
238
239
240 #[derive(
242 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
243 )]
244 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
245 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
246 pub struct ClosePath {
247 pub path_id: Uuid,
249 }
250
251 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
253 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
254 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
255 pub struct CameraDragStart {
256 pub interaction: CameraDragInteractionType,
258 pub window: Point2d,
260 }
261
262 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
264 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
265 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
266 pub struct CameraDragMove {
267 pub interaction: CameraDragInteractionType,
269 pub window: Point2d,
271 pub sequence: Option<u32>,
276 }
277
278 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
280 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
281 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
282 pub struct CameraDragEnd {
283 pub interaction: CameraDragInteractionType,
285 pub window: Point2d,
287 }
288
289 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
291 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
292 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
293 pub struct DefaultCameraGetSettings {}
294
295 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
297 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
298 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
299 pub struct DefaultCameraGetView {}
300
301 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
303 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
304 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
305 pub struct DefaultCameraSetView {
306 pub view: CameraViewState,
308 }
309
310 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
312 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
313 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
314 pub struct DefaultCameraLookAt {
315 pub vantage: Point3d,
317 pub center: Point3d,
319 pub up: Point3d,
321 pub sequence: Option<u32>,
326 }
327
328 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
330 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
331 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
332 pub struct DefaultCameraPerspectiveSettings {
333 pub vantage: Point3d,
335 pub center: Point3d,
337 pub up: Point3d,
339 pub fov_y: Option<f32>,
341 pub z_near: Option<f32>,
343 pub z_far: Option<f32>,
345 pub sequence: Option<u32>,
350 }
351
352 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
354 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
355 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
356 pub struct DefaultCameraZoom {
357 pub magnitude: f32,
361 }
362
363 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
365 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
366 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
367 pub struct Export2d {
368 pub entity_ids: Vec<Uuid>,
370 pub format: OutputFormat2d,
372 }
373
374 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
376 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
377 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
378 pub struct Export3d {
379 pub entity_ids: Vec<Uuid>,
381 pub format: OutputFormat3d,
383 }
384
385 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
387 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
388 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
389 pub struct Export {
390 pub entity_ids: Vec<Uuid>,
392 pub format: OutputFormat3d,
394 }
395
396 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
398 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
399 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
400 pub struct EntityGetParentId {
401 pub entity_id: Uuid,
403 }
404
405 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
407 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
408 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
409 pub struct EntityGetNumChildren {
410 pub entity_id: Uuid,
412 }
413
414 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
416 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
417 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
418 pub struct EntityGetChildUuid {
419 pub entity_id: Uuid,
421 pub child_index: u32,
423 }
424
425 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
427 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
428 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
429 pub struct EntityGetAllChildUuids {
430 pub entity_id: Uuid,
432 }
433
434 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
436 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
437 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
438 pub struct EntityGetSketchPaths {
439 pub entity_id: Uuid,
441 }
442
443 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
445 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
446 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
447 pub struct EntityGetDistance {
448 pub entity_id1: Uuid,
450 pub entity_id2: Uuid,
452 pub distance_type: DistanceType,
454 }
455
456 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
459 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
460 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
461 pub struct EntityClone {
462 pub entity_id: Uuid,
464 }
465
466 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
469 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
470 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
471 pub struct EntityLinearPatternTransform {
472 pub entity_id: Uuid,
474 #[serde(default)]
478 pub transform: Vec<crate::shared::Transform>,
479 #[serde(default)]
483 pub transforms: Vec<Vec<crate::shared::Transform>>,
484 }
485
486 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
488 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
489 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
490 pub struct EntityLinearPattern {
491 pub entity_id: Uuid,
493 pub axis: Point3d<f64>,
496 pub num_repetitions: u32,
498 pub spacing: LengthUnit,
500 }
501 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
503 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
504 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
505 pub struct EntityCircularPattern {
506 pub entity_id: Uuid,
508 pub axis: Point3d<f64>,
511 pub center: Point3d<LengthUnit>,
514 pub num_repetitions: u32,
516 pub arc_degrees: f64,
518 pub rotate_duplicates: bool,
520 }
521
522 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
524 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
525 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
526 pub struct EntityMakeHelix {
527 pub cylinder_id: Uuid,
529 pub revolutions: f64,
531 #[serde(default)]
533 pub start_angle: Angle,
534 pub is_clockwise: bool,
536 pub length: LengthUnit,
538 }
539
540 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
542 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
543 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
544 pub struct EntityMakeHelixFromParams {
545 pub radius: LengthUnit,
547 pub length: LengthUnit,
549 pub revolutions: f64,
551 #[serde(default)]
553 pub start_angle: Angle,
554 pub is_clockwise: bool,
556 pub center: Point3d<LengthUnit>,
558 pub axis: Point3d<f64>,
560 }
561
562 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
564 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
565 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
566 pub struct EntityMakeHelixFromEdge {
567 pub radius: LengthUnit,
569 pub length: Option<LengthUnit>,
571 pub revolutions: f64,
573 #[serde(default)]
575 pub start_angle: Angle,
576 pub is_clockwise: bool,
578 pub edge_id: Uuid,
580 }
581
582 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
584 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
585 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
586 pub struct EntityMirror {
587 pub ids: Vec<Uuid>,
589 pub axis: Point3d<f64>,
591 pub point: Point3d<LengthUnit>,
593 }
594
595 #[derive(
597 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
598 )]
599 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
600 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
601 pub struct EntityMirrorAcrossEdge {
602 pub ids: Vec<Uuid>,
604 pub edge_id: Uuid,
606 }
607
608 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
611 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
612 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
613 pub struct SelectWithPoint {
614 pub selected_at_window: Point2d,
616 pub selection_type: SceneSelectionType,
618 }
619
620 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
622 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
623 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
624 pub struct SelectAdd {
625 pub entities: Vec<Uuid>,
627 }
628
629 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
631 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
632 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
633 pub struct SelectRemove {
634 pub entities: Vec<Uuid>,
636 }
637
638 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
640 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
641 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
642 pub struct SceneClearAll {}
643
644 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
646 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
647 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
648 pub struct SelectReplace {
649 pub entities: Vec<Uuid>,
651 }
652
653 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
656 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
657 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
658 pub struct HighlightSetEntity {
659 pub selected_at_window: Point2d,
661 pub sequence: Option<u32>,
666 }
667
668 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
670 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
671 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
672 pub struct HighlightSetEntities {
673 pub entities: Vec<Uuid>,
675 }
676
677 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
679 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
680 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
681 pub struct NewAnnotation {
682 pub options: AnnotationOptions,
684 pub clobber: bool,
686 pub annotation_type: AnnotationType,
688 }
689
690 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
692 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
693 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
694 pub struct UpdateAnnotation {
695 pub annotation_id: Uuid,
697 pub options: AnnotationOptions,
700 }
701
702 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
704 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
705 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
706 pub struct EdgeLinesVisible {
707 pub hidden: bool,
709 }
710
711 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
713 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
714 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
715 pub struct ObjectVisible {
716 pub object_id: Uuid,
718 pub hidden: bool,
720 }
721
722 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
724 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
725 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
726 pub struct ObjectBringToFront {
727 pub object_id: Uuid,
729 }
730
731 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
733 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
734 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
735 pub struct ObjectSetMaterialParamsPbr {
736 pub object_id: Uuid,
738 pub color: Color,
740 pub metalness: f32,
742 pub roughness: f32,
744 pub ambient_occlusion: f32,
746 }
747 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
749 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
750 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
751 pub struct GetEntityType {
752 pub entity_id: Uuid,
754 }
755
756 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
758 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
759 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
760 pub struct Solid3dGetAllEdgeFaces {
761 pub object_id: Uuid,
763 pub edge_id: Uuid,
765 }
766
767 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
769 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
770 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
771 pub struct Solid2dAddHole {
772 pub object_id: Uuid,
774 pub hole_id: Uuid,
776 }
777
778 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
780 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
781 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
782 pub struct Solid3dGetAllOppositeEdges {
783 pub object_id: Uuid,
785 pub edge_id: Uuid,
787 pub along_vector: Option<Point3d<f64>>,
789 }
790
791 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
793 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
794 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
795 pub struct Solid3dGetOppositeEdge {
796 pub object_id: Uuid,
798 pub edge_id: Uuid,
800 pub face_id: Uuid,
802 }
803
804 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
806 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
807 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
808 pub struct Solid3dGetNextAdjacentEdge {
809 pub object_id: Uuid,
811 pub edge_id: Uuid,
813 pub face_id: Uuid,
815 }
816
817 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
819 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
820 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
821 pub struct Solid3dGetPrevAdjacentEdge {
822 pub object_id: Uuid,
824 pub edge_id: Uuid,
826 pub face_id: Uuid,
828 }
829
830 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
832 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
833 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
834 pub struct Solid3dGetCommonEdge {
835 pub object_id: Uuid,
837 pub face_ids: [Uuid; 2]
839 }
840
841 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
843 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
844 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
845 pub struct Solid3dFilletEdge {
846 pub object_id: Uuid,
848 #[serde(default)]
850 pub edge_id: Option<Uuid>,
851 #[serde(default)]
853 pub edge_ids: Vec<Uuid>,
854 pub radius: LengthUnit,
856 pub tolerance: LengthUnit,
858 #[serde(default)]
860 pub cut_type: CutType,
861 #[serde(default)]
863 pub strategy: CutStrategy,
864 #[serde(default)]
872 pub extra_face_ids: Vec<Uuid>,
873 }
874
875 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
877 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
878 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
879 pub struct FaceIsPlanar {
880 pub object_id: Uuid,
882 }
883
884 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
886 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
887 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
888 pub struct FaceGetPosition {
889 pub object_id: Uuid,
891
892 pub uv: Point2d<f64>,
894 }
895
896 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
898 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
899 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
900 pub struct FaceGetCenter {
901 pub object_id: Uuid,
903 }
904
905 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
907 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
908 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
909 pub struct FaceGetGradient {
910 pub object_id: Uuid,
912
913 pub uv: Point2d<f64>,
915 }
916
917 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
919 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
920 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
921 pub struct SendObject {
922 pub object_id: Uuid,
924 pub front: bool,
926 }
927 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
929 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
930 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
931 pub struct EntitySetOpacity {
932 pub entity_id: Uuid,
934 pub opacity: f32,
938 }
939
940 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
942 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
943 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
944 pub struct EntityFade {
945 pub entity_id: Uuid,
947 pub fade_in: bool,
949 #[serde(default = "default_animation_seconds")]
951 pub duration_seconds: f32,
952 }
953
954 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
956 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
957 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
958 pub struct MakePlane {
959 pub origin: Point3d<LengthUnit>,
961 pub x_axis: Point3d<f64>,
963 pub y_axis: Point3d<f64>,
965 pub size: LengthUnit,
969 pub clobber: bool,
971 pub hide: Option<bool>,
973 }
974
975 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
977 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
978 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
979 pub struct PlaneSetColor {
980 pub plane_id: Uuid,
982 pub color: Color,
984 }
985
986 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
988 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
989 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
990 pub struct SetTool {
991 pub tool: SceneToolType,
993 }
994
995 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
997 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
998 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
999 pub struct MouseMove {
1000 pub window: Point2d,
1002 pub sequence: Option<u32>,
1007 }
1008
1009 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1012 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1013 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1014 pub struct MouseClick {
1015 pub window: Point2d,
1017 }
1018
1019 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1023 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1024 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1025 pub struct SketchModeDisable {}
1026
1027 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1029 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1030 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1031 pub struct GetSketchModePlane {}
1032
1033 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1035 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1036 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1037 pub struct CurveSetConstraint {
1038 pub object_id: Uuid,
1040 pub constraint_bound: PathComponentConstraintBound,
1042 pub constraint_type: PathComponentConstraintType,
1044 }
1045
1046 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1048 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1049 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1050 pub struct EnableSketchMode {
1051 pub entity_id: Uuid,
1053 pub ortho: bool,
1056 pub animated: bool,
1058 pub adjust_camera: bool,
1060 pub planar_normal: Option<Point3d<f64>>,
1063 }
1064
1065 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1069 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1070 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1071 pub struct EnableDryRun {}
1072
1073 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1077 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1078 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1079 pub struct DisableDryRun {}
1080
1081 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1083 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1084 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1085 pub struct SetBackgroundColor {
1086 pub color: Color,
1088 }
1089
1090 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1092 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1093 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1094 pub struct SetCurrentToolProperties {
1095 pub color: Option<Color>,
1097 }
1098
1099 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1101 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1102 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1103 pub struct SetDefaultSystemProperties {
1104 pub color: Option<Color>,
1106 }
1107
1108 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1110 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1111 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1112 pub struct CurveGetType {
1113 pub curve_id: Uuid,
1115 }
1116
1117 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1119 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1120 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1121 pub struct CurveGetControlPoints {
1122 pub curve_id: Uuid,
1124 }
1125
1126 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1128 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1129 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1130 pub struct ProjectEntityToPlane {
1131 pub entity_id: Uuid,
1133 pub plane_id: Uuid,
1135 pub use_plane_coords: bool,
1138 }
1139
1140 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1142 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1143 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1144 pub struct ProjectPointsToPlane {
1145 pub plane_id: Uuid,
1147 pub points: Vec<Point3d<f64>>,
1149 pub use_plane_coords: bool,
1152 }
1153
1154 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1156 #[serde(rename_all = "snake_case")]
1157 #[display(style = "snake_case")]
1158 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1159 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1160 pub enum ImageFormat {
1161 Png,
1163 Jpeg,
1165 }
1166
1167 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1169 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1170 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1171 pub struct TakeSnapshot {
1172 pub format: ImageFormat,
1174 }
1175
1176 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1178 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1179 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1180 pub struct MakeAxesGizmo {
1181 pub gizmo_mode: bool,
1184 pub clobber: bool,
1186 }
1187
1188 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1190 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1191 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1192 pub struct PathGetInfo {
1193 pub path_id: Uuid,
1195 }
1196
1197 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1199 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1200 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1201 pub struct PathGetCurveUuidsForVertices {
1202 pub path_id: Uuid,
1204
1205 pub vertex_ids: Vec<Uuid>,
1207 }
1208
1209 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1211 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1212 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1213 pub struct PathGetCurveUuid {
1214 pub path_id: Uuid,
1216
1217 pub index: u32,
1219 }
1220
1221 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1223 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1224 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1225 pub struct PathGetVertexUuids {
1226 pub path_id: Uuid,
1228 }
1229
1230 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1232 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1233 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1234 pub struct PathGetSketchTargetUuid {
1235 pub path_id: Uuid,
1237 }
1238
1239 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1241 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1242 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1243 pub struct HandleMouseDragStart {
1244 pub window: Point2d,
1246 }
1247
1248 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1250 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1251 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1252 pub struct HandleMouseDragMove {
1253 pub window: Point2d,
1255 pub sequence: Option<u32>,
1260 }
1261
1262 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1264 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1265 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1266 pub struct HandleMouseDragEnd {
1267 pub window: Point2d,
1269 }
1270
1271 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1273 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1274 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1275 pub struct RemoveSceneObjects {
1276 pub object_ids: HashSet<Uuid>,
1278 }
1279
1280 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1283 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1284 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1285 pub struct PlaneIntersectAndProject {
1286 pub plane_id: Uuid,
1288 pub window: Point2d,
1290 }
1291
1292 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1294 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1295 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1296 pub struct CurveGetEndPoints {
1297 pub curve_id: Uuid,
1299 }
1300
1301 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1303 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1304 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1305 pub struct ReconfigureStream {
1306 pub width: u32,
1308 pub height: u32,
1310 pub fps: u32,
1312 #[serde(default)]
1314 pub bitrate: Option<u32>,
1315 }
1316
1317 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1319 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1320 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1321 pub struct ImportFiles {
1322 pub files: Vec<super::ImportFile>,
1324 pub format: crate::format::InputFormat3d,
1326 }
1327
1328 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1333 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1334 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1335 pub struct SetSceneUnits {
1336 pub unit: units::UnitLength,
1338 }
1339
1340 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1342 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1343 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1344 pub struct Mass {
1345 pub entity_ids: Vec<Uuid>,
1348 pub material_density: f64,
1350 pub material_density_unit: units::UnitDensity,
1352 pub output_unit: units::UnitMass,
1354 }
1355
1356 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1358 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1359 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1360 pub struct Density {
1361 pub entity_ids: Vec<Uuid>,
1364 pub material_mass: f64,
1366 pub material_mass_unit: units::UnitMass,
1368 pub output_unit: units::UnitDensity,
1370 }
1371
1372 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1374 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1375 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1376 pub struct Volume {
1377 pub entity_ids: Vec<Uuid>,
1380 pub output_unit: units::UnitVolume,
1382 }
1383
1384 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1386 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1387 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1388 pub struct CenterOfMass {
1389 pub entity_ids: Vec<Uuid>,
1392 pub output_unit: units::UnitLength,
1394 }
1395
1396 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1398 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1399 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1400 pub struct SurfaceArea {
1401 pub entity_ids: Vec<Uuid>,
1404 pub output_unit: units::UnitArea,
1406 }
1407
1408 #[derive(
1410 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1411 )]
1412 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1413 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1414 pub struct DefaultCameraFocusOn {
1415 pub uuid: Uuid,
1417 }
1418 #[derive(
1420 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1421 )]
1422 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1423 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1424 pub struct SetSelectionType {
1425 pub selection_type: SceneSelectionType,
1427 }
1428
1429 #[derive(
1431 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1432 )]
1433 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1434 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1435 pub struct SetSelectionFilter {
1436 pub filter: Vec<EntityType>,
1439 }
1440
1441 #[derive(
1443 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1444 )]
1445 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1446 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1447 pub struct DefaultCameraSetOrthographic {}
1448
1449 #[derive(
1451 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1452 )]
1453 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1454 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1455 pub struct DefaultCameraSetPerspective {
1456 pub parameters: Option<PerspectiveCameraParameters>,
1458 }
1459
1460 #[derive(
1463 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1464 )]
1465 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1466 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1467 pub struct DefaultCameraCenterToSelection {
1468 #[serde(default)]
1471 pub camera_movement: CameraMovement,
1472 }
1473
1474 #[derive(
1476 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1477 )]
1478 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1479 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1480 pub struct DefaultCameraCenterToScene {
1481 #[serde(default)]
1484 pub camera_movement: CameraMovement,
1485 }
1486
1487 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1489 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1490 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1491 pub struct ZoomToFit {
1492 #[serde(default = "default_uuid_vector")]
1494 pub object_ids: Vec<Uuid>,
1495 #[serde(default)]
1500 pub padding: f32,
1501 #[serde(default)]
1503 pub animated: bool,
1504 }
1505
1506 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1508 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1509 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1510 pub struct OrientToFace {
1511 pub face_id: Uuid,
1513 #[serde(default)]
1518 pub padding: f32,
1519 #[serde(default)]
1521 pub animated: bool,
1522 }
1523
1524 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1526 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1527 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1528 pub struct ViewIsometric {
1529 #[serde(default = "f32::default")]
1534 pub padding: f32,
1535 }
1536
1537 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1539 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1540 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1541 pub struct Solid3dGetExtrusionFaceInfo {
1542 pub object_id: Uuid,
1544 pub edge_id: Uuid,
1546 }
1547
1548 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1550 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1551 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1552 pub struct Solid3dGetAdjacencyInfo {
1553 pub object_id: Uuid,
1555 pub edge_id: Uuid,
1557 }
1558
1559
1560 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1562 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1563 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1564 pub struct SelectClear {}
1565
1566 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1568 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1569 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1570 pub struct SelectGet {}
1571
1572 #[derive(
1574 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1575 )]
1576 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1577 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1578 pub struct GetNumObjects {}
1579
1580 #[derive(
1582 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1583 )]
1584 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1585 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1586 pub struct SetObjectTransform
1587 {
1588 pub object_id: Uuid,
1590 pub transforms: Vec<ComponentTransform>,
1592 }
1593
1594 #[derive(
1597 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1598 )]
1599 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1600 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1601 pub struct BooleanUnion
1602 {
1603 pub solid_ids: Vec<Uuid>,
1606 pub tolerance: LengthUnit,
1608 }
1609
1610 #[derive(
1613 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1614 )]
1615 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1616 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1617 pub struct BooleanIntersection
1618 {
1619 pub solid_ids: Vec<Uuid>,
1621 pub tolerance: LengthUnit,
1623 }
1624
1625 #[derive(
1629 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1630 )]
1631 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1632 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1633 pub struct BooleanSubtract
1634 {
1635 pub target_ids: Vec<Uuid>,
1637 pub tool_ids: Vec<Uuid>,
1639 pub tolerance: LengthUnit,
1641 }
1642
1643 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1646 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1647 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1648 pub struct MakeOffsetPath {
1649 pub object_id: Uuid,
1651 #[serde(default)]
1656 pub face_id: Option<Uuid>,
1657 pub offset: LengthUnit,
1659 }
1660
1661 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1663 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1664 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1665 pub struct AddHoleFromOffset {
1666 pub object_id: Uuid,
1668 pub offset: LengthUnit,
1670 }
1671
1672 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1674 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1675 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1676 pub struct SetGridReferencePlane {
1677 pub grid_id: Uuid,
1679 pub reference_id: Uuid,
1682 }
1683
1684 }
1685}
1686
1687impl ModelingCmd {
1688 pub fn is_safe_to_batch(&self) -> bool {
1690 use ModelingCmd::*;
1691 matches!(
1692 self,
1693 MovePathPen(_)
1694 | ExtendPath(_)
1695 | Extrude(_)
1696 | Revolve(_)
1697 | Solid3dFilletEdge(_)
1698 | ClosePath(_)
1699 | UpdateAnnotation(_)
1700 | ObjectVisible(_)
1701 | ObjectBringToFront(_)
1702 | Solid2dAddHole(_)
1703 | SendObject(_)
1704 | EntitySetOpacity(_)
1705 | PlaneSetColor(_)
1706 | SetTool(_)
1707 )
1708 }
1709}
1710
1711#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1715#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1716#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1717pub struct ImportFile {
1718 pub path: String,
1720 #[serde(
1722 serialize_with = "serde_bytes::serialize",
1723 deserialize_with = "serde_bytes::deserialize"
1724 )]
1725 pub data: Vec<u8>,
1726}