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 BodyType,
27 ComponentTransform,
28 RelativeTo,
29 CutType, CutTypeV2,
30 CutStrategy,
31 CameraMovement,
32 ExtrudedFaceInfo, ExtrudeMethod,
33 AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
34 PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
35 Point2d, Point3d, ExtrudeReference, SceneSelectionType, SceneToolType, Opposite,
36 },
37 units,
38 };
39
40 fn default_animation_seconds() -> f64 {
42 0.4
43 }
44
45 fn default_uuid_vector() -> Vec<Uuid> {
47 Vec::new()
48 }
49
50 #[derive(
52 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
53 )]
54 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
55 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
56 pub struct EngineUtilEvaluatePath {
57 pub path_json: String,
59
60 pub t: f64,
62 }
63
64 #[derive(
66 Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
67 )]
68 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
69 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
70 pub struct StartPath {}
71
72 #[derive(
80 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
81 )]
82 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
83 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
84 pub struct MovePathPen {
85 pub path: ModelingCmdId,
87 pub to: Point3d<LengthUnit>,
89 }
90
91 #[derive(
94 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
95 )]
96 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
97 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
98 pub struct ExtendPath {
99 pub path: ModelingCmdId,
101 pub segment: PathSegment,
104 #[serde(default, skip_serializing_if = "Option::is_none")]
106 pub label: Option<String>,
107 }
108
109 #[derive(
111 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
112 )]
113 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
114 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
115 pub struct Extrude {
116 pub target: ModelingCmdId,
119 pub distance: LengthUnit,
121 #[serde(default)]
124 pub faces: Option<ExtrudedFaceInfo>,
125 #[serde(default)]
128 pub opposite: Opposite<LengthUnit>,
129 #[serde(default)]
131 pub extrude_method: ExtrudeMethod,
132 #[serde(default)]
134 pub body_type: BodyType,
135 }
136
137 #[derive(
139 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
140 )]
141 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
142 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
143 pub struct ExtrudeToReference {
144 pub target: ModelingCmdId,
147 pub reference: ExtrudeReference,
150 #[serde(default)]
153 pub faces: Option<ExtrudedFaceInfo>,
154 #[serde(default)]
156 pub extrude_method: ExtrudeMethod,
157 #[serde(default)]
159 pub body_type: BodyType,
160 }
161
162 fn default_twist_extrude_section_interval() -> Angle {
163 Angle::from_degrees(15.0)
164 }
165
166 #[derive(
168 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
169 )]
170 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
171 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
172 pub struct TwistExtrude {
173 pub target: ModelingCmdId,
176 pub distance: LengthUnit,
178 #[serde(default)]
181 pub faces: Option<ExtrudedFaceInfo>,
182 #[serde(default)]
184 pub center_2d: Point2d<f64>,
185 pub total_rotation_angle: Angle,
187 #[serde(default = "default_twist_extrude_section_interval")]
189 pub angle_step_size: Angle,
190 pub tolerance: LengthUnit,
192 #[serde(default)]
194 pub body_type: BodyType,
195 }
196
197 #[derive(
199 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, 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 Sweep {
204 pub target: ModelingCmdId,
207 pub trajectory: ModelingCmdId,
209 pub sectional: bool,
211 pub tolerance: LengthUnit,
213 #[serde(default)]
215 pub relative_to: RelativeTo,
216 }
217
218 #[derive(
220 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
221 )]
222 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
223 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
224 pub struct Revolve {
225 pub target: ModelingCmdId,
228 pub origin: Point3d<LengthUnit>,
230 pub axis: Point3d<f64>,
232 pub axis_is_2d: bool,
234 pub angle: Angle,
236 pub tolerance: LengthUnit,
238 #[serde(default)]
241 pub opposite: Opposite<Angle>,
242 }
243
244 #[derive(
246 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
247 )]
248 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
249 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
250 pub struct Solid3dShellFace {
251 pub object_id: Uuid,
253 pub face_ids: Vec<Uuid>,
255 pub shell_thickness: LengthUnit,
258 #[serde(default)]
260 pub hollow: bool,
261 }
262
263 #[derive(
265 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
266 )]
267 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
268 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
269 pub struct RevolveAboutEdge {
270 pub target: ModelingCmdId,
273 pub edge_id: Uuid,
275 pub angle: Angle,
277 pub tolerance: LengthUnit,
279 #[serde(default)]
282 pub opposite: Opposite<Angle>,
283 }
284
285 #[derive(
287 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
288 )]
289 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
290 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
291 pub struct Loft {
292 pub section_ids: Vec<Uuid>,
295 pub v_degree: std::num::NonZeroU32,
298 pub bez_approximate_rational: bool,
302 pub base_curve_index: Option<u32>,
304 pub tolerance: LengthUnit,
306 }
307
308
309 #[derive(
311 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
312 )]
313 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
314 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
315 pub struct ClosePath {
316 pub path_id: Uuid,
318 }
319
320 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
322 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
323 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
324 pub struct CameraDragStart {
325 pub interaction: CameraDragInteractionType,
327 pub window: Point2d,
329 }
330
331 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
333 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
334 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
335 pub struct CameraDragMove {
336 pub interaction: CameraDragInteractionType,
338 pub window: Point2d,
340 pub sequence: Option<u32>,
345 }
346
347 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
349 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
350 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
351 pub struct CameraDragEnd {
352 pub interaction: CameraDragInteractionType,
354 pub window: Point2d,
356 }
357
358 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
360 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
361 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
362 pub struct DefaultCameraGetSettings {}
363
364 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
366 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
367 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
368 pub struct DefaultCameraGetView {}
369
370 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
372 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
373 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
374 pub struct DefaultCameraSetView {
375 pub view: CameraViewState,
377 }
378
379 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
381 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
382 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
383 pub struct DefaultCameraLookAt {
384 pub vantage: Point3d,
386 pub center: Point3d,
388 pub up: Point3d,
390 pub sequence: Option<u32>,
395 }
396
397 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
399 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
400 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
401 pub struct DefaultCameraPerspectiveSettings {
402 pub vantage: Point3d,
404 pub center: Point3d,
406 pub up: Point3d,
408 pub fov_y: Option<f32>,
410 pub z_near: Option<f32>,
412 pub z_far: Option<f32>,
414 pub sequence: Option<u32>,
419 }
420
421 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
423 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
424 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
425 pub struct DefaultCameraZoom {
426 pub magnitude: f32,
430 }
431
432 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
434 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
435 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
436 pub struct Export2d {
437 pub entity_ids: Vec<Uuid>,
439 pub format: OutputFormat2d,
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 Export3d {
448 pub entity_ids: Vec<Uuid>,
450 pub format: OutputFormat3d,
452 }
453
454 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
456 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
457 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
458 pub struct Export {
459 pub entity_ids: Vec<Uuid>,
461 pub format: OutputFormat3d,
463 }
464
465 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
467 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
468 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
469 pub struct EntityGetParentId {
470 pub entity_id: Uuid,
472 }
473
474 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
476 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
477 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
478 pub struct EntityGetNumChildren {
479 pub entity_id: Uuid,
481 }
482
483 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
485 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
486 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
487 pub struct EntityGetChildUuid {
488 pub entity_id: Uuid,
490 pub child_index: u32,
492 }
493
494 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
496 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
497 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
498 pub struct EntityGetAllChildUuids {
499 pub entity_id: Uuid,
501 }
502
503 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
505 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
506 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
507 pub struct EntityGetSketchPaths {
508 pub entity_id: Uuid,
510 }
511
512 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
514 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
515 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
516 pub struct EntityGetDistance {
517 pub entity_id1: Uuid,
519 pub entity_id2: Uuid,
521 pub distance_type: DistanceType,
523 }
524
525 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
528 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
529 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
530 pub struct EntityClone {
531 pub entity_id: Uuid,
533 }
534
535 #[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 EntityLinearPatternTransform {
541 pub entity_id: Uuid,
543 #[serde(default)]
547 pub transform: Vec<crate::shared::Transform>,
548 #[serde(default)]
552 pub transforms: Vec<Vec<crate::shared::Transform>>,
553 }
554
555 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
557 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
558 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
559 pub struct EntityLinearPattern {
560 pub entity_id: Uuid,
562 pub axis: Point3d<f64>,
565 pub num_repetitions: u32,
567 pub spacing: LengthUnit,
569 }
570 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
572 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
573 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
574 pub struct EntityCircularPattern {
575 pub entity_id: Uuid,
577 pub axis: Point3d<f64>,
580 pub center: Point3d<LengthUnit>,
583 pub num_repetitions: u32,
585 pub arc_degrees: f64,
587 pub rotate_duplicates: bool,
589 }
590
591 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
593 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
594 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
595 pub struct EntityMakeHelix {
596 pub cylinder_id: Uuid,
598 pub revolutions: f64,
600 #[serde(default)]
602 pub start_angle: Angle,
603 pub is_clockwise: bool,
605 pub length: Option<LengthUnit>,
607 }
608
609 #[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 EntityMakeHelixFromParams {
614 pub radius: LengthUnit,
616 pub length: LengthUnit,
618 pub revolutions: f64,
620 #[serde(default)]
622 pub start_angle: Angle,
623 pub is_clockwise: bool,
625 pub center: Point3d<LengthUnit>,
627 pub axis: Point3d<f64>,
629 }
630
631 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
633 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
634 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
635 pub struct EntityMakeHelixFromEdge {
636 pub radius: LengthUnit,
638 pub length: Option<LengthUnit>,
640 pub revolutions: f64,
642 #[serde(default)]
644 pub start_angle: Angle,
645 pub is_clockwise: bool,
647 pub edge_id: Uuid,
649 }
650
651 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
653 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
654 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
655 pub struct EntityMirror {
656 pub ids: Vec<Uuid>,
658 pub axis: Point3d<f64>,
660 pub point: Point3d<LengthUnit>,
662 }
663
664 #[derive(
666 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
667 )]
668 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
669 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
670 pub struct EntityMirrorAcrossEdge {
671 pub ids: Vec<Uuid>,
673 pub edge_id: Uuid,
675 }
676
677 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
680 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
681 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
682 pub struct SelectWithPoint {
683 pub selected_at_window: Point2d,
685 pub selection_type: SceneSelectionType,
687 }
688
689 #[derive(Debug, Clone, 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 SelectAdd {
694 pub entities: Vec<Uuid>,
696 }
697
698 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
700 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
701 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
702 pub struct SelectRemove {
703 pub entities: Vec<Uuid>,
705 }
706
707 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
709 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
710 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
711 pub struct SceneClearAll {}
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 SelectReplace {
718 pub entities: Vec<Uuid>,
720 }
721
722 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
725 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
726 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
727 pub struct HighlightSetEntity {
728 pub selected_at_window: Point2d,
730 pub sequence: Option<u32>,
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 HighlightSetEntities {
742 pub entities: Vec<Uuid>,
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 NewAnnotation {
751 pub options: AnnotationOptions,
753 pub clobber: bool,
755 pub annotation_type: AnnotationType,
757 }
758
759 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
761 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
762 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
763 pub struct UpdateAnnotation {
764 pub annotation_id: Uuid,
766 pub options: AnnotationOptions,
769 }
770
771 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
773 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
774 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
775 pub struct EdgeLinesVisible {
776 pub hidden: bool,
778 }
779
780 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
782 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
783 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
784 pub struct ObjectVisible {
785 pub object_id: Uuid,
787 pub hidden: bool,
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 ObjectBringToFront {
796 pub object_id: Uuid,
798 }
799
800 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
802 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
803 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
804 pub struct ObjectSetMaterialParamsPbr {
805 pub object_id: Uuid,
807 pub color: Color,
809 pub metalness: f32,
811 pub roughness: f32,
813 pub ambient_occlusion: f32,
815 #[serde(default, skip_serializing_if = "Option::is_none")]
817 pub backface_color: Option<Color>,
818 }
819 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
821 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
822 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
823 pub struct GetEntityType {
824 pub entity_id: Uuid,
826 }
827
828 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
830 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
831 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
832 pub struct Solid3dGetAllEdgeFaces {
833 pub object_id: Uuid,
835 pub edge_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 Solid2dAddHole {
844 pub object_id: Uuid,
846 pub hole_id: Uuid,
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 Solid3dGetAllOppositeEdges {
855 pub object_id: Uuid,
857 pub edge_id: Uuid,
859 pub along_vector: Option<Point3d<f64>>,
861 }
862
863 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
865 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
866 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
867 pub struct Solid3dGetOppositeEdge {
868 pub object_id: Uuid,
870 pub edge_id: Uuid,
872 pub face_id: Uuid,
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 Solid3dGetNextAdjacentEdge {
881 pub object_id: Uuid,
883 pub edge_id: Uuid,
885 pub face_id: Uuid,
887 }
888
889 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
891 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
892 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
893 pub struct Solid3dGetPrevAdjacentEdge {
894 pub object_id: Uuid,
896 pub edge_id: Uuid,
898 pub face_id: Uuid,
900 }
901
902 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
904 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
905 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
906 pub struct Solid3dGetCommonEdge {
907 pub object_id: Uuid,
909 pub face_ids: [Uuid; 2]
911 }
912
913 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
915 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
916 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
917 pub struct Solid3dFilletEdge {
918 pub object_id: Uuid,
920 #[serde(default)]
922 pub edge_id: Option<Uuid>,
923 #[serde(default)]
925 pub edge_ids: Vec<Uuid>,
926 pub radius: LengthUnit,
928 pub tolerance: LengthUnit,
930 #[serde(default)]
932 pub cut_type: CutType,
933 #[serde(default)]
935 pub strategy: CutStrategy,
936 #[serde(default)]
944 pub extra_face_ids: Vec<Uuid>,
945 }
946
947 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
949 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
950 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
951 pub struct Solid3dCutEdges {
952 pub object_id: Uuid,
954 #[serde(default)]
956 pub edge_ids: Vec<Uuid>,
957 pub cut_type: CutTypeV2,
959 pub tolerance: LengthUnit,
962 #[serde(default)]
964 pub strategy: CutStrategy,
965 #[serde(default)]
973 pub extra_face_ids: Vec<Uuid>,
974 }
975
976 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
978 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
979 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
980 pub struct FaceIsPlanar {
981 pub object_id: Uuid,
983 }
984
985 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
987 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
988 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
989 pub struct FaceGetPosition {
990 pub object_id: Uuid,
992
993 pub uv: Point2d<f64>,
995 }
996
997 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
999 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1000 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1001 pub struct FaceGetCenter {
1002 pub object_id: Uuid,
1004 }
1005
1006 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1008 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1009 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1010 pub struct FaceGetGradient {
1011 pub object_id: Uuid,
1013
1014 pub uv: Point2d<f64>,
1016 }
1017
1018 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1020 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1021 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1022 pub struct SendObject {
1023 pub object_id: Uuid,
1025 pub front: bool,
1027 }
1028 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1030 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1031 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1032 pub struct EntitySetOpacity {
1033 pub entity_id: Uuid,
1035 pub opacity: f32,
1039 }
1040
1041 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1043 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1044 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1045 pub struct EntityFade {
1046 pub entity_id: Uuid,
1048 pub fade_in: bool,
1050 #[serde(default = "default_animation_seconds")]
1052 pub duration_seconds: f64,
1053 }
1054
1055 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1057 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1058 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1059 pub struct MakePlane {
1060 pub origin: Point3d<LengthUnit>,
1062 pub x_axis: Point3d<f64>,
1064 pub y_axis: Point3d<f64>,
1066 pub size: LengthUnit,
1070 pub clobber: bool,
1072 pub hide: Option<bool>,
1074 }
1075
1076 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1078 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1079 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1080 pub struct PlaneSetColor {
1081 pub plane_id: Uuid,
1083 pub color: Color,
1085 }
1086
1087 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1089 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1090 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1091 pub struct SetTool {
1092 pub tool: SceneToolType,
1094 }
1095
1096 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1098 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1099 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1100 pub struct MouseMove {
1101 pub window: Point2d,
1103 pub sequence: Option<u32>,
1108 }
1109
1110 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1113 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1114 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1115 pub struct MouseClick {
1116 pub window: Point2d,
1118 }
1119
1120 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1124 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1125 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1126 pub struct SketchModeDisable {}
1127
1128 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1130 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1131 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1132 pub struct GetSketchModePlane {}
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 CurveSetConstraint {
1139 pub object_id: Uuid,
1141 pub constraint_bound: PathComponentConstraintBound,
1143 pub constraint_type: PathComponentConstraintType,
1145 }
1146
1147 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1149 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1150 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1151 pub struct EnableSketchMode {
1152 pub entity_id: Uuid,
1154 pub ortho: bool,
1157 pub animated: bool,
1159 pub adjust_camera: bool,
1161 pub planar_normal: Option<Point3d<f64>>,
1164 }
1165
1166 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1170 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1171 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1172 pub struct EnableDryRun {}
1173
1174 #[derive(Debug, Clone, Default, 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 DisableDryRun {}
1181
1182 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1184 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1185 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1186 pub struct SetBackgroundColor {
1187 pub color: Color,
1189 }
1190
1191 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1193 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1194 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1195 pub struct SetCurrentToolProperties {
1196 pub color: Option<Color>,
1198 }
1199
1200 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1202 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1203 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1204 pub struct SetDefaultSystemProperties {
1205 pub color: Option<Color>,
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 CurveGetType {
1214 pub curve_id: Uuid,
1216 }
1217
1218 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1220 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1221 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1222 pub struct CurveGetControlPoints {
1223 pub curve_id: Uuid,
1225 }
1226
1227 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1229 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1230 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1231 pub struct ProjectEntityToPlane {
1232 pub entity_id: Uuid,
1234 pub plane_id: Uuid,
1236 pub use_plane_coords: bool,
1239 }
1240
1241 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1243 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1244 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1245 pub struct ProjectPointsToPlane {
1246 pub plane_id: Uuid,
1248 pub points: Vec<Point3d<f64>>,
1250 pub use_plane_coords: bool,
1253 }
1254
1255 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1257 #[serde(rename_all = "snake_case")]
1258 #[display(style = "snake_case")]
1259 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1260 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1261 #[cfg_attr(feature = "python", pyo3::pyclass, pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1262 pub enum ImageFormat {
1263 Png,
1265 Jpeg,
1267 }
1268
1269 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1271 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1272 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1273 pub struct TakeSnapshot {
1274 pub format: ImageFormat,
1276 }
1277
1278 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1280 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1281 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1282 pub struct MakeAxesGizmo {
1283 pub gizmo_mode: bool,
1286 pub clobber: bool,
1288 }
1289
1290 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1292 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1293 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1294 pub struct PathGetInfo {
1295 pub path_id: Uuid,
1297 }
1298
1299 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1301 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1302 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1303 pub struct PathGetCurveUuidsForVertices {
1304 pub path_id: Uuid,
1306
1307 pub vertex_ids: Vec<Uuid>,
1309 }
1310
1311 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1313 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1314 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1315 pub struct PathGetCurveUuid {
1316 pub path_id: Uuid,
1318
1319 pub index: u32,
1321 }
1322
1323 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1325 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1326 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1327 pub struct PathGetVertexUuids {
1328 pub path_id: Uuid,
1330 }
1331
1332 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1334 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1335 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1336 pub struct PathGetSketchTargetUuid {
1337 pub path_id: Uuid,
1339 }
1340
1341 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1343 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1344 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1345 pub struct HandleMouseDragStart {
1346 pub window: Point2d,
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 HandleMouseDragMove {
1355 pub window: Point2d,
1357 pub sequence: Option<u32>,
1362 }
1363
1364 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1366 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1367 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1368 pub struct HandleMouseDragEnd {
1369 pub window: Point2d,
1371 }
1372
1373 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1375 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1376 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1377 pub struct RemoveSceneObjects {
1378 pub object_ids: HashSet<Uuid>,
1380 }
1381
1382 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1385 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1386 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1387 pub struct PlaneIntersectAndProject {
1388 pub plane_id: Uuid,
1390 pub window: Point2d,
1392 }
1393
1394 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1396 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1397 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1398 pub struct CurveGetEndPoints {
1399 pub curve_id: Uuid,
1401 }
1402
1403 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1405 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1406 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1407 pub struct ReconfigureStream {
1408 pub width: u32,
1410 pub height: u32,
1412 pub fps: u32,
1414 #[serde(default)]
1416 pub bitrate: Option<u32>,
1417 }
1418
1419 #[derive(Debug, Eq, PartialEq, Clone, 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 ImportFiles {
1424 pub files: Vec<super::ImportFile>,
1426 pub format: crate::format::InputFormat3d,
1428 }
1429
1430 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1435 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1436 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1437 pub struct SetSceneUnits {
1438 pub unit: units::UnitLength,
1440 }
1441
1442 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1444 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1445 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1446 pub struct Mass {
1447 pub entity_ids: Vec<Uuid>,
1450 pub material_density: f64,
1452 pub material_density_unit: units::UnitDensity,
1454 pub output_unit: units::UnitMass,
1456 }
1457
1458 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1460 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1461 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1462 pub struct Density {
1463 pub entity_ids: Vec<Uuid>,
1466 pub material_mass: f64,
1468 pub material_mass_unit: units::UnitMass,
1470 pub output_unit: units::UnitDensity,
1472 }
1473
1474 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1476 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1477 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1478 pub struct Volume {
1479 pub entity_ids: Vec<Uuid>,
1482 pub output_unit: units::UnitVolume,
1484 }
1485
1486 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1488 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1489 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1490 pub struct CenterOfMass {
1491 pub entity_ids: Vec<Uuid>,
1494 pub output_unit: units::UnitLength,
1496 }
1497
1498 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1500 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1501 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1502 pub struct SurfaceArea {
1503 pub entity_ids: Vec<Uuid>,
1506 pub output_unit: units::UnitArea,
1508 }
1509
1510 #[derive(
1512 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1513 )]
1514 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1515 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1516 pub struct DefaultCameraFocusOn {
1517 pub uuid: Uuid,
1519 }
1520 #[derive(
1522 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1523 )]
1524 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1525 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1526 pub struct SetSelectionType {
1527 pub selection_type: SceneSelectionType,
1529 }
1530
1531 #[derive(
1533 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1534 )]
1535 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1536 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1537 pub struct SetSelectionFilter {
1538 pub filter: Vec<EntityType>,
1541 }
1542
1543 #[derive(
1545 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1546 )]
1547 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1548 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1549 pub struct SceneGetEntityIds {
1550 pub filter: Vec<EntityType>,
1552 pub skip: u32,
1555 #[schemars(range(min = 1, max = 1000))]
1560 pub take: u32,
1561 }
1562
1563 #[derive(
1565 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1566 )]
1567 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1568 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1569 pub struct DefaultCameraSetOrthographic {}
1570
1571 #[derive(
1573 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1574 )]
1575 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1576 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1577 pub struct DefaultCameraSetPerspective {
1578 pub parameters: Option<PerspectiveCameraParameters>,
1580 }
1581
1582 #[derive(
1585 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1586 )]
1587 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1588 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1589 pub struct DefaultCameraCenterToSelection {
1590 #[serde(default)]
1593 pub camera_movement: CameraMovement,
1594 }
1595
1596 #[derive(
1598 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1599 )]
1600 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1601 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1602 pub struct DefaultCameraCenterToScene {
1603 #[serde(default)]
1606 pub camera_movement: CameraMovement,
1607 }
1608
1609 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1611 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1612 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1613 pub struct ZoomToFit {
1614 #[serde(default = "default_uuid_vector")]
1616 pub object_ids: Vec<Uuid>,
1617 #[serde(default)]
1622 pub padding: f32,
1623 #[serde(default)]
1625 pub animated: bool,
1626 }
1627
1628 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1630 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1631 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1632 pub struct OrientToFace {
1633 pub face_id: Uuid,
1635 #[serde(default)]
1640 pub padding: f32,
1641 #[serde(default)]
1643 pub animated: bool,
1644 }
1645
1646 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1648 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1649 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1650 pub struct ViewIsometric {
1651 #[serde(default = "f32::default")]
1656 pub padding: f32,
1657 }
1658
1659 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1661 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1662 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1663 pub struct Solid3dGetExtrusionFaceInfo {
1664 pub object_id: Uuid,
1666 pub edge_id: Uuid,
1668 }
1669
1670 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1672 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1673 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1674 pub struct Solid3dGetAdjacencyInfo {
1675 pub object_id: Uuid,
1677 pub edge_id: Uuid,
1679 }
1680
1681
1682 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1684 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1685 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1686 pub struct SelectClear {}
1687
1688 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1690 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1691 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1692 pub struct SelectGet {}
1693
1694 #[derive(
1696 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1697 )]
1698 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1699 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1700 pub struct GetNumObjects {}
1701
1702 #[derive(
1704 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1705 )]
1706 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1707 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1708 pub struct SetObjectTransform
1709 {
1710 pub object_id: Uuid,
1712 pub transforms: Vec<ComponentTransform>,
1714 }
1715
1716 #[derive(
1719 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1720 )]
1721 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1722 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1723 pub struct BooleanUnion
1724 {
1725 pub solid_ids: Vec<Uuid>,
1728 pub tolerance: LengthUnit,
1730 }
1731
1732 #[derive(
1735 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1736 )]
1737 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1738 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1739 pub struct BooleanIntersection
1740 {
1741 pub solid_ids: Vec<Uuid>,
1743 pub tolerance: LengthUnit,
1745 }
1746
1747 #[derive(
1751 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1752 )]
1753 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1754 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1755 pub struct BooleanSubtract
1756 {
1757 pub target_ids: Vec<Uuid>,
1759 pub tool_ids: Vec<Uuid>,
1761 pub tolerance: LengthUnit,
1763 }
1764
1765 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1768 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1769 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1770 pub struct MakeOffsetPath {
1771 pub object_id: Uuid,
1773 #[serde(default)]
1778 pub face_id: Option<Uuid>,
1779 pub offset: LengthUnit,
1781 }
1782
1783 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1785 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1786 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1787 pub struct AddHoleFromOffset {
1788 pub object_id: Uuid,
1790 pub offset: LengthUnit,
1792 }
1793
1794 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1796 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1797 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1798 pub struct SetGridReferencePlane {
1799 pub grid_id: Uuid,
1801 pub reference_id: Uuid,
1804 }
1805
1806 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1808 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1809 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1810 pub struct SetGridScale {
1811 pub value: f32,
1813 pub units: units::UnitLength,
1815 }
1816
1817 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1820 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1821 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1822 pub struct SetGridAutoScale {
1823 }
1824
1825 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1828 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1829 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1830 pub struct SetOrderIndependentTransparency {
1831 pub enabled: Option<bool>,
1834 }
1835 }
1836}
1837
1838impl ModelingCmd {
1839 pub fn is_safe_to_batch(&self) -> bool {
1841 use ModelingCmd::*;
1842 matches!(
1843 self,
1844 MovePathPen(_)
1845 | ExtendPath(_)
1846 | Extrude(_)
1847 | Revolve(_)
1848 | Solid3dFilletEdge(_)
1849 | ClosePath(_)
1850 | UpdateAnnotation(_)
1851 | ObjectVisible(_)
1852 | ObjectBringToFront(_)
1853 | Solid2dAddHole(_)
1854 | SendObject(_)
1855 | EntitySetOpacity(_)
1856 | PlaneSetColor(_)
1857 | SetTool(_)
1858 )
1859 }
1860}
1861
1862#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1866#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1867#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1868pub struct ImportFile {
1869 pub path: String,
1871 #[serde(
1873 serialize_with = "serde_bytes::serialize",
1874 deserialize_with = "serde_bytes::deserialize"
1875 )]
1876 pub data: Vec<u8>,
1877}