1use kittycad_modeling_cmds_macros::define_modeling_cmd_enum;
2use schemars::JsonSchema;
3use serde::{Deserialize, Serialize};
4
5pub use self::each_cmd::*;
6use crate::{self as kittycad_modeling_cmds};
7
8define_modeling_cmd_enum! {
9 pub mod each_cmd {
10 use std::collections::HashSet;
11
12 use crate::{self as kittycad_modeling_cmds};
13 use kittycad_modeling_cmds_macros::{ModelingCmdVariant};
14 use parse_display_derive::{Display, FromStr};
15 use schemars::JsonSchema;
16 use serde::{Deserialize, Serialize};
17 use uuid::Uuid;
18 use crate::shared::CameraViewState;
19
20 use crate::{
21 format::{OutputFormat2d, OutputFormat3d},
22 id::ModelingCmdId,
23 length_unit::LengthUnit,
24 shared::{
25 Angle,
26 ComponentTransform,
27 RelativeTo,
28 CutType, CutTypeV2,
29 CutStrategy,
30 CameraMovement,
31 ExtrudedFaceInfo, ExtrudeMethod,
32 AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
33 PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
34 Point2d, Point3d, ExtrudeReference, SceneSelectionType, SceneToolType, Opposite,
35 },
36 units,
37 };
38
39 fn default_animation_seconds() -> f64 {
41 0.4
42 }
43
44 fn default_uuid_vector() -> Vec<Uuid> {
46 Vec::new()
47 }
48
49 #[derive(
51 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
52 )]
53 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
54 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
55 pub struct EngineUtilEvaluatePath {
56 pub path_json: String,
58
59 pub t: f64,
61 }
62
63 #[derive(
65 Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
66 )]
67 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
68 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
69 pub struct StartPath {}
70
71 #[derive(
79 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
80 )]
81 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
82 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
83 pub struct MovePathPen {
84 pub path: ModelingCmdId,
86 pub to: Point3d<LengthUnit>,
88 }
89
90 #[derive(
93 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
94 )]
95 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
96 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
97 pub struct ExtendPath {
98 pub path: ModelingCmdId,
100 pub segment: PathSegment,
103 #[serde(default, skip_serializing_if = "Option::is_none")]
105 pub label: Option<String>,
106 }
107
108 #[derive(
110 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
111 )]
112 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
113 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
114 pub struct Extrude {
115 pub target: ModelingCmdId,
118 pub distance: LengthUnit,
120 #[serde(default)]
123 pub faces: Option<ExtrudedFaceInfo>,
124 #[serde(default)]
127 pub opposite: Opposite<LengthUnit>,
128 #[serde(default)]
130 pub extrude_method: ExtrudeMethod,
131 }
132
133 #[derive(
135 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
136 )]
137 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
138 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
139 pub struct ExtrudeToReference {
140 pub target: ModelingCmdId,
143 pub reference: ExtrudeReference,
146 #[serde(default)]
149 pub faces: Option<ExtrudedFaceInfo>,
150 #[serde(default)]
152 pub extrude_method: ExtrudeMethod,
153 }
154
155 fn default_twist_extrude_section_interval() -> Angle {
156 Angle::from_degrees(15.0)
157 }
158
159 #[derive(
161 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
162 )]
163 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
164 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
165 pub struct TwistExtrude {
166 pub target: ModelingCmdId,
169 pub distance: LengthUnit,
171 #[serde(default)]
174 pub faces: Option<ExtrudedFaceInfo>,
175 #[serde(default)]
177 pub center_2d: Point2d<f64>,
178 pub total_rotation_angle: Angle,
180 #[serde(default = "default_twist_extrude_section_interval")]
182 pub angle_step_size: Angle,
183 pub tolerance: LengthUnit,
185 }
186
187 #[derive(
189 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
190 )]
191 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
192 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
193 pub struct Sweep {
194 pub target: ModelingCmdId,
197 pub trajectory: ModelingCmdId,
199 pub sectional: bool,
201 pub tolerance: LengthUnit,
203 #[serde(default)]
205 pub relative_to: RelativeTo,
206 }
207
208 #[derive(
210 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
211 )]
212 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
213 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
214 pub struct Revolve {
215 pub target: ModelingCmdId,
218 pub origin: Point3d<LengthUnit>,
220 pub axis: Point3d<f64>,
222 pub axis_is_2d: bool,
224 pub angle: Angle,
226 pub tolerance: LengthUnit,
228 #[serde(default)]
231 pub opposite: Opposite<Angle>,
232 }
233
234 #[derive(
236 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
237 )]
238 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
239 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
240 pub struct Solid3dShellFace {
241 pub object_id: Uuid,
243 pub face_ids: Vec<Uuid>,
245 pub shell_thickness: LengthUnit,
248 #[serde(default)]
250 pub hollow: bool,
251 }
252
253 #[derive(
255 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
256 )]
257 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
258 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
259 pub struct RevolveAboutEdge {
260 pub target: ModelingCmdId,
263 pub edge_id: Uuid,
265 pub angle: Angle,
267 pub tolerance: LengthUnit,
269 #[serde(default)]
272 pub opposite: Opposite<Angle>,
273 }
274
275 #[derive(
277 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
278 )]
279 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
280 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
281 pub struct Loft {
282 pub section_ids: Vec<Uuid>,
285 pub v_degree: std::num::NonZeroU32,
288 pub bez_approximate_rational: bool,
292 pub base_curve_index: Option<u32>,
294 pub tolerance: LengthUnit,
296 }
297
298
299 #[derive(
301 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
302 )]
303 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
304 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
305 pub struct ClosePath {
306 pub path_id: Uuid,
308 }
309
310 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
312 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
313 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
314 pub struct CameraDragStart {
315 pub interaction: CameraDragInteractionType,
317 pub window: Point2d,
319 }
320
321 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
323 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
324 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
325 pub struct CameraDragMove {
326 pub interaction: CameraDragInteractionType,
328 pub window: Point2d,
330 pub sequence: Option<u32>,
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 CameraDragEnd {
342 pub interaction: CameraDragInteractionType,
344 pub window: Point2d,
346 }
347
348 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
350 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
351 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
352 pub struct DefaultCameraGetSettings {}
353
354 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
356 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
357 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
358 pub struct DefaultCameraGetView {}
359
360 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
362 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
363 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
364 pub struct DefaultCameraSetView {
365 pub view: CameraViewState,
367 }
368
369 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
371 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
372 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
373 pub struct DefaultCameraLookAt {
374 pub vantage: Point3d,
376 pub center: Point3d,
378 pub up: Point3d,
380 pub sequence: Option<u32>,
385 }
386
387 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
389 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
390 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
391 pub struct DefaultCameraPerspectiveSettings {
392 pub vantage: Point3d,
394 pub center: Point3d,
396 pub up: Point3d,
398 pub fov_y: Option<f32>,
400 pub z_near: Option<f32>,
402 pub z_far: Option<f32>,
404 pub sequence: Option<u32>,
409 }
410
411 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
413 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
414 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
415 pub struct DefaultCameraZoom {
416 pub magnitude: f32,
420 }
421
422 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
424 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
425 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
426 pub struct Export2d {
427 pub entity_ids: Vec<Uuid>,
429 pub format: OutputFormat2d,
431 }
432
433 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
435 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
436 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
437 pub struct Export3d {
438 pub entity_ids: Vec<Uuid>,
440 pub format: OutputFormat3d,
442 }
443
444 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
446 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
447 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
448 pub struct Export {
449 pub entity_ids: Vec<Uuid>,
451 pub format: OutputFormat3d,
453 }
454
455 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
457 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
458 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
459 pub struct EntityGetParentId {
460 pub entity_id: Uuid,
462 }
463
464 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
466 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
467 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
468 pub struct EntityGetNumChildren {
469 pub entity_id: Uuid,
471 }
472
473 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
475 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
476 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
477 pub struct EntityGetChildUuid {
478 pub entity_id: Uuid,
480 pub child_index: u32,
482 }
483
484 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
486 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
487 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
488 pub struct EntityGetAllChildUuids {
489 pub entity_id: Uuid,
491 }
492
493 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
495 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
496 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
497 pub struct EntityGetSketchPaths {
498 pub entity_id: Uuid,
500 }
501
502 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
504 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
505 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
506 pub struct EntityGetDistance {
507 pub entity_id1: Uuid,
509 pub entity_id2: Uuid,
511 pub distance_type: DistanceType,
513 }
514
515 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
518 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
519 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
520 pub struct EntityClone {
521 pub entity_id: Uuid,
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 EntityLinearPatternTransform {
531 pub entity_id: Uuid,
533 #[serde(default)]
537 pub transform: Vec<crate::shared::Transform>,
538 #[serde(default)]
542 pub transforms: Vec<Vec<crate::shared::Transform>>,
543 }
544
545 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
547 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
548 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
549 pub struct EntityLinearPattern {
550 pub entity_id: Uuid,
552 pub axis: Point3d<f64>,
555 pub num_repetitions: u32,
557 pub spacing: LengthUnit,
559 }
560 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
562 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
563 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
564 pub struct EntityCircularPattern {
565 pub entity_id: Uuid,
567 pub axis: Point3d<f64>,
570 pub center: Point3d<LengthUnit>,
573 pub num_repetitions: u32,
575 pub arc_degrees: f64,
577 pub rotate_duplicates: bool,
579 }
580
581 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
583 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
584 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
585 pub struct EntityMakeHelix {
586 pub cylinder_id: Uuid,
588 pub revolutions: f64,
590 #[serde(default)]
592 pub start_angle: Angle,
593 pub is_clockwise: bool,
595 pub length: Option<LengthUnit>,
597 }
598
599 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
601 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
602 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
603 pub struct EntityMakeHelixFromParams {
604 pub radius: LengthUnit,
606 pub length: LengthUnit,
608 pub revolutions: f64,
610 #[serde(default)]
612 pub start_angle: Angle,
613 pub is_clockwise: bool,
615 pub center: Point3d<LengthUnit>,
617 pub axis: Point3d<f64>,
619 }
620
621 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
623 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
624 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
625 pub struct EntityMakeHelixFromEdge {
626 pub radius: LengthUnit,
628 pub length: Option<LengthUnit>,
630 pub revolutions: f64,
632 #[serde(default)]
634 pub start_angle: Angle,
635 pub is_clockwise: bool,
637 pub edge_id: Uuid,
639 }
640
641 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
643 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
644 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
645 pub struct EntityMirror {
646 pub ids: Vec<Uuid>,
648 pub axis: Point3d<f64>,
650 pub point: Point3d<LengthUnit>,
652 }
653
654 #[derive(
656 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
657 )]
658 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
659 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
660 pub struct EntityMirrorAcrossEdge {
661 pub ids: Vec<Uuid>,
663 pub edge_id: Uuid,
665 }
666
667 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
670 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
671 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
672 pub struct SelectWithPoint {
673 pub selected_at_window: Point2d,
675 pub selection_type: SceneSelectionType,
677 }
678
679 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
681 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
682 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
683 pub struct SelectAdd {
684 pub entities: Vec<Uuid>,
686 }
687
688 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
690 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
691 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
692 pub struct SelectRemove {
693 pub entities: Vec<Uuid>,
695 }
696
697 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
699 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
700 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
701 pub struct SceneClearAll {}
702
703 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
705 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
706 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
707 pub struct SelectReplace {
708 pub entities: Vec<Uuid>,
710 }
711
712 #[derive(Debug, Clone, Copy, 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 HighlightSetEntity {
718 pub selected_at_window: Point2d,
720 pub sequence: Option<u32>,
725 }
726
727 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
729 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
730 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
731 pub struct HighlightSetEntities {
732 pub entities: Vec<Uuid>,
734 }
735
736 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
738 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
739 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
740 pub struct NewAnnotation {
741 pub options: AnnotationOptions,
743 pub clobber: bool,
745 pub annotation_type: AnnotationType,
747 }
748
749 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
751 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
752 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
753 pub struct UpdateAnnotation {
754 pub annotation_id: Uuid,
756 pub options: AnnotationOptions,
759 }
760
761 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
763 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
764 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
765 pub struct EdgeLinesVisible {
766 pub hidden: bool,
768 }
769
770 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
772 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
773 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
774 pub struct ObjectVisible {
775 pub object_id: Uuid,
777 pub hidden: bool,
779 }
780
781 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
783 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
784 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
785 pub struct ObjectBringToFront {
786 pub object_id: Uuid,
788 }
789
790 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
792 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
793 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
794 pub struct ObjectSetMaterialParamsPbr {
795 pub object_id: Uuid,
797 pub color: Color,
799 pub metalness: f32,
801 pub roughness: f32,
803 pub ambient_occlusion: f32,
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 GetEntityType {
811 pub entity_id: Uuid,
813 }
814
815 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
817 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
818 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
819 pub struct Solid3dGetAllEdgeFaces {
820 pub object_id: Uuid,
822 pub edge_id: Uuid,
824 }
825
826 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
828 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
829 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
830 pub struct Solid2dAddHole {
831 pub object_id: Uuid,
833 pub hole_id: Uuid,
835 }
836
837 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
839 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
840 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
841 pub struct Solid3dGetAllOppositeEdges {
842 pub object_id: Uuid,
844 pub edge_id: Uuid,
846 pub along_vector: Option<Point3d<f64>>,
848 }
849
850 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
852 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
853 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
854 pub struct Solid3dGetOppositeEdge {
855 pub object_id: Uuid,
857 pub edge_id: Uuid,
859 pub face_id: Uuid,
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 Solid3dGetNextAdjacentEdge {
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 Solid3dGetPrevAdjacentEdge {
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 Solid3dGetCommonEdge {
894 pub object_id: Uuid,
896 pub face_ids: [Uuid; 2]
898 }
899
900 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
902 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
903 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
904 pub struct Solid3dFilletEdge {
905 pub object_id: Uuid,
907 #[serde(default)]
909 pub edge_id: Option<Uuid>,
910 #[serde(default)]
912 pub edge_ids: Vec<Uuid>,
913 pub radius: LengthUnit,
915 pub tolerance: LengthUnit,
917 #[serde(default)]
919 pub cut_type: CutType,
920 #[serde(default)]
922 pub strategy: CutStrategy,
923 #[serde(default)]
931 pub extra_face_ids: Vec<Uuid>,
932 }
933
934 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
936 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
937 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
938 pub struct Solid3dCutEdges {
939 pub object_id: Uuid,
941 #[serde(default)]
943 pub edge_ids: Vec<Uuid>,
944 pub cut_type: CutTypeV2,
946 pub tolerance: LengthUnit,
949 #[serde(default)]
951 pub strategy: CutStrategy,
952 #[serde(default)]
960 pub extra_face_ids: Vec<Uuid>,
961 }
962
963 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
965 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
966 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
967 pub struct FaceIsPlanar {
968 pub object_id: Uuid,
970 }
971
972 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
974 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
975 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
976 pub struct FaceGetPosition {
977 pub object_id: Uuid,
979
980 pub uv: Point2d<f64>,
982 }
983
984 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
986 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
987 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
988 pub struct FaceGetCenter {
989 pub object_id: Uuid,
991 }
992
993 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
995 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
996 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
997 pub struct FaceGetGradient {
998 pub object_id: Uuid,
1000
1001 pub uv: Point2d<f64>,
1003 }
1004
1005 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1007 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1008 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1009 pub struct SendObject {
1010 pub object_id: Uuid,
1012 pub front: bool,
1014 }
1015 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1017 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1018 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1019 pub struct EntitySetOpacity {
1020 pub entity_id: Uuid,
1022 pub opacity: f32,
1026 }
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 EntityFade {
1033 pub entity_id: Uuid,
1035 pub fade_in: bool,
1037 #[serde(default = "default_animation_seconds")]
1039 pub duration_seconds: f64,
1040 }
1041
1042 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1044 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1045 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1046 pub struct MakePlane {
1047 pub origin: Point3d<LengthUnit>,
1049 pub x_axis: Point3d<f64>,
1051 pub y_axis: Point3d<f64>,
1053 pub size: LengthUnit,
1057 pub clobber: bool,
1059 pub hide: Option<bool>,
1061 }
1062
1063 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1065 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1066 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1067 pub struct PlaneSetColor {
1068 pub plane_id: Uuid,
1070 pub color: Color,
1072 }
1073
1074 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1076 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1077 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1078 pub struct SetTool {
1079 pub tool: SceneToolType,
1081 }
1082
1083 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1085 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1086 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1087 pub struct MouseMove {
1088 pub window: Point2d,
1090 pub sequence: Option<u32>,
1095 }
1096
1097 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1100 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1101 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1102 pub struct MouseClick {
1103 pub window: Point2d,
1105 }
1106
1107 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1111 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1112 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1113 pub struct SketchModeDisable {}
1114
1115 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1117 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1118 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1119 pub struct GetSketchModePlane {}
1120
1121 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1123 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1124 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1125 pub struct CurveSetConstraint {
1126 pub object_id: Uuid,
1128 pub constraint_bound: PathComponentConstraintBound,
1130 pub constraint_type: PathComponentConstraintType,
1132 }
1133
1134 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1136 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1137 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1138 pub struct EnableSketchMode {
1139 pub entity_id: Uuid,
1141 pub ortho: bool,
1144 pub animated: bool,
1146 pub adjust_camera: bool,
1148 pub planar_normal: Option<Point3d<f64>>,
1151 }
1152
1153 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1157 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1158 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1159 pub struct EnableDryRun {}
1160
1161 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1165 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1166 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1167 pub struct DisableDryRun {}
1168
1169 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1171 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1172 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1173 pub struct SetBackgroundColor {
1174 pub color: Color,
1176 }
1177
1178 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1180 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1181 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1182 pub struct SetCurrentToolProperties {
1183 pub color: Option<Color>,
1185 }
1186
1187 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1189 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1190 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1191 pub struct SetDefaultSystemProperties {
1192 pub color: Option<Color>,
1194 }
1195
1196 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1198 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1199 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1200 pub struct CurveGetType {
1201 pub curve_id: Uuid,
1203 }
1204
1205 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1207 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1208 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1209 pub struct CurveGetControlPoints {
1210 pub curve_id: Uuid,
1212 }
1213
1214 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1216 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1217 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1218 pub struct ProjectEntityToPlane {
1219 pub entity_id: Uuid,
1221 pub plane_id: Uuid,
1223 pub use_plane_coords: bool,
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 ProjectPointsToPlane {
1233 pub plane_id: Uuid,
1235 pub points: Vec<Point3d<f64>>,
1237 pub use_plane_coords: bool,
1240 }
1241
1242 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1244 #[serde(rename_all = "snake_case")]
1245 #[display(style = "snake_case")]
1246 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1247 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1248 #[cfg_attr(feature = "python", pyo3::pyclass, pyo3_stub_gen::derive::gen_stub_pyclass_enum)]
1249 pub enum ImageFormat {
1250 Png,
1252 Jpeg,
1254 }
1255
1256 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1258 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1259 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1260 pub struct TakeSnapshot {
1261 pub format: ImageFormat,
1263 }
1264
1265 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1267 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1268 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1269 pub struct MakeAxesGizmo {
1270 pub gizmo_mode: bool,
1273 pub clobber: bool,
1275 }
1276
1277 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1279 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1280 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1281 pub struct PathGetInfo {
1282 pub path_id: Uuid,
1284 }
1285
1286 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1288 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1289 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1290 pub struct PathGetCurveUuidsForVertices {
1291 pub path_id: Uuid,
1293
1294 pub vertex_ids: Vec<Uuid>,
1296 }
1297
1298 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1300 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1301 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1302 pub struct PathGetCurveUuid {
1303 pub path_id: Uuid,
1305
1306 pub index: u32,
1308 }
1309
1310 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1312 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1313 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1314 pub struct PathGetVertexUuids {
1315 pub path_id: Uuid,
1317 }
1318
1319 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1321 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1322 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1323 pub struct PathGetSketchTargetUuid {
1324 pub path_id: Uuid,
1326 }
1327
1328 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1330 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1331 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1332 pub struct HandleMouseDragStart {
1333 pub window: Point2d,
1335 }
1336
1337 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1339 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1340 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1341 pub struct HandleMouseDragMove {
1342 pub window: Point2d,
1344 pub sequence: Option<u32>,
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 HandleMouseDragEnd {
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 RemoveSceneObjects {
1365 pub object_ids: HashSet<Uuid>,
1367 }
1368
1369 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1372 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1373 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1374 pub struct PlaneIntersectAndProject {
1375 pub plane_id: Uuid,
1377 pub window: Point2d,
1379 }
1380
1381 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1383 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1384 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1385 pub struct CurveGetEndPoints {
1386 pub curve_id: Uuid,
1388 }
1389
1390 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1392 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1393 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1394 pub struct ReconfigureStream {
1395 pub width: u32,
1397 pub height: u32,
1399 pub fps: u32,
1401 #[serde(default)]
1403 pub bitrate: Option<u32>,
1404 }
1405
1406 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1408 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1409 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1410 pub struct ImportFiles {
1411 pub files: Vec<super::ImportFile>,
1413 pub format: crate::format::InputFormat3d,
1415 }
1416
1417 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1422 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1423 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1424 pub struct SetSceneUnits {
1425 pub unit: units::UnitLength,
1427 }
1428
1429 #[derive(Debug, Clone, PartialEq, 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 Mass {
1434 pub entity_ids: Vec<Uuid>,
1437 pub material_density: f64,
1439 pub material_density_unit: units::UnitDensity,
1441 pub output_unit: units::UnitMass,
1443 }
1444
1445 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1447 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1448 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1449 pub struct Density {
1450 pub entity_ids: Vec<Uuid>,
1453 pub material_mass: f64,
1455 pub material_mass_unit: units::UnitMass,
1457 pub output_unit: units::UnitDensity,
1459 }
1460
1461 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1463 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1464 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1465 pub struct Volume {
1466 pub entity_ids: Vec<Uuid>,
1469 pub output_unit: units::UnitVolume,
1471 }
1472
1473 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1475 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1476 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1477 pub struct CenterOfMass {
1478 pub entity_ids: Vec<Uuid>,
1481 pub output_unit: units::UnitLength,
1483 }
1484
1485 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1487 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1488 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1489 pub struct SurfaceArea {
1490 pub entity_ids: Vec<Uuid>,
1493 pub output_unit: units::UnitArea,
1495 }
1496
1497 #[derive(
1499 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1500 )]
1501 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1502 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1503 pub struct DefaultCameraFocusOn {
1504 pub uuid: Uuid,
1506 }
1507 #[derive(
1509 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1510 )]
1511 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1512 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1513 pub struct SetSelectionType {
1514 pub selection_type: SceneSelectionType,
1516 }
1517
1518 #[derive(
1520 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1521 )]
1522 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1523 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1524 pub struct SetSelectionFilter {
1525 pub filter: Vec<EntityType>,
1528 }
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 SceneGetEntityIds {
1537 pub filter: Vec<EntityType>,
1539 pub skip: u32,
1542 #[schemars(range(min = 1, max = 1000))]
1547 pub take: u32,
1548 }
1549
1550 #[derive(
1552 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1553 )]
1554 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1555 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1556 pub struct DefaultCameraSetOrthographic {}
1557
1558 #[derive(
1560 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1561 )]
1562 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1563 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1564 pub struct DefaultCameraSetPerspective {
1565 pub parameters: Option<PerspectiveCameraParameters>,
1567 }
1568
1569 #[derive(
1572 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1573 )]
1574 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1575 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1576 pub struct DefaultCameraCenterToSelection {
1577 #[serde(default)]
1580 pub camera_movement: CameraMovement,
1581 }
1582
1583 #[derive(
1585 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1586 )]
1587 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1588 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1589 pub struct DefaultCameraCenterToScene {
1590 #[serde(default)]
1593 pub camera_movement: CameraMovement,
1594 }
1595
1596 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1598 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1599 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1600 pub struct ZoomToFit {
1601 #[serde(default = "default_uuid_vector")]
1603 pub object_ids: Vec<Uuid>,
1604 #[serde(default)]
1609 pub padding: f32,
1610 #[serde(default)]
1612 pub animated: bool,
1613 }
1614
1615 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1617 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1618 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1619 pub struct OrientToFace {
1620 pub face_id: Uuid,
1622 #[serde(default)]
1627 pub padding: f32,
1628 #[serde(default)]
1630 pub animated: bool,
1631 }
1632
1633 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1635 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1636 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1637 pub struct ViewIsometric {
1638 #[serde(default = "f32::default")]
1643 pub padding: f32,
1644 }
1645
1646 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1648 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1649 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1650 pub struct Solid3dGetExtrusionFaceInfo {
1651 pub object_id: Uuid,
1653 pub edge_id: Uuid,
1655 }
1656
1657 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1659 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1660 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1661 pub struct Solid3dGetAdjacencyInfo {
1662 pub object_id: Uuid,
1664 pub edge_id: Uuid,
1666 }
1667
1668
1669 #[derive(Clone, Debug, Default, 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 SelectClear {}
1674
1675 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1677 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1678 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1679 pub struct SelectGet {}
1680
1681 #[derive(
1683 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1684 )]
1685 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1686 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1687 pub struct GetNumObjects {}
1688
1689 #[derive(
1691 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1692 )]
1693 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1694 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1695 pub struct SetObjectTransform
1696 {
1697 pub object_id: Uuid,
1699 pub transforms: Vec<ComponentTransform>,
1701 }
1702
1703 #[derive(
1706 Clone, Debug, Deserialize, PartialEq, 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 BooleanUnion
1711 {
1712 pub solid_ids: Vec<Uuid>,
1715 pub tolerance: LengthUnit,
1717 }
1718
1719 #[derive(
1722 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1723 )]
1724 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1725 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1726 pub struct BooleanIntersection
1727 {
1728 pub solid_ids: Vec<Uuid>,
1730 pub tolerance: LengthUnit,
1732 }
1733
1734 #[derive(
1738 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1739 )]
1740 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1741 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1742 pub struct BooleanSubtract
1743 {
1744 pub target_ids: Vec<Uuid>,
1746 pub tool_ids: Vec<Uuid>,
1748 pub tolerance: LengthUnit,
1750 }
1751
1752 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1755 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1756 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1757 pub struct MakeOffsetPath {
1758 pub object_id: Uuid,
1760 #[serde(default)]
1765 pub face_id: Option<Uuid>,
1766 pub offset: LengthUnit,
1768 }
1769
1770 #[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 AddHoleFromOffset {
1775 pub object_id: Uuid,
1777 pub offset: LengthUnit,
1779 }
1780
1781 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1783 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1784 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1785 pub struct SetGridReferencePlane {
1786 pub grid_id: Uuid,
1788 pub reference_id: Uuid,
1791 }
1792
1793 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, 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 SetGridScale {
1798 pub value: f32,
1800 pub units: units::UnitLength,
1802 }
1803 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, 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 SetGridAutoScale {
1809 }
1810 }
1811}
1812
1813impl ModelingCmd {
1814 pub fn is_safe_to_batch(&self) -> bool {
1816 use ModelingCmd::*;
1817 matches!(
1818 self,
1819 MovePathPen(_)
1820 | ExtendPath(_)
1821 | Extrude(_)
1822 | Revolve(_)
1823 | Solid3dFilletEdge(_)
1824 | ClosePath(_)
1825 | UpdateAnnotation(_)
1826 | ObjectVisible(_)
1827 | ObjectBringToFront(_)
1828 | Solid2dAddHole(_)
1829 | SendObject(_)
1830 | EntitySetOpacity(_)
1831 | PlaneSetColor(_)
1832 | SetTool(_)
1833 )
1834 }
1835}
1836
1837#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1841#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1842#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1843pub struct ImportFile {
1844 pub path: String,
1846 #[serde(
1848 serialize_with = "serde_bytes::serialize",
1849 deserialize_with = "serde_bytes::deserialize"
1850 )]
1851 pub data: Vec<u8>,
1852}