-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdef_enum.rs
More file actions
2834 lines (2648 loc) · 143 KB
/
Copy pathdef_enum.rs
File metadata and controls
2834 lines (2648 loc) · 143 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
use kittycad_modeling_cmds_macros::define_modeling_cmd_enum;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
pub use self::each_cmd::*;
use crate::{self as kittycad_modeling_cmds};
define_modeling_cmd_enum! {
pub mod each_cmd {
use std::collections::HashSet;
use bon::Builder;
use crate::{self as kittycad_modeling_cmds};
use kittycad_modeling_cmds_macros::{ModelingCmdVariant};
use parse_display_derive::{Display, FromStr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::shared::CameraViewState;
use crate::shared::MirrorAcross;
use crate::{
format::{OutputFormat2d, OutputFormat3d},
id::ModelingCmdId,
length_unit::LengthUnit,
shared::{
Angle,
RegionVersion,
BlendType,
BodyType,
EdgeCutVersion,
ComponentTransform,
RelativeTo,
CutType, CutTypeV2,
CutStrategy,
CameraMovement,
DirectionType,
EdgeSpecifier,
EntityReference,
ExtrudedFaceInfo, ExtrudeMethod,
AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
PathComponentConstraintBound, PathComponentConstraintType, PathSegment, PerspectiveCameraParameters,
Point2d, Point3d, ExtrudeReference, SceneSelectionType, SceneToolType, SurfaceEdgeReference, Opposite,
},
units,
};
/// Mike says this usually looks nice.
fn default_animation_seconds() -> f64 {
0.4
}
fn mm() -> crate::units::UnitLength {
crate::units::UnitLength::Millimeters
}
/// Evaluates the position of a path in one shot (engine utility for kcl executor)
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EngineUtilEvaluatePath {
/// The path in json form (the serialized result of the kcl Sketch/Path object
pub path_json: String,
/// The evaluation parameter (path curve parameter in the normalized domain [0, 1])
pub t: f64,
}
/// Start a new path.
#[derive(
Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant,
Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct StartPath {}
/// Move the path's "pen".
/// If you're in sketch mode, these coordinates are in the local coordinate system,
/// not the world's coordinate system.
/// For example, say you're sketching on the plane {x: (1,0,0), y: (0,1,0), origin: (0, 0, 50)}.
/// In other words, the plane 50 units above the default XY plane. Then, moving the pen
/// to (1, 1, 0) with this command uses local coordinates. So, it would move the pen to
/// (1, 1, 50) in global coordinates.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct MovePathPen {
/// The ID of the command which created the path.
pub path: ModelingCmdId,
/// Where the path's pen should be.
pub to: Point3d<LengthUnit>,
}
/// Extend a path by adding a new segment which starts at the path's "pen".
/// If no "pen" location has been set before (via `MovePen`), then the pen is at the origin.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct ExtendPath {
/// The ID of the command which created the path.
pub path: ModelingCmdId,
/// Segment to append to the path.
/// This segment will implicitly begin at the current "pen" location.
pub segment: PathSegment,
/// Optional label to associate with the new path segment.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub label: Option<String>,
}
/// Command for extruding a solid 2d.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Extrude {
/// Which sketch to extrude (legacy API).
/// Must be a closed 2D solid. If `target_reference` is provided, the reference takes precedence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub target: Option<ModelingCmdId>,
/// Edge specifier identifying the edge to extrude. If provided, this takes precedence over `target`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub target_reference: Option<EdgeSpecifier>,
/// How far off the plane to extrude
pub distance: LengthUnit,
/// What direction to extrude in. If None, the engine will extrude in the direction normal of the target's plane.
/// Legacy field; if `direction_reference` is provided, the reference takes precedence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub direction: Option<DirectionType>,
/// Edge specifier identifying the edge direction to use. If provided, this takes precedence over `direction`.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub direction_reference: Option<EdgeSpecifier>,
/// What draft angle should be used in this extrusion?
/// Negative values indicate an outward draft,
/// while positive values indicate an inward draft
#[serde(default, skip_serializing_if = "Option::is_none")]
pub draft_angle: Option<Angle>,
/// Which IDs should the new faces have?
/// If this isn't given, the engine will generate IDs.
#[serde(default)]
pub faces: Option<ExtrudedFaceInfo>,
/// Should the extrusion also extrude in the opposite direction?
/// If so, this specifies its distance.
#[serde(default)]
#[builder(default)]
pub opposite: Opposite<LengthUnit>,
/// Should the extrusion create a new object or be part of the existing object.
#[builder(default)]
#[serde(default)]
pub extrude_method: ExtrudeMethod,
/// Only used if the extrusion is created from a face and extrude_method = Merge
/// If true, coplanar faces will be merged and seams will be hidden.
/// Otherwise, seams between the extrusion and original body will be shown.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub merge_coplanar_faces: Option<bool>,
/// Should this extrude create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
}
/// Command for extruding a solid 2d to a reference geometry.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct ExtrudeToReference {
/// Which sketch to extrude.
/// Must be a closed 2D solid.
pub target: ModelingCmdId,
/// Reference to extrude to.
/// Extrusion occurs along the target's normal until it is as close to the reference as possible.
pub reference: ExtrudeReference,
/// Which IDs should the new faces have?
/// If this isn't given, the engine will generate IDs.
#[serde(default)]
pub faces: Option<ExtrudedFaceInfo>,
/// Should the extrusion create a new object or be part of the existing object.
#[serde(default)]
#[builder(default)]
pub extrude_method: ExtrudeMethod,
/// Should this extrude create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
}
fn default_twist_extrude_section_interval() -> Angle {
Angle::from_degrees(15.0)
}
/// Command for twist extruding a solid 2d.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct TwistExtrude {
/// Which sketch to extrude.
/// Must be a closed 2D solid.
pub target: ModelingCmdId,
/// How far off the plane to extrude
pub distance: LengthUnit,
/// Which IDs should the new faces have?
/// If this isn't given, the engine will generate IDs.
#[serde(default)]
pub faces: Option<ExtrudedFaceInfo>,
/// Center to twist about (relative to plane's origin)
/// Defaults to `[0, 0]` i.e. the plane's origin
#[serde(default)]
#[builder(default)]
pub center_2d: Point2d<f64>,
/// Total rotation of the section
pub total_rotation_angle: Angle,
/// Angle step interval (converted to whole number degrees and bounded between 4° and 90°)
#[serde(default = "default_twist_extrude_section_interval")]
#[builder(default = default_twist_extrude_section_interval())]
pub angle_step_size: Angle,
/// The twisted surface loft tolerance
pub tolerance: LengthUnit,
/// Should this extrude create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
}
/// Extrude the object along a path.
#[derive(
Clone, Debug, PartialEq, Deserialize, JsonSchema, Serialize, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Sweep {
/// Which sketch to sweep.
/// Must be a closed 2D solid.
pub target: ModelingCmdId,
/// Path along which to sweep.
pub trajectory: ModelingCmdId,
/// If true, the sweep will be broken up into sub-sweeps (extrusions, revolves, sweeps) based on the trajectory path components.
pub sectional: bool,
/// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
pub tolerance: LengthUnit,
/// Should this sweep create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
/// What is this sweep relative to?
/// Deprecated; please use `translate_profile_to_path` and `orient_profile_perpendicular` instead.
#[serde(default)]
pub relative_to: Option<RelativeTo>,
/// What version of the sweeping algorithm to use. If None, or zero, the engine's
/// default algorithm will be used
#[serde(default, skip_serializing_if = "Option::is_none")]
pub version: Option<u8>,
/// If true, the profile being swept will be moved to the path being swept along,
/// before the sweep starts.
/// If false, the profile stays where it is, and the sweep starts from there.
/// Defaults to false.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub translate_profile_to_path: Option<bool>,
/// If true, before the sweep starts, the profile will be re-oriented
/// so that it is perpendicular to the path being swept along.
/// If false, the profile is left in its current orientation.
/// Defaults to false.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub orient_profile_perpendicular: Option<bool>,
/// If orient_profile_perpendicular is true, the sketch shall be oriented such that the
/// local Y axis of the sketch will be oriented to align with this element as much as
/// possible.
/// Defaults to +Z if not set
#[serde(default, skip_serializing_if = "Option::is_none")]
pub projected_axis: Option<DirectionType>,
}
/// Command for revolving a solid 2d.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Revolve {
/// Which sketch to revolve.
/// Must be a closed 2D solid.
pub target: ModelingCmdId,
/// The origin of the extrusion axis
pub origin: Point3d<LengthUnit>,
/// The axis of the extrusion (taken from the origin)
pub axis: Point3d<f64>,
/// If true, the axis is interpreted within the 2D space of the solid 2D's plane
pub axis_is_2d: bool,
/// The signed angle of revolution (in degrees, must be <= 360 in either direction)
pub angle: Angle,
/// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
pub tolerance: LengthUnit,
/// Should the revolution also revolve in the opposite direction along the given axis?
/// If so, this specifies its angle.
#[serde(default)]
#[builder(default)]
pub opposite: Opposite<Angle>,
/// Should this extrude create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
}
/// Command for shelling a solid3d face
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Solid3dShellFace {
/// Which Solid3D is being shelled.
pub object_id: Uuid,
/// Which faces to remove, leaving only the shell.
pub face_ids: Vec<Uuid>,
/// How thick the shell should be.
/// Smaller values mean a thinner shell.
pub shell_thickness: LengthUnit,
/// If true, the Solid3D is made hollow instead of removing the selected faces
#[serde(default)]
#[builder(default)]
pub hollow: bool,
}
/// Command for joining a Surface (non-manifold) body back to a Solid.
/// All of the surfaces should already be contained within the body mated topologically.
/// This operation should be the final step after a sequence of Solid modeling commands such as
/// BooleanImprint, EntityDeleteChildren, Solid3dFlipFace
/// If successful, the new body type will become "Solid".
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Solid3dJoin {
/// Which Solid3D is being joined.
pub object_id: Uuid,
}
/// Command for joining multiple Surfaces (non-manifold) to a Solid.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Solid3dMultiJoin {
/// Which bodies are being joined.
pub object_ids: Vec<Uuid>,
/// The maximum acceptable surface gap computed between the joints. Must be positive (i.e. greater than zero).
pub tolerance: LengthUnit,
}
/// Command for creating a blend between the edge of two given surfaces
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct SurfaceBlend {
/// The two surfaces that the blend will span between
#[schemars(length(min = 2, max = 2))]
pub surfaces: Vec<SurfaceEdgeReference>,
/// The type of blend to use.
#[serde(default)]
#[builder(default)]
pub blend_type: BlendType,
}
/// What is the UUID of this body's n-th edge?
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Solid3dGetEdgeUuid {
/// The Solid3D parent who owns the edge
pub object_id: Uuid,
/// The primitive index of the edge being queried.
pub edge_index: u32,
}
/// What is the UUID of this body's n-th face?
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Solid3dGetFaceUuid {
/// The Solid3D parent who owns the face
pub object_id: Uuid,
/// The primitive index of the face being queried.
pub face_index: u32,
}
/// Retrieves the body type.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Solid3dGetBodyType {
/// The Solid3D whose body type is being queried.
pub object_id: Uuid,
}
/// Command for revolving a solid 2d about a brep edge
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct RevolveAboutEdge {
/// Which sketch to revolve.
/// Must be a closed 2D solid.
pub target: ModelingCmdId,
/// The edge to use as the axis of revolution, must be linear and lie in the plane of the solid
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edge_id: Option<Uuid>,
/// Edge reference to use as the axis of revolution (new API).
/// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edge_reference: Option<EdgeSpecifier>,
/// The signed angle of revolution (in degrees, must be <= 360 in either direction)
pub angle: Angle,
/// The maximum acceptable surface gap computed between the revolution surface joints. Must be positive (i.e. greater than zero).
pub tolerance: LengthUnit,
/// Should the revolution also revolve in the opposite direction along the given axis?
/// If so, this specifies its angle.
#[serde(default)]
#[builder(default)]
pub opposite: Opposite<Angle>,
/// Should this extrude create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
}
/// Command for lofting sections to create a solid
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Loft {
/// The closed section curves to create a lofted solid from.
/// Currently, these must be Solid2Ds
pub section_ids: Vec<Uuid>,
/// Degree of the interpolation. Must be greater than zero.
/// For example, use 2 for quadratic, or 3 for cubic interpolation in the V direction.
pub v_degree: std::num::NonZeroU32,
/// Attempt to approximate rational curves (such as arcs) using a bezier.
/// This will remove banding around interpolations between arcs and non-arcs. It may produce errors in other scenarios
/// Over time, this field won't be necessary.
pub bez_approximate_rational: bool,
/// This can be set to override the automatically determined topological base curve, which is usually the first section encountered.
pub base_curve_index: Option<u32>,
/// Tolerance
pub tolerance: LengthUnit,
/// Should this loft create a solid body or a surface?
#[serde(default)]
#[builder(default)]
pub body_type: BodyType,
}
/// Closes a path, converting it to a 2D solid.
#[derive(
Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder
)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct ClosePath {
/// Which path to close.
pub path_id: Uuid,
}
/// Camera drag started.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct CameraDragStart {
/// The type of camera drag interaction.
pub interaction: CameraDragInteractionType,
/// The initial mouse position.
pub window: Point2d,
}
/// Camera drag continued.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct CameraDragMove {
/// The type of camera drag interaction.
pub interaction: CameraDragInteractionType,
/// The current mouse position.
pub window: Point2d,
/// Logical timestamp. The client should increment this
/// with every event in the current mouse drag. That way, if the
/// events are being sent over an unordered channel, the API
/// can ignore the older events.
pub sequence: Option<u32>,
}
/// Camera drag ended
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct CameraDragEnd {
/// The type of camera drag interaction.
pub interaction: CameraDragInteractionType,
/// The final mouse position.
pub window: Point2d,
}
/// Gets the default camera's camera settings
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct DefaultCameraGetSettings {}
/// Gets the default camera's view state
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct DefaultCameraGetView {}
/// Sets the default camera's view state
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct DefaultCameraSetView {
/// Camera view state
pub view: CameraViewState,
}
/// Change what the default camera is looking at.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct DefaultCameraLookAt {
/// Where the camera is positioned
pub vantage: Point3d,
/// What the camera is looking at. Center of the camera's field of vision
pub center: Point3d,
/// Which way is "up", from the camera's point of view.
pub up: Point3d,
/// Logical timestamp. The client should increment this
/// with every event in the current mouse drag. That way, if the
/// events are being sent over an unordered channel, the API
/// can ignore the older events.
pub sequence: Option<u32>,
}
/// Change what the default camera is looking at.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct DefaultCameraPerspectiveSettings {
/// Where the camera is positioned
pub vantage: Point3d,
/// What the camera is looking at. Center of the camera's field of vision
pub center: Point3d,
/// Which way is "up", from the camera's point of view.
pub up: Point3d,
/// The field of view angle in the y direction, in degrees.
pub fov_y: Option<f32>,
/// The distance to the near clipping plane.
pub z_near: Option<f32>,
/// The distance to the far clipping plane.
pub z_far: Option<f32>,
/// Logical timestamp. The client should increment this
/// with every event in the current mouse drag. That way, if the
/// events are being sent over an unordered channel, the API
/// can ignore the older events.
pub sequence: Option<u32>,
}
/// Adjust zoom of the default camera.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct DefaultCameraZoom {
/// Move the camera forward along the vector it's looking at,
/// by this magnitudedefaultCameraZoom.
/// Basically, how much should the camera move forward by.
pub magnitude: f32,
}
/// Export a sketch to a file.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Export2d {
/// IDs of the entities to be exported.
pub entity_ids: Vec<Uuid>,
/// The file format to export to.
pub format: OutputFormat2d,
}
/// Export the scene to a file.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Export3d {
/// IDs of the entities to be exported. If this is empty, then all entities are exported.
#[builder(default)]
pub entity_ids: Vec<Uuid>,
/// The file format to export to.
pub format: OutputFormat3d,
}
/// Export the scene to a file.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct Export {
/// IDs of the entities to be exported. If this is empty, then all entities are exported.
#[builder(default)]
pub entity_ids: Vec<Uuid>,
/// The file format to export to.
pub format: OutputFormat3d,
}
/// What is this entity's parent?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetParentId {
/// ID of the entity being queried.
pub entity_id: Uuid,
}
/// How many children does the entity have?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetNumChildren {
/// ID of the entity being queried.
pub entity_id: Uuid,
}
/// What is the UUID of this entity's n-th child?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetChildUuid {
/// ID of the entity being queried.
pub entity_id: Uuid,
/// Index into the entity's list of children.
pub child_index: u32,
}
/// What is this entity's child index within its parent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetIndex {
/// ID of the entity being queried.
pub entity_id: Uuid,
}
/// What is this edge or face entity's primitive index within its parent body's edges or faces array respectively
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetPrimitiveIndex {
/// ID of the entity being queried.
pub entity_id: Uuid,
}
/// Attempts to delete children entity from an entity.
/// Note that this API may change the body type of certain entities from Solid to Surface.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityDeleteChildren {
/// ID of the entity being modified
pub entity_id: Uuid,
/// ID of the entity's child being deleted
pub child_entity_ids: HashSet<Uuid>,
}
/// What are all UUIDs of this entity's children?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetAllChildUuids {
/// ID of the entity being queried.
pub entity_id: Uuid,
}
/// What are all UUIDs of all the paths sketched on top of this entity?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetSketchPaths {
/// ID of the entity being queried.
pub entity_id: Uuid,
}
/// What is the distance between these two entities?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityGetDistance {
/// ID of the first entity being queried.
pub entity_id1: Uuid,
/// ID of the second entity being queried.
pub entity_id2: Uuid,
/// Type of distance to be measured.
pub distance_type: DistanceType,
}
/// What is the length of this edge?
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EdgeGetLength {
/// ID of the edge being queried.
pub edge_id: Uuid,
}
/// Create a pattern using this entity by specifying the transform for each desired repetition.
/// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityClone {
/// ID of the entity being cloned.
pub entity_id: Uuid,
}
/// Create a pattern using this entity by specifying the transform for each desired repetition.
/// Transformations are performed in the following order (first applied to last applied): scale, rotate, translate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityLinearPatternTransform {
/// ID of the entity being copied.
pub entity_id: Uuid,
/// How to transform each repeated solid.
/// The 0th transform will create the first copy of the entity.
/// The total number of (optional) repetitions equals the size of this list.
#[serde(default)]
#[builder(default)]
pub transform: Vec<crate::shared::Transform>,
/// Alternatively, you could set this key instead.
/// If you want to use multiple transforms per item.
/// If this is non-empty then the `transform` key must be empty, and vice-versa.
#[serde(default)]
#[builder(default)]
pub transforms: Vec<Vec<crate::shared::Transform>>,
}
/// Create a linear pattern using this entity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityLinearPattern {
/// ID of the entity being copied.
pub entity_id: Uuid,
/// Axis along which to make the copies.
/// For Solid2d patterns, the z component is ignored.
pub axis: Point3d<f64>,
/// Number of repetitions to make.
pub num_repetitions: u32,
/// Spacing between repetitions.
pub spacing: LengthUnit,
}
/// Create a circular pattern using this entity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityCircularPattern {
/// ID of the entity being copied.
pub entity_id: Uuid,
/// Axis around which to make the copies.
/// For Solid2d patterns, this is ignored.
pub axis: Point3d<f64>,
/// Point around which to make the copies.
/// For Solid2d patterns, the z component is ignored.
pub center: Point3d<LengthUnit>,
/// Number of repetitions to make.
pub num_repetitions: u32,
/// Arc angle (in degrees) to place repetitions along.
pub arc_degrees: f64,
/// Whether or not to rotate the objects as they are copied.
pub rotate_duplicates: bool,
}
/// Create a helix using the input cylinder and other specified parameters.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityMakeHelix {
/// ID of the cylinder.
pub cylinder_id: Uuid,
/// Number of revolutions.
pub revolutions: f64,
/// Start angle.
#[serde(default)]
#[builder(default)]
pub start_angle: Angle,
/// Is the helix rotation clockwise?
pub is_clockwise: bool,
/// Length of the helix. If None, the length of the cylinder will be used instead.
pub length: Option<LengthUnit>,
}
/// Create a helix using the specified parameters.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityMakeHelixFromParams {
/// Radius of the helix.
pub radius: LengthUnit,
/// Length of the helix.
pub length: LengthUnit,
/// Number of revolutions.
pub revolutions: f64,
/// Start angle.
#[serde(default)]
#[builder(default)]
pub start_angle: Angle,
/// Is the helix rotation clockwise?
pub is_clockwise: bool,
/// Center of the helix at the base of the helix.
pub center: Point3d<LengthUnit>,
/// Axis of the helix. The helix will be created around and in the direction of this axis.
pub axis: Point3d<f64>,
}
/// Create a helix using the specified parameters.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityMakeHelixFromEdge {
/// Radius of the helix.
pub radius: LengthUnit,
/// Length of the helix. If None, the length of the edge will be used instead.
pub length: Option<LengthUnit>,
/// Number of revolutions.
pub revolutions: f64,
/// Start angle.
#[serde(default)]
#[builder(default)]
pub start_angle: Angle,
/// Is the helix rotation clockwise?
pub is_clockwise: bool,
/// Edge ID about which to make the helix (legacy API, for backwards compatibility).
/// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edge_id: Option<Uuid>,
/// Edge reference about which to make the helix (new API).
/// If both `edge_id` and `edge_reference` are provided, `edge_reference` takes precedence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub edge_reference: Option<EdgeSpecifier>,
}
/// Mirror the input entities over the specified axis, edge, or plane.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityMirrorAcross {
/// ID of the mirror entities.
pub ids: Vec<Uuid>,
/// What to mirror across
pub across: MirrorAcross,
}
/// Mirror the input entities over the specified axis.
/// Deprecated; please use `EntityMirrorAcross`
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, JsonSchema, ModelingCmdVariant, Builder)]
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)]
pub struct EntityMirror {
/// ID of the mirror entities.
pub ids: Vec<Uuid>,
/// Axis to use as mirror.
pub axis: Point3d<f64>,
/// Point through which the mirror axis passes.
pub point: Point3d<LengthUnit>,
}
/// Mirror the input entities over the specified edge.
/// Deprecated; please use `EntityMirrorAcross`