1use bon::Builder;
2use enum_iterator::Sequence;
3use parse_display_derive::{Display, FromStr};
4pub use point::{Point2d, Point3d, Point4d, Quaternion};
5use schemars::{schema::SchemaObject, JsonSchema};
6use serde::{Deserialize, Serialize};
7use uuid::Uuid;
8
9#[cfg(feature = "cxx")]
10use crate::impl_extern_type;
11use crate::{
12 def_enum::negative_one,
13 id::ModelingCmdId,
14 length_unit::LengthUnit,
15 output::ExtrusionFaceInfo,
16 units::{self, UnitAngle},
17};
18
19mod point;
20pub mod safe_filepath;
21
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
24#[serde(rename_all = "snake_case")]
25#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
26#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
27#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
28#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
29pub struct EdgeSpecifier {
30 pub side_faces: Vec<Uuid>,
32 #[serde(default, skip_serializing_if = "Vec::is_empty")]
34 #[builder(default)]
35 pub end_faces: Vec<Uuid>,
36 #[serde(skip_serializing_if = "Option::is_none")]
40 pub index: Option<u32>,
41}
42
43#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
59#[serde(rename_all = "snake_case")]
60#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
61#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
62#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
63#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
64pub struct PrimitiveTopologyFallback {
65 pub parent_id: Uuid,
67 pub primitive_index: u32,
69}
70
71#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
73#[serde(tag = "type", rename_all = "snake_case")]
74#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
75#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
76#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
77pub enum EntityReference {
78 Plane {
80 plane_id: Uuid,
82 #[serde(default, skip_serializing_if = "Option::is_none")]
84 topology_fallback: Option<PrimitiveTopologyFallback>,
85 },
86 Face {
88 face_id: Uuid,
90 #[serde(default, skip_serializing_if = "Option::is_none")]
92 topology_fallback: Option<PrimitiveTopologyFallback>,
93 },
94 Edge {
96 #[serde(flatten)]
98 inner: EdgeSpecifier,
99 #[serde(default, skip_serializing_if = "Option::is_none")]
101 topology_fallback: Option<PrimitiveTopologyFallback>,
102 },
103 Vertex {
105 side_faces: Vec<Uuid>,
107 #[serde(skip_serializing_if = "Option::is_none")]
109 index: Option<u32>,
110 #[serde(default, skip_serializing_if = "Option::is_none")]
112 topology_fallback: Option<PrimitiveTopologyFallback>,
113 },
114 Solid2d {
116 solid2d_id: Uuid,
118 #[serde(default, skip_serializing_if = "Option::is_none")]
120 topology_fallback: Option<PrimitiveTopologyFallback>,
121 },
122 Solid3d {
124 solid3d_id: Uuid,
126 #[serde(default, skip_serializing_if = "Option::is_none")]
128 topology_fallback: Option<PrimitiveTopologyFallback>,
129 },
130 Solid2dEdge {
133 edge_id: Uuid,
135 #[serde(default, skip_serializing_if = "Option::is_none")]
137 topology_fallback: Option<PrimitiveTopologyFallback>,
138 },
139 Segment {
141 path_id: Uuid,
143 segment_id: Uuid,
145 #[serde(default, skip_serializing_if = "Option::is_none")]
147 topology_fallback: Option<PrimitiveTopologyFallback>,
148 },
149 Region {
151 region_id: Uuid,
153 #[serde(default, skip_serializing_if = "Option::is_none")]
155 topology_fallback: Option<PrimitiveTopologyFallback>,
156 },
157}
158
159#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
161#[serde(rename_all = "snake_case")]
162#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
163#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
164#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
165pub enum CutType {
166 #[default]
168 Fillet,
169 Chamfer,
171}
172
173#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
175#[serde(rename_all = "snake_case")]
176#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
177#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
178#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
179pub enum DirectionType {
180 Edge {
182 id: Uuid,
184 },
185 Axis {
187 direction: Point3d<f64>,
189 },
190}
191
192#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
194#[serde(rename_all = "snake_case")]
195#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
196#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
197#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
198pub enum MirrorAcross {
199 Edge {
202 id: Uuid,
204 },
205 EdgeReference {
208 reference: EdgeSpecifier,
210 },
211 Axis {
214 axis: Point3d<f64>,
216 point: Point3d<LengthUnit>,
218 },
219 Plane {
222 id: Uuid,
224 },
225}
226
227#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
229#[serde(rename_all = "snake_case")]
230#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
231#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
232#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
233#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
234pub enum CutTypeV2 {
235 Fillet {
237 radius: LengthUnit,
239 second_length: Option<LengthUnit>,
242 },
243 Chamfer {
245 distance: LengthUnit,
247 second_distance: Option<LengthUnit>,
249 angle: Option<Angle>,
251 swap: bool,
253 },
254 Custom {
256 path: Uuid,
258 },
259}
260
261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
263#[serde(rename_all = "snake_case")]
264#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
265#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
266#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
267#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
268pub struct Rotation {
269 pub axis: Point3d<f64>,
272 pub angle: Angle,
275 pub origin: OriginType,
277}
278
279impl Default for Rotation {
280 fn default() -> Self {
282 Self {
283 axis: z_axis(),
284 angle: Angle::default(),
285 origin: OriginType::Local,
286 }
287 }
288}
289
290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
292#[serde(rename_all = "snake_case")]
293#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
294#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
295#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
296#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
297pub struct Transform {
298 #[serde(default)]
301 #[builder(default)]
302 pub translate: Point3d<LengthUnit>,
303 #[serde(default = "same_scale")]
306 #[builder(default = same_scale())]
307 pub scale: Point3d<f64>,
308 #[serde(default)]
311 #[builder(default)]
312 pub rotation: Rotation,
313 #[serde(default = "bool_true")]
315 #[builder(default = bool_true())]
316 pub replicate: bool,
317}
318
319impl Default for Transform {
320 fn default() -> Self {
321 Self {
322 scale: same_scale(),
323 replicate: true,
324 translate: Default::default(),
325 rotation: Rotation::default(),
326 }
327 }
328}
329
330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
332#[serde(rename_all = "snake_case")]
333#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
334#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
335#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
336#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
337pub struct AnnotationOptions {
338 pub text: Option<AnnotationTextOptions>,
340 pub line_ends: Option<AnnotationLineEndOptions>,
342 pub line_width: Option<f32>,
344 pub color: Option<Color>,
346 pub position: Option<Point3d<f32>>,
348 #[serde(default, skip_serializing_if = "Option::is_none")]
350 pub units: Option<units::UnitLength>,
351 pub dimension: Option<AnnotationBasicDimension>,
353 pub feature_control: Option<AnnotationFeatureControl>,
355 pub feature_tag: Option<AnnotationFeatureTag>,
357 #[serde(default, skip_serializing_if = "Option::is_none")]
362 pub name: Option<String>,
363}
364
365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
367#[serde(rename_all = "snake_case")]
368#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
369#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
370#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
371#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
372pub struct AnnotationLineEndOptions {
373 pub start: AnnotationLineEnd,
375 pub end: AnnotationLineEnd,
377}
378
379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
381#[serde(rename_all = "snake_case")]
382#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
383#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
384#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
385#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
386pub struct AnnotationTextOptions {
387 pub x: AnnotationTextAlignmentX,
389 pub y: AnnotationTextAlignmentY,
391 pub text: String,
393 pub point_size: u32,
395}
396
397#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
399#[serde(rename_all = "snake_case")]
400#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
401#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
402#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
403#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
404pub struct AnnotationMbdControlFrame {
405 pub symbol: MbdSymbol,
407 pub diameter_symbol: Option<MbdSymbol>,
409 pub tolerance: f64,
412 pub modifier: Option<MbdSymbol>,
414 pub primary_datum: Option<char>,
416 pub secondary_datum: Option<char>,
418 pub tertiary_datum: Option<char>,
420}
421
422#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
424#[serde(rename_all = "snake_case")]
425#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
426#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
427#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
428#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
429pub struct AnnotationMbdBasicDimension {
430 pub symbol: Option<MbdSymbol>,
432 pub dimension: Option<f64>,
435 #[serde(default, skip_serializing_if = "Option::is_none")]
437 pub tolerance: Option<f64>,
438}
439
440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
442#[serde(rename_all = "snake_case")]
443#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
444#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
445#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
446#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
447pub struct AnnotationBasicDimension {
448 #[serde(default, skip_serializing_if = "Option::is_none")]
450 pub from_entity_id: Option<Uuid>,
451
452 #[serde(default, skip_serializing_if = "Option::is_none")]
455 pub from_edge_reference: Option<EdgeSpecifier>,
456
457 pub from_entity_pos: Point2d<f64>,
459
460 #[serde(default, skip_serializing_if = "Option::is_none")]
462 pub to_entity_id: Option<Uuid>,
463
464 #[serde(default, skip_serializing_if = "Option::is_none")]
467 pub to_edge_reference: Option<EdgeSpecifier>,
468
469 pub to_entity_pos: Point2d<f64>,
471
472 pub dimension: AnnotationMbdBasicDimension,
474
475 pub plane_id: Uuid,
477
478 pub offset: Point2d<f64>,
480
481 pub precision: u32,
483
484 pub font_scale: f32,
486
487 pub font_point_size: u32,
489
490 #[serde(default = "one")]
492 pub arrow_scale: f32,
493}
494
495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
497#[serde(rename_all = "snake_case")]
498#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
499#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
500#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
501#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
502pub struct AnnotationFeatureControl {
503 #[serde(default, skip_serializing_if = "Option::is_none")]
505 pub entity_id: Option<Uuid>,
506
507 #[serde(default, skip_serializing_if = "Option::is_none")]
510 pub edge_reference: Option<EdgeSpecifier>,
511
512 pub entity_pos: Point2d<f64>,
514
515 pub leader_type: AnnotationLineEnd,
517
518 pub dimension: Option<AnnotationMbdBasicDimension>,
520
521 pub control_frame: Option<AnnotationMbdControlFrame>,
523
524 pub defined_datum: Option<char>,
526
527 pub prefix: Option<String>,
529
530 pub suffix: Option<String>,
532
533 pub plane_id: Uuid,
535
536 pub offset: Point2d<f64>,
538
539 pub precision: u32,
541
542 pub font_scale: f32,
544
545 pub font_point_size: u32,
547
548 #[serde(default = "one")]
550 pub leader_scale: f32,
551}
552
553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
555#[serde(rename_all = "snake_case")]
556#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
557#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
558#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
559#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
560pub struct AnnotationFeatureTag {
561 #[serde(default, skip_serializing_if = "Option::is_none")]
563 pub entity_id: Option<Uuid>,
564
565 #[serde(default, skip_serializing_if = "Option::is_none")]
568 pub edge_reference: Option<EdgeSpecifier>,
569
570 pub entity_pos: Point2d<f64>,
572
573 pub leader_type: AnnotationLineEnd,
575
576 pub key: String,
578
579 pub value: String,
581
582 pub show_key: bool,
584
585 pub plane_id: Uuid,
587
588 pub offset: Point2d<f64>,
590
591 pub font_scale: f32,
593
594 pub font_point_size: u32,
596
597 #[serde(default = "one")]
599 pub leader_scale: f32,
600}
601
602#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
606#[serde(rename_all = "snake_case", tag = "type")]
607#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
608#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
609#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
610#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
611pub enum DistanceType {
612 Euclidean {},
614 OnAxis {
616 axis: GlobalAxis,
618 },
619}
620
621#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
623#[serde(rename_all = "snake_case", tag = "type")]
624#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
625#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
626#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
627#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
628pub enum OriginType {
629 #[default]
631 Local,
632 Global,
634 Custom {
636 origin: Point3d<f64>,
638 },
639}
640
641#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
643#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
644#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
645#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
646#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
647pub struct Color {
648 pub r: f32,
650 pub g: f32,
652 pub b: f32,
654 pub a: f32,
656}
657
658impl Color {
659 pub fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self {
661 Self { r, g, b, a }
662 }
663}
664
665#[allow(missing_docs)]
667#[derive(
668 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
669)]
670#[serde(rename_all = "lowercase")]
671#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
672#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
673#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
674#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
675pub enum AnnotationTextAlignmentX {
676 Left,
677 Center,
678 Right,
679}
680
681#[allow(missing_docs)]
683#[derive(
684 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
685)]
686#[serde(rename_all = "lowercase")]
687#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
688#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
689#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
690#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
691pub enum AnnotationTextAlignmentY {
692 Bottom,
693 Center,
694 Top,
695}
696
697#[allow(missing_docs)]
699#[derive(
700 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
701)]
702#[serde(rename_all = "lowercase")]
703#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
704#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
705#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
706#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
707pub enum AnnotationLineEnd {
708 None,
709 Arrow,
710 Dot,
711}
712
713#[derive(
715 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
716)]
717#[serde(rename_all = "lowercase")]
718#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
719#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
720#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
721#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
722pub enum AnnotationType {
723 T2D,
725 T3D,
727}
728
729#[derive(
731 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
732)]
733#[serde(rename_all = "lowercase")]
734#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
735#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
736#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
737#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
738pub enum MbdStandard {
739 AsmeY14_5,
741}
742
743#[allow(missing_docs)]
746#[derive(
747 Default,
748 Display,
749 FromStr,
750 Copy,
751 Eq,
752 PartialEq,
753 Debug,
754 JsonSchema,
755 Deserialize,
756 Serialize,
757 Sequence,
758 Clone,
759 Ord,
760 PartialOrd,
761)]
762#[serde(rename_all = "lowercase")]
763#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
764#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
765#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
766#[repr(u16)]
767#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
768pub enum MbdSymbol {
769 #[default]
770 None = 0,
771 ArcLength = 174,
772 Between = 175,
773 Degrees = 176,
774 PlusMinus = 177,
775 Angularity = 178,
776 Cylindricity = 179,
777 Roundness = 180,
778 Concentricity = 181,
779 Straightness = 182,
780 Parallelism = 183,
781 Flatness = 184,
782 ProfileOfLine = 185,
783 SurfaceProfile = 186,
784 Symmetry = 187,
785 Perpendicularity = 188,
786 Runout = 189,
787 TotalRunout = 190,
788 Position = 191,
789 CenterLine = 192,
790 PartingLine = 193,
791 IsoEnvelope = 195,
792 IsoEnvelopeNonY145M = 196,
793 FreeState = 197,
794 StatisticalTolerance = 198,
795 ContinuousFeature = 199,
796 Independency = 200,
797 Depth = 201,
798 Start = 202,
799 LeastCondition = 203,
800 MaxCondition = 204,
801 ConicalTaper = 205,
802 Projected = 206,
803 Slope = 207,
804 Micro = 208,
805 TangentPlane = 210,
806 Unilateral = 211,
807 SquareFeature = 212,
808 Countersink = 213,
809 SpotFace = 214,
810 Target = 215,
811 Diameter = 216,
812 Radius = 217,
813 SphericalRadius = 218,
814 SphericalDiameter = 219,
815 ControlledRadius = 220,
816 BoxStart = 123,
817 BoxBar = 162,
818 BoxBarBetween = 124,
819 LetterBackwardUnderline = 95,
820 PunctuationBackwardUnderline = 92,
821 ModifierBackwardUnderline = 126,
822 NumericBackwardUnderline = 96,
823 BoxEnd = 125,
824 DatumUp = 166,
825 DatumLeft = 168,
826 DatumRight = 167,
827 DatumDown = 165,
828 DatumTriangle = 295,
829 HalfSpace = 236,
830 QuarterSpace = 237,
831 EighthSpace = 238,
832 ModifierSpace = 239,
833}
834
835#[derive(
837 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
838)]
839#[serde(rename_all = "lowercase")]
840#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
841#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
842#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
843#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
844pub enum CameraDragInteractionType {
845 Pan,
847 Rotate,
849 RotateTrackball,
851 Zoom,
853}
854
855#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq)]
858#[serde(rename_all = "snake_case", tag = "type")]
859#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
860#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
861#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
862#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
863pub enum PathSegment {
864 Line {
867 end: Point3d<LengthUnit>,
869 relative: bool,
871 },
872 Arc {
875 center: Point2d<LengthUnit>,
877 radius: LengthUnit,
879 start: Angle,
881 end: Angle,
883 relative: bool,
885 },
886 Bezier {
890 control1: Point3d<LengthUnit>,
892 control2: Point3d<LengthUnit>,
894 end: Point3d<LengthUnit>,
896 relative: bool,
898 },
899 TangentialArc {
901 radius: LengthUnit,
904 offset: Angle,
906 },
907 TangentialArcTo {
910 to: Point3d<LengthUnit>,
914 angle_snap_increment: Option<Angle>,
916 },
917 ArcTo {
919 interior: Point3d<LengthUnit>,
921 end: Point3d<LengthUnit>,
923 relative: bool,
925 },
926 CircularInvolute {
929 start_radius: LengthUnit,
932 end_radius: LengthUnit,
935 angle: Angle,
938 reverse: bool,
941 },
942 Ellipse {
944 center: Point2d<LengthUnit>,
946 major_axis: Point2d<LengthUnit>,
948 minor_radius: LengthUnit,
950 start_angle: Angle,
952 end_angle: Angle,
954 },
955 ConicTo {
958 interior: Point2d<LengthUnit>,
960 end: Point2d<LengthUnit>,
962 start_tangent: Point2d<LengthUnit>,
964 end_tangent: Point2d<LengthUnit>,
966 relative: bool,
968 },
969}
970
971#[derive(Clone, Copy, PartialEq, Debug, JsonSchema, Deserialize, Serialize)]
973#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
974#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
975#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
976#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
977pub struct Angle {
978 pub unit: UnitAngle,
980 pub value: f64,
982}
983
984impl Angle {
985 pub fn to_degrees(self) -> f64 {
987 match self.unit {
988 UnitAngle::Degrees => self.value,
989 UnitAngle::Radians => self.value.to_degrees(),
990 }
991 }
992 pub fn to_radians(self) -> f64 {
994 match self.unit {
995 UnitAngle::Degrees => self.value.to_radians(),
996 UnitAngle::Radians => self.value,
997 }
998 }
999 pub const fn from_degrees(value: f64) -> Self {
1001 Self {
1002 unit: UnitAngle::Degrees,
1003 value,
1004 }
1005 }
1006 pub const fn from_radians(value: f64) -> Self {
1008 Self {
1009 unit: UnitAngle::Radians,
1010 value,
1011 }
1012 }
1013 pub const fn turn() -> Self {
1015 Self::from_degrees(360.0)
1016 }
1017 pub const fn half_circle() -> Self {
1019 Self::from_degrees(180.0)
1020 }
1021 pub const fn quarter_circle() -> Self {
1023 Self::from_degrees(90.0)
1024 }
1025 pub const fn zero() -> Self {
1027 Self::from_degrees(0.0)
1028 }
1029}
1030
1031impl Default for Angle {
1033 fn default() -> Self {
1035 Self::zero()
1036 }
1037}
1038
1039impl PartialOrd for Angle {
1040 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
1041 match (self.unit, other.unit) {
1042 (UnitAngle::Degrees, UnitAngle::Degrees) => self.value.partial_cmp(&other.value),
1044 (UnitAngle::Radians, UnitAngle::Radians) => self.value.partial_cmp(&other.value),
1045 _ => self.to_degrees().partial_cmp(&other.to_degrees()),
1046 }
1047 }
1048}
1049
1050impl std::ops::Add for Angle {
1051 type Output = Self;
1052
1053 fn add(self, rhs: Self) -> Self::Output {
1054 Self {
1055 unit: UnitAngle::Degrees,
1056 value: self.to_degrees() + rhs.to_degrees(),
1057 }
1058 }
1059}
1060
1061impl std::ops::AddAssign for Angle {
1062 fn add_assign(&mut self, rhs: Self) {
1063 match self.unit {
1064 UnitAngle::Degrees => {
1065 self.value += rhs.to_degrees();
1066 }
1067 UnitAngle::Radians => {
1068 self.value += rhs.to_radians();
1069 }
1070 }
1071 }
1072}
1073
1074#[derive(
1076 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1077)]
1078#[serde(rename_all = "lowercase")]
1079#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1080#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1081#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1082#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1083pub enum SceneSelectionType {
1084 Replace,
1086 Add,
1088 Remove,
1090}
1091
1092#[allow(missing_docs)]
1094#[derive(
1095 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1096)]
1097#[serde(rename_all = "snake_case")]
1098#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1099#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1100#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1101#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1102pub enum SceneToolType {
1103 CameraRevolve,
1104 Select,
1105 Move,
1106 SketchLine,
1107 SketchTangentialArc,
1108 SketchCurve,
1109 SketchCurveMod,
1110}
1111
1112#[allow(missing_docs)]
1114#[derive(
1115 Display,
1116 FromStr,
1117 Copy,
1118 Eq,
1119 PartialEq,
1120 Debug,
1121 JsonSchema,
1122 Deserialize,
1123 Serialize,
1124 Sequence,
1125 Clone,
1126 Ord,
1127 PartialOrd,
1128 Default,
1129)]
1130#[serde(rename_all = "snake_case")]
1131#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1132#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1133#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1134#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1135pub enum PathComponentConstraintBound {
1136 #[default]
1137 Unconstrained,
1138 PartiallyConstrained,
1139 FullyConstrained,
1140}
1141
1142#[allow(missing_docs)]
1144#[derive(
1145 Display,
1146 FromStr,
1147 Copy,
1148 Eq,
1149 PartialEq,
1150 Debug,
1151 JsonSchema,
1152 Deserialize,
1153 Serialize,
1154 Sequence,
1155 Clone,
1156 Ord,
1157 PartialOrd,
1158 Default,
1159)]
1160#[serde(rename_all = "snake_case")]
1161#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1162#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1163#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1164#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1165pub enum PathComponentConstraintType {
1166 #[default]
1167 Unconstrained,
1168 Vertical,
1169 Horizontal,
1170 EqualLength,
1171 Parallel,
1172 AngleBetween,
1173}
1174
1175#[allow(missing_docs)]
1177#[derive(
1178 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1179)]
1180#[serde(rename_all = "snake_case")]
1181#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1182#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1183#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1184#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1185pub enum PathCommand {
1186 MoveTo,
1187 LineTo,
1188 BezCurveTo,
1189 NurbsCurveTo,
1190 AddArc,
1191}
1192
1193#[allow(missing_docs)]
1195#[derive(
1196 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1197)]
1198#[serde(rename_all = "lowercase")]
1199#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1200#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1201#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1202#[repr(u8)]
1203#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1204pub enum EntityType {
1205 Entity,
1206 Object,
1207 Path,
1208 Segment,
1209 Curve,
1210 Solid2D,
1211 Solid3D,
1212 Edge,
1213 Face,
1214 Plane,
1215 Vertex,
1216 Region,
1217}
1218
1219#[allow(missing_docs)]
1221#[derive(
1222 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1223)]
1224#[serde(rename_all = "snake_case")]
1225#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1226#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1227#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1228#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1229pub enum CurveType {
1230 Line,
1231 Arc,
1232 Nurbs,
1233}
1234
1235#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone, PartialEq, Builder)]
1237#[cfg_attr(
1238 feature = "python",
1239 pyo3::pyclass(from_py_object),
1240 pyo3_stub_gen::derive::gen_stub_pyclass
1241)]
1242#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1243pub struct ExportFile {
1244 pub name: String,
1246 pub contents: crate::base64::Base64Data,
1248}
1249
1250#[cfg(feature = "python")]
1251#[pyo3_stub_gen::derive::gen_stub_pymethods]
1252#[pyo3::pymethods]
1253impl ExportFile {
1254 #[getter]
1255 fn contents(&self) -> Vec<u8> {
1256 self.contents.0.clone()
1257 }
1258
1259 #[getter]
1260 fn name(&self) -> String {
1261 self.name.clone()
1262 }
1263}
1264
1265#[derive(
1267 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd, Sequence,
1268)]
1269#[serde(rename_all = "lowercase")]
1270#[display(style = "lowercase")]
1271#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1272#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1273#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1274#[cfg_attr(
1275 feature = "python",
1276 pyo3::pyclass(from_py_object),
1277 pyo3_stub_gen::derive::gen_stub_pyclass_enum
1278)]
1279#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1280pub enum FileExportFormat {
1281 Fbx,
1283 Glb,
1290 Gltf,
1301 Obj,
1305 Ply,
1307 Step,
1309 Stl,
1311}
1312
1313#[derive(
1315 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd, Sequence,
1316)]
1317#[serde(rename_all = "lowercase")]
1318#[display(style = "lowercase")]
1319#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1320#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1321#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1322#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1323pub enum FileExportFormat2d {
1324 Dxf,
1326}
1327
1328#[derive(
1330 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd, Sequence,
1331)]
1332#[serde(rename_all = "lowercase")]
1333#[display(style = "lowercase")]
1334#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1335#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1336#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1337#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1338pub enum FileImportFormat {
1339 Acis,
1341 Catia,
1343 Creo,
1345 Fbx,
1347 Gltf,
1349 Inventor,
1351 Nx,
1353 Obj,
1357 Parasolid,
1359 Ply,
1361 Sldprt,
1363 Step,
1365 Stl,
1367}
1368
1369#[derive(Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd)]
1371#[serde(rename_all = "snake_case")]
1372#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1373#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1374#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1375#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1376pub enum EngineErrorCode {
1377 BadRequest = 1,
1381 InternalEngine,
1383}
1384
1385impl From<EngineErrorCode> for http::StatusCode {
1386 fn from(e: EngineErrorCode) -> Self {
1387 match e {
1388 EngineErrorCode::BadRequest => Self::BAD_REQUEST,
1389 EngineErrorCode::InternalEngine => Self::INTERNAL_SERVER_ERROR,
1390 }
1391 }
1392}
1393
1394#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1396#[serde(rename_all = "snake_case")]
1397#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1398#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1399#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1400pub enum BlendType {
1401 #[default]
1403 Tangent,
1404}
1405
1406#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1408#[serde(rename_all = "snake_case")]
1409#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1410#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1411#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1412#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1413pub enum BodyType {
1414 #[default]
1416 Solid,
1417 Surface,
1419}
1420
1421#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1424#[serde(rename_all = "snake_case")]
1425#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1426#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1427#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1428#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1429pub enum ExtrudeMethod {
1430 New,
1433 #[default]
1436 Merge,
1437}
1438
1439#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
1441#[serde(rename_all = "snake_case")]
1442#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1443#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1444#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1445#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1446pub enum ExtrudeReference {
1447 EntityReference {
1450 #[serde(default, skip_serializing_if = "Option::is_none")]
1452 entity_id: Option<Uuid>,
1453 #[serde(default, skip_serializing_if = "Option::is_none")]
1455 entity_reference: Option<EntityReference>,
1456 },
1457 Axis {
1459 axis: Point3d<f64>,
1461 #[serde(default)]
1464 point: Point3d<LengthUnit>,
1465 },
1466 Point {
1468 point: Point3d<LengthUnit>,
1470 },
1471}
1472
1473#[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone, Builder)]
1475#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1476#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1477#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1478#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1479pub struct ExtrudedFaceInfo {
1480 pub bottom: Option<Uuid>,
1485 pub top: Uuid,
1487 pub sides: Vec<SideFace>,
1489}
1490
1491#[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone, Builder)]
1493#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1494#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1495#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1496#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1497pub struct SideFace {
1498 pub path_id: Uuid,
1500 pub face_id: Uuid,
1502}
1503
1504#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone, PartialEq, Builder)]
1506#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1507#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1508#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1509#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1510pub struct CameraSettings {
1511 pub pos: Point3d,
1513
1514 pub center: Point3d,
1516
1517 pub up: Point3d,
1519
1520 pub orientation: Quaternion,
1522
1523 pub fov_y: Option<f32>,
1525
1526 pub ortho_scale: Option<f32>,
1528
1529 pub ortho: bool,
1531}
1532
1533#[allow(missing_docs)]
1534#[repr(u8)]
1535#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1536#[serde(rename_all = "snake_case")]
1537#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1538#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1539#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1540#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1541pub enum WorldCoordinateSystem {
1542 #[default]
1543 RightHandedUpZ,
1544 RightHandedUpY,
1545}
1546
1547#[allow(missing_docs)]
1548#[repr(C)]
1549#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
1550#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1551#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1552#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1553#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1554pub struct CameraViewState {
1555 pub pivot_rotation: Quaternion,
1556 pub pivot_position: Point3d,
1557 pub eye_offset: f32,
1558 pub fov_y: f32,
1559 pub ortho_scale_factor: f32,
1560 pub is_ortho: bool,
1561 pub ortho_scale_enabled: bool,
1562 pub world_coord_system: WorldCoordinateSystem,
1563}
1564
1565impl Default for CameraViewState {
1566 fn default() -> Self {
1567 CameraViewState {
1568 pivot_rotation: Default::default(),
1569 pivot_position: Default::default(),
1570 eye_offset: 10.0,
1571 fov_y: 45.0,
1572 ortho_scale_factor: 1.6,
1573 is_ortho: false,
1574 ortho_scale_enabled: true,
1575 world_coord_system: Default::default(),
1576 }
1577 }
1578}
1579
1580#[cfg(feature = "cxx")]
1581impl_extern_type! {
1582 [Trivial]
1583 CameraViewState = "Endpoints::CameraViewState"
1584}
1585
1586impl From<CameraSettings> for crate::output::DefaultCameraZoom {
1587 fn from(settings: CameraSettings) -> Self {
1588 Self { settings }
1589 }
1590}
1591impl From<CameraSettings> for crate::output::CameraDragMove {
1592 fn from(settings: CameraSettings) -> Self {
1593 Self { settings }
1594 }
1595}
1596impl From<CameraSettings> for crate::output::CameraDragEnd {
1597 fn from(settings: CameraSettings) -> Self {
1598 Self { settings }
1599 }
1600}
1601impl From<CameraSettings> for crate::output::DefaultCameraGetSettings {
1602 fn from(settings: CameraSettings) -> Self {
1603 Self { settings }
1604 }
1605}
1606impl From<CameraSettings> for crate::output::ZoomToFit {
1607 fn from(settings: CameraSettings) -> Self {
1608 Self { settings }
1609 }
1610}
1611impl From<CameraSettings> for crate::output::OrientToFace {
1612 fn from(settings: CameraSettings) -> Self {
1613 Self { settings }
1614 }
1615}
1616impl From<CameraSettings> for crate::output::ViewIsometric {
1617 fn from(settings: CameraSettings) -> Self {
1618 Self { settings }
1619 }
1620}
1621
1622#[derive(Copy, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, PartialOrd, Default, Builder)]
1624#[serde(rename_all = "snake_case")]
1625#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1626#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1627#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1628#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1629pub struct PerspectiveCameraParameters {
1630 pub fov_y: Option<f32>,
1632 pub z_near: Option<f32>,
1634 pub z_far: Option<f32>,
1636}
1637
1638#[derive(
1640 Default,
1641 Display,
1642 FromStr,
1643 Copy,
1644 Eq,
1645 PartialEq,
1646 Debug,
1647 JsonSchema,
1648 Deserialize,
1649 Serialize,
1650 Sequence,
1651 Clone,
1652 Ord,
1653 PartialOrd,
1654)]
1655#[serde(rename_all = "snake_case")]
1656#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1657#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1658#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1659#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1660pub enum CameraMovement {
1661 #[default]
1663 Vantage,
1664 None,
1666}
1667
1668#[derive(
1670 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1671)]
1672#[serde(rename_all = "lowercase")]
1673#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1674#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1675#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1676#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1677pub enum GlobalAxis {
1678 X,
1680 Y,
1682 Z,
1684}
1685
1686#[derive(
1688 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1689)]
1690#[serde(rename_all = "snake_case")]
1691#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1692#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1693#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1694#[repr(u8)]
1695#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1696pub enum ExtrusionFaceCapType {
1697 None,
1699 Top,
1701 Bottom,
1703 Both,
1705}
1706
1707#[allow(missing_docs)]
1709#[derive(
1710 Display,
1711 FromStr,
1712 Copy,
1713 Eq,
1714 PartialEq,
1715 Debug,
1716 JsonSchema,
1717 Deserialize,
1718 Serialize,
1719 Sequence,
1720 Clone,
1721 Ord,
1722 PartialOrd,
1723 Default,
1724)]
1725#[serde(rename_all = "lowercase")]
1726#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1727#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1728#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1729#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1730pub enum PostEffectType {
1731 Phosphor,
1732 Ssao,
1733 #[default]
1734 NoEffect,
1735}
1736
1737#[cfg(feature = "cxx")]
1740impl_extern_type! {
1741 [Trivial]
1742 FileImportFormat = "Enums::_FileImportFormat"
1744 FileExportFormat = "Enums::_FileExportFormat"
1745 CameraDragInteractionType = "Enums::_CameraDragInteractionType"
1747 SceneSelectionType = "Enums::_SceneSelectionType"
1749 SceneToolType = "Enums::_SceneToolType"
1750 BlendType = "Enums::_BlendType"
1751 BodyType = "Enums::_BodyType"
1752 EntityType = "Enums::_EntityType"
1753 AnnotationType = "Enums::_AnnotationType"
1754 AnnotationTextAlignmentX = "Enums::_AnnotationTextAlignmentX"
1755 AnnotationTextAlignmentY = "Enums::_AnnotationTextAlignmentY"
1756 AnnotationLineEnd = "Enums::_AnnotationLineEnd"
1757 MbdStandard = "Enums::_MBDStandard"
1758 MbdSymbol = "Enums::_MBDSymbol"
1759
1760 CurveType = "Enums::_CurveType"
1761 PathCommand = "Enums::_PathCommand"
1762 PathComponentConstraintBound = "Enums::_PathComponentConstraintBound"
1763 PathComponentConstraintType = "Enums::_PathComponentConstraintType"
1764 ExtrusionFaceCapType = "Enums::_ExtrusionFaceCapType"
1765
1766 EngineErrorCode = "Enums::_ErrorCode"
1768 GlobalAxis = "Enums::_GlobalAxis"
1769 OriginType = "Enums::_OriginType"
1770
1771 PostEffectType = "Enums::_PostEffectType"
1773}
1774
1775fn bool_true() -> bool {
1776 true
1777}
1778fn same_scale() -> Point3d<f64> {
1779 Point3d::uniform(1.0)
1780}
1781
1782fn z_axis() -> Point3d<f64> {
1783 Point3d { x: 0.0, y: 0.0, z: 1.0 }
1784}
1785
1786impl ExtrudedFaceInfo {
1787 pub fn list_faces(self) -> Vec<ExtrusionFaceInfo> {
1790 let mut face_infos: Vec<_> = self
1791 .sides
1792 .into_iter()
1793 .map(|side| ExtrusionFaceInfo {
1794 curve_id: Some(side.path_id),
1795 face_id: Some(side.face_id),
1796 cap: ExtrusionFaceCapType::None,
1797 })
1798 .collect();
1799 face_infos.push(ExtrusionFaceInfo {
1800 curve_id: None,
1801 face_id: Some(self.top),
1802 cap: ExtrusionFaceCapType::Top,
1803 });
1804 if let Some(bottom) = self.bottom {
1805 face_infos.push(ExtrusionFaceInfo {
1806 curve_id: None,
1807 face_id: Some(bottom),
1808 cap: ExtrusionFaceCapType::Bottom,
1809 });
1810 }
1811 face_infos
1812 }
1813}
1814
1815#[cfg(test)]
1816mod tests {
1817 use super::*;
1818
1819 #[test]
1820 fn test_angle_comparison() {
1821 let a = Angle::from_degrees(90.0);
1822 assert!(a < Angle::from_degrees(91.0));
1823 assert!(a > Angle::from_degrees(89.0));
1824 assert!(a <= Angle::from_degrees(90.0));
1825 assert!(a >= Angle::from_degrees(90.0));
1826 let b = Angle::from_radians(std::f64::consts::FRAC_PI_4);
1827 assert!(b < Angle::from_radians(std::f64::consts::FRAC_PI_2));
1828 assert!(b > Angle::from_radians(std::f64::consts::FRAC_PI_8));
1829 assert!(b <= Angle::from_radians(std::f64::consts::FRAC_PI_4));
1830 assert!(b >= Angle::from_radians(std::f64::consts::FRAC_PI_4));
1831 assert!(a > b);
1833 assert!(a >= b);
1834 assert!(b < a);
1835 assert!(b <= a);
1836 let c = Angle::from_radians(std::f64::consts::FRAC_PI_2 * 3.0);
1837 assert!(a < c);
1838 assert!(a <= c);
1839 assert!(c > a);
1840 assert!(c >= a);
1841 }
1842}
1843
1844#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, JsonSchema, Builder)]
1846#[schemars(rename = "TransformByFor{T}")]
1847#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1848#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1849#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1850#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1851pub struct TransformBy<T> {
1852 pub property: T,
1854 pub set: bool,
1859 #[serde(default)]
1861 #[builder(default)]
1862 pub origin: OriginType,
1863}
1864
1865impl<T> TransformBy<T> {
1866 pub fn get_origin(&self) -> OriginType {
1869 self.origin
1870 }
1871}
1872
1873#[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, Default, Builder)]
1876#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1877#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1878#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1879#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1880pub struct ComponentTransform {
1881 pub translate: Option<TransformBy<Point3d<LengthUnit>>>,
1883 pub rotate_rpy: Option<TransformBy<Point3d<f64>>>,
1886 pub rotate_angle_axis: Option<TransformBy<Point4d<f64>>>,
1890 pub scale: Option<TransformBy<Point3d<f64>>>,
1892}
1893
1894#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
1897#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1898#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1899#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1900#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1901pub enum Opposite<T> {
1902 #[default]
1904 None,
1905 Symmetric,
1907 Other(T),
1909}
1910
1911impl<T: JsonSchema> JsonSchema for Opposite<T> {
1912 fn schema_name() -> String {
1913 format!("OppositeFor{}", T::schema_name())
1914 }
1915
1916 fn schema_id() -> std::borrow::Cow<'static, str> {
1917 std::borrow::Cow::Owned(format!("{}::Opposite<{}>", module_path!(), T::schema_id()))
1918 }
1919
1920 fn json_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
1921 SchemaObject {
1922 instance_type: Some(schemars::schema::InstanceType::String.into()),
1923 ..Default::default()
1924 }
1925 .into()
1926 }
1927}
1928
1929#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
1932#[serde(rename_all = "snake_case")]
1933#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1934#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1935#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1936#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1937pub enum CutStrategy {
1938 Basic,
1941 Csg,
1944 #[default]
1946 Automatic,
1947}
1948
1949#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
1951#[serde(rename_all = "snake_case")]
1952#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1953#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1954#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1955#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1956pub enum RelativeTo {
1957 #[default]
1959 SketchPlane,
1960 TrajectoryCurve,
1962}
1963
1964#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
1966#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1967#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1968#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1969pub struct SelectedRegion {
1970 pub segment: Uuid,
1972 pub intersection_segment: Uuid,
1975 #[serde(default = "negative_one")]
1979 pub intersection_index: i32,
1980 #[serde(default)]
1983 pub curve_clockwise: bool,
1984}
1985
1986impl Default for SelectedRegion {
1987 fn default() -> Self {
1988 Self {
1989 segment: Default::default(),
1990 intersection_segment: Default::default(),
1991 intersection_index: -1,
1992 curve_clockwise: Default::default(),
1993 }
1994 }
1995}
1996
1997#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1999#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2000#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2001#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2002#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2003pub struct FractionOfEdge {
2004 #[serde(default, skip_serializing_if = "Option::is_none")]
2006 pub edge_id: Option<Uuid>,
2007 #[serde(default, skip_serializing_if = "Option::is_none")]
2009 pub edge_specifier: Option<EdgeSpecifier>,
2010 #[serde(default)]
2014 #[builder(default)]
2015 #[schemars(range(min = 0, max = 1))]
2016 pub lower_bound: f32,
2017 #[serde(default = "one")]
2021 #[builder(default = one())]
2022 #[schemars(range(min = 0, max = 1))]
2023 pub upper_bound: f32,
2024}
2025
2026#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2028#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2029#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2030#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2031#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2032pub struct SurfaceEdgeReference {
2033 pub object_id: Uuid,
2035 pub edges: Vec<FractionOfEdge>,
2037}
2038
2039#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
2041#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2042#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2043#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2044#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2045pub struct BodiesCreated {
2046 pub bodies: Vec<BodyCreated>,
2048}
2049
2050impl BodiesCreated {
2051 pub fn is_empty(&self) -> bool {
2053 self.bodies.is_empty()
2054 }
2055}
2056
2057#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
2059#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2060#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2061#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2062#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2063pub struct BodiesUpdated {
2064 pub bodies: Vec<BodyUpdated>,
2066}
2067
2068impl BodiesUpdated {
2069 pub fn is_empty(&self) -> bool {
2071 self.bodies.is_empty()
2072 }
2073}
2074
2075#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2077#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2078#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2079#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2080#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2081pub struct BodyCreated {
2082 pub id: Uuid,
2084 pub surfaces: Vec<SurfaceCreated>,
2086}
2087
2088#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2090#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2091#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2092#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2093#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2094pub struct BodyUpdated {
2095 pub id: Uuid,
2097 pub surfaces: Vec<SurfaceCreated>,
2099}
2100
2101#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2103#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2104#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2105#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2106#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2107pub struct SurfaceCreated {
2108 pub id: Uuid,
2110 pub primitive_face_index: u32,
2112 pub from_segments: Vec<Uuid>,
2114}
2115
2116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
2118#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2119#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2120#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2121#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2122pub enum RegionVersion {
2123 #[default]
2126 V0,
2127 V1,
2130}
2131
2132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Copy)]
2134#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2135#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2136#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2137#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2138#[serde(rename_all = "snake_case")]
2139pub enum EdgeCutVersion {
2140 V0,
2142 V1,
2146 V2,
2150}
2151
2152const DEFAULT_EDGE_CUT_VERSION: EdgeCutVersion = EdgeCutVersion::V1;
2153
2154impl EdgeCutVersion {
2155 pub fn is_default(&self) -> bool {
2157 self == &DEFAULT_EDGE_CUT_VERSION
2158 }
2159}
2160
2161impl Default for EdgeCutVersion {
2162 fn default() -> Self {
2163 DEFAULT_EDGE_CUT_VERSION
2164 }
2165}
2166
2167impl TryFrom<u32> for EdgeCutVersion {
2169 type Error = ();
2170
2171 fn try_from(version: u32) -> Result<Self, Self::Error> {
2172 match version {
2173 0 => Ok(Self::V0),
2174 1 => Ok(Self::V1),
2175 2 => Ok(Self::V2),
2176 _ => Err(()),
2177 }
2178 }
2179}
2180
2181impl RegionVersion {
2182 pub fn is_zero(&self) -> bool {
2184 matches!(self, Self::V0)
2185 }
2186}
2187
2188impl From<BodyCreated> for BodyUpdated {
2189 fn from(body: BodyCreated) -> Self {
2190 Self {
2191 id: body.id,
2192 surfaces: body.surfaces,
2193 }
2194 }
2195}
2196
2197impl From<BodyUpdated> for BodyCreated {
2198 fn from(body: BodyUpdated) -> Self {
2199 Self {
2200 id: body.id,
2201 surfaces: body.surfaces,
2202 }
2203 }
2204}
2205
2206impl From<BodiesCreated> for BodiesUpdated {
2207 fn from(bodies: BodiesCreated) -> Self {
2208 Self {
2209 bodies: bodies.bodies.into_iter().map(Into::into).collect(),
2210 }
2211 }
2212}
2213
2214impl From<BodiesUpdated> for BodiesCreated {
2215 fn from(bodies: BodiesUpdated) -> Self {
2216 Self {
2217 bodies: bodies.bodies.into_iter().map(Into::into).collect(),
2218 }
2219 }
2220}
2221
2222fn one() -> f32 {
2223 1.0
2224}
2225
2226#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema, Builder)]
2228pub struct CurveDebug {
2229 pub start: Option<Point2d<f64>>,
2231 pub end: Option<Point2d<f64>>,
2233 pub center: Option<Point2d<f64>>,
2235 pub mid: Option<Point2d<f64>>,
2237 pub segment_type: CurveTypeDebug,
2239 pub id: ModelingCmdId,
2241}
2242
2243#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, JsonSchema)]
2245#[serde(rename_all = "snake_case")]
2246pub enum CurveTypeDebug {
2247 Line,
2249 ThreePointArc,
2251 Circle,
2253}