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 #[serde(default)]
244 pub body_type: BodyType,
245 }
246
247 #[derive(
249 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
250 )]
251 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
252 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
253 pub struct Solid3dShellFace {
254 pub object_id: Uuid,
256 pub face_ids: Vec<Uuid>,
258 pub shell_thickness: LengthUnit,
261 #[serde(default)]
263 pub hollow: bool,
264 }
265
266 #[derive(
268 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
269 )]
270 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
271 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
272 pub struct RevolveAboutEdge {
273 pub target: ModelingCmdId,
276 pub edge_id: Uuid,
278 pub angle: Angle,
280 pub tolerance: LengthUnit,
282 #[serde(default)]
285 pub opposite: Opposite<Angle>,
286 #[serde(default)]
288 pub body_type: BodyType,
289 }
290
291 #[derive(
293 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
294 )]
295 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
296 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
297 pub struct Loft {
298 pub section_ids: Vec<Uuid>,
301 pub v_degree: std::num::NonZeroU32,
304 pub bez_approximate_rational: bool,
308 pub base_curve_index: Option<u32>,
310 pub tolerance: LengthUnit,
312 }
313
314
315 #[derive(
317 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
318 )]
319 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
320 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
321 pub struct ClosePath {
322 pub path_id: Uuid,
324 }
325
326 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
328 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
329 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
330 pub struct CameraDragStart {
331 pub interaction: CameraDragInteractionType,
333 pub window: Point2d,
335 }
336
337 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
339 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
340 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
341 pub struct CameraDragMove {
342 pub interaction: CameraDragInteractionType,
344 pub window: Point2d,
346 pub sequence: Option<u32>,
351 }
352
353 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
355 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
356 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
357 pub struct CameraDragEnd {
358 pub interaction: CameraDragInteractionType,
360 pub window: Point2d,
362 }
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 DefaultCameraGetSettings {}
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 DefaultCameraGetView {}
375
376 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
378 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
379 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
380 pub struct DefaultCameraSetView {
381 pub view: CameraViewState,
383 }
384
385 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
387 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
388 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
389 pub struct DefaultCameraLookAt {
390 pub vantage: Point3d,
392 pub center: Point3d,
394 pub up: Point3d,
396 pub sequence: Option<u32>,
401 }
402
403 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
405 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
406 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
407 pub struct DefaultCameraPerspectiveSettings {
408 pub vantage: Point3d,
410 pub center: Point3d,
412 pub up: Point3d,
414 pub fov_y: Option<f32>,
416 pub z_near: Option<f32>,
418 pub z_far: Option<f32>,
420 pub sequence: Option<u32>,
425 }
426
427 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
429 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
430 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
431 pub struct DefaultCameraZoom {
432 pub magnitude: f32,
436 }
437
438 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
440 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
441 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
442 pub struct Export2d {
443 pub entity_ids: Vec<Uuid>,
445 pub format: OutputFormat2d,
447 }
448
449 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
451 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
452 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
453 pub struct Export3d {
454 pub entity_ids: Vec<Uuid>,
456 pub format: OutputFormat3d,
458 }
459
460 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
462 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
463 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
464 pub struct Export {
465 pub entity_ids: Vec<Uuid>,
467 pub format: OutputFormat3d,
469 }
470
471 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
473 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
474 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
475 pub struct EntityGetParentId {
476 pub entity_id: Uuid,
478 }
479
480 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
482 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
483 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
484 pub struct EntityGetNumChildren {
485 pub entity_id: Uuid,
487 }
488
489 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
491 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
492 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
493 pub struct EntityGetChildUuid {
494 pub entity_id: Uuid,
496 pub child_index: u32,
498 }
499
500 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
502 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
503 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
504 pub struct EntityGetAllChildUuids {
505 pub entity_id: Uuid,
507 }
508
509 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
511 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
512 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
513 pub struct EntityGetSketchPaths {
514 pub entity_id: Uuid,
516 }
517
518 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
520 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
521 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
522 pub struct EntityGetDistance {
523 pub entity_id1: Uuid,
525 pub entity_id2: Uuid,
527 pub distance_type: DistanceType,
529 }
530
531 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
534 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
535 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
536 pub struct EntityClone {
537 pub entity_id: Uuid,
539 }
540
541 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
544 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
545 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
546 pub struct EntityLinearPatternTransform {
547 pub entity_id: Uuid,
549 #[serde(default)]
553 pub transform: Vec<crate::shared::Transform>,
554 #[serde(default)]
558 pub transforms: Vec<Vec<crate::shared::Transform>>,
559 }
560
561 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
563 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
564 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
565 pub struct EntityLinearPattern {
566 pub entity_id: Uuid,
568 pub axis: Point3d<f64>,
571 pub num_repetitions: u32,
573 pub spacing: LengthUnit,
575 }
576 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
578 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
579 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
580 pub struct EntityCircularPattern {
581 pub entity_id: Uuid,
583 pub axis: Point3d<f64>,
586 pub center: Point3d<LengthUnit>,
589 pub num_repetitions: u32,
591 pub arc_degrees: f64,
593 pub rotate_duplicates: bool,
595 }
596
597 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
599 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
600 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
601 pub struct EntityMakeHelix {
602 pub cylinder_id: Uuid,
604 pub revolutions: f64,
606 #[serde(default)]
608 pub start_angle: Angle,
609 pub is_clockwise: bool,
611 pub length: Option<LengthUnit>,
613 }
614
615 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
617 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
618 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
619 pub struct EntityMakeHelixFromParams {
620 pub radius: LengthUnit,
622 pub length: LengthUnit,
624 pub revolutions: f64,
626 #[serde(default)]
628 pub start_angle: Angle,
629 pub is_clockwise: bool,
631 pub center: Point3d<LengthUnit>,
633 pub axis: Point3d<f64>,
635 }
636
637 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
639 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
640 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
641 pub struct EntityMakeHelixFromEdge {
642 pub radius: LengthUnit,
644 pub length: Option<LengthUnit>,
646 pub revolutions: f64,
648 #[serde(default)]
650 pub start_angle: Angle,
651 pub is_clockwise: bool,
653 pub edge_id: Uuid,
655 }
656
657 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
659 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
660 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
661 pub struct EntityMirror {
662 pub ids: Vec<Uuid>,
664 pub axis: Point3d<f64>,
666 pub point: Point3d<LengthUnit>,
668 }
669
670 #[derive(
672 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
673 )]
674 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
675 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
676 pub struct EntityMirrorAcrossEdge {
677 pub ids: Vec<Uuid>,
679 pub edge_id: Uuid,
681 }
682
683 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
686 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
687 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
688 pub struct SelectWithPoint {
689 pub selected_at_window: Point2d,
691 pub selection_type: SceneSelectionType,
693 }
694
695 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
697 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
698 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
699 pub struct SelectAdd {
700 pub entities: Vec<Uuid>,
702 }
703
704 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
706 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
707 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
708 pub struct SelectRemove {
709 pub entities: Vec<Uuid>,
711 }
712
713 #[derive(Debug, Clone, Default, 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 SceneClearAll {}
718
719 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
721 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
722 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
723 pub struct SelectReplace {
724 pub entities: Vec<Uuid>,
726 }
727
728 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
731 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
732 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
733 pub struct HighlightSetEntity {
734 pub selected_at_window: Point2d,
736 pub sequence: Option<u32>,
741 }
742
743 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
745 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
746 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
747 pub struct HighlightSetEntities {
748 pub entities: Vec<Uuid>,
750 }
751
752 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
754 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
755 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
756 pub struct NewAnnotation {
757 pub options: AnnotationOptions,
759 pub clobber: bool,
761 pub annotation_type: AnnotationType,
763 }
764
765 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
767 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
768 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
769 pub struct UpdateAnnotation {
770 pub annotation_id: Uuid,
772 pub options: AnnotationOptions,
775 }
776
777 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
779 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
780 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
781 pub struct EdgeLinesVisible {
782 pub hidden: bool,
784 }
785
786 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
788 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
789 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
790 pub struct ObjectVisible {
791 pub object_id: Uuid,
793 pub hidden: bool,
795 }
796
797 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
799 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
800 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
801 pub struct ObjectBringToFront {
802 pub object_id: Uuid,
804 }
805
806 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
808 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
809 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
810 pub struct ObjectSetMaterialParamsPbr {
811 pub object_id: Uuid,
813 pub color: Color,
815 pub metalness: f32,
817 pub roughness: f32,
819 pub ambient_occlusion: f32,
821 #[serde(default, skip_serializing_if = "Option::is_none")]
823 pub backface_color: Option<Color>,
824 }
825 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
827 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
828 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
829 pub struct GetEntityType {
830 pub entity_id: Uuid,
832 }
833
834 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
836 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
837 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
838 pub struct Solid3dGetAllEdgeFaces {
839 pub object_id: Uuid,
841 pub edge_id: Uuid,
843 }
844
845 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
847 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
848 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
849 pub struct Solid2dAddHole {
850 pub object_id: Uuid,
852 pub hole_id: Uuid,
854 }
855
856 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
858 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
859 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
860 pub struct Solid3dGetAllOppositeEdges {
861 pub object_id: Uuid,
863 pub edge_id: Uuid,
865 pub along_vector: Option<Point3d<f64>>,
867 }
868
869 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
871 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
872 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
873 pub struct Solid3dGetOppositeEdge {
874 pub object_id: Uuid,
876 pub edge_id: Uuid,
878 pub face_id: Uuid,
880 }
881
882 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
884 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
885 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
886 pub struct Solid3dGetNextAdjacentEdge {
887 pub object_id: Uuid,
889 pub edge_id: Uuid,
891 pub face_id: Uuid,
893 }
894
895 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
897 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
898 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
899 pub struct Solid3dGetPrevAdjacentEdge {
900 pub object_id: Uuid,
902 pub edge_id: Uuid,
904 pub face_id: Uuid,
906 }
907
908 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
910 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
911 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
912 pub struct Solid3dGetCommonEdge {
913 pub object_id: Uuid,
915 pub face_ids: [Uuid; 2]
917 }
918
919 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
921 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
922 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
923 pub struct Solid3dFilletEdge {
924 pub object_id: Uuid,
926 #[serde(default)]
928 pub edge_id: Option<Uuid>,
929 #[serde(default)]
931 pub edge_ids: Vec<Uuid>,
932 pub radius: LengthUnit,
934 pub tolerance: LengthUnit,
936 #[serde(default)]
938 pub cut_type: CutType,
939 #[serde(default)]
941 pub strategy: CutStrategy,
942 #[serde(default)]
950 pub extra_face_ids: Vec<Uuid>,
951 }
952
953 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
955 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
956 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
957 pub struct Solid3dCutEdges {
958 pub object_id: Uuid,
960 #[serde(default)]
962 pub edge_ids: Vec<Uuid>,
963 pub cut_type: CutTypeV2,
965 pub tolerance: LengthUnit,
968 #[serde(default)]
970 pub strategy: CutStrategy,
971 #[serde(default)]
979 pub extra_face_ids: Vec<Uuid>,
980 }
981
982 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
984 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
985 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
986 pub struct FaceIsPlanar {
987 pub object_id: Uuid,
989 }
990
991 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
993 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
994 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
995 pub struct FaceGetPosition {
996 pub object_id: Uuid,
998
999 pub uv: Point2d<f64>,
1001 }
1002
1003 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1005 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1006 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1007 pub struct FaceGetCenter {
1008 pub object_id: Uuid,
1010 }
1011
1012 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1014 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1015 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1016 pub struct FaceGetGradient {
1017 pub object_id: Uuid,
1019
1020 pub uv: Point2d<f64>,
1022 }
1023
1024 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1026 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1027 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1028 pub struct SendObject {
1029 pub object_id: Uuid,
1031 pub front: bool,
1033 }
1034 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1036 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1037 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1038 pub struct EntitySetOpacity {
1039 pub entity_id: Uuid,
1041 pub opacity: f32,
1045 }
1046
1047 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1049 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1050 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1051 pub struct EntityFade {
1052 pub entity_id: Uuid,
1054 pub fade_in: bool,
1056 #[serde(default = "default_animation_seconds")]
1058 pub duration_seconds: f64,
1059 }
1060
1061 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1063 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1064 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1065 pub struct MakePlane {
1066 pub origin: Point3d<LengthUnit>,
1068 pub x_axis: Point3d<f64>,
1070 pub y_axis: Point3d<f64>,
1072 pub size: LengthUnit,
1076 pub clobber: bool,
1078 pub hide: Option<bool>,
1080 }
1081
1082 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1084 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1085 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1086 pub struct PlaneSetColor {
1087 pub plane_id: Uuid,
1089 pub color: Color,
1091 }
1092
1093 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1095 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1096 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1097 pub struct SetTool {
1098 pub tool: SceneToolType,
1100 }
1101
1102 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1104 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1105 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1106 pub struct MouseMove {
1107 pub window: Point2d,
1109 pub sequence: Option<u32>,
1114 }
1115
1116 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1119 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1120 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1121 pub struct MouseClick {
1122 pub window: Point2d,
1124 }
1125
1126 #[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 SketchModeDisable {}
1133
1134 #[derive(Debug, Clone, Default, 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 GetSketchModePlane {}
1139
1140 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1142 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1143 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1144 pub struct CurveSetConstraint {
1145 pub object_id: Uuid,
1147 pub constraint_bound: PathComponentConstraintBound,
1149 pub constraint_type: PathComponentConstraintType,
1151 }
1152
1153 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1155 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1156 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1157 pub struct EnableSketchMode {
1158 pub entity_id: Uuid,
1160 pub ortho: bool,
1163 pub animated: bool,
1165 pub adjust_camera: bool,
1167 pub planar_normal: Option<Point3d<f64>>,
1170 }
1171
1172 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1176 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1177 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1178 pub struct EnableDryRun {}
1179
1180 #[derive(Debug, Clone, Default, 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 DisableDryRun {}
1187
1188 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1190 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1191 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1192 pub struct SetBackgroundColor {
1193 pub color: Color,
1195 }
1196
1197 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1199 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1200 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1201 pub struct SetCurrentToolProperties {
1202 pub color: Option<Color>,
1204 }
1205
1206 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1208 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1209 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1210 pub struct SetDefaultSystemProperties {
1211 #[serde(default)]
1213 pub color: Option<Color>,
1214 #[serde(default)]
1216 pub backface_color: Option<Color>,
1217 }
1218
1219 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1221 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1222 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1223 pub struct CurveGetType {
1224 pub curve_id: Uuid,
1226 }
1227
1228 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1230 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1231 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1232 pub struct CurveGetControlPoints {
1233 pub curve_id: Uuid,
1235 }
1236
1237 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1239 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1240 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1241 pub struct ProjectEntityToPlane {
1242 pub entity_id: Uuid,
1244 pub plane_id: Uuid,
1246 pub use_plane_coords: bool,
1249 }
1250
1251 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1253 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1254 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1255 pub struct ProjectPointsToPlane {
1256 pub plane_id: Uuid,
1258 pub points: Vec<Point3d<f64>>,
1260 pub use_plane_coords: bool,
1263 }
1264
1265 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1267 #[serde(rename_all = "snake_case")]
1268 #[display(style = "snake_case")]
1269 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1270 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1271 #[cfg_attr(feature = "python", pyo3::pyclass, pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1272 pub enum ImageFormat {
1273 Png,
1275 Jpeg,
1277 }
1278
1279 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1281 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1282 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1283 pub struct TakeSnapshot {
1284 pub format: ImageFormat,
1286 }
1287
1288 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1290 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1291 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1292 pub struct MakeAxesGizmo {
1293 pub gizmo_mode: bool,
1296 pub clobber: bool,
1298 }
1299
1300 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1302 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1303 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1304 pub struct PathGetInfo {
1305 pub path_id: Uuid,
1307 }
1308
1309 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1311 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1312 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1313 pub struct PathGetCurveUuidsForVertices {
1314 pub path_id: Uuid,
1316
1317 pub vertex_ids: Vec<Uuid>,
1319 }
1320
1321 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1323 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1324 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1325 pub struct PathGetCurveUuid {
1326 pub path_id: Uuid,
1328
1329 pub index: u32,
1331 }
1332
1333 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1335 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1336 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1337 pub struct PathGetVertexUuids {
1338 pub path_id: Uuid,
1340 }
1341
1342 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1344 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1345 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1346 pub struct PathGetSketchTargetUuid {
1347 pub path_id: Uuid,
1349 }
1350
1351 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1353 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1354 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1355 pub struct HandleMouseDragStart {
1356 pub window: Point2d,
1358 }
1359
1360 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1362 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1363 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1364 pub struct HandleMouseDragMove {
1365 pub window: Point2d,
1367 pub sequence: Option<u32>,
1372 }
1373
1374 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1376 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1377 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1378 pub struct HandleMouseDragEnd {
1379 pub window: Point2d,
1381 }
1382
1383 #[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 RemoveSceneObjects {
1388 pub object_ids: HashSet<Uuid>,
1390 }
1391
1392 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1395 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1396 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1397 pub struct PlaneIntersectAndProject {
1398 pub plane_id: Uuid,
1400 pub window: Point2d,
1402 }
1403
1404 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1406 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1407 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1408 pub struct CurveGetEndPoints {
1409 pub curve_id: Uuid,
1411 }
1412
1413 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1415 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1416 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1417 pub struct ReconfigureStream {
1418 pub width: u32,
1420 pub height: u32,
1422 pub fps: u32,
1424 #[serde(default)]
1426 pub bitrate: Option<u32>,
1427 }
1428
1429 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1431 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1432 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1433 pub struct ImportFiles {
1434 pub files: Vec<super::ImportFile>,
1436 pub format: crate::format::InputFormat3d,
1438 }
1439
1440 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1445 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1446 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1447 pub struct SetSceneUnits {
1448 pub unit: units::UnitLength,
1450 }
1451
1452 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1454 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1455 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1456 pub struct Mass {
1457 pub entity_ids: Vec<Uuid>,
1460 pub material_density: f64,
1462 pub material_density_unit: units::UnitDensity,
1464 pub output_unit: units::UnitMass,
1466 }
1467
1468 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1470 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1471 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1472 pub struct Density {
1473 pub entity_ids: Vec<Uuid>,
1476 pub material_mass: f64,
1478 pub material_mass_unit: units::UnitMass,
1480 pub output_unit: units::UnitDensity,
1482 }
1483
1484 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1486 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1487 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1488 pub struct Volume {
1489 pub entity_ids: Vec<Uuid>,
1492 pub output_unit: units::UnitVolume,
1494 }
1495
1496 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1498 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1499 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1500 pub struct CenterOfMass {
1501 pub entity_ids: Vec<Uuid>,
1504 pub output_unit: units::UnitLength,
1506 }
1507
1508 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1510 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1511 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1512 pub struct SurfaceArea {
1513 pub entity_ids: Vec<Uuid>,
1516 pub output_unit: units::UnitArea,
1518 }
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 DefaultCameraFocusOn {
1527 pub uuid: Uuid,
1529 }
1530 #[derive(
1532 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1533 )]
1534 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1535 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1536 pub struct SetSelectionType {
1537 pub selection_type: SceneSelectionType,
1539 }
1540
1541 #[derive(
1543 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1544 )]
1545 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1546 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1547 pub struct SetSelectionFilter {
1548 pub filter: Vec<EntityType>,
1551 }
1552
1553 #[derive(
1555 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1556 )]
1557 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1558 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1559 pub struct SceneGetEntityIds {
1560 pub filter: Vec<EntityType>,
1562 pub skip: u32,
1565 #[schemars(range(min = 1, max = 1000))]
1570 pub take: u32,
1571 }
1572
1573 #[derive(
1575 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1576 )]
1577 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1578 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1579 pub struct DefaultCameraSetOrthographic {}
1580
1581 #[derive(
1583 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1584 )]
1585 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1586 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1587 pub struct DefaultCameraSetPerspective {
1588 pub parameters: Option<PerspectiveCameraParameters>,
1590 }
1591
1592 #[derive(
1595 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1596 )]
1597 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1598 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1599 pub struct DefaultCameraCenterToSelection {
1600 #[serde(default)]
1603 pub camera_movement: CameraMovement,
1604 }
1605
1606 #[derive(
1608 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1609 )]
1610 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1611 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1612 pub struct DefaultCameraCenterToScene {
1613 #[serde(default)]
1616 pub camera_movement: CameraMovement,
1617 }
1618
1619 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1621 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1622 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1623 pub struct ZoomToFit {
1624 #[serde(default = "default_uuid_vector")]
1626 pub object_ids: Vec<Uuid>,
1627 #[serde(default)]
1632 pub padding: f32,
1633 #[serde(default)]
1635 pub animated: bool,
1636 }
1637
1638 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1640 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1641 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1642 pub struct OrientToFace {
1643 pub face_id: Uuid,
1645 #[serde(default)]
1650 pub padding: f32,
1651 #[serde(default)]
1653 pub animated: bool,
1654 }
1655
1656 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1658 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1659 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1660 pub struct ViewIsometric {
1661 #[serde(default = "f32::default")]
1666 pub padding: f32,
1667 }
1668
1669 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1671 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1672 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1673 pub struct Solid3dGetExtrusionFaceInfo {
1674 pub object_id: Uuid,
1676 pub edge_id: Uuid,
1678 }
1679
1680 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1682 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1683 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1684 pub struct Solid3dGetAdjacencyInfo {
1685 pub object_id: Uuid,
1687 pub edge_id: Uuid,
1689 }
1690
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 SelectClear {}
1697
1698 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1700 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1701 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1702 pub struct SelectGet {}
1703
1704 #[derive(
1706 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1707 )]
1708 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1709 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1710 pub struct GetNumObjects {}
1711
1712 #[derive(
1714 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1715 )]
1716 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1717 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1718 pub struct SetObjectTransform
1719 {
1720 pub object_id: Uuid,
1722 pub transforms: Vec<ComponentTransform>,
1724 }
1725
1726 #[derive(
1729 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1730 )]
1731 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1732 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1733 pub struct BooleanUnion
1734 {
1735 pub solid_ids: Vec<Uuid>,
1738 pub tolerance: LengthUnit,
1740 }
1741
1742 #[derive(
1745 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1746 )]
1747 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1748 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1749 pub struct BooleanIntersection
1750 {
1751 pub solid_ids: Vec<Uuid>,
1753 pub tolerance: LengthUnit,
1755 }
1756
1757 #[derive(
1761 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1762 )]
1763 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1764 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1765 pub struct BooleanSubtract
1766 {
1767 pub target_ids: Vec<Uuid>,
1769 pub tool_ids: Vec<Uuid>,
1771 pub tolerance: LengthUnit,
1773 }
1774
1775 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1778 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1779 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1780 pub struct MakeOffsetPath {
1781 pub object_id: Uuid,
1783 #[serde(default)]
1788 pub face_id: Option<Uuid>,
1789 pub offset: LengthUnit,
1791 }
1792
1793 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1795 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1796 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1797 pub struct AddHoleFromOffset {
1798 pub object_id: Uuid,
1800 pub offset: LengthUnit,
1802 }
1803
1804 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1806 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1807 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1808 pub struct SetGridReferencePlane {
1809 pub grid_id: Uuid,
1811 pub reference_id: Uuid,
1814 }
1815
1816 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1818 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1819 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1820 pub struct SetGridScale {
1821 pub value: f32,
1823 pub units: units::UnitLength,
1825 }
1826
1827 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1830 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1831 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1832 pub struct SetGridAutoScale {
1833 }
1834
1835 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1838 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1839 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1840 pub struct SetOrderIndependentTransparency {
1841 pub enabled: Option<bool>,
1844 }
1845 }
1846}
1847
1848impl ModelingCmd {
1849 pub fn is_safe_to_batch(&self) -> bool {
1851 use ModelingCmd::*;
1852 matches!(
1853 self,
1854 MovePathPen(_)
1855 | ExtendPath(_)
1856 | Extrude(_)
1857 | Revolve(_)
1858 | Solid3dFilletEdge(_)
1859 | ClosePath(_)
1860 | UpdateAnnotation(_)
1861 | ObjectVisible(_)
1862 | ObjectBringToFront(_)
1863 | Solid2dAddHole(_)
1864 | SendObject(_)
1865 | EntitySetOpacity(_)
1866 | PlaneSetColor(_)
1867 | SetTool(_)
1868 )
1869 }
1870}
1871
1872#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1876#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1877#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1878pub struct ImportFile {
1879 pub path: String,
1881 #[serde(
1883 serialize_with = "serde_bytes::serialize",
1884 deserialize_with = "serde_bytes::deserialize"
1885 )]
1886 pub data: Vec<u8>,
1887}