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
19 use crate::{
20 format::{OutputFormat2d, OutputFormat3d},
21 id::ModelingCmdId,
22 length_unit::LengthUnit,
23 shared::{
24 Angle,
25 ComponentTransform,
26 CutType,
27 CameraMovement,
28 ExtrudedFaceInfo,
29 AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
30 PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
31 Point2d, Point3d, SceneSelectionType, SceneToolType,
32 },
33 units,
34 };
35
36 fn default_animation_seconds() -> f32 {
38 0.4
39 }
40
41 fn default_uuid_vector() -> Vec<Uuid> {
43 Vec::new()
44 }
45
46 #[derive(
48 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
49 )]
50 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
51 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
52 pub struct EngineUtilEvaluatePath {
53 pub path_json: String,
55
56 pub t: f64,
58 }
59
60 #[derive(
62 Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
63 )]
64 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
65 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
66 pub struct StartPath {}
67
68 #[derive(
76 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
77 )]
78 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
79 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
80 pub struct MovePathPen {
81 pub path: ModelingCmdId,
83 pub to: Point3d<LengthUnit>,
85 }
86
87 #[derive(
90 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
91 )]
92 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
93 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
94 pub struct ExtendPath {
95 pub path: ModelingCmdId,
97 pub segment: PathSegment,
100 }
101
102 #[derive(
104 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
105 )]
106 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
107 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
108 pub struct Extrude {
109 pub target: ModelingCmdId,
112 pub distance: LengthUnit,
114 #[serde(default)]
117 pub faces: Option<ExtrudedFaceInfo>,
118 }
119
120 #[derive(
122 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
123 )]
124 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
125 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
126 pub struct Sweep {
127 pub target: ModelingCmdId,
130 pub trajectory: ModelingCmdId,
132 pub sectional: bool,
134 pub tolerance: LengthUnit,
136 }
137
138 #[derive(
140 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
141 )]
142 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
143 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
144 pub struct Revolve {
145 pub target: ModelingCmdId,
148 pub origin: Point3d<LengthUnit>,
150 pub axis: Point3d<f64>,
152 pub axis_is_2d: bool,
154 pub angle: Angle,
156 pub tolerance: LengthUnit,
158 }
159
160 #[derive(
162 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
163 )]
164 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
165 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
166 pub struct Solid3dShellFace {
167 pub object_id: Uuid,
169 pub face_ids: Vec<Uuid>,
171 pub shell_thickness: LengthUnit,
174 #[serde(default)]
176 pub hollow: bool,
177 }
178
179 #[derive(
181 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
182 )]
183 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
184 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
185 pub struct RevolveAboutEdge {
186 pub target: ModelingCmdId,
189 pub edge_id: Uuid,
191 pub angle: Angle,
193 pub tolerance: LengthUnit,
195 }
196
197 #[derive(
199 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
200 )]
201 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
202 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
203 pub struct Loft {
204 pub section_ids: Vec<Uuid>,
207 pub v_degree: std::num::NonZeroU32,
210 pub bez_approximate_rational: bool,
214 pub base_curve_index: Option<u32>,
216 pub tolerance: LengthUnit,
218 }
219
220
221 #[derive(
223 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
224 )]
225 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
226 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
227 pub struct ClosePath {
228 pub path_id: Uuid,
230 }
231
232 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
234 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
235 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
236 pub struct CameraDragStart {
237 pub interaction: CameraDragInteractionType,
239 pub window: Point2d,
241 }
242
243 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
245 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
246 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
247 pub struct CameraDragMove {
248 pub interaction: CameraDragInteractionType,
250 pub window: Point2d,
252 pub sequence: Option<u32>,
257 }
258
259 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
261 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
262 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
263 pub struct CameraDragEnd {
264 pub interaction: CameraDragInteractionType,
266 pub window: Point2d,
268 }
269
270 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
272 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
273 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
274 pub struct DefaultCameraGetSettings {}
275
276 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
278 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
279 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
280 pub struct DefaultCameraLookAt {
281 pub vantage: Point3d,
283 pub center: Point3d,
285 pub up: Point3d,
287 pub sequence: Option<u32>,
292 }
293
294 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
296 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
297 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
298 pub struct DefaultCameraPerspectiveSettings {
299 pub vantage: Point3d,
301 pub center: Point3d,
303 pub up: Point3d,
305 pub fov_y: Option<f32>,
307 pub z_near: Option<f32>,
309 pub z_far: Option<f32>,
311 pub sequence: Option<u32>,
316 }
317
318 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
320 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
321 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
322 pub struct DefaultCameraZoom {
323 pub magnitude: f32,
327 }
328
329 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
331 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
332 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
333 pub struct Export2d {
334 pub entity_ids: Vec<Uuid>,
336 pub format: OutputFormat2d,
338 }
339
340 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
342 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
343 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
344 pub struct Export3d {
345 pub entity_ids: Vec<Uuid>,
347 pub format: OutputFormat3d,
349 }
350
351 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
353 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
354 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
355 pub struct Export {
356 pub entity_ids: Vec<Uuid>,
358 pub format: OutputFormat3d,
360 }
361
362 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
364 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
365 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
366 pub struct EntityGetParentId {
367 pub entity_id: Uuid,
369 }
370
371 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
373 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
374 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
375 pub struct EntityGetNumChildren {
376 pub entity_id: Uuid,
378 }
379
380 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
382 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
383 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
384 pub struct EntityGetChildUuid {
385 pub entity_id: Uuid,
387 pub child_index: u32,
389 }
390
391 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
393 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
394 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
395 pub struct EntityGetAllChildUuids {
396 pub entity_id: Uuid,
398 }
399
400 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
402 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
403 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
404 pub struct EntityGetSketchPaths {
405 pub entity_id: Uuid,
407 }
408
409 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
411 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
412 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
413 pub struct EntityGetDistance {
414 pub entity_id1: Uuid,
416 pub entity_id2: Uuid,
418 pub distance_type: DistanceType,
420 }
421
422 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
425 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
426 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
427 pub struct EntityClone {
428 pub entity_id: Uuid,
430 }
431
432 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
435 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
436 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
437 pub struct EntityLinearPatternTransform {
438 pub entity_id: Uuid,
440 #[serde(default)]
444 pub transform: Vec<crate::shared::Transform>,
445 #[serde(default)]
449 pub transforms: Vec<Vec<crate::shared::Transform>>,
450 }
451
452 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
454 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
455 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
456 pub struct EntityLinearPattern {
457 pub entity_id: Uuid,
459 pub axis: Point3d<f64>,
462 pub num_repetitions: u32,
464 pub spacing: LengthUnit,
466 }
467 #[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 EntityCircularPattern {
472 pub entity_id: Uuid,
474 pub axis: Point3d<f64>,
477 pub center: Point3d<LengthUnit>,
480 pub num_repetitions: u32,
482 pub arc_degrees: f64,
484 pub rotate_duplicates: bool,
486 }
487
488 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
490 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
491 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
492 pub struct EntityMakeHelix {
493 pub cylinder_id: Uuid,
495 pub revolutions: f64,
497 #[serde(default)]
499 pub start_angle: Angle,
500 pub is_clockwise: bool,
502 pub length: LengthUnit,
504 }
505
506 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
508 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
509 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
510 pub struct EntityMakeHelixFromParams {
511 pub radius: LengthUnit,
513 pub length: LengthUnit,
515 pub revolutions: f64,
517 #[serde(default)]
519 pub start_angle: Angle,
520 pub is_clockwise: bool,
522 pub center: Point3d<LengthUnit>,
524 pub axis: Point3d<f64>,
526 }
527
528 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
530 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
531 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
532 pub struct EntityMakeHelixFromEdge {
533 pub radius: LengthUnit,
535 pub length: Option<LengthUnit>,
537 pub revolutions: f64,
539 #[serde(default)]
541 pub start_angle: Angle,
542 pub is_clockwise: bool,
544 pub edge_id: Uuid,
546 }
547
548 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
550 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
551 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
552 pub struct EntityMirror {
553 pub ids: Vec<Uuid>,
555 pub axis: Point3d<f64>,
557 pub point: Point3d<LengthUnit>,
559 }
560
561 #[derive(
563 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
564 )]
565 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
566 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
567 pub struct EntityMirrorAcrossEdge {
568 pub ids: Vec<Uuid>,
570 pub edge_id: Uuid,
572 }
573
574 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
577 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
578 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
579 pub struct SelectWithPoint {
580 pub selected_at_window: Point2d,
582 pub selection_type: SceneSelectionType,
584 }
585
586 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
588 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
589 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
590 pub struct SelectAdd {
591 pub entities: Vec<Uuid>,
593 }
594
595 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
597 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
598 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
599 pub struct SelectRemove {
600 pub entities: Vec<Uuid>,
602 }
603
604 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
606 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
607 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
608 pub struct SceneClearAll {}
609
610 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
612 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
613 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
614 pub struct SelectReplace {
615 pub entities: Vec<Uuid>,
617 }
618
619 #[derive(Debug, Clone, Copy, 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 HighlightSetEntity {
625 pub selected_at_window: Point2d,
627 pub sequence: Option<u32>,
632 }
633
634 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
636 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
637 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
638 pub struct HighlightSetEntities {
639 pub entities: Vec<Uuid>,
641 }
642
643 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
645 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
646 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
647 pub struct NewAnnotation {
648 pub options: AnnotationOptions,
650 pub clobber: bool,
652 pub annotation_type: AnnotationType,
654 }
655
656 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
658 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
659 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
660 pub struct UpdateAnnotation {
661 pub annotation_id: Uuid,
663 pub options: AnnotationOptions,
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 EdgeLinesVisible {
673 pub hidden: bool,
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 ObjectVisible {
682 pub object_id: Uuid,
684 pub hidden: bool,
686 }
687
688 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
690 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
691 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
692 pub struct ObjectBringToFront {
693 pub object_id: Uuid,
695 }
696
697 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
699 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
700 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
701 pub struct ObjectSetMaterialParamsPbr {
702 pub object_id: Uuid,
704 pub color: Color,
706 pub metalness: f32,
708 pub roughness: f32,
710 pub ambient_occlusion: f32,
712 }
713 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
715 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
716 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
717 pub struct GetEntityType {
718 pub entity_id: Uuid,
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 Solid3dGetAllEdgeFaces {
727 pub object_id: Uuid,
729 pub edge_id: Uuid,
731 }
732
733 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
735 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
736 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
737 pub struct Solid2dAddHole {
738 pub object_id: Uuid,
740 pub hole_id: Uuid,
742 }
743
744 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
746 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
747 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
748 pub struct Solid3dGetAllOppositeEdges {
749 pub object_id: Uuid,
751 pub edge_id: Uuid,
753 pub along_vector: Option<Point3d<f64>>,
755 }
756
757 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
759 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
760 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
761 pub struct Solid3dGetOppositeEdge {
762 pub object_id: Uuid,
764 pub edge_id: Uuid,
766 pub face_id: Uuid,
768 }
769
770 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
772 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
773 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
774 pub struct Solid3dGetNextAdjacentEdge {
775 pub object_id: Uuid,
777 pub edge_id: Uuid,
779 pub face_id: Uuid,
781 }
782
783 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
785 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
786 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
787 pub struct Solid3dGetPrevAdjacentEdge {
788 pub object_id: Uuid,
790 pub edge_id: Uuid,
792 pub face_id: Uuid,
794 }
795
796 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
798 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
799 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
800 pub struct Solid3dGetCommonEdge {
801 pub object_id: Uuid,
803 pub face_ids: [Uuid; 2]
805 }
806
807 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
809 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
810 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
811 pub struct Solid3dFilletEdge {
812 pub object_id: Uuid,
814 pub edge_id: Uuid,
816 pub radius: LengthUnit,
818 pub tolerance: LengthUnit,
820 #[serde(default)]
822 pub cut_type: CutType,
823 #[serde(default, skip_serializing_if = "Option::is_none")]
826 pub face_id: Option<Uuid>,
827 }
828
829 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
831 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
832 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
833 pub struct FaceIsPlanar {
834 pub object_id: Uuid,
836 }
837
838 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
840 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
841 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
842 pub struct FaceGetPosition {
843 pub object_id: Uuid,
845
846 pub uv: Point2d<f64>,
848 }
849
850 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
852 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
853 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
854 pub struct FaceGetCenter {
855 pub object_id: Uuid,
857 }
858
859 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
861 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
862 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
863 pub struct FaceGetGradient {
864 pub object_id: Uuid,
866
867 pub uv: Point2d<f64>,
869 }
870
871 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
873 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
874 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
875 pub struct SendObject {
876 pub object_id: Uuid,
878 pub front: bool,
880 }
881 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
883 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
884 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
885 pub struct EntitySetOpacity {
886 pub entity_id: Uuid,
888 pub opacity: f32,
892 }
893
894 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
896 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
897 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
898 pub struct EntityFade {
899 pub entity_id: Uuid,
901 pub fade_in: bool,
903 #[serde(default = "default_animation_seconds")]
905 pub duration_seconds: f32,
906 }
907
908 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
910 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
911 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
912 pub struct MakePlane {
913 pub origin: Point3d<LengthUnit>,
915 pub x_axis: Point3d<f64>,
917 pub y_axis: Point3d<f64>,
919 pub size: LengthUnit,
923 pub clobber: bool,
925 pub hide: Option<bool>,
927 }
928
929 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
931 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
932 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
933 pub struct PlaneSetColor {
934 pub plane_id: Uuid,
936 pub color: Color,
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 SetTool {
945 pub tool: SceneToolType,
947 }
948
949 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
951 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
952 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
953 pub struct MouseMove {
954 pub window: Point2d,
956 pub sequence: Option<u32>,
961 }
962
963 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
966 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
967 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
968 pub struct MouseClick {
969 pub window: Point2d,
971 }
972
973 #[derive(Debug, Clone, Default, 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 SketchModeDisable {}
980
981 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
983 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
984 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
985 pub struct GetSketchModePlane {}
986
987 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
989 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
990 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
991 pub struct CurveSetConstraint {
992 pub object_id: Uuid,
994 pub constraint_bound: PathComponentConstraintBound,
996 pub constraint_type: PathComponentConstraintType,
998 }
999
1000 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1002 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1003 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1004 pub struct EnableSketchMode {
1005 pub entity_id: Uuid,
1007 pub ortho: bool,
1010 pub animated: bool,
1012 pub adjust_camera: bool,
1014 pub planar_normal: Option<Point3d<f64>>,
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 EnableDryRun {}
1026
1027 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1031 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1032 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1033 pub struct DisableDryRun {}
1034
1035 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1037 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1038 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1039 pub struct SetBackgroundColor {
1040 pub color: Color,
1042 }
1043
1044 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1046 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1047 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1048 pub struct SetCurrentToolProperties {
1049 pub color: Option<Color>,
1051 }
1052
1053 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1055 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1056 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1057 pub struct SetDefaultSystemProperties {
1058 pub color: Option<Color>,
1060 }
1061
1062 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1064 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1065 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1066 pub struct CurveGetType {
1067 pub curve_id: Uuid,
1069 }
1070
1071 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1073 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1074 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1075 pub struct CurveGetControlPoints {
1076 pub curve_id: Uuid,
1078 }
1079
1080 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1082 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1083 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1084 pub struct ProjectEntityToPlane {
1085 pub entity_id: Uuid,
1087 pub plane_id: Uuid,
1089 pub use_plane_coords: bool,
1092 }
1093
1094 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1096 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1097 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1098 pub struct ProjectPointsToPlane {
1099 pub plane_id: Uuid,
1101 pub points: Vec<Point3d<f64>>,
1103 pub use_plane_coords: bool,
1106 }
1107
1108 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1110 #[serde(rename_all = "snake_case")]
1111 #[display(style = "snake_case")]
1112 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1113 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1114 pub enum ImageFormat {
1115 Png,
1117 Jpeg,
1119 }
1120
1121 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1123 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1124 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1125 pub struct TakeSnapshot {
1126 pub format: ImageFormat,
1128 }
1129
1130 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1132 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1133 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1134 pub struct MakeAxesGizmo {
1135 pub gizmo_mode: bool,
1138 pub clobber: bool,
1140 }
1141
1142 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1144 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1145 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1146 pub struct PathGetInfo {
1147 pub path_id: Uuid,
1149 }
1150
1151 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1153 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1154 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1155 pub struct PathGetCurveUuidsForVertices {
1156 pub path_id: Uuid,
1158
1159 pub vertex_ids: Vec<Uuid>,
1161 }
1162
1163 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1165 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1166 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1167 pub struct PathGetCurveUuid {
1168 pub path_id: Uuid,
1170
1171 pub index: u32,
1173 }
1174
1175 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1177 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1178 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1179 pub struct PathGetVertexUuids {
1180 pub path_id: Uuid,
1182 }
1183
1184 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1186 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1187 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1188 pub struct PathGetSketchTargetUuid {
1189 pub path_id: Uuid,
1191 }
1192
1193 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1195 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1196 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1197 pub struct HandleMouseDragStart {
1198 pub window: Point2d,
1200 }
1201
1202 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1204 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1205 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1206 pub struct HandleMouseDragMove {
1207 pub window: Point2d,
1209 pub sequence: Option<u32>,
1214 }
1215
1216 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1218 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1219 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1220 pub struct HandleMouseDragEnd {
1221 pub window: Point2d,
1223 }
1224
1225 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1227 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1228 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1229 pub struct RemoveSceneObjects {
1230 pub object_ids: HashSet<Uuid>,
1232 }
1233
1234 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1237 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1238 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1239 pub struct PlaneIntersectAndProject {
1240 pub plane_id: Uuid,
1242 pub window: Point2d,
1244 }
1245
1246 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1248 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1249 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1250 pub struct CurveGetEndPoints {
1251 pub curve_id: Uuid,
1253 }
1254
1255 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1257 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1258 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1259 pub struct ReconfigureStream {
1260 pub width: u32,
1262 pub height: u32,
1264 pub fps: u32,
1266 #[serde(default)]
1268 pub bitrate: Option<u32>,
1269 }
1270
1271 #[derive(Debug, Eq, PartialEq, Clone, 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 ImportFiles {
1276 pub files: Vec<super::ImportFile>,
1278 pub format: crate::format::InputFormat3d,
1280 }
1281
1282 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1287 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1288 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1289 pub struct SetSceneUnits {
1290 pub unit: units::UnitLength,
1292 }
1293
1294 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1296 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1297 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1298 pub struct Mass {
1299 pub entity_ids: Vec<Uuid>,
1302 pub material_density: f64,
1304 pub material_density_unit: units::UnitDensity,
1306 pub output_unit: units::UnitMass,
1308 }
1309
1310 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1312 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1313 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1314 pub struct Density {
1315 pub entity_ids: Vec<Uuid>,
1318 pub material_mass: f64,
1320 pub material_mass_unit: units::UnitMass,
1322 pub output_unit: units::UnitDensity,
1324 }
1325
1326 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1328 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1329 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1330 pub struct Volume {
1331 pub entity_ids: Vec<Uuid>,
1334 pub output_unit: units::UnitVolume,
1336 }
1337
1338 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1340 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1341 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1342 pub struct CenterOfMass {
1343 pub entity_ids: Vec<Uuid>,
1346 pub output_unit: units::UnitLength,
1348 }
1349
1350 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1352 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1353 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1354 pub struct SurfaceArea {
1355 pub entity_ids: Vec<Uuid>,
1358 pub output_unit: units::UnitArea,
1360 }
1361
1362 #[derive(
1364 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1365 )]
1366 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1367 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1368 pub struct DefaultCameraFocusOn {
1369 pub uuid: Uuid,
1371 }
1372 #[derive(
1374 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1375 )]
1376 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1377 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1378 pub struct SetSelectionType {
1379 pub selection_type: SceneSelectionType,
1381 }
1382
1383 #[derive(
1385 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1386 )]
1387 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1388 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1389 pub struct SetSelectionFilter {
1390 pub filter: Vec<EntityType>,
1393 }
1394
1395 #[derive(
1397 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1398 )]
1399 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1400 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1401 pub struct DefaultCameraSetOrthographic {}
1402
1403 #[derive(
1405 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1406 )]
1407 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1408 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1409 pub struct DefaultCameraSetPerspective {
1410 pub parameters: Option<PerspectiveCameraParameters>,
1412 }
1413
1414 #[derive(
1417 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1418 )]
1419 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1420 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1421 pub struct DefaultCameraCenterToSelection {
1422 #[serde(default)]
1425 pub camera_movement: CameraMovement,
1426 }
1427
1428 #[derive(
1430 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1431 )]
1432 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1433 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1434 pub struct DefaultCameraCenterToScene {
1435 #[serde(default)]
1438 pub camera_movement: CameraMovement,
1439 }
1440
1441 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1443 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1444 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1445 pub struct ZoomToFit {
1446 #[serde(default = "default_uuid_vector")]
1448 pub object_ids: Vec<Uuid>,
1449 #[serde(default)]
1454 pub padding: f32,
1455 #[serde(default)]
1457 pub animated: bool,
1458 }
1459
1460 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1462 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1463 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1464 pub struct OrientToFace {
1465 pub face_id: Uuid,
1467 #[serde(default)]
1472 pub padding: f32,
1473 #[serde(default)]
1475 pub animated: bool,
1476 }
1477
1478 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1480 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1481 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1482 pub struct ViewIsometric {
1483 #[serde(default = "f32::default")]
1488 pub padding: f32,
1489 }
1490
1491 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1493 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1494 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1495 pub struct Solid3dGetExtrusionFaceInfo {
1496 pub object_id: Uuid,
1498 pub edge_id: Uuid,
1500 }
1501
1502 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1504 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1505 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1506 pub struct SelectClear {}
1507
1508 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1510 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1511 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1512 pub struct SelectGet {}
1513
1514 #[derive(
1516 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1517 )]
1518 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1519 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1520 pub struct GetNumObjects {}
1521
1522 #[derive(
1524 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1525 )]
1526 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1527 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1528 pub struct SetObjectTransform
1529 {
1530 pub object_id: Uuid,
1532 pub transforms: Vec<ComponentTransform>,
1534 }
1535 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1538 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1539 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1540 pub struct MakeOffsetPath {
1541 pub object_id: Uuid,
1543 #[serde(default)]
1548 pub face_id: Option<Uuid>,
1549 pub offset: LengthUnit,
1551 }
1552
1553 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1555 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1556 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1557 pub struct AddHoleFromOffset {
1558 pub object_id: Uuid,
1560 pub offset: LengthUnit,
1562 }
1563 }
1564}
1565
1566impl ModelingCmd {
1567 pub fn is_safe_to_batch(&self) -> bool {
1569 use ModelingCmd::*;
1570 matches!(
1571 self,
1572 MovePathPen(_)
1573 | ExtendPath(_)
1574 | Extrude(_)
1575 | Revolve(_)
1576 | Solid3dFilletEdge(_)
1577 | ClosePath(_)
1578 | UpdateAnnotation(_)
1579 | ObjectVisible(_)
1580 | ObjectBringToFront(_)
1581 | Solid2dAddHole(_)
1582 | SendObject(_)
1583 | EntitySetOpacity(_)
1584 | PlaneSetColor(_)
1585 | SetTool(_)
1586 )
1587 }
1588}
1589
1590#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1594#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1595#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1596pub struct ImportFile {
1597 pub path: String,
1599 #[serde(
1601 serialize_with = "serde_bytes::serialize",
1602 deserialize_with = "serde_bytes::deserialize"
1603 )]
1604 pub data: Vec<u8>,
1605}