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 #[serde(default)]
1207 pub color: Option<Color>,
1208 #[serde(default)]
1210 pub backface_color: Option<Color>,
1211 }
1212
1213 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1215 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1216 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1217 pub struct CurveGetType {
1218 pub curve_id: Uuid,
1220 }
1221
1222 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1224 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1225 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1226 pub struct CurveGetControlPoints {
1227 pub curve_id: Uuid,
1229 }
1230
1231 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1233 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1234 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1235 pub struct ProjectEntityToPlane {
1236 pub entity_id: Uuid,
1238 pub plane_id: Uuid,
1240 pub use_plane_coords: bool,
1243 }
1244
1245 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1247 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1248 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1249 pub struct ProjectPointsToPlane {
1250 pub plane_id: Uuid,
1252 pub points: Vec<Point3d<f64>>,
1254 pub use_plane_coords: bool,
1257 }
1258
1259 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1261 #[serde(rename_all = "snake_case")]
1262 #[display(style = "snake_case")]
1263 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1264 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1265 #[cfg_attr(feature = "python", pyo3::pyclass, pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1266 pub enum ImageFormat {
1267 Png,
1269 Jpeg,
1271 }
1272
1273 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1275 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1276 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1277 pub struct TakeSnapshot {
1278 pub format: ImageFormat,
1280 }
1281
1282 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1284 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1285 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1286 pub struct MakeAxesGizmo {
1287 pub gizmo_mode: bool,
1290 pub clobber: bool,
1292 }
1293
1294 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1296 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1297 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1298 pub struct PathGetInfo {
1299 pub path_id: Uuid,
1301 }
1302
1303 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1305 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1306 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1307 pub struct PathGetCurveUuidsForVertices {
1308 pub path_id: Uuid,
1310
1311 pub vertex_ids: Vec<Uuid>,
1313 }
1314
1315 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1317 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1318 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1319 pub struct PathGetCurveUuid {
1320 pub path_id: Uuid,
1322
1323 pub index: u32,
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 PathGetVertexUuids {
1332 pub path_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 PathGetSketchTargetUuid {
1341 pub path_id: Uuid,
1343 }
1344
1345 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1347 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1348 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1349 pub struct HandleMouseDragStart {
1350 pub window: Point2d,
1352 }
1353
1354 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1356 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1357 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1358 pub struct HandleMouseDragMove {
1359 pub window: Point2d,
1361 pub sequence: Option<u32>,
1366 }
1367
1368 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1370 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1371 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1372 pub struct HandleMouseDragEnd {
1373 pub window: Point2d,
1375 }
1376
1377 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1379 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1380 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1381 pub struct RemoveSceneObjects {
1382 pub object_ids: HashSet<Uuid>,
1384 }
1385
1386 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1389 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1390 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1391 pub struct PlaneIntersectAndProject {
1392 pub plane_id: Uuid,
1394 pub window: Point2d,
1396 }
1397
1398 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1400 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1401 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1402 pub struct CurveGetEndPoints {
1403 pub curve_id: Uuid,
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 ReconfigureStream {
1412 pub width: u32,
1414 pub height: u32,
1416 pub fps: u32,
1418 #[serde(default)]
1420 pub bitrate: Option<u32>,
1421 }
1422
1423 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1425 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1426 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1427 pub struct ImportFiles {
1428 pub files: Vec<super::ImportFile>,
1430 pub format: crate::format::InputFormat3d,
1432 }
1433
1434 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1439 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1440 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1441 pub struct SetSceneUnits {
1442 pub unit: units::UnitLength,
1444 }
1445
1446 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1448 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1449 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1450 pub struct Mass {
1451 pub entity_ids: Vec<Uuid>,
1454 pub material_density: f64,
1456 pub material_density_unit: units::UnitDensity,
1458 pub output_unit: units::UnitMass,
1460 }
1461
1462 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1464 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1465 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1466 pub struct Density {
1467 pub entity_ids: Vec<Uuid>,
1470 pub material_mass: f64,
1472 pub material_mass_unit: units::UnitMass,
1474 pub output_unit: units::UnitDensity,
1476 }
1477
1478 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1480 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1481 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1482 pub struct Volume {
1483 pub entity_ids: Vec<Uuid>,
1486 pub output_unit: units::UnitVolume,
1488 }
1489
1490 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1492 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1493 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1494 pub struct CenterOfMass {
1495 pub entity_ids: Vec<Uuid>,
1498 pub output_unit: units::UnitLength,
1500 }
1501
1502 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1504 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1505 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1506 pub struct SurfaceArea {
1507 pub entity_ids: Vec<Uuid>,
1510 pub output_unit: units::UnitArea,
1512 }
1513
1514 #[derive(
1516 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1517 )]
1518 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1519 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1520 pub struct DefaultCameraFocusOn {
1521 pub uuid: Uuid,
1523 }
1524 #[derive(
1526 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1527 )]
1528 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1529 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1530 pub struct SetSelectionType {
1531 pub selection_type: SceneSelectionType,
1533 }
1534
1535 #[derive(
1537 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1538 )]
1539 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1540 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1541 pub struct SetSelectionFilter {
1542 pub filter: Vec<EntityType>,
1545 }
1546
1547 #[derive(
1549 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1550 )]
1551 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1552 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1553 pub struct SceneGetEntityIds {
1554 pub filter: Vec<EntityType>,
1556 pub skip: u32,
1559 #[schemars(range(min = 1, max = 1000))]
1564 pub take: u32,
1565 }
1566
1567 #[derive(
1569 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1570 )]
1571 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1572 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1573 pub struct DefaultCameraSetOrthographic {}
1574
1575 #[derive(
1577 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1578 )]
1579 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1580 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1581 pub struct DefaultCameraSetPerspective {
1582 pub parameters: Option<PerspectiveCameraParameters>,
1584 }
1585
1586 #[derive(
1589 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1590 )]
1591 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1592 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1593 pub struct DefaultCameraCenterToSelection {
1594 #[serde(default)]
1597 pub camera_movement: CameraMovement,
1598 }
1599
1600 #[derive(
1602 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1603 )]
1604 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1605 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1606 pub struct DefaultCameraCenterToScene {
1607 #[serde(default)]
1610 pub camera_movement: CameraMovement,
1611 }
1612
1613 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1615 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1616 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1617 pub struct ZoomToFit {
1618 #[serde(default = "default_uuid_vector")]
1620 pub object_ids: Vec<Uuid>,
1621 #[serde(default)]
1626 pub padding: f32,
1627 #[serde(default)]
1629 pub animated: bool,
1630 }
1631
1632 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1634 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1635 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1636 pub struct OrientToFace {
1637 pub face_id: Uuid,
1639 #[serde(default)]
1644 pub padding: f32,
1645 #[serde(default)]
1647 pub animated: bool,
1648 }
1649
1650 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1652 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1653 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1654 pub struct ViewIsometric {
1655 #[serde(default = "f32::default")]
1660 pub padding: f32,
1661 }
1662
1663 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1665 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1666 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1667 pub struct Solid3dGetExtrusionFaceInfo {
1668 pub object_id: Uuid,
1670 pub edge_id: Uuid,
1672 }
1673
1674 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1676 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1677 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1678 pub struct Solid3dGetAdjacencyInfo {
1679 pub object_id: Uuid,
1681 pub edge_id: Uuid,
1683 }
1684
1685
1686 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1688 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1689 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1690 pub struct SelectClear {}
1691
1692 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1694 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1695 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1696 pub struct SelectGet {}
1697
1698 #[derive(
1700 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1701 )]
1702 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1703 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1704 pub struct GetNumObjects {}
1705
1706 #[derive(
1708 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1709 )]
1710 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1711 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1712 pub struct SetObjectTransform
1713 {
1714 pub object_id: Uuid,
1716 pub transforms: Vec<ComponentTransform>,
1718 }
1719
1720 #[derive(
1723 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1724 )]
1725 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1726 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1727 pub struct BooleanUnion
1728 {
1729 pub solid_ids: Vec<Uuid>,
1732 pub tolerance: LengthUnit,
1734 }
1735
1736 #[derive(
1739 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1740 )]
1741 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1742 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1743 pub struct BooleanIntersection
1744 {
1745 pub solid_ids: Vec<Uuid>,
1747 pub tolerance: LengthUnit,
1749 }
1750
1751 #[derive(
1755 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1756 )]
1757 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1758 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1759 pub struct BooleanSubtract
1760 {
1761 pub target_ids: Vec<Uuid>,
1763 pub tool_ids: Vec<Uuid>,
1765 pub tolerance: LengthUnit,
1767 }
1768
1769 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1772 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1773 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1774 pub struct MakeOffsetPath {
1775 pub object_id: Uuid,
1777 #[serde(default)]
1782 pub face_id: Option<Uuid>,
1783 pub offset: LengthUnit,
1785 }
1786
1787 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1789 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1790 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1791 pub struct AddHoleFromOffset {
1792 pub object_id: Uuid,
1794 pub offset: LengthUnit,
1796 }
1797
1798 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1800 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1801 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1802 pub struct SetGridReferencePlane {
1803 pub grid_id: Uuid,
1805 pub reference_id: Uuid,
1808 }
1809
1810 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1812 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1813 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1814 pub struct SetGridScale {
1815 pub value: f32,
1817 pub units: units::UnitLength,
1819 }
1820
1821 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1824 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1825 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1826 pub struct SetGridAutoScale {
1827 }
1828
1829 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1832 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1833 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1834 pub struct SetOrderIndependentTransparency {
1835 pub enabled: Option<bool>,
1838 }
1839 }
1840}
1841
1842impl ModelingCmd {
1843 pub fn is_safe_to_batch(&self) -> bool {
1845 use ModelingCmd::*;
1846 matches!(
1847 self,
1848 MovePathPen(_)
1849 | ExtendPath(_)
1850 | Extrude(_)
1851 | Revolve(_)
1852 | Solid3dFilletEdge(_)
1853 | ClosePath(_)
1854 | UpdateAnnotation(_)
1855 | ObjectVisible(_)
1856 | ObjectBringToFront(_)
1857 | Solid2dAddHole(_)
1858 | SendObject(_)
1859 | EntitySetOpacity(_)
1860 | PlaneSetColor(_)
1861 | SetTool(_)
1862 )
1863 }
1864}
1865
1866#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1870#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1871#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1872pub struct ImportFile {
1873 pub path: String,
1875 #[serde(
1877 serialize_with = "serde_bytes::serialize",
1878 deserialize_with = "serde_bytes::deserialize"
1879 )]
1880 pub data: Vec<u8>,
1881}