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 CutType,
28 CameraMovement,
29 ExtrudedFaceInfo,
30 AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
31 PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
32 Point2d, Point3d, SceneSelectionType, SceneToolType,
33 },
34 units,
35 };
36
37 fn default_animation_seconds() -> f32 {
39 0.4
40 }
41
42 fn default_uuid_vector() -> Vec<Uuid> {
44 Vec::new()
45 }
46
47 #[derive(
49 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
50 )]
51 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
52 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
53 pub struct EngineUtilEvaluatePath {
54 pub path_json: String,
56
57 pub t: f64,
59 }
60
61 #[derive(
63 Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
64 )]
65 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
66 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
67 pub struct StartPath {}
68
69 #[derive(
77 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
78 )]
79 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
80 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
81 pub struct MovePathPen {
82 pub path: ModelingCmdId,
84 pub to: Point3d<LengthUnit>,
86 }
87
88 #[derive(
91 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
92 )]
93 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
94 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
95 pub struct ExtendPath {
96 pub path: ModelingCmdId,
98 pub segment: PathSegment,
101 }
102
103 #[derive(
105 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
106 )]
107 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
108 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
109 pub struct Extrude {
110 pub target: ModelingCmdId,
113 pub distance: LengthUnit,
115 #[serde(default)]
118 pub faces: Option<ExtrudedFaceInfo>,
119 }
120
121 #[derive(
123 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
124 )]
125 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
126 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
127 pub struct Sweep {
128 pub target: ModelingCmdId,
131 pub trajectory: ModelingCmdId,
133 pub sectional: bool,
135 pub tolerance: LengthUnit,
137 }
138
139 #[derive(
141 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
142 )]
143 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
144 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
145 pub struct Revolve {
146 pub target: ModelingCmdId,
149 pub origin: Point3d<LengthUnit>,
151 pub axis: Point3d<f64>,
153 pub axis_is_2d: bool,
155 pub angle: Angle,
157 pub tolerance: LengthUnit,
159 }
160
161 #[derive(
163 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
164 )]
165 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
166 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
167 pub struct Solid3dShellFace {
168 pub object_id: Uuid,
170 pub face_ids: Vec<Uuid>,
172 pub shell_thickness: LengthUnit,
175 #[serde(default)]
177 pub hollow: bool,
178 }
179
180 #[derive(
182 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
183 )]
184 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
185 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
186 pub struct RevolveAboutEdge {
187 pub target: ModelingCmdId,
190 pub edge_id: Uuid,
192 pub angle: Angle,
194 pub tolerance: LengthUnit,
196 }
197
198 #[derive(
200 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
201 )]
202 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
203 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
204 pub struct Loft {
205 pub section_ids: Vec<Uuid>,
208 pub v_degree: std::num::NonZeroU32,
211 pub bez_approximate_rational: bool,
215 pub base_curve_index: Option<u32>,
217 pub tolerance: LengthUnit,
219 }
220
221
222 #[derive(
224 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
225 )]
226 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
227 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
228 pub struct ClosePath {
229 pub path_id: Uuid,
231 }
232
233 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
235 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
236 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
237 pub struct CameraDragStart {
238 pub interaction: CameraDragInteractionType,
240 pub window: Point2d,
242 }
243
244 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
246 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
247 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
248 pub struct CameraDragMove {
249 pub interaction: CameraDragInteractionType,
251 pub window: Point2d,
253 pub sequence: Option<u32>,
258 }
259
260 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
262 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
263 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
264 pub struct CameraDragEnd {
265 pub interaction: CameraDragInteractionType,
267 pub window: Point2d,
269 }
270
271 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
273 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
274 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
275 pub struct DefaultCameraGetSettings {}
276
277 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
279 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
280 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
281 pub struct DefaultCameraGetView {}
282
283 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
285 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
286 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
287 pub struct DefaultCameraSetView {
288 pub view: CameraViewState,
290 }
291
292 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
294 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
295 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
296 pub struct DefaultCameraLookAt {
297 pub vantage: Point3d,
299 pub center: Point3d,
301 pub up: Point3d,
303 pub sequence: Option<u32>,
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 DefaultCameraPerspectiveSettings {
315 pub vantage: Point3d,
317 pub center: Point3d,
319 pub up: Point3d,
321 pub fov_y: Option<f32>,
323 pub z_near: Option<f32>,
325 pub z_far: Option<f32>,
327 pub sequence: Option<u32>,
332 }
333
334 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
336 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
337 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
338 pub struct DefaultCameraZoom {
339 pub magnitude: f32,
343 }
344
345 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
347 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
348 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
349 pub struct Export2d {
350 pub entity_ids: Vec<Uuid>,
352 pub format: OutputFormat2d,
354 }
355
356 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
358 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
359 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
360 pub struct Export3d {
361 pub entity_ids: Vec<Uuid>,
363 pub format: OutputFormat3d,
365 }
366
367 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
369 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
370 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
371 pub struct Export {
372 pub entity_ids: Vec<Uuid>,
374 pub format: OutputFormat3d,
376 }
377
378 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
380 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
381 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
382 pub struct EntityGetParentId {
383 pub entity_id: Uuid,
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 EntityGetNumChildren {
392 pub entity_id: Uuid,
394 }
395
396 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
398 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
399 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
400 pub struct EntityGetChildUuid {
401 pub entity_id: Uuid,
403 pub child_index: u32,
405 }
406
407 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
409 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
410 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
411 pub struct EntityGetAllChildUuids {
412 pub entity_id: Uuid,
414 }
415
416 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
418 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
419 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
420 pub struct EntityGetSketchPaths {
421 pub entity_id: Uuid,
423 }
424
425 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
427 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
428 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
429 pub struct EntityGetDistance {
430 pub entity_id1: Uuid,
432 pub entity_id2: Uuid,
434 pub distance_type: DistanceType,
436 }
437
438 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
441 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
442 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
443 pub struct EntityClone {
444 pub entity_id: Uuid,
446 }
447
448 #[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 EntityLinearPatternTransform {
454 pub entity_id: Uuid,
456 #[serde(default)]
460 pub transform: Vec<crate::shared::Transform>,
461 #[serde(default)]
465 pub transforms: Vec<Vec<crate::shared::Transform>>,
466 }
467
468 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
470 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
471 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
472 pub struct EntityLinearPattern {
473 pub entity_id: Uuid,
475 pub axis: Point3d<f64>,
478 pub num_repetitions: u32,
480 pub spacing: LengthUnit,
482 }
483 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
485 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
486 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
487 pub struct EntityCircularPattern {
488 pub entity_id: Uuid,
490 pub axis: Point3d<f64>,
493 pub center: Point3d<LengthUnit>,
496 pub num_repetitions: u32,
498 pub arc_degrees: f64,
500 pub rotate_duplicates: bool,
502 }
503
504 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
506 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
507 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
508 pub struct EntityMakeHelix {
509 pub cylinder_id: Uuid,
511 pub revolutions: f64,
513 #[serde(default)]
515 pub start_angle: Angle,
516 pub is_clockwise: bool,
518 pub length: LengthUnit,
520 }
521
522 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
524 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
525 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
526 pub struct EntityMakeHelixFromParams {
527 pub radius: LengthUnit,
529 pub length: LengthUnit,
531 pub revolutions: f64,
533 #[serde(default)]
535 pub start_angle: Angle,
536 pub is_clockwise: bool,
538 pub center: Point3d<LengthUnit>,
540 pub axis: Point3d<f64>,
542 }
543
544 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
546 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
547 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
548 pub struct EntityMakeHelixFromEdge {
549 pub radius: LengthUnit,
551 pub length: Option<LengthUnit>,
553 pub revolutions: f64,
555 #[serde(default)]
557 pub start_angle: Angle,
558 pub is_clockwise: bool,
560 pub edge_id: Uuid,
562 }
563
564 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
566 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
567 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
568 pub struct EntityMirror {
569 pub ids: Vec<Uuid>,
571 pub axis: Point3d<f64>,
573 pub point: Point3d<LengthUnit>,
575 }
576
577 #[derive(
579 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
580 )]
581 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
582 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
583 pub struct EntityMirrorAcrossEdge {
584 pub ids: Vec<Uuid>,
586 pub edge_id: Uuid,
588 }
589
590 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
593 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
594 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
595 pub struct SelectWithPoint {
596 pub selected_at_window: Point2d,
598 pub selection_type: SceneSelectionType,
600 }
601
602 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
604 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
605 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
606 pub struct SelectAdd {
607 pub entities: Vec<Uuid>,
609 }
610
611 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
613 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
614 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
615 pub struct SelectRemove {
616 pub entities: Vec<Uuid>,
618 }
619
620 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
622 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
623 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
624 pub struct SceneClearAll {}
625
626 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
628 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
629 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
630 pub struct SelectReplace {
631 pub entities: Vec<Uuid>,
633 }
634
635 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
638 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
639 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
640 pub struct HighlightSetEntity {
641 pub selected_at_window: Point2d,
643 pub sequence: Option<u32>,
648 }
649
650 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
652 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
653 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
654 pub struct HighlightSetEntities {
655 pub entities: Vec<Uuid>,
657 }
658
659 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
661 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
662 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
663 pub struct NewAnnotation {
664 pub options: AnnotationOptions,
666 pub clobber: bool,
668 pub annotation_type: AnnotationType,
670 }
671
672 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
674 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
675 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
676 pub struct UpdateAnnotation {
677 pub annotation_id: Uuid,
679 pub options: AnnotationOptions,
682 }
683
684 #[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 EdgeLinesVisible {
689 pub hidden: bool,
691 }
692
693 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
695 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
696 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
697 pub struct ObjectVisible {
698 pub object_id: Uuid,
700 pub hidden: bool,
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 ObjectBringToFront {
709 pub object_id: Uuid,
711 }
712
713 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
715 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
716 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
717 pub struct ObjectSetMaterialParamsPbr {
718 pub object_id: Uuid,
720 pub color: Color,
722 pub metalness: f32,
724 pub roughness: f32,
726 pub ambient_occlusion: f32,
728 }
729 #[derive(Debug, Clone, 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 GetEntityType {
734 pub entity_id: Uuid,
736 }
737
738 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
740 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
741 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
742 pub struct Solid3dGetAllEdgeFaces {
743 pub object_id: Uuid,
745 pub edge_id: Uuid,
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 Solid2dAddHole {
754 pub object_id: Uuid,
756 pub hole_id: Uuid,
758 }
759
760 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
762 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
763 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
764 pub struct Solid3dGetAllOppositeEdges {
765 pub object_id: Uuid,
767 pub edge_id: Uuid,
769 pub along_vector: Option<Point3d<f64>>,
771 }
772
773 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
775 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
776 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
777 pub struct Solid3dGetOppositeEdge {
778 pub object_id: Uuid,
780 pub edge_id: Uuid,
782 pub face_id: Uuid,
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 Solid3dGetNextAdjacentEdge {
791 pub object_id: Uuid,
793 pub edge_id: Uuid,
795 pub face_id: Uuid,
797 }
798
799 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
801 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
802 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
803 pub struct Solid3dGetPrevAdjacentEdge {
804 pub object_id: Uuid,
806 pub edge_id: Uuid,
808 pub face_id: Uuid,
810 }
811
812 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
814 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
815 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
816 pub struct Solid3dGetCommonEdge {
817 pub object_id: Uuid,
819 pub face_ids: [Uuid; 2]
821 }
822
823 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
825 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
826 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
827 pub struct Solid3dFilletEdge {
828 pub object_id: Uuid,
830 pub edge_id: Uuid,
832 pub radius: LengthUnit,
834 pub tolerance: LengthUnit,
836 #[serde(default)]
838 pub cut_type: CutType,
839 #[serde(default, skip_serializing_if = "Option::is_none")]
842 pub face_id: Option<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 FaceIsPlanar {
850 pub object_id: Uuid,
852 }
853
854 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
856 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
857 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
858 pub struct FaceGetPosition {
859 pub object_id: Uuid,
861
862 pub uv: Point2d<f64>,
864 }
865
866 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
868 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
869 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
870 pub struct FaceGetCenter {
871 pub object_id: Uuid,
873 }
874
875 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
877 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
878 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
879 pub struct FaceGetGradient {
880 pub object_id: Uuid,
882
883 pub uv: Point2d<f64>,
885 }
886
887 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
889 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
890 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
891 pub struct SendObject {
892 pub object_id: Uuid,
894 pub front: bool,
896 }
897 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
899 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
900 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
901 pub struct EntitySetOpacity {
902 pub entity_id: Uuid,
904 pub opacity: f32,
908 }
909
910 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
912 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
913 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
914 pub struct EntityFade {
915 pub entity_id: Uuid,
917 pub fade_in: bool,
919 #[serde(default = "default_animation_seconds")]
921 pub duration_seconds: f32,
922 }
923
924 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
926 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
927 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
928 pub struct MakePlane {
929 pub origin: Point3d<LengthUnit>,
931 pub x_axis: Point3d<f64>,
933 pub y_axis: Point3d<f64>,
935 pub size: LengthUnit,
939 pub clobber: bool,
941 pub hide: Option<bool>,
943 }
944
945 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
947 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
948 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
949 pub struct PlaneSetColor {
950 pub plane_id: Uuid,
952 pub color: Color,
954 }
955
956 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
958 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
959 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
960 pub struct SetTool {
961 pub tool: SceneToolType,
963 }
964
965 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
967 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
968 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
969 pub struct MouseMove {
970 pub window: Point2d,
972 pub sequence: Option<u32>,
977 }
978
979 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
982 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
983 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
984 pub struct MouseClick {
985 pub window: Point2d,
987 }
988
989 #[derive(Debug, Clone, Default, 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 SketchModeDisable {}
996
997 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
999 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1000 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1001 pub struct GetSketchModePlane {}
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 CurveSetConstraint {
1008 pub object_id: Uuid,
1010 pub constraint_bound: PathComponentConstraintBound,
1012 pub constraint_type: PathComponentConstraintType,
1014 }
1015
1016 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1018 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1019 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1020 pub struct EnableSketchMode {
1021 pub entity_id: Uuid,
1023 pub ortho: bool,
1026 pub animated: bool,
1028 pub adjust_camera: bool,
1030 pub planar_normal: Option<Point3d<f64>>,
1033 }
1034
1035 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1039 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1040 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1041 pub struct EnableDryRun {}
1042
1043 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1047 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1048 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1049 pub struct DisableDryRun {}
1050
1051 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1053 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1054 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1055 pub struct SetBackgroundColor {
1056 pub color: Color,
1058 }
1059
1060 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1062 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1063 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1064 pub struct SetCurrentToolProperties {
1065 pub color: Option<Color>,
1067 }
1068
1069 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1071 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1072 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1073 pub struct SetDefaultSystemProperties {
1074 pub color: Option<Color>,
1076 }
1077
1078 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1080 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1081 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1082 pub struct CurveGetType {
1083 pub curve_id: Uuid,
1085 }
1086
1087 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1089 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1090 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1091 pub struct CurveGetControlPoints {
1092 pub curve_id: Uuid,
1094 }
1095
1096 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1098 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1099 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1100 pub struct ProjectEntityToPlane {
1101 pub entity_id: Uuid,
1103 pub plane_id: Uuid,
1105 pub use_plane_coords: bool,
1108 }
1109
1110 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1112 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1113 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1114 pub struct ProjectPointsToPlane {
1115 pub plane_id: Uuid,
1117 pub points: Vec<Point3d<f64>>,
1119 pub use_plane_coords: bool,
1122 }
1123
1124 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1126 #[serde(rename_all = "snake_case")]
1127 #[display(style = "snake_case")]
1128 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1129 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1130 pub enum ImageFormat {
1131 Png,
1133 Jpeg,
1135 }
1136
1137 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1139 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1140 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1141 pub struct TakeSnapshot {
1142 pub format: ImageFormat,
1144 }
1145
1146 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1148 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1149 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1150 pub struct MakeAxesGizmo {
1151 pub gizmo_mode: bool,
1154 pub clobber: bool,
1156 }
1157
1158 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1160 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1161 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1162 pub struct PathGetInfo {
1163 pub path_id: Uuid,
1165 }
1166
1167 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1169 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1170 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1171 pub struct PathGetCurveUuidsForVertices {
1172 pub path_id: Uuid,
1174
1175 pub vertex_ids: Vec<Uuid>,
1177 }
1178
1179 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1181 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1182 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1183 pub struct PathGetCurveUuid {
1184 pub path_id: Uuid,
1186
1187 pub index: u32,
1189 }
1190
1191 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1193 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1194 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1195 pub struct PathGetVertexUuids {
1196 pub path_id: Uuid,
1198 }
1199
1200 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1202 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1203 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1204 pub struct PathGetSketchTargetUuid {
1205 pub path_id: Uuid,
1207 }
1208
1209 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1211 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1212 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1213 pub struct HandleMouseDragStart {
1214 pub window: Point2d,
1216 }
1217
1218 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1220 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1221 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1222 pub struct HandleMouseDragMove {
1223 pub window: Point2d,
1225 pub sequence: Option<u32>,
1230 }
1231
1232 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1234 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1235 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1236 pub struct HandleMouseDragEnd {
1237 pub window: Point2d,
1239 }
1240
1241 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1243 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1244 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1245 pub struct RemoveSceneObjects {
1246 pub object_ids: HashSet<Uuid>,
1248 }
1249
1250 #[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 PlaneIntersectAndProject {
1256 pub plane_id: Uuid,
1258 pub window: Point2d,
1260 }
1261
1262 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1264 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1265 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1266 pub struct CurveGetEndPoints {
1267 pub curve_id: Uuid,
1269 }
1270
1271 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1273 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1274 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1275 pub struct ReconfigureStream {
1276 pub width: u32,
1278 pub height: u32,
1280 pub fps: u32,
1282 #[serde(default)]
1284 pub bitrate: Option<u32>,
1285 }
1286
1287 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1289 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1290 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1291 pub struct ImportFiles {
1292 pub files: Vec<super::ImportFile>,
1294 pub format: crate::format::InputFormat3d,
1296 }
1297
1298 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1303 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1304 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1305 pub struct SetSceneUnits {
1306 pub unit: units::UnitLength,
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 Mass {
1315 pub entity_ids: Vec<Uuid>,
1318 pub material_density: f64,
1320 pub material_density_unit: units::UnitDensity,
1322 pub output_unit: units::UnitMass,
1324 }
1325
1326 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1328 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1329 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1330 pub struct Density {
1331 pub entity_ids: Vec<Uuid>,
1334 pub material_mass: f64,
1336 pub material_mass_unit: units::UnitMass,
1338 pub output_unit: units::UnitDensity,
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 Volume {
1347 pub entity_ids: Vec<Uuid>,
1350 pub output_unit: units::UnitVolume,
1352 }
1353
1354 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1356 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1357 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1358 pub struct CenterOfMass {
1359 pub entity_ids: Vec<Uuid>,
1362 pub output_unit: units::UnitLength,
1364 }
1365
1366 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1368 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1369 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1370 pub struct SurfaceArea {
1371 pub entity_ids: Vec<Uuid>,
1374 pub output_unit: units::UnitArea,
1376 }
1377
1378 #[derive(
1380 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1381 )]
1382 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1383 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1384 pub struct DefaultCameraFocusOn {
1385 pub uuid: Uuid,
1387 }
1388 #[derive(
1390 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1391 )]
1392 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1393 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1394 pub struct SetSelectionType {
1395 pub selection_type: SceneSelectionType,
1397 }
1398
1399 #[derive(
1401 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1402 )]
1403 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1404 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1405 pub struct SetSelectionFilter {
1406 pub filter: Vec<EntityType>,
1409 }
1410
1411 #[derive(
1413 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1414 )]
1415 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1416 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1417 pub struct DefaultCameraSetOrthographic {}
1418
1419 #[derive(
1421 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1422 )]
1423 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1424 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1425 pub struct DefaultCameraSetPerspective {
1426 pub parameters: Option<PerspectiveCameraParameters>,
1428 }
1429
1430 #[derive(
1433 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1434 )]
1435 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1436 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1437 pub struct DefaultCameraCenterToSelection {
1438 #[serde(default)]
1441 pub camera_movement: CameraMovement,
1442 }
1443
1444 #[derive(
1446 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1447 )]
1448 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1449 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1450 pub struct DefaultCameraCenterToScene {
1451 #[serde(default)]
1454 pub camera_movement: CameraMovement,
1455 }
1456
1457 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1459 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1460 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1461 pub struct ZoomToFit {
1462 #[serde(default = "default_uuid_vector")]
1464 pub object_ids: Vec<Uuid>,
1465 #[serde(default)]
1470 pub padding: f32,
1471 #[serde(default)]
1473 pub animated: bool,
1474 }
1475
1476 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1478 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1479 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1480 pub struct OrientToFace {
1481 pub face_id: Uuid,
1483 #[serde(default)]
1488 pub padding: f32,
1489 #[serde(default)]
1491 pub animated: bool,
1492 }
1493
1494 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1496 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1497 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1498 pub struct ViewIsometric {
1499 #[serde(default = "f32::default")]
1504 pub padding: f32,
1505 }
1506
1507 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1509 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1510 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1511 pub struct Solid3dGetExtrusionFaceInfo {
1512 pub object_id: Uuid,
1514 pub edge_id: Uuid,
1516 }
1517
1518 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1520 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1521 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1522 pub struct SelectClear {}
1523
1524 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1526 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1527 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1528 pub struct SelectGet {}
1529
1530 #[derive(
1532 Clone, Debug, Default, 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 GetNumObjects {}
1537
1538 #[derive(
1540 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1541 )]
1542 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1543 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1544 pub struct SetObjectTransform
1545 {
1546 pub object_id: Uuid,
1548 pub transforms: Vec<ComponentTransform>,
1550 }
1551 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1554 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1555 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1556 pub struct MakeOffsetPath {
1557 pub object_id: Uuid,
1559 #[serde(default)]
1564 pub face_id: Option<Uuid>,
1565 pub offset: LengthUnit,
1567 }
1568
1569 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1571 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1572 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1573 pub struct AddHoleFromOffset {
1574 pub object_id: Uuid,
1576 pub offset: LengthUnit,
1578 }
1579
1580 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1582 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1583 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1584 pub struct SetGridReferencePlane {
1585 pub grid_id: Uuid,
1587 pub reference_id: Uuid,
1590 }
1591
1592 }
1593}
1594
1595impl ModelingCmd {
1596 pub fn is_safe_to_batch(&self) -> bool {
1598 use ModelingCmd::*;
1599 matches!(
1600 self,
1601 MovePathPen(_)
1602 | ExtendPath(_)
1603 | Extrude(_)
1604 | Revolve(_)
1605 | Solid3dFilletEdge(_)
1606 | ClosePath(_)
1607 | UpdateAnnotation(_)
1608 | ObjectVisible(_)
1609 | ObjectBringToFront(_)
1610 | Solid2dAddHole(_)
1611 | SendObject(_)
1612 | EntitySetOpacity(_)
1613 | PlaneSetColor(_)
1614 | SetTool(_)
1615 )
1616 }
1617}
1618
1619#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1623#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1624#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1625pub struct ImportFile {
1626 pub path: String,
1628 #[serde(
1630 serialize_with = "serde_bytes::serialize",
1631 deserialize_with = "serde_bytes::deserialize"
1632 )]
1633 pub data: Vec<u8>,
1634}