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 CutStrategy,
29 CameraMovement,
30 ExtrudedFaceInfo,
31 AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
32 PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
33 Point2d, Point3d, SceneSelectionType, SceneToolType, Opposite,
34 },
35 units,
36 };
37
38 fn default_animation_seconds() -> f32 {
40 0.4
41 }
42
43 fn default_uuid_vector() -> Vec<Uuid> {
45 Vec::new()
46 }
47
48 #[derive(
50 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
51 )]
52 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
53 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
54 pub struct EngineUtilEvaluatePath {
55 pub path_json: String,
57
58 pub t: f64,
60 }
61
62 #[derive(
64 Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
65 )]
66 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
67 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
68 pub struct StartPath {}
69
70 #[derive(
78 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
79 )]
80 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
81 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
82 pub struct MovePathPen {
83 pub path: ModelingCmdId,
85 pub to: Point3d<LengthUnit>,
87 }
88
89 #[derive(
92 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
93 )]
94 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
95 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
96 pub struct ExtendPath {
97 pub path: ModelingCmdId,
99 pub segment: PathSegment,
102 }
103
104
105 #[derive(
107 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
108 )]
109 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
110 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
111 pub struct Extrude {
112 pub target: ModelingCmdId,
115 pub distance: LengthUnit,
117 #[serde(default)]
120 pub faces: Option<ExtrudedFaceInfo>,
121 #[serde(default)]
124 pub opposite: Opposite<LengthUnit>,
125 }
126
127 #[derive(
129 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
130 )]
131 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
132 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
133 pub struct Sweep {
134 pub target: ModelingCmdId,
137 pub trajectory: ModelingCmdId,
139 pub sectional: bool,
141 pub tolerance: LengthUnit,
143 }
144
145 #[derive(
147 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
148 )]
149 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
150 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
151 pub struct Revolve {
152 pub target: ModelingCmdId,
155 pub origin: Point3d<LengthUnit>,
157 pub axis: Point3d<f64>,
159 pub axis_is_2d: bool,
161 pub angle: Angle,
163 pub tolerance: LengthUnit,
165 #[serde(default)]
168 pub opposite: Opposite<Angle>,
169 }
170
171 #[derive(
173 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
174 )]
175 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
176 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
177 pub struct Solid3dShellFace {
178 pub object_id: Uuid,
180 pub face_ids: Vec<Uuid>,
182 pub shell_thickness: LengthUnit,
185 #[serde(default)]
187 pub hollow: bool,
188 }
189
190 #[derive(
192 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
193 )]
194 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
195 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
196 pub struct RevolveAboutEdge {
197 pub target: ModelingCmdId,
200 pub edge_id: Uuid,
202 pub angle: Angle,
204 pub tolerance: LengthUnit,
206 #[serde(default)]
209 pub opposite: Opposite<Angle>,
210 }
211
212 #[derive(
214 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant
215 )]
216 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
217 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
218 pub struct Loft {
219 pub section_ids: Vec<Uuid>,
222 pub v_degree: std::num::NonZeroU32,
225 pub bez_approximate_rational: bool,
229 pub base_curve_index: Option<u32>,
231 pub tolerance: LengthUnit,
233 }
234
235
236 #[derive(
238 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
239 )]
240 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
241 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
242 pub struct ClosePath {
243 pub path_id: Uuid,
245 }
246
247 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
249 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
250 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
251 pub struct CameraDragStart {
252 pub interaction: CameraDragInteractionType,
254 pub window: Point2d,
256 }
257
258 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
260 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
261 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
262 pub struct CameraDragMove {
263 pub interaction: CameraDragInteractionType,
265 pub window: Point2d,
267 pub sequence: Option<u32>,
272 }
273
274 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
276 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
277 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
278 pub struct CameraDragEnd {
279 pub interaction: CameraDragInteractionType,
281 pub window: Point2d,
283 }
284
285 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
287 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
288 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
289 pub struct DefaultCameraGetSettings {}
290
291 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
293 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
294 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
295 pub struct DefaultCameraGetView {}
296
297 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
299 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
300 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
301 pub struct DefaultCameraSetView {
302 pub view: CameraViewState,
304 }
305
306 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
308 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
309 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
310 pub struct DefaultCameraLookAt {
311 pub vantage: Point3d,
313 pub center: Point3d,
315 pub up: Point3d,
317 pub sequence: Option<u32>,
322 }
323
324 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
326 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
327 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
328 pub struct DefaultCameraPerspectiveSettings {
329 pub vantage: Point3d,
331 pub center: Point3d,
333 pub up: Point3d,
335 pub fov_y: Option<f32>,
337 pub z_near: Option<f32>,
339 pub z_far: Option<f32>,
341 pub sequence: Option<u32>,
346 }
347
348 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
350 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
351 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
352 pub struct DefaultCameraZoom {
353 pub magnitude: f32,
357 }
358
359 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
361 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
362 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
363 pub struct Export2d {
364 pub entity_ids: Vec<Uuid>,
366 pub format: OutputFormat2d,
368 }
369
370 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
372 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
373 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
374 pub struct Export3d {
375 pub entity_ids: Vec<Uuid>,
377 pub format: OutputFormat3d,
379 }
380
381 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
383 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
384 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
385 pub struct Export {
386 pub entity_ids: Vec<Uuid>,
388 pub format: OutputFormat3d,
390 }
391
392 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
394 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
395 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
396 pub struct EntityGetParentId {
397 pub entity_id: Uuid,
399 }
400
401 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
403 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
404 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
405 pub struct EntityGetNumChildren {
406 pub entity_id: Uuid,
408 }
409
410 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
412 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
413 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
414 pub struct EntityGetChildUuid {
415 pub entity_id: Uuid,
417 pub child_index: u32,
419 }
420
421 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
423 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
424 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
425 pub struct EntityGetAllChildUuids {
426 pub entity_id: Uuid,
428 }
429
430 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
432 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
433 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
434 pub struct EntityGetSketchPaths {
435 pub entity_id: Uuid,
437 }
438
439 #[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 EntityGetDistance {
444 pub entity_id1: Uuid,
446 pub entity_id2: Uuid,
448 pub distance_type: DistanceType,
450 }
451
452 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
455 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
456 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
457 pub struct EntityClone {
458 pub entity_id: Uuid,
460 }
461
462 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
465 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
466 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
467 pub struct EntityLinearPatternTransform {
468 pub entity_id: Uuid,
470 #[serde(default)]
474 pub transform: Vec<crate::shared::Transform>,
475 #[serde(default)]
479 pub transforms: Vec<Vec<crate::shared::Transform>>,
480 }
481
482 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
484 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
485 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
486 pub struct EntityLinearPattern {
487 pub entity_id: Uuid,
489 pub axis: Point3d<f64>,
492 pub num_repetitions: u32,
494 pub spacing: LengthUnit,
496 }
497 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
499 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
500 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
501 pub struct EntityCircularPattern {
502 pub entity_id: Uuid,
504 pub axis: Point3d<f64>,
507 pub center: Point3d<LengthUnit>,
510 pub num_repetitions: u32,
512 pub arc_degrees: f64,
514 pub rotate_duplicates: bool,
516 }
517
518 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
520 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
521 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
522 pub struct EntityMakeHelix {
523 pub cylinder_id: Uuid,
525 pub revolutions: f64,
527 #[serde(default)]
529 pub start_angle: Angle,
530 pub is_clockwise: bool,
532 pub length: LengthUnit,
534 }
535
536 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
538 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
539 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
540 pub struct EntityMakeHelixFromParams {
541 pub radius: LengthUnit,
543 pub length: LengthUnit,
545 pub revolutions: f64,
547 #[serde(default)]
549 pub start_angle: Angle,
550 pub is_clockwise: bool,
552 pub center: Point3d<LengthUnit>,
554 pub axis: Point3d<f64>,
556 }
557
558 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
560 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
561 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
562 pub struct EntityMakeHelixFromEdge {
563 pub radius: LengthUnit,
565 pub length: Option<LengthUnit>,
567 pub revolutions: f64,
569 #[serde(default)]
571 pub start_angle: Angle,
572 pub is_clockwise: bool,
574 pub edge_id: Uuid,
576 }
577
578 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
580 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
581 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
582 pub struct EntityMirror {
583 pub ids: Vec<Uuid>,
585 pub axis: Point3d<f64>,
587 pub point: Point3d<LengthUnit>,
589 }
590
591 #[derive(
593 Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
594 )]
595 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
596 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
597 pub struct EntityMirrorAcrossEdge {
598 pub ids: Vec<Uuid>,
600 pub edge_id: Uuid,
602 }
603
604 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
607 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
608 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
609 pub struct SelectWithPoint {
610 pub selected_at_window: Point2d,
612 pub selection_type: SceneSelectionType,
614 }
615
616 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
618 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
619 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
620 pub struct SelectAdd {
621 pub entities: Vec<Uuid>,
623 }
624
625 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
627 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
628 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
629 pub struct SelectRemove {
630 pub entities: Vec<Uuid>,
632 }
633
634 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
636 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
637 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
638 pub struct SceneClearAll {}
639
640 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
642 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
643 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
644 pub struct SelectReplace {
645 pub entities: Vec<Uuid>,
647 }
648
649 #[derive(Debug, Clone, Copy, 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 HighlightSetEntity {
655 pub selected_at_window: Point2d,
657 pub sequence: Option<u32>,
662 }
663
664 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
666 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
667 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
668 pub struct HighlightSetEntities {
669 pub entities: Vec<Uuid>,
671 }
672
673 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
675 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
676 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
677 pub struct NewAnnotation {
678 pub options: AnnotationOptions,
680 pub clobber: bool,
682 pub annotation_type: AnnotationType,
684 }
685
686 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
688 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
689 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
690 pub struct UpdateAnnotation {
691 pub annotation_id: Uuid,
693 pub options: AnnotationOptions,
696 }
697
698 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
700 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
701 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
702 pub struct EdgeLinesVisible {
703 pub hidden: bool,
705 }
706
707 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
709 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
710 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
711 pub struct ObjectVisible {
712 pub object_id: Uuid,
714 pub hidden: bool,
716 }
717
718 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
720 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
721 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
722 pub struct ObjectBringToFront {
723 pub object_id: Uuid,
725 }
726
727 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
729 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
730 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
731 pub struct ObjectSetMaterialParamsPbr {
732 pub object_id: Uuid,
734 pub color: Color,
736 pub metalness: f32,
738 pub roughness: f32,
740 pub ambient_occlusion: f32,
742 }
743 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
745 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
746 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
747 pub struct GetEntityType {
748 pub entity_id: Uuid,
750 }
751
752 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
754 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
755 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
756 pub struct Solid3dGetAllEdgeFaces {
757 pub object_id: Uuid,
759 pub edge_id: Uuid,
761 }
762
763 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
765 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
766 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
767 pub struct Solid2dAddHole {
768 pub object_id: Uuid,
770 pub hole_id: Uuid,
772 }
773
774 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
776 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
777 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
778 pub struct Solid3dGetAllOppositeEdges {
779 pub object_id: Uuid,
781 pub edge_id: Uuid,
783 pub along_vector: Option<Point3d<f64>>,
785 }
786
787 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
789 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
790 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
791 pub struct Solid3dGetOppositeEdge {
792 pub object_id: Uuid,
794 pub edge_id: Uuid,
796 pub face_id: Uuid,
798 }
799
800 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
802 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
803 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
804 pub struct Solid3dGetNextAdjacentEdge {
805 pub object_id: Uuid,
807 pub edge_id: Uuid,
809 pub face_id: Uuid,
811 }
812
813 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
815 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
816 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
817 pub struct Solid3dGetPrevAdjacentEdge {
818 pub object_id: Uuid,
820 pub edge_id: Uuid,
822 pub face_id: Uuid,
824 }
825
826 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
828 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
829 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
830 pub struct Solid3dGetCommonEdge {
831 pub object_id: Uuid,
833 pub face_ids: [Uuid; 2]
835 }
836
837 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
839 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
840 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
841 pub struct Solid3dFilletEdge {
842 pub object_id: Uuid,
844 #[serde(default)]
846 pub edge_id: Option<Uuid>,
847 #[serde(default)]
849 pub edge_ids: Vec<Uuid>,
850 pub radius: LengthUnit,
852 pub tolerance: LengthUnit,
854 #[serde(default)]
856 pub cut_type: CutType,
857 #[serde(default)]
859 pub strategy: CutStrategy,
860 #[serde(default)]
868 pub extra_face_ids: Vec<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 FaceIsPlanar {
876 pub object_id: Uuid,
878 }
879
880 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
882 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
883 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
884 pub struct FaceGetPosition {
885 pub object_id: Uuid,
887
888 pub uv: Point2d<f64>,
890 }
891
892 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
894 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
895 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
896 pub struct FaceGetCenter {
897 pub object_id: Uuid,
899 }
900
901 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
903 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
904 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
905 pub struct FaceGetGradient {
906 pub object_id: Uuid,
908
909 pub uv: Point2d<f64>,
911 }
912
913 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
915 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
916 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
917 pub struct SendObject {
918 pub object_id: Uuid,
920 pub front: bool,
922 }
923 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
925 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
926 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
927 pub struct EntitySetOpacity {
928 pub entity_id: Uuid,
930 pub opacity: f32,
934 }
935
936 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
938 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
939 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
940 pub struct EntityFade {
941 pub entity_id: Uuid,
943 pub fade_in: bool,
945 #[serde(default = "default_animation_seconds")]
947 pub duration_seconds: f32,
948 }
949
950 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
952 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
953 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
954 pub struct MakePlane {
955 pub origin: Point3d<LengthUnit>,
957 pub x_axis: Point3d<f64>,
959 pub y_axis: Point3d<f64>,
961 pub size: LengthUnit,
965 pub clobber: bool,
967 pub hide: Option<bool>,
969 }
970
971 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
973 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
974 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
975 pub struct PlaneSetColor {
976 pub plane_id: Uuid,
978 pub color: Color,
980 }
981
982 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
984 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
985 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
986 pub struct SetTool {
987 pub tool: SceneToolType,
989 }
990
991 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
993 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
994 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
995 pub struct MouseMove {
996 pub window: Point2d,
998 pub sequence: Option<u32>,
1003 }
1004
1005 #[derive(Debug, Clone, 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 MouseClick {
1011 pub window: Point2d,
1013 }
1014
1015 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1019 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1020 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1021 pub struct SketchModeDisable {}
1022
1023 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1025 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1026 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1027 pub struct GetSketchModePlane {}
1028
1029 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1031 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1032 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1033 pub struct CurveSetConstraint {
1034 pub object_id: Uuid,
1036 pub constraint_bound: PathComponentConstraintBound,
1038 pub constraint_type: PathComponentConstraintType,
1040 }
1041
1042 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1044 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1045 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1046 pub struct EnableSketchMode {
1047 pub entity_id: Uuid,
1049 pub ortho: bool,
1052 pub animated: bool,
1054 pub adjust_camera: bool,
1056 pub planar_normal: Option<Point3d<f64>>,
1059 }
1060
1061 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1065 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1066 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1067 pub struct EnableDryRun {}
1068
1069 #[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1073 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1074 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1075 pub struct DisableDryRun {}
1076
1077 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1079 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1080 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1081 pub struct SetBackgroundColor {
1082 pub color: Color,
1084 }
1085
1086 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1088 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1089 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1090 pub struct SetCurrentToolProperties {
1091 pub color: Option<Color>,
1093 }
1094
1095 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1097 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1098 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1099 pub struct SetDefaultSystemProperties {
1100 pub color: Option<Color>,
1102 }
1103
1104 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1106 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1107 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1108 pub struct CurveGetType {
1109 pub curve_id: Uuid,
1111 }
1112
1113 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1115 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1116 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1117 pub struct CurveGetControlPoints {
1118 pub curve_id: Uuid,
1120 }
1121
1122 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1124 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1125 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1126 pub struct ProjectEntityToPlane {
1127 pub entity_id: Uuid,
1129 pub plane_id: Uuid,
1131 pub use_plane_coords: bool,
1134 }
1135
1136 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1138 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1139 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1140 pub struct ProjectPointsToPlane {
1141 pub plane_id: Uuid,
1143 pub points: Vec<Point3d<f64>>,
1145 pub use_plane_coords: bool,
1148 }
1149
1150 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, FromStr, Display)]
1152 #[serde(rename_all = "snake_case")]
1153 #[display(style = "snake_case")]
1154 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1155 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1156 pub enum ImageFormat {
1157 Png,
1159 Jpeg,
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 TakeSnapshot {
1168 pub format: ImageFormat,
1170 }
1171
1172 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1174 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1175 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1176 pub struct MakeAxesGizmo {
1177 pub gizmo_mode: bool,
1180 pub clobber: bool,
1182 }
1183
1184 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1186 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1187 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1188 pub struct PathGetInfo {
1189 pub path_id: Uuid,
1191 }
1192
1193 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1195 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1196 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1197 pub struct PathGetCurveUuidsForVertices {
1198 pub path_id: Uuid,
1200
1201 pub vertex_ids: Vec<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 PathGetCurveUuid {
1210 pub path_id: Uuid,
1212
1213 pub index: u32,
1215 }
1216
1217 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1219 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1220 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1221 pub struct PathGetVertexUuids {
1222 pub path_id: Uuid,
1224 }
1225
1226 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1228 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1229 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1230 pub struct PathGetSketchTargetUuid {
1231 pub path_id: Uuid,
1233 }
1234
1235 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1237 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1238 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1239 pub struct HandleMouseDragStart {
1240 pub window: Point2d,
1242 }
1243
1244 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1246 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1247 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1248 pub struct HandleMouseDragMove {
1249 pub window: Point2d,
1251 pub sequence: Option<u32>,
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 HandleMouseDragEnd {
1263 pub window: Point2d,
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 RemoveSceneObjects {
1272 pub object_ids: HashSet<Uuid>,
1274 }
1275
1276 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1279 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1280 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1281 pub struct PlaneIntersectAndProject {
1282 pub plane_id: Uuid,
1284 pub window: Point2d,
1286 }
1287
1288 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1290 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1291 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1292 pub struct CurveGetEndPoints {
1293 pub curve_id: Uuid,
1295 }
1296
1297 #[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 ReconfigureStream {
1302 pub width: u32,
1304 pub height: u32,
1306 pub fps: u32,
1308 #[serde(default)]
1310 pub bitrate: Option<u32>,
1311 }
1312
1313 #[derive(Debug, Eq, PartialEq, Clone, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1315 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1316 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1317 pub struct ImportFiles {
1318 pub files: Vec<super::ImportFile>,
1320 pub format: crate::format::InputFormat3d,
1322 }
1323
1324 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1329 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1330 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1331 pub struct SetSceneUnits {
1332 pub unit: units::UnitLength,
1334 }
1335
1336 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1338 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1339 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1340 pub struct Mass {
1341 pub entity_ids: Vec<Uuid>,
1344 pub material_density: f64,
1346 pub material_density_unit: units::UnitDensity,
1348 pub output_unit: units::UnitMass,
1350 }
1351
1352 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1354 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1355 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1356 pub struct Density {
1357 pub entity_ids: Vec<Uuid>,
1360 pub material_mass: f64,
1362 pub material_mass_unit: units::UnitMass,
1364 pub output_unit: units::UnitDensity,
1366 }
1367
1368 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1370 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1371 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1372 pub struct Volume {
1373 pub entity_ids: Vec<Uuid>,
1376 pub output_unit: units::UnitVolume,
1378 }
1379
1380 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1382 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1383 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1384 pub struct CenterOfMass {
1385 pub entity_ids: Vec<Uuid>,
1388 pub output_unit: units::UnitLength,
1390 }
1391
1392 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1394 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1395 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1396 pub struct SurfaceArea {
1397 pub entity_ids: Vec<Uuid>,
1400 pub output_unit: units::UnitArea,
1402 }
1403
1404 #[derive(
1406 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1407 )]
1408 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1409 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1410 pub struct DefaultCameraFocusOn {
1411 pub uuid: Uuid,
1413 }
1414 #[derive(
1416 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1417 )]
1418 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1419 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1420 pub struct SetSelectionType {
1421 pub selection_type: SceneSelectionType,
1423 }
1424
1425 #[derive(
1427 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1428 )]
1429 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1430 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1431 pub struct SetSelectionFilter {
1432 pub filter: Vec<EntityType>,
1435 }
1436
1437 #[derive(
1439 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1440 )]
1441 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1442 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1443 pub struct DefaultCameraSetOrthographic {}
1444
1445 #[derive(
1447 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1448 )]
1449 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1450 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1451 pub struct DefaultCameraSetPerspective {
1452 pub parameters: Option<PerspectiveCameraParameters>,
1454 }
1455
1456 #[derive(
1459 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1460 )]
1461 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1462 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1463 pub struct DefaultCameraCenterToSelection {
1464 #[serde(default)]
1467 pub camera_movement: CameraMovement,
1468 }
1469
1470 #[derive(
1472 Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1473 )]
1474 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1475 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1476 pub struct DefaultCameraCenterToScene {
1477 #[serde(default)]
1480 pub camera_movement: CameraMovement,
1481 }
1482
1483 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1485 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1486 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1487 pub struct ZoomToFit {
1488 #[serde(default = "default_uuid_vector")]
1490 pub object_ids: Vec<Uuid>,
1491 #[serde(default)]
1496 pub padding: f32,
1497 #[serde(default)]
1499 pub animated: bool,
1500 }
1501
1502 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant)]
1504 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1505 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1506 pub struct OrientToFace {
1507 pub face_id: Uuid,
1509 #[serde(default)]
1514 pub padding: f32,
1515 #[serde(default)]
1517 pub animated: bool,
1518 }
1519
1520 #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, 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 ViewIsometric {
1525 #[serde(default = "f32::default")]
1530 pub padding: f32,
1531 }
1532
1533 #[derive(Clone, Debug, 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 Solid3dGetExtrusionFaceInfo {
1538 pub object_id: Uuid,
1540 pub edge_id: Uuid,
1542 }
1543
1544 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1546 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1547 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1548 pub struct Solid3dGetAdjacencyInfo {
1549 pub object_id: Uuid,
1551 pub edge_id: Uuid,
1553 }
1554
1555
1556 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1558 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1559 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1560 pub struct SelectClear {}
1561
1562 #[derive(Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1564 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1565 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1566 pub struct SelectGet {}
1567
1568 #[derive(
1570 Clone, Debug, Default, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant,
1571 )]
1572 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1573 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1574 pub struct GetNumObjects {}
1575
1576 #[derive(
1578 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1579 )]
1580 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1581 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1582 pub struct SetObjectTransform
1583 {
1584 pub object_id: Uuid,
1586 pub transforms: Vec<ComponentTransform>,
1588 }
1589
1590 #[derive(
1593 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1594 )]
1595 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1596 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1597 pub struct BooleanUnion
1598 {
1599 pub solid_ids: Vec<Uuid>,
1602 pub tolerance: LengthUnit,
1604 }
1605
1606 #[derive(
1609 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1610 )]
1611 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1612 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1613 pub struct BooleanIntersection
1614 {
1615 pub solid_ids: Vec<Uuid>,
1617 pub tolerance: LengthUnit,
1619 }
1620
1621 #[derive(
1625 Clone, Debug, Deserialize, PartialEq, JsonSchema, Serialize, ModelingCmdVariant,
1626 )]
1627 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1628 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1629 pub struct BooleanSubtract
1630 {
1631 pub target_ids: Vec<Uuid>,
1633 pub tool_ids: Vec<Uuid>,
1635 pub tolerance: LengthUnit,
1637 }
1638
1639 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1642 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1643 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1644 pub struct MakeOffsetPath {
1645 pub object_id: Uuid,
1647 #[serde(default)]
1652 pub face_id: Option<Uuid>,
1653 pub offset: LengthUnit,
1655 }
1656
1657 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1659 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1660 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1661 pub struct AddHoleFromOffset {
1662 pub object_id: Uuid,
1664 pub offset: LengthUnit,
1666 }
1667
1668 #[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant)]
1670 #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1671 #[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1672 pub struct SetGridReferencePlane {
1673 pub grid_id: Uuid,
1675 pub reference_id: Uuid,
1678 }
1679
1680 }
1681}
1682
1683impl ModelingCmd {
1684 pub fn is_safe_to_batch(&self) -> bool {
1686 use ModelingCmd::*;
1687 matches!(
1688 self,
1689 MovePathPen(_)
1690 | ExtendPath(_)
1691 | Extrude(_)
1692 | Revolve(_)
1693 | Solid3dFilletEdge(_)
1694 | ClosePath(_)
1695 | UpdateAnnotation(_)
1696 | ObjectVisible(_)
1697 | ObjectBringToFront(_)
1698 | Solid2dAddHole(_)
1699 | SendObject(_)
1700 | EntitySetOpacity(_)
1701 | PlaneSetColor(_)
1702 | SetTool(_)
1703 )
1704 }
1705}
1706
1707#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema, Eq, PartialEq)]
1711#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1712#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1713pub struct ImportFile {
1714 pub path: String,
1716 #[serde(
1718 serialize_with = "serde_bytes::serialize",
1719 deserialize_with = "serde_bytes::deserialize"
1720 )]
1721 pub data: Vec<u8>,
1722}