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, Opposite,
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
104 #[derive(
106 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
107 )]
108 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
109 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
110 pub struct Extrude {
111 pub target: ModelingCmdId,
114 pub distance: LengthUnit,
116 #[serde(default)]
119 pub faces: Option<ExtrudedFaceInfo>,
120 #[serde(default)]
123 pub opposite: Opposite<LengthUnit>,
124 }
125
126 #[derive(
128 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
129 )]
130 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
131 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
132 pub struct Sweep {
133 pub target: ModelingCmdId,
136 pub trajectory: ModelingCmdId,
138 pub sectional: bool,
140 pub tolerance: LengthUnit,
142 }
143
144 #[derive(
146 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
147 )]
148 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
149 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
150 pub struct Revolve {
151 pub target: ModelingCmdId,
154 pub origin: Point3d<LengthUnit>,
156 pub axis: Point3d<f64>,
158 pub axis_is_2d: bool,
160 pub angle: Angle,
162 pub tolerance: LengthUnit,
164 #[serde(default)]
167 pub opposite: Opposite<Angle>,
168 }
169
170 #[derive(
172 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
173 )]
174 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
175 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
176 pub struct Solid3dShellFace {
177 pub object_id: Uuid,
179 pub face_ids: Vec<Uuid>,
181 pub shell_thickness: LengthUnit,
184 #[serde(default)]
186 pub hollow: bool,
187 }
188
189 #[derive(
191 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
192 )]
193 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
194 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
195 pub struct RevolveAboutEdge {
196 pub target: ModelingCmdId,
199 pub edge_id: Uuid,
201 pub angle: Angle,
203 pub tolerance: LengthUnit,
205 #[serde(default)]
208 pub opposite: Opposite<Angle>,
209 }
210
211 #[derive(
213 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
214 )]
215 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
216 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
217 pub struct Loft {
218 pub section_ids: Vec<Uuid>,
221 pub v_degree: std::num::NonZeroU32,
224 pub bez_approximate_rational: bool,
228 pub base_curve_index: Option<u32>,
230 pub tolerance: LengthUnit,
232 }
233
234
235 #[derive(
237 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
238 )]
239 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
240 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
241 pub struct ClosePath {
242 pub path_id: Uuid,
244 }
245
246 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
248 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
249 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
250 pub struct CameraDragStart {
251 pub interaction: CameraDragInteractionType,
253 pub window: Point2d,
255 }
256
257 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
259 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
260 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
261 pub struct CameraDragMove {
262 pub interaction: CameraDragInteractionType,
264 pub window: Point2d,
266 pub sequence: Option<u32>,
271 }
272
273 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
275 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
276 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
277 pub struct CameraDragEnd {
278 pub interaction: CameraDragInteractionType,
280 pub window: Point2d,
282 }
283
284 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
286 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
287 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
288 pub struct DefaultCameraGetSettings {}
289
290 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
292 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
293 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
294 pub struct DefaultCameraGetView {}
295
296 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
298 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
299 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
300 pub struct DefaultCameraSetView {
301 pub view: CameraViewState,
303 }
304
305 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
307 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
308 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
309 pub struct DefaultCameraLookAt {
310 pub vantage: Point3d,
312 pub center: Point3d,
314 pub up: Point3d,
316 pub sequence: Option<u32>,
321 }
322
323 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
325 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
326 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
327 pub struct DefaultCameraPerspectiveSettings {
328 pub vantage: Point3d,
330 pub center: Point3d,
332 pub up: Point3d,
334 pub fov_y: Option<f32>,
336 pub z_near: Option<f32>,
338 pub z_far: Option<f32>,
340 pub sequence: Option<u32>,
345 }
346
347 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
349 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
350 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
351 pub struct DefaultCameraZoom {
352 pub magnitude: f32,
356 }
357
358 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
360 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
361 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
362 pub struct Export2d {
363 pub entity_ids: Vec<Uuid>,
365 pub format: OutputFormat2d,
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 Export3d {
374 pub entity_ids: Vec<Uuid>,
376 pub format: OutputFormat3d,
378 }
379
380 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
382 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
383 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
384 pub struct Export {
385 pub entity_ids: Vec<Uuid>,
387 pub format: OutputFormat3d,
389 }
390
391 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
393 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
394 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
395 pub struct EntityGetParentId {
396 pub entity_id: Uuid,
398 }
399
400 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
402 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
403 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
404 pub struct EntityGetNumChildren {
405 pub entity_id: Uuid,
407 }
408
409 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
411 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
412 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
413 pub struct EntityGetChildUuid {
414 pub entity_id: Uuid,
416 pub child_index: u32,
418 }
419
420 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
422 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
423 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
424 pub struct EntityGetAllChildUuids {
425 pub entity_id: Uuid,
427 }
428
429 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
431 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
432 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
433 pub struct EntityGetSketchPaths {
434 pub entity_id: Uuid,
436 }
437
438 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
440 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
441 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
442 pub struct EntityGetDistance {
443 pub entity_id1: Uuid,
445 pub entity_id2: Uuid,
447 pub distance_type: DistanceType,
449 }
450
451 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
454 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
455 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
456 pub struct EntityClone {
457 pub entity_id: Uuid,
459 }
460
461 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
464 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
465 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
466 pub struct EntityLinearPatternTransform {
467 pub entity_id: Uuid,
469 #[serde(default)]
473 pub transform: Vec<crate::shared::Transform>,
474 #[serde(default)]
478 pub transforms: Vec<Vec<crate::shared::Transform>>,
479 }
480
481 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
483 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
484 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
485 pub struct EntityLinearPattern {
486 pub entity_id: Uuid,
488 pub axis: Point3d<f64>,
491 pub num_repetitions: u32,
493 pub spacing: LengthUnit,
495 }
496 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
498 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
499 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
500 pub struct EntityCircularPattern {
501 pub entity_id: Uuid,
503 pub axis: Point3d<f64>,
506 pub center: Point3d<LengthUnit>,
509 pub num_repetitions: u32,
511 pub arc_degrees: f64,
513 pub rotate_duplicates: bool,
515 }
516
517 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
519 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
520 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
521 pub struct EntityMakeHelix {
522 pub cylinder_id: Uuid,
524 pub revolutions: f64,
526 #[serde(default)]
528 pub start_angle: Angle,
529 pub is_clockwise: bool,
531 pub length: LengthUnit,
533 }
534
535 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
537 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
538 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
539 pub struct EntityMakeHelixFromParams {
540 pub radius: LengthUnit,
542 pub length: LengthUnit,
544 pub revolutions: f64,
546 #[serde(default)]
548 pub start_angle: Angle,
549 pub is_clockwise: bool,
551 pub center: Point3d<LengthUnit>,
553 pub axis: Point3d<f64>,
555 }
556
557 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
559 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
560 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
561 pub struct EntityMakeHelixFromEdge {
562 pub radius: LengthUnit,
564 pub length: Option<LengthUnit>,
566 pub revolutions: f64,
568 #[serde(default)]
570 pub start_angle: Angle,
571 pub is_clockwise: bool,
573 pub edge_id: Uuid,
575 }
576
577 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
579 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
580 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
581 pub struct EntityMirror {
582 pub ids: Vec<Uuid>,
584 pub axis: Point3d<f64>,
586 pub point: Point3d<LengthUnit>,
588 }
589
590 #[derive(
592 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
593 )]
594 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
595 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
596 pub struct EntityMirrorAcrossEdge {
597 pub ids: Vec<Uuid>,
599 pub edge_id: Uuid,
601 }
602
603 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
606 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
607 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
608 pub struct SelectWithPoint {
609 pub selected_at_window: Point2d,
611 pub selection_type: SceneSelectionType,
613 }
614
615 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
617 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
618 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
619 pub struct SelectAdd {
620 pub entities: Vec<Uuid>,
622 }
623
624 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
626 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
627 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
628 pub struct SelectRemove {
629 pub entities: Vec<Uuid>,
631 }
632
633 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
635 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
636 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
637 pub struct SceneClearAll {}
638
639 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
641 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
642 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
643 pub struct SelectReplace {
644 pub entities: Vec<Uuid>,
646 }
647
648 #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
651 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
652 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
653 pub struct HighlightSetEntity {
654 pub selected_at_window: Point2d,
656 pub sequence: Option<u32>,
661 }
662
663 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
665 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
666 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
667 pub struct HighlightSetEntities {
668 pub entities: Vec<Uuid>,
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 NewAnnotation {
677 pub options: AnnotationOptions,
679 pub clobber: bool,
681 pub annotation_type: AnnotationType,
683 }
684
685 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
687 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
688 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
689 pub struct UpdateAnnotation {
690 pub annotation_id: Uuid,
692 pub options: AnnotationOptions,
695 }
696
697 #[derive(Debug, Clone, 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 EdgeLinesVisible {
702 pub hidden: bool,
704 }
705
706 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
708 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
709 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
710 pub struct ObjectVisible {
711 pub object_id: Uuid,
713 pub hidden: bool,
715 }
716
717 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
719 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
720 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
721 pub struct ObjectBringToFront {
722 pub object_id: Uuid,
724 }
725
726 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
728 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
729 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
730 pub struct ObjectSetMaterialParamsPbr {
731 pub object_id: Uuid,
733 pub color: Color,
735 pub metalness: f32,
737 pub roughness: f32,
739 pub ambient_occlusion: f32,
741 }
742 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
744 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
745 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
746 pub struct GetEntityType {
747 pub entity_id: Uuid,
749 }
750
751 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
753 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
754 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
755 pub struct Solid3dGetAllEdgeFaces {
756 pub object_id: Uuid,
758 pub edge_id: Uuid,
760 }
761
762 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
764 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
765 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
766 pub struct Solid2dAddHole {
767 pub object_id: Uuid,
769 pub hole_id: Uuid,
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 Solid3dGetAllOppositeEdges {
778 pub object_id: Uuid,
780 pub edge_id: Uuid,
782 pub along_vector: Option<Point3d<f64>>,
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 Solid3dGetOppositeEdge {
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 Solid3dGetNextAdjacentEdge {
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 Solid3dGetPrevAdjacentEdge {
817 pub object_id: Uuid,
819 pub edge_id: Uuid,
821 pub face_id: Uuid,
823 }
824
825 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
827 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
828 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
829 pub struct Solid3dGetCommonEdge {
830 pub object_id: Uuid,
832 pub face_ids: [Uuid; 2]
834 }
835
836 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
838 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
839 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
840 pub struct Solid3dFilletEdge {
841 pub object_id: Uuid,
843 pub edge_id: Uuid,
845 pub radius: LengthUnit,
847 pub tolerance: LengthUnit,
849 #[serde(default)]
851 pub cut_type: CutType,
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 FaceIsPlanar {
859 pub object_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 FaceGetPosition {
868 pub object_id: Uuid,
870
871 pub uv: Point2d<f64>,
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 FaceGetCenter {
880 pub object_id: Uuid,
882 }
883
884 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
886 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
887 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
888 pub struct FaceGetGradient {
889 pub object_id: Uuid,
891
892 pub uv: Point2d<f64>,
894 }
895
896 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
898 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
899 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
900 pub struct SendObject {
901 pub object_id: Uuid,
903 pub front: bool,
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 EntitySetOpacity {
911 pub entity_id: Uuid,
913 pub opacity: f32,
917 }
918
919 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
921 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
922 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
923 pub struct EntityFade {
924 pub entity_id: Uuid,
926 pub fade_in: bool,
928 #[serde(default = "default_animation_seconds")]
930 pub duration_seconds: f32,
931 }
932
933 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
935 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
936 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
937 pub struct MakePlane {
938 pub origin: Point3d<LengthUnit>,
940 pub x_axis: Point3d<f64>,
942 pub y_axis: Point3d<f64>,
944 pub size: LengthUnit,
948 pub clobber: bool,
950 pub hide: Option<bool>,
952 }
953
954 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
956 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
957 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
958 pub struct PlaneSetColor {
959 pub plane_id: Uuid,
961 pub color: Color,
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 SetTool {
970 pub tool: SceneToolType,
972 }
973
974 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
976 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
977 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
978 pub struct MouseMove {
979 pub window: Point2d,
981 pub sequence: Option<u32>,
986 }
987
988 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
991 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
992 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
993 pub struct MouseClick {
994 pub window: Point2d,
996 }
997
998 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1002 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1003 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1004 pub struct SketchModeDisable {}
1005
1006 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1008 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1009 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1010 pub struct GetSketchModePlane {}
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 CurveSetConstraint {
1017 pub object_id: Uuid,
1019 pub constraint_bound: PathComponentConstraintBound,
1021 pub constraint_type: PathComponentConstraintType,
1023 }
1024
1025 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1027 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1028 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1029 pub struct EnableSketchMode {
1030 pub entity_id: Uuid,
1032 pub ortho: bool,
1035 pub animated: bool,
1037 pub adjust_camera: bool,
1039 pub planar_normal: Option<Point3d<f64>>,
1042 }
1043
1044 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1048 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1049 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1050 pub struct EnableDryRun {}
1051
1052 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1056 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1057 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1058 pub struct DisableDryRun {}
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 SetBackgroundColor {
1065 pub color: 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 SetCurrentToolProperties {
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 SetDefaultSystemProperties {
1083 pub color: Option<Color>,
1085 }
1086
1087 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1089 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1090 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1091 pub struct CurveGetType {
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 CurveGetControlPoints {
1101 pub curve_id: Uuid,
1103 }
1104
1105 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1107 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1108 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1109 pub struct ProjectEntityToPlane {
1110 pub entity_id: Uuid,
1112 pub plane_id: Uuid,
1114 pub use_plane_coords: bool,
1117 }
1118
1119 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1121 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1122 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1123 pub struct ProjectPointsToPlane {
1124 pub plane_id: Uuid,
1126 pub points: Vec<Point3d<f64>>,
1128 pub use_plane_coords: bool,
1131 }
1132
1133 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1135 #[serde(rename_all = "snake_case")]
1136 #[display(style = "snake_case")]
1137 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1138 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1139 pub enum ImageFormat {
1140 Png,
1142 Jpeg,
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 TakeSnapshot {
1151 pub format: ImageFormat,
1153 }
1154
1155 #[derive(Debug, Clone, 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 MakeAxesGizmo {
1160 pub gizmo_mode: bool,
1163 pub clobber: bool,
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 PathGetInfo {
1172 pub path_id: Uuid,
1174 }
1175
1176 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1178 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1179 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1180 pub struct PathGetCurveUuidsForVertices {
1181 pub path_id: Uuid,
1183
1184 pub vertex_ids: Vec<Uuid>,
1186 }
1187
1188 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1190 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1191 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1192 pub struct PathGetCurveUuid {
1193 pub path_id: Uuid,
1195
1196 pub index: u32,
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 PathGetVertexUuids {
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 PathGetSketchTargetUuid {
1214 pub path_id: Uuid,
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 HandleMouseDragStart {
1223 pub window: Point2d,
1225 }
1226
1227 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1229 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1230 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1231 pub struct HandleMouseDragMove {
1232 pub window: Point2d,
1234 pub sequence: Option<u32>,
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 HandleMouseDragEnd {
1246 pub window: Point2d,
1248 }
1249
1250 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1252 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1253 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1254 pub struct RemoveSceneObjects {
1255 pub object_ids: HashSet<Uuid>,
1257 }
1258
1259 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1262 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1263 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1264 pub struct PlaneIntersectAndProject {
1265 pub plane_id: Uuid,
1267 pub window: Point2d,
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 CurveGetEndPoints {
1276 pub curve_id: Uuid,
1278 }
1279
1280 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1282 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1283 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1284 pub struct ReconfigureStream {
1285 pub width: u32,
1287 pub height: u32,
1289 pub fps: u32,
1291 #[serde(default)]
1293 pub bitrate: Option<u32>,
1294 }
1295
1296 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1298 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1299 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1300 pub struct ImportFiles {
1301 pub files: Vec<super::ImportFile>,
1303 pub format: crate::format::InputFormat3d,
1305 }
1306
1307 #[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 SetSceneUnits {
1315 pub unit: units::UnitLength,
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 Mass {
1324 pub entity_ids: Vec<Uuid>,
1327 pub material_density: f64,
1329 pub material_density_unit: units::UnitDensity,
1331 pub output_unit: units::UnitMass,
1333 }
1334
1335 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1337 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1338 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1339 pub struct Density {
1340 pub entity_ids: Vec<Uuid>,
1343 pub material_mass: f64,
1345 pub material_mass_unit: units::UnitMass,
1347 pub output_unit: units::UnitDensity,
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 Volume {
1356 pub entity_ids: Vec<Uuid>,
1359 pub output_unit: units::UnitVolume,
1361 }
1362
1363 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1365 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1366 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1367 pub struct CenterOfMass {
1368 pub entity_ids: Vec<Uuid>,
1371 pub output_unit: units::UnitLength,
1373 }
1374
1375 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1377 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1378 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1379 pub struct SurfaceArea {
1380 pub entity_ids: Vec<Uuid>,
1383 pub output_unit: units::UnitArea,
1385 }
1386
1387 #[derive(
1389 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1390 )]
1391 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1392 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1393 pub struct DefaultCameraFocusOn {
1394 pub uuid: Uuid,
1396 }
1397 #[derive(
1399 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1400 )]
1401 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1402 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1403 pub struct SetSelectionType {
1404 pub selection_type: SceneSelectionType,
1406 }
1407
1408 #[derive(
1410 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1411 )]
1412 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1413 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1414 pub struct SetSelectionFilter {
1415 pub filter: Vec<EntityType>,
1418 }
1419
1420 #[derive(
1422 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1423 )]
1424 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1425 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1426 pub struct DefaultCameraSetOrthographic {}
1427
1428 #[derive(
1430 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1431 )]
1432 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1433 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1434 pub struct DefaultCameraSetPerspective {
1435 pub parameters: Option<PerspectiveCameraParameters>,
1437 }
1438
1439 #[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 DefaultCameraCenterToSelection {
1447 #[serde(default)]
1450 pub camera_movement: CameraMovement,
1451 }
1452
1453 #[derive(
1455 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1456 )]
1457 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1458 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1459 pub struct DefaultCameraCenterToScene {
1460 #[serde(default)]
1463 pub camera_movement: CameraMovement,
1464 }
1465
1466 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1468 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1469 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1470 pub struct ZoomToFit {
1471 #[serde(default = "default_uuid_vector")]
1473 pub object_ids: Vec<Uuid>,
1474 #[serde(default)]
1479 pub padding: f32,
1480 #[serde(default)]
1482 pub animated: bool,
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 OrientToFace {
1490 pub face_id: Uuid,
1492 #[serde(default)]
1497 pub padding: f32,
1498 #[serde(default)]
1500 pub animated: bool,
1501 }
1502
1503 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, 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 ViewIsometric {
1508 #[serde(default = "f32::default")]
1513 pub padding: f32,
1514 }
1515
1516 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1518 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1519 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1520 pub struct Solid3dGetExtrusionFaceInfo {
1521 pub object_id: Uuid,
1523 pub edge_id: Uuid,
1525 }
1526
1527 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1529 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1530 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1531 pub struct SelectClear {}
1532
1533 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1535 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1536 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1537 pub struct SelectGet {}
1538
1539 #[derive(
1541 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1542 )]
1543 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1544 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1545 pub struct GetNumObjects {}
1546
1547 #[derive(
1549 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1550 )]
1551 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1552 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1553 pub struct SetObjectTransform
1554 {
1555 pub object_id: Uuid,
1557 pub transforms: Vec<ComponentTransform>,
1559 }
1560
1561 #[derive(
1564 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1565 )]
1566 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1567 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1568 pub struct BooleanUnion
1569 {
1570 pub solid_ids: Vec<Uuid>,
1573 pub tolerance: LengthUnit,
1575 }
1576
1577 #[derive(
1580 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1581 )]
1582 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1583 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1584 pub struct BooleanIntersection
1585 {
1586 pub solid_ids: Vec<Uuid>,
1588 pub tolerance: LengthUnit,
1590 }
1591
1592 #[derive(
1596 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1597 )]
1598 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1599 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1600 pub struct BooleanSubtract
1601 {
1602 pub target_ids: Vec<Uuid>,
1604 pub tool_ids: Vec<Uuid>,
1606 pub tolerance: LengthUnit,
1608 }
1609
1610 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1613 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1614 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1615 pub struct MakeOffsetPath {
1616 pub object_id: Uuid,
1618 #[serde(default)]
1623 pub face_id: Option<Uuid>,
1624 pub offset: LengthUnit,
1626 }
1627
1628 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1630 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1631 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1632 pub struct AddHoleFromOffset {
1633 pub object_id: Uuid,
1635 pub offset: LengthUnit,
1637 }
1638
1639 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1641 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1642 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1643 pub struct SetGridReferencePlane {
1644 pub grid_id: Uuid,
1646 pub reference_id: Uuid,
1649 }
1650
1651 }
1652}
1653
1654impl ModelingCmd {
1655 pub fn is_safe_to_batch(&self) -> bool {
1657 use ModelingCmd::*;
1658 matches!(
1659 self,
1660 MovePathPen(_)
1661 | ExtendPath(_)
1662 | Extrude(_)
1663 | Revolve(_)
1664 | Solid3dFilletEdge(_)
1665 | ClosePath(_)
1666 | UpdateAnnotation(_)
1667 | ObjectVisible(_)
1668 | ObjectBringToFront(_)
1669 | Solid2dAddHole(_)
1670 | SendObject(_)
1671 | EntitySetOpacity(_)
1672 | PlaneSetColor(_)
1673 | SetTool(_)
1674 )
1675 }
1676}
1677
1678#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1682#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1683#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1684pub struct ImportFile {
1685 pub path: String,
1687 #[serde(
1689 serialize_with = "serde_bytes::serialize",
1690 deserialize_with = "serde_bytes::deserialize"
1691 )]
1692 pub data: Vec<u8>,
1693}