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 }
840
841 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
843 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
844 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
845 pub struct FaceIsPlanar {
846 pub object_id: Uuid,
848 }
849
850 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
852 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
853 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
854 pub struct FaceGetPosition {
855 pub object_id: Uuid,
857
858 pub uv: Point2d<f64>,
860 }
861
862 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
864 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
865 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
866 pub struct FaceGetCenter {
867 pub object_id: Uuid,
869 }
870
871 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
873 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
874 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
875 pub struct FaceGetGradient {
876 pub object_id: Uuid,
878
879 pub uv: Point2d<f64>,
881 }
882
883 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
885 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
886 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
887 pub struct SendObject {
888 pub object_id: Uuid,
890 pub front: bool,
892 }
893 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
895 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
896 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
897 pub struct EntitySetOpacity {
898 pub entity_id: Uuid,
900 pub opacity: f32,
904 }
905
906 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
908 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
909 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
910 pub struct EntityFade {
911 pub entity_id: Uuid,
913 pub fade_in: bool,
915 #[serde(default = "default_animation_seconds")]
917 pub duration_seconds: f32,
918 }
919
920 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
922 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
923 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
924 pub struct MakePlane {
925 pub origin: Point3d<LengthUnit>,
927 pub x_axis: Point3d<f64>,
929 pub y_axis: Point3d<f64>,
931 pub size: LengthUnit,
935 pub clobber: bool,
937 pub hide: Option<bool>,
939 }
940
941 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
943 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
944 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
945 pub struct PlaneSetColor {
946 pub plane_id: Uuid,
948 pub color: Color,
950 }
951
952 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
954 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
955 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
956 pub struct SetTool {
957 pub tool: SceneToolType,
959 }
960
961 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
963 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
964 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
965 pub struct MouseMove {
966 pub window: Point2d,
968 pub sequence: Option<u32>,
973 }
974
975 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
978 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
979 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
980 pub struct MouseClick {
981 pub window: Point2d,
983 }
984
985 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
989 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
990 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
991 pub struct SketchModeDisable {}
992
993 #[derive(Debug, Clone, Default, 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 GetSketchModePlane {}
998
999 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1001 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1002 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1003 pub struct CurveSetConstraint {
1004 pub object_id: Uuid,
1006 pub constraint_bound: PathComponentConstraintBound,
1008 pub constraint_type: PathComponentConstraintType,
1010 }
1011
1012 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1014 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1015 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1016 pub struct EnableSketchMode {
1017 pub entity_id: Uuid,
1019 pub ortho: bool,
1022 pub animated: bool,
1024 pub adjust_camera: bool,
1026 pub planar_normal: Option<Point3d<f64>>,
1029 }
1030
1031 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1035 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1036 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1037 pub struct EnableDryRun {}
1038
1039 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1043 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1044 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1045 pub struct DisableDryRun {}
1046
1047 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1049 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1050 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1051 pub struct SetBackgroundColor {
1052 pub color: Color,
1054 }
1055
1056 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1058 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1059 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1060 pub struct SetCurrentToolProperties {
1061 pub color: Option<Color>,
1063 }
1064
1065 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1067 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1068 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1069 pub struct SetDefaultSystemProperties {
1070 pub color: Option<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 CurveGetType {
1079 pub curve_id: Uuid,
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 CurveGetControlPoints {
1088 pub curve_id: Uuid,
1090 }
1091
1092 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1094 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1095 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1096 pub struct ProjectEntityToPlane {
1097 pub entity_id: Uuid,
1099 pub plane_id: Uuid,
1101 pub use_plane_coords: bool,
1104 }
1105
1106 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1108 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1109 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1110 pub struct ProjectPointsToPlane {
1111 pub plane_id: Uuid,
1113 pub points: Vec<Point3d<f64>>,
1115 pub use_plane_coords: bool,
1118 }
1119
1120 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1122 #[serde(rename_all = "snake_case")]
1123 #[display(style = "snake_case")]
1124 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1125 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1126 pub enum ImageFormat {
1127 Png,
1129 Jpeg,
1131 }
1132
1133 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1135 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1136 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1137 pub struct TakeSnapshot {
1138 pub format: ImageFormat,
1140 }
1141
1142 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1144 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1145 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1146 pub struct MakeAxesGizmo {
1147 pub gizmo_mode: bool,
1150 pub clobber: bool,
1152 }
1153
1154 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1156 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1157 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1158 pub struct PathGetInfo {
1159 pub path_id: Uuid,
1161 }
1162
1163 #[derive(Debug, Clone, 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 PathGetCurveUuidsForVertices {
1168 pub path_id: Uuid,
1170
1171 pub vertex_ids: Vec<Uuid>,
1173 }
1174
1175 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1177 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1178 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1179 pub struct PathGetCurveUuid {
1180 pub path_id: Uuid,
1182
1183 pub index: u32,
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 PathGetVertexUuids {
1192 pub path_id: Uuid,
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 PathGetSketchTargetUuid {
1201 pub path_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 HandleMouseDragStart {
1210 pub window: Point2d,
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 HandleMouseDragMove {
1219 pub window: Point2d,
1221 pub sequence: Option<u32>,
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 HandleMouseDragEnd {
1233 pub window: Point2d,
1235 }
1236
1237 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1239 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1240 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1241 pub struct RemoveSceneObjects {
1242 pub object_ids: HashSet<Uuid>,
1244 }
1245
1246 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1249 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1250 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1251 pub struct PlaneIntersectAndProject {
1252 pub plane_id: Uuid,
1254 pub window: Point2d,
1256 }
1257
1258 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1260 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1261 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1262 pub struct CurveGetEndPoints {
1263 pub curve_id: Uuid,
1265 }
1266
1267 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1269 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1270 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1271 pub struct ReconfigureStream {
1272 pub width: u32,
1274 pub height: u32,
1276 pub fps: u32,
1278 #[serde(default)]
1280 pub bitrate: Option<u32>,
1281 }
1282
1283 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1285 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1286 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1287 pub struct ImportFiles {
1288 pub files: Vec<super::ImportFile>,
1290 pub format: crate::format::InputFormat3d,
1292 }
1293
1294 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1299 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1300 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1301 pub struct SetSceneUnits {
1302 pub unit: units::UnitLength,
1304 }
1305
1306 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1308 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1309 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1310 pub struct Mass {
1311 pub entity_ids: Vec<Uuid>,
1314 pub material_density: f64,
1316 pub material_density_unit: units::UnitDensity,
1318 pub output_unit: units::UnitMass,
1320 }
1321
1322 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1324 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1325 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1326 pub struct Density {
1327 pub entity_ids: Vec<Uuid>,
1330 pub material_mass: f64,
1332 pub material_mass_unit: units::UnitMass,
1334 pub output_unit: units::UnitDensity,
1336 }
1337
1338 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1340 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1341 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1342 pub struct Volume {
1343 pub entity_ids: Vec<Uuid>,
1346 pub output_unit: units::UnitVolume,
1348 }
1349
1350 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1352 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1353 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1354 pub struct CenterOfMass {
1355 pub entity_ids: Vec<Uuid>,
1358 pub output_unit: units::UnitLength,
1360 }
1361
1362 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1364 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1365 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1366 pub struct SurfaceArea {
1367 pub entity_ids: Vec<Uuid>,
1370 pub output_unit: units::UnitArea,
1372 }
1373
1374 #[derive(
1376 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1377 )]
1378 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1379 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1380 pub struct DefaultCameraFocusOn {
1381 pub uuid: Uuid,
1383 }
1384 #[derive(
1386 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1387 )]
1388 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1389 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1390 pub struct SetSelectionType {
1391 pub selection_type: SceneSelectionType,
1393 }
1394
1395 #[derive(
1397 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1398 )]
1399 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1400 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1401 pub struct SetSelectionFilter {
1402 pub filter: Vec<EntityType>,
1405 }
1406
1407 #[derive(
1409 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1410 )]
1411 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1412 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1413 pub struct DefaultCameraSetOrthographic {}
1414
1415 #[derive(
1417 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1418 )]
1419 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1420 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1421 pub struct DefaultCameraSetPerspective {
1422 pub parameters: Option<PerspectiveCameraParameters>,
1424 }
1425
1426 #[derive(
1429 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1430 )]
1431 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1432 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1433 pub struct DefaultCameraCenterToSelection {
1434 #[serde(default)]
1437 pub camera_movement: CameraMovement,
1438 }
1439
1440 #[derive(
1442 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1443 )]
1444 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1445 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1446 pub struct DefaultCameraCenterToScene {
1447 #[serde(default)]
1450 pub camera_movement: CameraMovement,
1451 }
1452
1453 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1455 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1456 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1457 pub struct ZoomToFit {
1458 #[serde(default = "default_uuid_vector")]
1460 pub object_ids: Vec<Uuid>,
1461 #[serde(default)]
1466 pub padding: f32,
1467 #[serde(default)]
1469 pub animated: bool,
1470 }
1471
1472 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1474 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1475 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1476 pub struct OrientToFace {
1477 pub face_id: Uuid,
1479 #[serde(default)]
1484 pub padding: f32,
1485 #[serde(default)]
1487 pub animated: bool,
1488 }
1489
1490 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1492 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1493 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1494 pub struct ViewIsometric {
1495 #[serde(default = "f32::default")]
1500 pub padding: f32,
1501 }
1502
1503 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1505 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1506 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1507 pub struct Solid3dGetExtrusionFaceInfo {
1508 pub object_id: Uuid,
1510 pub edge_id: Uuid,
1512 }
1513
1514 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1516 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1517 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1518 pub struct SelectClear {}
1519
1520 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1522 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1523 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1524 pub struct SelectGet {}
1525
1526 #[derive(
1528 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1529 )]
1530 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1531 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1532 pub struct GetNumObjects {}
1533
1534 #[derive(
1536 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1537 )]
1538 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1539 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1540 pub struct SetObjectTransform
1541 {
1542 pub object_id: Uuid,
1544 pub transforms: Vec<ComponentTransform>,
1546 }
1547 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1550 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1551 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1552 pub struct MakeOffsetPath {
1553 pub object_id: Uuid,
1555 #[serde(default)]
1560 pub face_id: Option<Uuid>,
1561 pub offset: LengthUnit,
1563 }
1564
1565 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1567 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1568 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1569 pub struct AddHoleFromOffset {
1570 pub object_id: Uuid,
1572 pub offset: LengthUnit,
1574 }
1575
1576 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1578 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1579 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1580 pub struct SetGridReferencePlane {
1581 pub grid_id: Uuid,
1583 pub reference_id: Uuid,
1586 }
1587
1588 }
1589}
1590
1591impl ModelingCmd {
1592 pub fn is_safe_to_batch(&self) -> bool {
1594 use ModelingCmd::*;
1595 matches!(
1596 self,
1597 MovePathPen(_)
1598 | ExtendPath(_)
1599 | Extrude(_)
1600 | Revolve(_)
1601 | Solid3dFilletEdge(_)
1602 | ClosePath(_)
1603 | UpdateAnnotation(_)
1604 | ObjectVisible(_)
1605 | ObjectBringToFront(_)
1606 | Solid2dAddHole(_)
1607 | SendObject(_)
1608 | EntitySetOpacity(_)
1609 | PlaneSetColor(_)
1610 | SetTool(_)
1611 )
1612 }
1613}
1614
1615#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1619#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1620#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1621pub struct ImportFile {
1622 pub path: String,
1624 #[serde(
1626 serialize_with = "serde_bytes::serialize",
1627 deserialize_with = "serde_bytes::deserialize"
1628 )]
1629 pub data: Vec<u8>,
1630}