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, ExtrudeMethod,
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() -> f64 {
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 #[serde(default)]
128 pub extrude_method: ExtrudeMethod,
129 }
130
131 fn default_twist_extrude_section_interval() -> Angle {
132 Angle::from_degrees(15.0)
133 }
134
135 #[derive(
137 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
138 )]
139 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
140 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
141 pub struct TwistExtrude {
142 pub target: ModelingCmdId,
145 pub distance: LengthUnit,
147 #[serde(default)]
150 pub faces: Option<ExtrudedFaceInfo>,
151 #[serde(default)]
153 pub center_2d: Point2d<f64>,
154 pub total_rotation_angle: Angle,
156 #[serde(default = "default_twist_extrude_section_interval")]
158 pub angle_step_size: Angle,
159 pub tolerance: LengthUnit,
161 }
162
163 #[derive(
165 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
166 )]
167 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
168 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
169 pub struct Sweep {
170 pub target: ModelingCmdId,
173 pub trajectory: ModelingCmdId,
175 pub sectional: bool,
177 pub tolerance: LengthUnit,
179 #[serde(default)]
181 pub relative_to: RelativeTo,
182 }
183
184 #[derive(
186 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
187 )]
188 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
189 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
190 pub struct Revolve {
191 pub target: ModelingCmdId,
194 pub origin: Point3d<LengthUnit>,
196 pub axis: Point3d<f64>,
198 pub axis_is_2d: bool,
200 pub angle: Angle,
202 pub tolerance: LengthUnit,
204 #[serde(default)]
207 pub opposite: Opposite<Angle>,
208 }
209
210 #[derive(
212 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
213 )]
214 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
215 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
216 pub struct Solid3dShellFace {
217 pub object_id: Uuid,
219 pub face_ids: Vec<Uuid>,
221 pub shell_thickness: LengthUnit,
224 #[serde(default)]
226 pub hollow: bool,
227 }
228
229 #[derive(
231 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
232 )]
233 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
234 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
235 pub struct RevolveAboutEdge {
236 pub target: ModelingCmdId,
239 pub edge_id: Uuid,
241 pub angle: Angle,
243 pub tolerance: LengthUnit,
245 #[serde(default)]
248 pub opposite: Opposite<Angle>,
249 }
250
251 #[derive(
253 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
254 )]
255 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
256 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
257 pub struct Loft {
258 pub section_ids: Vec<Uuid>,
261 pub v_degree: std::num::NonZeroU32,
264 pub bez_approximate_rational: bool,
268 pub base_curve_index: Option<u32>,
270 pub tolerance: LengthUnit,
272 }
273
274
275 #[derive(
277 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
278 )]
279 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
280 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
281 pub struct ClosePath {
282 pub path_id: Uuid,
284 }
285
286 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
288 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
289 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
290 pub struct CameraDragStart {
291 pub interaction: CameraDragInteractionType,
293 pub window: Point2d,
295 }
296
297 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
299 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
300 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
301 pub struct CameraDragMove {
302 pub interaction: CameraDragInteractionType,
304 pub window: Point2d,
306 pub sequence: Option<u32>,
311 }
312
313 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
315 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
316 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
317 pub struct CameraDragEnd {
318 pub interaction: CameraDragInteractionType,
320 pub window: Point2d,
322 }
323
324 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
326 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
327 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
328 pub struct DefaultCameraGetSettings {}
329
330 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
332 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
333 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
334 pub struct DefaultCameraGetView {}
335
336 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
338 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
339 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
340 pub struct DefaultCameraSetView {
341 pub view: CameraViewState,
343 }
344
345 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
347 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
348 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
349 pub struct DefaultCameraLookAt {
350 pub vantage: Point3d,
352 pub center: Point3d,
354 pub up: Point3d,
356 pub sequence: Option<u32>,
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 DefaultCameraPerspectiveSettings {
368 pub vantage: Point3d,
370 pub center: Point3d,
372 pub up: Point3d,
374 pub fov_y: Option<f32>,
376 pub z_near: Option<f32>,
378 pub z_far: Option<f32>,
380 pub sequence: Option<u32>,
385 }
386
387 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
389 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
390 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
391 pub struct DefaultCameraZoom {
392 pub magnitude: f32,
396 }
397
398 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
400 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
401 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
402 pub struct Export2d {
403 pub entity_ids: Vec<Uuid>,
405 pub format: OutputFormat2d,
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 Export3d {
414 pub entity_ids: Vec<Uuid>,
416 pub format: OutputFormat3d,
418 }
419
420 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
422 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
423 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
424 pub struct Export {
425 pub entity_ids: Vec<Uuid>,
427 pub format: OutputFormat3d,
429 }
430
431 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
433 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
434 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
435 pub struct EntityGetParentId {
436 pub entity_id: Uuid,
438 }
439
440 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
442 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
443 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
444 pub struct EntityGetNumChildren {
445 pub entity_id: Uuid,
447 }
448
449 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
451 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
452 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
453 pub struct EntityGetChildUuid {
454 pub entity_id: Uuid,
456 pub child_index: u32,
458 }
459
460 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
462 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
463 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
464 pub struct EntityGetAllChildUuids {
465 pub entity_id: Uuid,
467 }
468
469 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
471 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
472 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
473 pub struct EntityGetSketchPaths {
474 pub entity_id: Uuid,
476 }
477
478 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
480 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
481 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
482 pub struct EntityGetDistance {
483 pub entity_id1: Uuid,
485 pub entity_id2: Uuid,
487 pub distance_type: DistanceType,
489 }
490
491 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
494 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
495 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
496 pub struct EntityClone {
497 pub entity_id: Uuid,
499 }
500
501 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
504 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
505 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
506 pub struct EntityLinearPatternTransform {
507 pub entity_id: Uuid,
509 #[serde(default)]
513 pub transform: Vec<crate::shared::Transform>,
514 #[serde(default)]
518 pub transforms: Vec<Vec<crate::shared::Transform>>,
519 }
520
521 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
523 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
524 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
525 pub struct EntityLinearPattern {
526 pub entity_id: Uuid,
528 pub axis: Point3d<f64>,
531 pub num_repetitions: u32,
533 pub spacing: LengthUnit,
535 }
536 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
538 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
539 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
540 pub struct EntityCircularPattern {
541 pub entity_id: Uuid,
543 pub axis: Point3d<f64>,
546 pub center: Point3d<LengthUnit>,
549 pub num_repetitions: u32,
551 pub arc_degrees: f64,
553 pub rotate_duplicates: bool,
555 }
556
557 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
559 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
560 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
561 pub struct EntityMakeHelix {
562 pub cylinder_id: Uuid,
564 pub revolutions: f64,
566 #[serde(default)]
568 pub start_angle: Angle,
569 pub is_clockwise: bool,
571 pub length: LengthUnit,
573 }
574
575 #[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 EntityMakeHelixFromParams {
580 pub radius: LengthUnit,
582 pub length: LengthUnit,
584 pub revolutions: f64,
586 #[serde(default)]
588 pub start_angle: Angle,
589 pub is_clockwise: bool,
591 pub center: Point3d<LengthUnit>,
593 pub axis: Point3d<f64>,
595 }
596
597 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
599 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
600 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
601 pub struct EntityMakeHelixFromEdge {
602 pub radius: LengthUnit,
604 pub length: Option<LengthUnit>,
606 pub revolutions: f64,
608 #[serde(default)]
610 pub start_angle: Angle,
611 pub is_clockwise: bool,
613 pub edge_id: Uuid,
615 }
616
617 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
619 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
620 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
621 pub struct EntityMirror {
622 pub ids: Vec<Uuid>,
624 pub axis: Point3d<f64>,
626 pub point: Point3d<LengthUnit>,
628 }
629
630 #[derive(
632 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
633 )]
634 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
635 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
636 pub struct EntityMirrorAcrossEdge {
637 pub ids: Vec<Uuid>,
639 pub edge_id: Uuid,
641 }
642
643 #[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 SelectWithPoint {
649 pub selected_at_window: Point2d,
651 pub selection_type: SceneSelectionType,
653 }
654
655 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
657 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
658 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
659 pub struct SelectAdd {
660 pub entities: Vec<Uuid>,
662 }
663
664 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
666 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
667 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
668 pub struct SelectRemove {
669 pub entities: Vec<Uuid>,
671 }
672
673 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
675 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
676 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
677 pub struct SceneClearAll {}
678
679 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
681 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
682 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
683 pub struct SelectReplace {
684 pub entities: Vec<Uuid>,
686 }
687
688 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
691 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
692 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
693 pub struct HighlightSetEntity {
694 pub selected_at_window: Point2d,
696 pub sequence: Option<u32>,
701 }
702
703 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
705 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
706 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
707 pub struct HighlightSetEntities {
708 pub entities: Vec<Uuid>,
710 }
711
712 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
714 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
715 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
716 pub struct NewAnnotation {
717 pub options: AnnotationOptions,
719 pub clobber: bool,
721 pub annotation_type: AnnotationType,
723 }
724
725 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
727 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
728 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
729 pub struct UpdateAnnotation {
730 pub annotation_id: Uuid,
732 pub options: AnnotationOptions,
735 }
736
737 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
739 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
740 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
741 pub struct EdgeLinesVisible {
742 pub hidden: bool,
744 }
745
746 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
748 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
749 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
750 pub struct ObjectVisible {
751 pub object_id: Uuid,
753 pub hidden: bool,
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 ObjectBringToFront {
762 pub object_id: Uuid,
764 }
765
766 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
768 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
769 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
770 pub struct ObjectSetMaterialParamsPbr {
771 pub object_id: Uuid,
773 pub color: Color,
775 pub metalness: f32,
777 pub roughness: f32,
779 pub ambient_occlusion: f32,
781 }
782 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
784 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
785 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
786 pub struct GetEntityType {
787 pub entity_id: Uuid,
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 Solid3dGetAllEdgeFaces {
796 pub object_id: Uuid,
798 pub edge_id: Uuid,
800 }
801
802 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
804 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
805 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
806 pub struct Solid2dAddHole {
807 pub object_id: Uuid,
809 pub hole_id: Uuid,
811 }
812
813 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
815 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
816 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
817 pub struct Solid3dGetAllOppositeEdges {
818 pub object_id: Uuid,
820 pub edge_id: Uuid,
822 pub along_vector: Option<Point3d<f64>>,
824 }
825
826 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
828 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
829 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
830 pub struct Solid3dGetOppositeEdge {
831 pub object_id: Uuid,
833 pub edge_id: Uuid,
835 pub face_id: Uuid,
837 }
838
839 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
841 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
842 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
843 pub struct Solid3dGetNextAdjacentEdge {
844 pub object_id: Uuid,
846 pub edge_id: Uuid,
848 pub face_id: Uuid,
850 }
851
852 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
854 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
855 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
856 pub struct Solid3dGetPrevAdjacentEdge {
857 pub object_id: Uuid,
859 pub edge_id: Uuid,
861 pub face_id: Uuid,
863 }
864
865 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
867 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
868 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
869 pub struct Solid3dGetCommonEdge {
870 pub object_id: Uuid,
872 pub face_ids: [Uuid; 2]
874 }
875
876 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
878 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
879 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
880 pub struct Solid3dFilletEdge {
881 pub object_id: Uuid,
883 #[serde(default)]
885 pub edge_id: Option<Uuid>,
886 #[serde(default)]
888 pub edge_ids: Vec<Uuid>,
889 pub radius: LengthUnit,
891 pub tolerance: LengthUnit,
893 #[serde(default)]
895 pub cut_type: CutType,
896 #[serde(default)]
898 pub strategy: CutStrategy,
899 #[serde(default)]
907 pub extra_face_ids: Vec<Uuid>,
908 }
909
910 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
912 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
913 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
914 pub struct FaceIsPlanar {
915 pub object_id: Uuid,
917 }
918
919 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
921 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
922 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
923 pub struct FaceGetPosition {
924 pub object_id: Uuid,
926
927 pub uv: Point2d<f64>,
929 }
930
931 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
933 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
934 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
935 pub struct FaceGetCenter {
936 pub object_id: Uuid,
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 FaceGetGradient {
945 pub object_id: Uuid,
947
948 pub uv: Point2d<f64>,
950 }
951
952 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
954 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
955 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
956 pub struct SendObject {
957 pub object_id: Uuid,
959 pub front: bool,
961 }
962 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
964 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
965 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
966 pub struct EntitySetOpacity {
967 pub entity_id: Uuid,
969 pub opacity: f32,
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 EntityFade {
980 pub entity_id: Uuid,
982 pub fade_in: bool,
984 #[serde(default = "default_animation_seconds")]
986 pub duration_seconds: f64,
987 }
988
989 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
991 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
992 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
993 pub struct MakePlane {
994 pub origin: Point3d<LengthUnit>,
996 pub x_axis: Point3d<f64>,
998 pub y_axis: Point3d<f64>,
1000 pub size: LengthUnit,
1004 pub clobber: bool,
1006 pub hide: Option<bool>,
1008 }
1009
1010 #[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 PlaneSetColor {
1015 pub plane_id: Uuid,
1017 pub color: Color,
1019 }
1020
1021 #[derive(Debug, Clone, 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 SetTool {
1026 pub tool: SceneToolType,
1028 }
1029
1030 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1032 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1033 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1034 pub struct MouseMove {
1035 pub window: Point2d,
1037 pub sequence: Option<u32>,
1042 }
1043
1044 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1047 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1048 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1049 pub struct MouseClick {
1050 pub window: Point2d,
1052 }
1053
1054 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1058 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1059 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1060 pub struct SketchModeDisable {}
1061
1062 #[derive(Debug, Clone, Default, 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 GetSketchModePlane {}
1067
1068 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1070 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1071 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1072 pub struct CurveSetConstraint {
1073 pub object_id: Uuid,
1075 pub constraint_bound: PathComponentConstraintBound,
1077 pub constraint_type: PathComponentConstraintType,
1079 }
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 EnableSketchMode {
1086 pub entity_id: Uuid,
1088 pub ortho: bool,
1091 pub animated: bool,
1093 pub adjust_camera: bool,
1095 pub planar_normal: Option<Point3d<f64>>,
1098 }
1099
1100 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1104 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1105 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1106 pub struct EnableDryRun {}
1107
1108 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1112 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1113 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1114 pub struct DisableDryRun {}
1115
1116 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1118 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1119 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1120 pub struct SetBackgroundColor {
1121 pub color: Color,
1123 }
1124
1125 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1127 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1128 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1129 pub struct SetCurrentToolProperties {
1130 pub color: Option<Color>,
1132 }
1133
1134 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1136 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1137 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1138 pub struct SetDefaultSystemProperties {
1139 pub color: Option<Color>,
1141 }
1142
1143 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1145 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1146 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1147 pub struct CurveGetType {
1148 pub curve_id: Uuid,
1150 }
1151
1152 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1154 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1155 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1156 pub struct CurveGetControlPoints {
1157 pub curve_id: Uuid,
1159 }
1160
1161 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1163 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1164 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1165 pub struct ProjectEntityToPlane {
1166 pub entity_id: Uuid,
1168 pub plane_id: Uuid,
1170 pub use_plane_coords: bool,
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 ProjectPointsToPlane {
1180 pub plane_id: Uuid,
1182 pub points: Vec<Point3d<f64>>,
1184 pub use_plane_coords: bool,
1187 }
1188
1189 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1191 #[serde(rename_all = "snake_case")]
1192 #[display(style = "snake_case")]
1193 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1194 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1195 pub enum ImageFormat {
1196 Png,
1198 Jpeg,
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 TakeSnapshot {
1207 pub format: ImageFormat,
1209 }
1210
1211 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1213 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1214 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1215 pub struct MakeAxesGizmo {
1216 pub gizmo_mode: bool,
1219 pub clobber: bool,
1221 }
1222
1223 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1225 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1226 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1227 pub struct PathGetInfo {
1228 pub path_id: Uuid,
1230 }
1231
1232 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1234 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1235 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1236 pub struct PathGetCurveUuidsForVertices {
1237 pub path_id: Uuid,
1239
1240 pub vertex_ids: Vec<Uuid>,
1242 }
1243
1244 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1246 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1247 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1248 pub struct PathGetCurveUuid {
1249 pub path_id: Uuid,
1251
1252 pub index: u32,
1254 }
1255
1256 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1258 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1259 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1260 pub struct PathGetVertexUuids {
1261 pub path_id: Uuid,
1263 }
1264
1265 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1267 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1268 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1269 pub struct PathGetSketchTargetUuid {
1270 pub path_id: Uuid,
1272 }
1273
1274 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1276 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1277 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1278 pub struct HandleMouseDragStart {
1279 pub window: Point2d,
1281 }
1282
1283 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1285 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1286 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1287 pub struct HandleMouseDragMove {
1288 pub window: Point2d,
1290 pub sequence: Option<u32>,
1295 }
1296
1297 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1299 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1300 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1301 pub struct HandleMouseDragEnd {
1302 pub window: Point2d,
1304 }
1305
1306 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1308 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1309 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1310 pub struct RemoveSceneObjects {
1311 pub object_ids: HashSet<Uuid>,
1313 }
1314
1315 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1318 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1319 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1320 pub struct PlaneIntersectAndProject {
1321 pub plane_id: Uuid,
1323 pub window: Point2d,
1325 }
1326
1327 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1329 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1330 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1331 pub struct CurveGetEndPoints {
1332 pub curve_id: Uuid,
1334 }
1335
1336 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1338 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1339 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1340 pub struct ReconfigureStream {
1341 pub width: u32,
1343 pub height: u32,
1345 pub fps: u32,
1347 #[serde(default)]
1349 pub bitrate: Option<u32>,
1350 }
1351
1352 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1354 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1355 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1356 pub struct ImportFiles {
1357 pub files: Vec<super::ImportFile>,
1359 pub format: crate::format::InputFormat3d,
1361 }
1362
1363 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1368 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1369 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1370 pub struct SetSceneUnits {
1371 pub unit: units::UnitLength,
1373 }
1374
1375 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1377 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1378 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1379 pub struct Mass {
1380 pub entity_ids: Vec<Uuid>,
1383 pub material_density: f64,
1385 pub material_density_unit: units::UnitDensity,
1387 pub output_unit: units::UnitMass,
1389 }
1390
1391 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1393 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1394 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1395 pub struct Density {
1396 pub entity_ids: Vec<Uuid>,
1399 pub material_mass: f64,
1401 pub material_mass_unit: units::UnitMass,
1403 pub output_unit: units::UnitDensity,
1405 }
1406
1407 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1409 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1410 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1411 pub struct Volume {
1412 pub entity_ids: Vec<Uuid>,
1415 pub output_unit: units::UnitVolume,
1417 }
1418
1419 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1421 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1422 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1423 pub struct CenterOfMass {
1424 pub entity_ids: Vec<Uuid>,
1427 pub output_unit: units::UnitLength,
1429 }
1430
1431 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1433 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1434 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1435 pub struct SurfaceArea {
1436 pub entity_ids: Vec<Uuid>,
1439 pub output_unit: units::UnitArea,
1441 }
1442
1443 #[derive(
1445 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1446 )]
1447 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1448 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1449 pub struct DefaultCameraFocusOn {
1450 pub uuid: Uuid,
1452 }
1453 #[derive(
1455 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1456 )]
1457 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1458 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1459 pub struct SetSelectionType {
1460 pub selection_type: SceneSelectionType,
1462 }
1463
1464 #[derive(
1466 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1467 )]
1468 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1469 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1470 pub struct SetSelectionFilter {
1471 pub filter: Vec<EntityType>,
1474 }
1475
1476 #[derive(
1478 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1479 )]
1480 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1481 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1482 pub struct DefaultCameraSetOrthographic {}
1483
1484 #[derive(
1486 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1487 )]
1488 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1489 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1490 pub struct DefaultCameraSetPerspective {
1491 pub parameters: Option<PerspectiveCameraParameters>,
1493 }
1494
1495 #[derive(
1498 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1499 )]
1500 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1501 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1502 pub struct DefaultCameraCenterToSelection {
1503 #[serde(default)]
1506 pub camera_movement: CameraMovement,
1507 }
1508
1509 #[derive(
1511 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1512 )]
1513 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1514 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1515 pub struct DefaultCameraCenterToScene {
1516 #[serde(default)]
1519 pub camera_movement: CameraMovement,
1520 }
1521
1522 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1524 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1525 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1526 pub struct ZoomToFit {
1527 #[serde(default = "default_uuid_vector")]
1529 pub object_ids: Vec<Uuid>,
1530 #[serde(default)]
1535 pub padding: f32,
1536 #[serde(default)]
1538 pub animated: bool,
1539 }
1540
1541 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1543 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1544 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1545 pub struct OrientToFace {
1546 pub face_id: Uuid,
1548 #[serde(default)]
1553 pub padding: f32,
1554 #[serde(default)]
1556 pub animated: bool,
1557 }
1558
1559 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1561 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1562 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1563 pub struct ViewIsometric {
1564 #[serde(default = "f32::default")]
1569 pub padding: f32,
1570 }
1571
1572 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1574 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1575 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1576 pub struct Solid3dGetExtrusionFaceInfo {
1577 pub object_id: Uuid,
1579 pub edge_id: Uuid,
1581 }
1582
1583 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1585 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1586 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1587 pub struct Solid3dGetAdjacencyInfo {
1588 pub object_id: Uuid,
1590 pub edge_id: Uuid,
1592 }
1593
1594
1595 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1597 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1598 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1599 pub struct SelectClear {}
1600
1601 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1603 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1604 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1605 pub struct SelectGet {}
1606
1607 #[derive(
1609 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1610 )]
1611 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1612 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1613 pub struct GetNumObjects {}
1614
1615 #[derive(
1617 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1618 )]
1619 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1620 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1621 pub struct SetObjectTransform
1622 {
1623 pub object_id: Uuid,
1625 pub transforms: Vec<ComponentTransform>,
1627 }
1628
1629 #[derive(
1632 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1633 )]
1634 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1635 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1636 pub struct BooleanUnion
1637 {
1638 pub solid_ids: Vec<Uuid>,
1641 pub tolerance: LengthUnit,
1643 }
1644
1645 #[derive(
1648 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1649 )]
1650 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1651 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1652 pub struct BooleanIntersection
1653 {
1654 pub solid_ids: Vec<Uuid>,
1656 pub tolerance: LengthUnit,
1658 }
1659
1660 #[derive(
1664 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1665 )]
1666 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1667 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1668 pub struct BooleanSubtract
1669 {
1670 pub target_ids: Vec<Uuid>,
1672 pub tool_ids: Vec<Uuid>,
1674 pub tolerance: LengthUnit,
1676 }
1677
1678 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1681 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1682 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1683 pub struct MakeOffsetPath {
1684 pub object_id: Uuid,
1686 #[serde(default)]
1691 pub face_id: Option<Uuid>,
1692 pub offset: LengthUnit,
1694 }
1695
1696 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1698 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1699 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1700 pub struct AddHoleFromOffset {
1701 pub object_id: Uuid,
1703 pub offset: LengthUnit,
1705 }
1706
1707 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1709 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1710 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1711 pub struct SetGridReferencePlane {
1712 pub grid_id: Uuid,
1714 pub reference_id: Uuid,
1717 }
1718
1719 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1721 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1722 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1723 pub struct SetGridScale {
1724 pub value: f32,
1726 pub units: units::UnitLength,
1728 }
1729 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1732 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1733 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1734 pub struct SetGridAutoScale {
1735 }
1736 }
1737}
1738
1739impl ModelingCmd {
1740 pub fn is_safe_to_batch(&self) -> bool {
1742 use ModelingCmd::*;
1743 matches!(
1744 self,
1745 MovePathPen(_)
1746 | ExtendPath(_)
1747 | Extrude(_)
1748 | Revolve(_)
1749 | Solid3dFilletEdge(_)
1750 | ClosePath(_)
1751 | UpdateAnnotation(_)
1752 | ObjectVisible(_)
1753 | ObjectBringToFront(_)
1754 | Solid2dAddHole(_)
1755 | SendObject(_)
1756 | EntitySetOpacity(_)
1757 | PlaneSetColor(_)
1758 | SetTool(_)
1759 )
1760 }
1761}
1762
1763#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1767#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1768#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1769pub struct ImportFile {
1770 pub path: String,
1772 #[serde(
1774 serialize_with = "serde_bytes::serialize",
1775 deserialize_with = "serde_bytes::deserialize"
1776 )]
1777 pub data: Vec<u8>,
1778}