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::{def_enum::negative_one, length_unit::LengthUnit, output::ExtrusionFaceInfo, units, units::UnitAngle};
12
13mod point;
14
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
17#[serde(rename_all = "snake_case")]
18#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
19#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
20#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
21#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
22pub struct EdgeSpecifier {
23 pub side_faces: Vec<Uuid>,
25 #[serde(default, skip_serializing_if = "Vec::is_empty")]
27 #[builder(default)]
28 pub end_faces: Vec<Uuid>,
29 #[serde(skip_serializing_if = "Option::is_none")]
33 pub index: Option<u32>,
34}
35
36#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
52#[serde(rename_all = "snake_case")]
53#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
54#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
55#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
56#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
57pub struct PrimitiveTopologyFallback {
58 pub parent_id: Uuid,
60 pub primitive_index: u32,
62}
63
64#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
66#[serde(tag = "type", rename_all = "snake_case")]
67#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
68#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
69#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
70pub enum EntityReference {
71 Plane {
73 plane_id: Uuid,
75 #[serde(default, skip_serializing_if = "Option::is_none")]
77 topology_fallback: Option<PrimitiveTopologyFallback>,
78 },
79 Face {
81 face_id: Uuid,
83 #[serde(default, skip_serializing_if = "Option::is_none")]
85 topology_fallback: Option<PrimitiveTopologyFallback>,
86 },
87 Edge {
89 #[serde(flatten)]
91 inner: EdgeSpecifier,
92 #[serde(default, skip_serializing_if = "Option::is_none")]
94 topology_fallback: Option<PrimitiveTopologyFallback>,
95 },
96 Vertex {
98 side_faces: Vec<Uuid>,
100 #[serde(skip_serializing_if = "Option::is_none")]
102 index: Option<u32>,
103 #[serde(default, skip_serializing_if = "Option::is_none")]
105 topology_fallback: Option<PrimitiveTopologyFallback>,
106 },
107 Solid2d {
109 solid2d_id: Uuid,
111 #[serde(default, skip_serializing_if = "Option::is_none")]
113 topology_fallback: Option<PrimitiveTopologyFallback>,
114 },
115 Solid3d {
117 solid3d_id: Uuid,
119 #[serde(default, skip_serializing_if = "Option::is_none")]
121 topology_fallback: Option<PrimitiveTopologyFallback>,
122 },
123 Solid2dEdge {
126 edge_id: Uuid,
128 #[serde(default, skip_serializing_if = "Option::is_none")]
130 topology_fallback: Option<PrimitiveTopologyFallback>,
131 },
132 Segment {
134 path_id: Uuid,
136 segment_id: Uuid,
138 #[serde(default, skip_serializing_if = "Option::is_none")]
140 topology_fallback: Option<PrimitiveTopologyFallback>,
141 },
142 Region {
144 region_id: Uuid,
146 #[serde(default, skip_serializing_if = "Option::is_none")]
148 topology_fallback: Option<PrimitiveTopologyFallback>,
149 },
150}
151
152#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
154#[serde(rename_all = "snake_case")]
155#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
156#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
157#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
158pub enum CutType {
159 #[default]
161 Fillet,
162 Chamfer,
164}
165
166#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
168#[serde(rename_all = "snake_case")]
169#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
170#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
171#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
172pub enum DirectionType {
173 Edge {
175 id: Uuid,
177 },
178 Axis {
180 direction: Point3d<f64>,
182 },
183}
184
185#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
187#[serde(rename_all = "snake_case")]
188#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
189#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
190#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
191pub enum MirrorAcross {
192 Edge {
195 id: Uuid,
197 },
198 Axis {
201 axis: Point3d<f64>,
203 point: Point3d<LengthUnit>,
205 },
206 Plane {
209 id: Uuid,
211 },
212}
213
214#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
216#[serde(rename_all = "snake_case")]
217#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
218#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
219#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
220#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
221pub enum CutTypeV2 {
222 Fillet {
224 radius: LengthUnit,
226 second_length: Option<LengthUnit>,
229 },
230 Chamfer {
232 distance: LengthUnit,
234 second_distance: Option<LengthUnit>,
236 angle: Option<Angle>,
238 swap: bool,
240 },
241 Custom {
243 path: Uuid,
245 },
246}
247
248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
250#[serde(rename_all = "snake_case")]
251#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
252#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
253#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
254#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
255pub struct Rotation {
256 pub axis: Point3d<f64>,
259 pub angle: Angle,
262 pub origin: OriginType,
264}
265
266impl Default for Rotation {
267 fn default() -> Self {
269 Self {
270 axis: z_axis(),
271 angle: Angle::default(),
272 origin: OriginType::Local,
273 }
274 }
275}
276
277#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
279#[serde(rename_all = "snake_case")]
280#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
281#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
282#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
283#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
284pub struct Transform {
285 #[serde(default)]
288 #[builder(default)]
289 pub translate: Point3d<LengthUnit>,
290 #[serde(default = "same_scale")]
293 #[builder(default = same_scale())]
294 pub scale: Point3d<f64>,
295 #[serde(default)]
298 #[builder(default)]
299 pub rotation: Rotation,
300 #[serde(default = "bool_true")]
302 #[builder(default = bool_true())]
303 pub replicate: bool,
304}
305
306impl Default for Transform {
307 fn default() -> Self {
308 Self {
309 scale: same_scale(),
310 replicate: true,
311 translate: Default::default(),
312 rotation: Rotation::default(),
313 }
314 }
315}
316
317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
319#[serde(rename_all = "snake_case")]
320#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
321#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
322#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
323#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
324pub struct AnnotationOptions {
325 pub text: Option<AnnotationTextOptions>,
327 pub line_ends: Option<AnnotationLineEndOptions>,
329 pub line_width: Option<f32>,
331 pub color: Option<Color>,
333 pub position: Option<Point3d<f32>>,
335 #[serde(default, skip_serializing_if = "Option::is_none")]
337 pub units: Option<units::UnitLength>,
338 pub dimension: Option<AnnotationBasicDimension>,
340 pub feature_control: Option<AnnotationFeatureControl>,
342 pub feature_tag: Option<AnnotationFeatureTag>,
344}
345
346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
348#[serde(rename_all = "snake_case")]
349#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
350#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
351#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
352#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
353pub struct AnnotationLineEndOptions {
354 pub start: AnnotationLineEnd,
356 pub end: AnnotationLineEnd,
358}
359
360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
362#[serde(rename_all = "snake_case")]
363#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
364#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
365#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
366#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
367pub struct AnnotationTextOptions {
368 pub x: AnnotationTextAlignmentX,
370 pub y: AnnotationTextAlignmentY,
372 pub text: String,
374 pub point_size: u32,
376}
377
378#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
380#[serde(rename_all = "snake_case")]
381#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
382#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
383#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
384#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
385pub struct AnnotationMbdControlFrame {
386 pub symbol: MbdSymbol,
388 pub diameter_symbol: Option<MbdSymbol>,
390 pub tolerance: f64,
392 pub modifier: Option<MbdSymbol>,
394 pub primary_datum: Option<char>,
396 pub secondary_datum: Option<char>,
398 pub tertiary_datum: Option<char>,
400}
401
402#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
404#[serde(rename_all = "snake_case")]
405#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
406#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
407#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
408#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
409pub struct AnnotationMbdBasicDimension {
410 pub symbol: Option<MbdSymbol>,
412 pub dimension: Option<f64>,
414 pub tolerance: f64,
416}
417
418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
420#[serde(rename_all = "snake_case")]
421#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
422#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
423#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
424#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
425pub struct AnnotationBasicDimension {
426 #[serde(default, skip_serializing_if = "Option::is_none")]
428 pub from_entity_id: Option<Uuid>,
429
430 #[serde(default, skip_serializing_if = "Option::is_none")]
433 pub from_edge_reference: Option<EdgeSpecifier>,
434
435 pub from_entity_pos: Point2d<f64>,
437
438 #[serde(default, skip_serializing_if = "Option::is_none")]
440 pub to_entity_id: Option<Uuid>,
441
442 #[serde(default, skip_serializing_if = "Option::is_none")]
445 pub to_edge_reference: Option<EdgeSpecifier>,
446
447 pub to_entity_pos: Point2d<f64>,
449
450 pub dimension: AnnotationMbdBasicDimension,
452
453 pub plane_id: Uuid,
455
456 pub offset: Point2d<f64>,
458
459 pub precision: u32,
461
462 pub font_scale: f32,
464
465 pub font_point_size: u32,
467
468 #[serde(default = "one")]
470 pub arrow_scale: f32,
471}
472
473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
475#[serde(rename_all = "snake_case")]
476#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
477#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
478#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
479#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
480pub struct AnnotationFeatureControl {
481 #[serde(default, skip_serializing_if = "Option::is_none")]
483 pub entity_id: Option<Uuid>,
484
485 #[serde(default, skip_serializing_if = "Option::is_none")]
488 pub edge_reference: Option<EdgeSpecifier>,
489
490 pub entity_pos: Point2d<f64>,
492
493 pub leader_type: AnnotationLineEnd,
495
496 pub dimension: Option<AnnotationMbdBasicDimension>,
498
499 pub control_frame: Option<AnnotationMbdControlFrame>,
501
502 pub defined_datum: Option<char>,
504
505 pub prefix: Option<String>,
507
508 pub suffix: Option<String>,
510
511 pub plane_id: Uuid,
513
514 pub offset: Point2d<f64>,
516
517 pub precision: u32,
519
520 pub font_scale: f32,
522
523 pub font_point_size: u32,
525
526 #[serde(default = "one")]
528 pub leader_scale: f32,
529}
530
531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
533#[serde(rename_all = "snake_case")]
534#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
535#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
536#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
537#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
538pub struct AnnotationFeatureTag {
539 #[serde(default, skip_serializing_if = "Option::is_none")]
541 pub entity_id: Option<Uuid>,
542
543 #[serde(default, skip_serializing_if = "Option::is_none")]
546 pub edge_reference: Option<EdgeSpecifier>,
547
548 pub entity_pos: Point2d<f64>,
550
551 pub leader_type: AnnotationLineEnd,
553
554 pub key: String,
556
557 pub value: String,
559
560 pub show_key: bool,
562
563 pub plane_id: Uuid,
565
566 pub offset: Point2d<f64>,
568
569 pub font_scale: f32,
571
572 pub font_point_size: u32,
574
575 #[serde(default = "one")]
577 pub leader_scale: f32,
578}
579
580#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema)]
584#[serde(rename_all = "snake_case", tag = "type")]
585#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
586#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
587#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
588#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
589pub enum DistanceType {
590 Euclidean {},
592 OnAxis {
594 axis: GlobalAxis,
596 },
597}
598
599#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
601#[serde(rename_all = "snake_case", tag = "type")]
602#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
603#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
604#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
605#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
606pub enum OriginType {
607 #[default]
609 Local,
610 Global,
612 Custom {
614 origin: Point3d<f64>,
616 },
617}
618
619#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
621#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
622#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
623#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
624#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
625pub struct Color {
626 pub r: f32,
628 pub g: f32,
630 pub b: f32,
632 pub a: f32,
634}
635
636impl Color {
637 pub fn from_rgba(r: f32, g: f32, b: f32, a: f32) -> Self {
639 Self { r, g, b, a }
640 }
641}
642
643#[allow(missing_docs)]
645#[derive(
646 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
647)]
648#[serde(rename_all = "lowercase")]
649#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
650#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
651#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
652#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
653pub enum AnnotationTextAlignmentX {
654 Left,
655 Center,
656 Right,
657}
658
659#[allow(missing_docs)]
661#[derive(
662 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
663)]
664#[serde(rename_all = "lowercase")]
665#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
666#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
667#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
668#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
669pub enum AnnotationTextAlignmentY {
670 Bottom,
671 Center,
672 Top,
673}
674
675#[allow(missing_docs)]
677#[derive(
678 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
679)]
680#[serde(rename_all = "lowercase")]
681#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
682#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
683#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
684#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
685pub enum AnnotationLineEnd {
686 None,
687 Arrow,
688 Dot,
689}
690
691#[derive(
693 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
694)]
695#[serde(rename_all = "lowercase")]
696#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
697#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
698#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
699#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
700pub enum AnnotationType {
701 T2D,
703 T3D,
705}
706
707#[derive(
709 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
710)]
711#[serde(rename_all = "lowercase")]
712#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
713#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
714#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
715#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
716pub enum MbdStandard {
717 AsmeY14_5,
719}
720
721#[allow(missing_docs)]
724#[derive(
725 Default,
726 Display,
727 FromStr,
728 Copy,
729 Eq,
730 PartialEq,
731 Debug,
732 JsonSchema,
733 Deserialize,
734 Serialize,
735 Sequence,
736 Clone,
737 Ord,
738 PartialOrd,
739)]
740#[serde(rename_all = "lowercase")]
741#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
742#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
743#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
744#[repr(u16)]
745#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
746pub enum MbdSymbol {
747 #[default]
748 None = 0,
749 ArcLength = 174,
750 Between = 175,
751 Degrees = 176,
752 PlusMinus = 177,
753 Angularity = 178,
754 Cylindricity = 179,
755 Roundness = 180,
756 Concentricity = 181,
757 Straightness = 182,
758 Parallelism = 183,
759 Flatness = 184,
760 ProfileOfLine = 185,
761 SurfaceProfile = 186,
762 Symmetry = 187,
763 Perpendicularity = 188,
764 Runout = 189,
765 TotalRunout = 190,
766 Position = 191,
767 CenterLine = 192,
768 PartingLine = 193,
769 IsoEnvelope = 195,
770 IsoEnvelopeNonY145M = 196,
771 FreeState = 197,
772 StatisticalTolerance = 198,
773 ContinuousFeature = 199,
774 Independency = 200,
775 Depth = 201,
776 Start = 202,
777 LeastCondition = 203,
778 MaxCondition = 204,
779 ConicalTaper = 205,
780 Projected = 206,
781 Slope = 207,
782 Micro = 208,
783 TangentPlane = 210,
784 Unilateral = 211,
785 SquareFeature = 212,
786 Countersink = 213,
787 SpotFace = 214,
788 Target = 215,
789 Diameter = 216,
790 Radius = 217,
791 SphericalRadius = 218,
792 SphericalDiameter = 219,
793 ControlledRadius = 220,
794 BoxStart = 123,
795 BoxBar = 162,
796 BoxBarBetween = 124,
797 LetterBackwardUnderline = 95,
798 PunctuationBackwardUnderline = 92,
799 ModifierBackwardUnderline = 126,
800 NumericBackwardUnderline = 96,
801 BoxEnd = 125,
802 DatumUp = 166,
803 DatumLeft = 168,
804 DatumRight = 167,
805 DatumDown = 165,
806 DatumTriangle = 295,
807 HalfSpace = 236,
808 QuarterSpace = 237,
809 EighthSpace = 238,
810 ModifierSpace = 239,
811}
812
813#[derive(
815 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
816)]
817#[serde(rename_all = "lowercase")]
818#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
819#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
820#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
821#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
822pub enum CameraDragInteractionType {
823 Pan,
825 Rotate,
827 RotateTrackball,
829 Zoom,
831}
832
833#[derive(Debug, Clone, Copy, Serialize, Deserialize, JsonSchema, PartialEq)]
836#[serde(rename_all = "snake_case", tag = "type")]
837#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
838#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
839#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
840#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
841pub enum PathSegment {
842 Line {
845 end: Point3d<LengthUnit>,
847 relative: bool,
849 },
850 Arc {
853 center: Point2d<LengthUnit>,
855 radius: LengthUnit,
857 start: Angle,
859 end: Angle,
861 relative: bool,
863 },
864 Bezier {
868 control1: Point3d<LengthUnit>,
870 control2: Point3d<LengthUnit>,
872 end: Point3d<LengthUnit>,
874 relative: bool,
876 },
877 TangentialArc {
879 radius: LengthUnit,
882 offset: Angle,
884 },
885 TangentialArcTo {
888 to: Point3d<LengthUnit>,
892 angle_snap_increment: Option<Angle>,
894 },
895 ArcTo {
897 interior: Point3d<LengthUnit>,
899 end: Point3d<LengthUnit>,
901 relative: bool,
903 },
904 CircularInvolute {
907 start_radius: LengthUnit,
910 end_radius: LengthUnit,
913 angle: Angle,
916 reverse: bool,
919 },
920 Ellipse {
922 center: Point2d<LengthUnit>,
924 major_axis: Point2d<LengthUnit>,
926 minor_radius: LengthUnit,
928 start_angle: Angle,
930 end_angle: Angle,
932 },
933 ConicTo {
936 interior: Point2d<LengthUnit>,
938 end: Point2d<LengthUnit>,
940 start_tangent: Point2d<LengthUnit>,
942 end_tangent: Point2d<LengthUnit>,
944 relative: bool,
946 },
947}
948
949#[derive(Clone, Copy, PartialEq, Debug, JsonSchema, Deserialize, Serialize)]
951#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
952#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
953#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
954#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
955pub struct Angle {
956 pub unit: UnitAngle,
958 pub value: f64,
960}
961
962impl Angle {
963 pub fn to_degrees(self) -> f64 {
965 match self.unit {
966 UnitAngle::Degrees => self.value,
967 UnitAngle::Radians => self.value.to_degrees(),
968 }
969 }
970 pub fn to_radians(self) -> f64 {
972 match self.unit {
973 UnitAngle::Degrees => self.value.to_radians(),
974 UnitAngle::Radians => self.value,
975 }
976 }
977 pub const fn from_degrees(value: f64) -> Self {
979 Self {
980 unit: UnitAngle::Degrees,
981 value,
982 }
983 }
984 pub const fn from_radians(value: f64) -> Self {
986 Self {
987 unit: UnitAngle::Radians,
988 value,
989 }
990 }
991 pub const fn turn() -> Self {
993 Self::from_degrees(360.0)
994 }
995 pub const fn half_circle() -> Self {
997 Self::from_degrees(180.0)
998 }
999 pub const fn quarter_circle() -> Self {
1001 Self::from_degrees(90.0)
1002 }
1003 pub const fn zero() -> Self {
1005 Self::from_degrees(0.0)
1006 }
1007}
1008
1009impl Default for Angle {
1011 fn default() -> Self {
1013 Self::zero()
1014 }
1015}
1016
1017impl PartialOrd for Angle {
1018 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
1019 match (self.unit, other.unit) {
1020 (UnitAngle::Degrees, UnitAngle::Degrees) => self.value.partial_cmp(&other.value),
1022 (UnitAngle::Radians, UnitAngle::Radians) => self.value.partial_cmp(&other.value),
1023 _ => self.to_degrees().partial_cmp(&other.to_degrees()),
1024 }
1025 }
1026}
1027
1028impl std::ops::Add for Angle {
1029 type Output = Self;
1030
1031 fn add(self, rhs: Self) -> Self::Output {
1032 Self {
1033 unit: UnitAngle::Degrees,
1034 value: self.to_degrees() + rhs.to_degrees(),
1035 }
1036 }
1037}
1038
1039impl std::ops::AddAssign for Angle {
1040 fn add_assign(&mut self, rhs: Self) {
1041 match self.unit {
1042 UnitAngle::Degrees => {
1043 self.value += rhs.to_degrees();
1044 }
1045 UnitAngle::Radians => {
1046 self.value += rhs.to_radians();
1047 }
1048 }
1049 }
1050}
1051
1052#[derive(
1054 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1055)]
1056#[serde(rename_all = "lowercase")]
1057#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1058#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1059#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1060#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1061pub enum SceneSelectionType {
1062 Replace,
1064 Add,
1066 Remove,
1068}
1069
1070#[allow(missing_docs)]
1072#[derive(
1073 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1074)]
1075#[serde(rename_all = "snake_case")]
1076#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1077#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1078#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1079#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1080pub enum SceneToolType {
1081 CameraRevolve,
1082 Select,
1083 Move,
1084 SketchLine,
1085 SketchTangentialArc,
1086 SketchCurve,
1087 SketchCurveMod,
1088}
1089
1090#[allow(missing_docs)]
1092#[derive(
1093 Display,
1094 FromStr,
1095 Copy,
1096 Eq,
1097 PartialEq,
1098 Debug,
1099 JsonSchema,
1100 Deserialize,
1101 Serialize,
1102 Sequence,
1103 Clone,
1104 Ord,
1105 PartialOrd,
1106 Default,
1107)]
1108#[serde(rename_all = "snake_case")]
1109#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1110#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1111#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1112#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1113pub enum PathComponentConstraintBound {
1114 #[default]
1115 Unconstrained,
1116 PartiallyConstrained,
1117 FullyConstrained,
1118}
1119
1120#[allow(missing_docs)]
1122#[derive(
1123 Display,
1124 FromStr,
1125 Copy,
1126 Eq,
1127 PartialEq,
1128 Debug,
1129 JsonSchema,
1130 Deserialize,
1131 Serialize,
1132 Sequence,
1133 Clone,
1134 Ord,
1135 PartialOrd,
1136 Default,
1137)]
1138#[serde(rename_all = "snake_case")]
1139#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1140#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1141#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1142#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1143pub enum PathComponentConstraintType {
1144 #[default]
1145 Unconstrained,
1146 Vertical,
1147 Horizontal,
1148 EqualLength,
1149 Parallel,
1150 AngleBetween,
1151}
1152
1153#[allow(missing_docs)]
1155#[derive(
1156 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1157)]
1158#[serde(rename_all = "snake_case")]
1159#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1160#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1161#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1162#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1163pub enum PathCommand {
1164 MoveTo,
1165 LineTo,
1166 BezCurveTo,
1167 NurbsCurveTo,
1168 AddArc,
1169}
1170
1171#[allow(missing_docs)]
1173#[derive(
1174 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1175)]
1176#[serde(rename_all = "lowercase")]
1177#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1178#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1179#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1180#[repr(u8)]
1181#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1182pub enum EntityType {
1183 Entity,
1184 Object,
1185 Path,
1186 Segment,
1187 Curve,
1188 Solid2D,
1189 Solid3D,
1190 Edge,
1191 Face,
1192 Plane,
1193 Vertex,
1194 Region,
1195}
1196
1197#[allow(missing_docs)]
1199#[derive(
1200 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1201)]
1202#[serde(rename_all = "snake_case")]
1203#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1204#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1205#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1206#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1207pub enum CurveType {
1208 Line,
1209 Arc,
1210 Nurbs,
1211}
1212
1213#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone, PartialEq, Builder)]
1215#[cfg_attr(
1216 feature = "python",
1217 pyo3::pyclass(from_py_object),
1218 pyo3_stub_gen::derive::gen_stub_pyclass
1219)]
1220#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1221pub struct ExportFile {
1222 pub name: String,
1224 pub contents: crate::base64::Base64Data,
1226}
1227
1228#[cfg(feature = "python")]
1229#[pyo3_stub_gen::derive::gen_stub_pymethods]
1230#[pyo3::pymethods]
1231impl ExportFile {
1232 #[getter]
1233 fn contents(&self) -> Vec<u8> {
1234 self.contents.0.clone()
1235 }
1236
1237 #[getter]
1238 fn name(&self) -> String {
1239 self.name.clone()
1240 }
1241}
1242
1243#[derive(
1245 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd, Sequence,
1246)]
1247#[serde(rename_all = "lowercase")]
1248#[display(style = "lowercase")]
1249#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1250#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1251#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1252#[cfg_attr(
1253 feature = "python",
1254 pyo3::pyclass(from_py_object),
1255 pyo3_stub_gen::derive::gen_stub_pyclass_enum
1256)]
1257#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1258pub enum FileExportFormat {
1259 Fbx,
1261 Glb,
1268 Gltf,
1279 Obj,
1283 Ply,
1285 Step,
1287 Stl,
1289}
1290
1291#[derive(
1293 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd, Sequence,
1294)]
1295#[serde(rename_all = "lowercase")]
1296#[display(style = "lowercase")]
1297#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1298#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1299#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1300#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1301pub enum FileExportFormat2d {
1302 Dxf,
1304}
1305
1306#[derive(
1308 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd, Sequence,
1309)]
1310#[serde(rename_all = "lowercase")]
1311#[display(style = "lowercase")]
1312#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1313#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1314#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1315#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1316pub enum FileImportFormat {
1317 Acis,
1319 Catia,
1321 Creo,
1323 Fbx,
1325 Gltf,
1327 Inventor,
1329 Nx,
1331 Obj,
1335 Parasolid,
1337 Ply,
1339 Sldprt,
1341 Step,
1343 Stl,
1345}
1346
1347#[derive(Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, Ord, PartialOrd)]
1349#[serde(rename_all = "snake_case")]
1350#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1351#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1352#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1353#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1354pub enum EngineErrorCode {
1355 BadRequest = 1,
1359 InternalEngine,
1361}
1362
1363impl From<EngineErrorCode> for http::StatusCode {
1364 fn from(e: EngineErrorCode) -> Self {
1365 match e {
1366 EngineErrorCode::BadRequest => Self::BAD_REQUEST,
1367 EngineErrorCode::InternalEngine => Self::INTERNAL_SERVER_ERROR,
1368 }
1369 }
1370}
1371
1372#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1374#[serde(rename_all = "snake_case")]
1375#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1376#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1377#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1378pub enum BlendType {
1379 #[default]
1381 Tangent,
1382}
1383
1384#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1386#[serde(rename_all = "snake_case")]
1387#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1388#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1389#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1390#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1391pub enum BodyType {
1392 #[default]
1394 Solid,
1395 Surface,
1397}
1398
1399#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1402#[serde(rename_all = "snake_case")]
1403#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1404#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1405#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1406#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1407pub enum ExtrudeMethod {
1408 New,
1411 #[default]
1414 Merge,
1415}
1416
1417#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, JsonSchema)]
1419#[serde(rename_all = "snake_case")]
1420#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1421#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1422#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1423#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1424pub enum ExtrudeReference {
1425 EntityReference {
1428 #[serde(default, skip_serializing_if = "Option::is_none")]
1430 entity_id: Option<Uuid>,
1431 #[serde(default, skip_serializing_if = "Option::is_none")]
1433 entity_reference: Option<EntityReference>,
1434 },
1435 Axis {
1437 axis: Point3d<f64>,
1439 #[serde(default)]
1442 point: Point3d<LengthUnit>,
1443 },
1444 Point {
1446 point: Point3d<LengthUnit>,
1448 },
1449}
1450
1451#[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone, Builder)]
1453#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1454#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1455#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1456#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1457pub struct ExtrudedFaceInfo {
1458 pub bottom: Option<Uuid>,
1463 pub top: Uuid,
1465 pub sides: Vec<SideFace>,
1467}
1468
1469#[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone, Builder)]
1471#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1472#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1473#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1474#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1475pub struct SideFace {
1476 pub path_id: Uuid,
1478 pub face_id: Uuid,
1480}
1481
1482#[derive(Debug, Serialize, Deserialize, JsonSchema, Clone, PartialEq, Builder)]
1484#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1485#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1486#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1487#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1488pub struct CameraSettings {
1489 pub pos: Point3d,
1491
1492 pub center: Point3d,
1494
1495 pub up: Point3d,
1497
1498 pub orientation: Quaternion,
1500
1501 pub fov_y: Option<f32>,
1503
1504 pub ortho_scale: Option<f32>,
1506
1507 pub ortho: bool,
1509}
1510
1511#[allow(missing_docs)]
1512#[repr(u8)]
1513#[derive(Default, Clone, Copy, Debug, Eq, PartialEq, Serialize, Deserialize, JsonSchema)]
1514#[serde(rename_all = "snake_case")]
1515#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1516#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1517#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1518#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1519pub enum WorldCoordinateSystem {
1520 #[default]
1521 RightHandedUpZ,
1522 RightHandedUpY,
1523}
1524
1525#[allow(missing_docs)]
1526#[repr(C)]
1527#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
1528#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1529#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1530#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1531#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1532pub struct CameraViewState {
1533 pub pivot_rotation: Quaternion,
1534 pub pivot_position: Point3d,
1535 pub eye_offset: f32,
1536 pub fov_y: f32,
1537 pub ortho_scale_factor: f32,
1538 pub is_ortho: bool,
1539 pub ortho_scale_enabled: bool,
1540 pub world_coord_system: WorldCoordinateSystem,
1541}
1542
1543impl Default for CameraViewState {
1544 fn default() -> Self {
1545 CameraViewState {
1546 pivot_rotation: Default::default(),
1547 pivot_position: Default::default(),
1548 eye_offset: 10.0,
1549 fov_y: 45.0,
1550 ortho_scale_factor: 1.6,
1551 is_ortho: false,
1552 ortho_scale_enabled: true,
1553 world_coord_system: Default::default(),
1554 }
1555 }
1556}
1557
1558#[cfg(feature = "cxx")]
1559impl_extern_type! {
1560 [Trivial]
1561 CameraViewState = "Endpoints::CameraViewState"
1562}
1563
1564impl From<CameraSettings> for crate::output::DefaultCameraZoom {
1565 fn from(settings: CameraSettings) -> Self {
1566 Self { settings }
1567 }
1568}
1569impl From<CameraSettings> for crate::output::CameraDragMove {
1570 fn from(settings: CameraSettings) -> Self {
1571 Self { settings }
1572 }
1573}
1574impl From<CameraSettings> for crate::output::CameraDragEnd {
1575 fn from(settings: CameraSettings) -> Self {
1576 Self { settings }
1577 }
1578}
1579impl From<CameraSettings> for crate::output::DefaultCameraGetSettings {
1580 fn from(settings: CameraSettings) -> Self {
1581 Self { settings }
1582 }
1583}
1584impl From<CameraSettings> for crate::output::ZoomToFit {
1585 fn from(settings: CameraSettings) -> Self {
1586 Self { settings }
1587 }
1588}
1589impl From<CameraSettings> for crate::output::OrientToFace {
1590 fn from(settings: CameraSettings) -> Self {
1591 Self { settings }
1592 }
1593}
1594impl From<CameraSettings> for crate::output::ViewIsometric {
1595 fn from(settings: CameraSettings) -> Self {
1596 Self { settings }
1597 }
1598}
1599
1600#[derive(Copy, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Clone, PartialOrd, Default, Builder)]
1602#[serde(rename_all = "snake_case")]
1603#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1604#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1605#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1606#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1607pub struct PerspectiveCameraParameters {
1608 pub fov_y: Option<f32>,
1610 pub z_near: Option<f32>,
1612 pub z_far: Option<f32>,
1614}
1615
1616#[derive(
1618 Default,
1619 Display,
1620 FromStr,
1621 Copy,
1622 Eq,
1623 PartialEq,
1624 Debug,
1625 JsonSchema,
1626 Deserialize,
1627 Serialize,
1628 Sequence,
1629 Clone,
1630 Ord,
1631 PartialOrd,
1632)]
1633#[serde(rename_all = "snake_case")]
1634#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1635#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1636#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1637#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1638pub enum CameraMovement {
1639 #[default]
1641 Vantage,
1642 None,
1644}
1645
1646#[derive(
1648 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1649)]
1650#[serde(rename_all = "lowercase")]
1651#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1652#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1653#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1654#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1655pub enum GlobalAxis {
1656 X,
1658 Y,
1660 Z,
1662}
1663
1664#[derive(
1666 Display, FromStr, Copy, Eq, PartialEq, Debug, JsonSchema, Deserialize, Serialize, Sequence, Clone, Ord, PartialOrd,
1667)]
1668#[serde(rename_all = "snake_case")]
1669#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1670#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1671#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1672#[repr(u8)]
1673#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1674pub enum ExtrusionFaceCapType {
1675 None,
1677 Top,
1679 Bottom,
1681 Both,
1683}
1684
1685#[allow(missing_docs)]
1687#[derive(
1688 Display,
1689 FromStr,
1690 Copy,
1691 Eq,
1692 PartialEq,
1693 Debug,
1694 JsonSchema,
1695 Deserialize,
1696 Serialize,
1697 Sequence,
1698 Clone,
1699 Ord,
1700 PartialOrd,
1701 Default,
1702)]
1703#[serde(rename_all = "lowercase")]
1704#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1705#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1706#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1707#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1708pub enum PostEffectType {
1709 Phosphor,
1710 Ssao,
1711 #[default]
1712 NoEffect,
1713}
1714
1715#[cfg(feature = "cxx")]
1718impl_extern_type! {
1719 [Trivial]
1720 FileImportFormat = "Enums::_FileImportFormat"
1722 FileExportFormat = "Enums::_FileExportFormat"
1723 CameraDragInteractionType = "Enums::_CameraDragInteractionType"
1725 SceneSelectionType = "Enums::_SceneSelectionType"
1727 SceneToolType = "Enums::_SceneToolType"
1728 BlendType = "Enums::_BlendType"
1729 BodyType = "Enums::_BodyType"
1730 EntityType = "Enums::_EntityType"
1731 AnnotationType = "Enums::_AnnotationType"
1732 AnnotationTextAlignmentX = "Enums::_AnnotationTextAlignmentX"
1733 AnnotationTextAlignmentY = "Enums::_AnnotationTextAlignmentY"
1734 AnnotationLineEnd = "Enums::_AnnotationLineEnd"
1735 MbdStandard = "Enums::_MBDStandard"
1736 MbdSymbol = "Enums::_MBDSymbol"
1737
1738 CurveType = "Enums::_CurveType"
1739 PathCommand = "Enums::_PathCommand"
1740 PathComponentConstraintBound = "Enums::_PathComponentConstraintBound"
1741 PathComponentConstraintType = "Enums::_PathComponentConstraintType"
1742 ExtrusionFaceCapType = "Enums::_ExtrusionFaceCapType"
1743
1744 EngineErrorCode = "Enums::_ErrorCode"
1746 GlobalAxis = "Enums::_GlobalAxis"
1747 OriginType = "Enums::_OriginType"
1748
1749 PostEffectType = "Enums::_PostEffectType"
1751}
1752
1753fn bool_true() -> bool {
1754 true
1755}
1756fn same_scale() -> Point3d<f64> {
1757 Point3d::uniform(1.0)
1758}
1759
1760fn z_axis() -> Point3d<f64> {
1761 Point3d { x: 0.0, y: 0.0, z: 1.0 }
1762}
1763
1764impl ExtrudedFaceInfo {
1765 pub fn list_faces(self) -> Vec<ExtrusionFaceInfo> {
1768 let mut face_infos: Vec<_> = self
1769 .sides
1770 .into_iter()
1771 .map(|side| ExtrusionFaceInfo {
1772 curve_id: Some(side.path_id),
1773 face_id: Some(side.face_id),
1774 cap: ExtrusionFaceCapType::None,
1775 })
1776 .collect();
1777 face_infos.push(ExtrusionFaceInfo {
1778 curve_id: None,
1779 face_id: Some(self.top),
1780 cap: ExtrusionFaceCapType::Top,
1781 });
1782 if let Some(bottom) = self.bottom {
1783 face_infos.push(ExtrusionFaceInfo {
1784 curve_id: None,
1785 face_id: Some(bottom),
1786 cap: ExtrusionFaceCapType::Bottom,
1787 });
1788 }
1789 face_infos
1790 }
1791}
1792
1793#[cfg(test)]
1794mod tests {
1795 use super::*;
1796
1797 #[test]
1798 fn test_angle_comparison() {
1799 let a = Angle::from_degrees(90.0);
1800 assert!(a < Angle::from_degrees(91.0));
1801 assert!(a > Angle::from_degrees(89.0));
1802 assert!(a <= Angle::from_degrees(90.0));
1803 assert!(a >= Angle::from_degrees(90.0));
1804 let b = Angle::from_radians(std::f64::consts::FRAC_PI_4);
1805 assert!(b < Angle::from_radians(std::f64::consts::FRAC_PI_2));
1806 assert!(b > Angle::from_radians(std::f64::consts::FRAC_PI_8));
1807 assert!(b <= Angle::from_radians(std::f64::consts::FRAC_PI_4));
1808 assert!(b >= Angle::from_radians(std::f64::consts::FRAC_PI_4));
1809 assert!(a > b);
1811 assert!(a >= b);
1812 assert!(b < a);
1813 assert!(b <= a);
1814 let c = Angle::from_radians(std::f64::consts::FRAC_PI_2 * 3.0);
1815 assert!(a < c);
1816 assert!(a <= c);
1817 assert!(c > a);
1818 assert!(c >= a);
1819 }
1820}
1821
1822#[derive(Clone, Debug, PartialEq, Deserialize, Serialize, JsonSchema, Builder)]
1824#[schemars(rename = "TransformByFor{T}")]
1825#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1826#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1827#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1828#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1829pub struct TransformBy<T> {
1830 pub property: T,
1832 pub set: bool,
1837 #[serde(default)]
1839 #[builder(default)]
1840 pub origin: OriginType,
1841}
1842
1843impl<T> TransformBy<T> {
1844 pub fn get_origin(&self) -> OriginType {
1848 self.origin
1849 }
1850}
1851
1852#[derive(Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, Default, Builder)]
1855#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1856#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1857#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1858#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1859pub struct ComponentTransform {
1860 pub translate: Option<TransformBy<Point3d<LengthUnit>>>,
1862 pub rotate_rpy: Option<TransformBy<Point3d<f64>>>,
1865 pub rotate_angle_axis: Option<TransformBy<Point4d<f64>>>,
1869 pub scale: Option<TransformBy<Point3d<f64>>>,
1871}
1872
1873#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
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 enum Opposite<T> {
1881 #[default]
1883 None,
1884 Symmetric,
1886 Other(T),
1888}
1889
1890impl<T: JsonSchema> JsonSchema for Opposite<T> {
1891 fn schema_name() -> String {
1892 format!("OppositeFor{}", T::schema_name())
1893 }
1894
1895 fn schema_id() -> std::borrow::Cow<'static, str> {
1896 std::borrow::Cow::Owned(format!("{}::Opposite<{}>", module_path!(), T::schema_id()))
1897 }
1898
1899 fn json_schema(_: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
1900 SchemaObject {
1901 instance_type: Some(schemars::schema::InstanceType::String.into()),
1902 ..Default::default()
1903 }
1904 .into()
1905 }
1906}
1907
1908#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
1911#[serde(rename_all = "snake_case")]
1912#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1913#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1914#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1915#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1916pub enum CutStrategy {
1917 Basic,
1920 Csg,
1923 #[default]
1925 Automatic,
1926}
1927
1928#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
1930#[serde(rename_all = "snake_case")]
1931#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1932#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1933#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1934#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1935pub enum RelativeTo {
1936 #[default]
1938 SketchPlane,
1939 TrajectoryCurve,
1941}
1942
1943#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Builder)]
1945#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1946#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1947#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1948pub struct SelectedRegion {
1949 pub segment: Uuid,
1951 pub intersection_segment: Uuid,
1954 #[serde(default = "negative_one")]
1958 pub intersection_index: i32,
1959 #[serde(default)]
1962 pub curve_clockwise: bool,
1963}
1964
1965impl Default for SelectedRegion {
1966 fn default() -> Self {
1967 Self {
1968 segment: Default::default(),
1969 intersection_segment: Default::default(),
1970 intersection_index: -1,
1971 curve_clockwise: Default::default(),
1972 }
1973 }
1974}
1975
1976#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
1978#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1979#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
1980#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1981#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
1982pub struct FractionOfEdge {
1983 #[serde(default, skip_serializing_if = "Option::is_none")]
1985 pub edge_id: Option<Uuid>,
1986 #[serde(default, skip_serializing_if = "Option::is_none")]
1988 pub edge_specifier: Option<EdgeSpecifier>,
1989 #[serde(default)]
1993 #[builder(default)]
1994 #[schemars(range(min = 0, max = 1))]
1995 pub lower_bound: f32,
1996 #[serde(default = "one")]
2000 #[builder(default = one())]
2001 #[schemars(range(min = 0, max = 1))]
2002 pub upper_bound: f32,
2003}
2004
2005#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2007#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2008#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2009#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2010#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2011pub struct SurfaceEdgeReference {
2012 pub object_id: Uuid,
2014 pub edges: Vec<FractionOfEdge>,
2016}
2017
2018#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
2020#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2021#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2022#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2023#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2024pub struct BodiesCreated {
2025 pub bodies: Vec<BodyCreated>,
2027}
2028
2029impl BodiesCreated {
2030 pub fn is_empty(&self) -> bool {
2032 self.bodies.is_empty()
2033 }
2034}
2035
2036#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
2038#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2039#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2040#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2041#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2042pub struct BodiesUpdated {
2043 pub bodies: Vec<BodyUpdated>,
2045}
2046
2047impl BodiesUpdated {
2048 pub fn is_empty(&self) -> bool {
2050 self.bodies.is_empty()
2051 }
2052}
2053
2054#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2056#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2057#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2058#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2059#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2060pub struct BodyCreated {
2061 pub id: Uuid,
2063 pub surfaces: Vec<SurfaceCreated>,
2065}
2066
2067#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2069#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2070#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2071#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2072#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2073pub struct BodyUpdated {
2074 pub id: Uuid,
2076 pub surfaces: Vec<SurfaceCreated>,
2078}
2079
2080#[derive(Builder, Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema)]
2082#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2083#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2084#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2085#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2086pub struct SurfaceCreated {
2087 pub id: Uuid,
2089 pub primitive_face_index: u32,
2091 pub from_segments: Vec<Uuid>,
2093}
2094
2095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
2097#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2098#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2099#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2100#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2101pub enum RegionVersion {
2102 #[default]
2105 V0,
2106 V1,
2109}
2110
2111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, Copy)]
2113#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
2114#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
2115#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
2116#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
2117#[serde(rename_all = "snake_case")]
2118pub enum EdgeCutVersion {
2119 V0,
2121 V1,
2125 V2,
2129}
2130
2131const DEFAULT_EDGE_CUT_VERSION: EdgeCutVersion = EdgeCutVersion::V1;
2132
2133impl EdgeCutVersion {
2134 pub fn is_default(&self) -> bool {
2136 self == &DEFAULT_EDGE_CUT_VERSION
2137 }
2138}
2139
2140impl Default for EdgeCutVersion {
2141 fn default() -> Self {
2142 DEFAULT_EDGE_CUT_VERSION
2143 }
2144}
2145
2146impl TryFrom<u32> for EdgeCutVersion {
2148 type Error = ();
2149
2150 fn try_from(version: u32) -> Result<Self, Self::Error> {
2151 match version {
2152 0 => Ok(Self::V0),
2153 1 => Ok(Self::V1),
2154 2 => Ok(Self::V2),
2155 _ => Err(()),
2156 }
2157 }
2158}
2159
2160impl RegionVersion {
2161 pub fn is_zero(&self) -> bool {
2163 matches!(self, Self::V0)
2164 }
2165}
2166
2167impl From<BodyCreated> for BodyUpdated {
2168 fn from(body: BodyCreated) -> Self {
2169 Self {
2170 id: body.id,
2171 surfaces: body.surfaces,
2172 }
2173 }
2174}
2175
2176impl From<BodyUpdated> for BodyCreated {
2177 fn from(body: BodyUpdated) -> Self {
2178 Self {
2179 id: body.id,
2180 surfaces: body.surfaces,
2181 }
2182 }
2183}
2184
2185impl From<BodiesCreated> for BodiesUpdated {
2186 fn from(bodies: BodiesCreated) -> Self {
2187 Self {
2188 bodies: bodies.bodies.into_iter().map(Into::into).collect(),
2189 }
2190 }
2191}
2192
2193impl From<BodiesUpdated> for BodiesCreated {
2194 fn from(bodies: BodiesUpdated) -> Self {
2195 Self {
2196 bodies: bodies.bodies.into_iter().map(Into::into).collect(),
2197 }
2198 }
2199}
2200
2201fn one() -> f32 {
2202 1.0
2203}