Skip to content

Commit ecaeb0c

Browse files
committed
Allow CSG fillets and chamfers
1 parent 98d1941 commit ecaeb0c

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

modeling-cmds/src/def_enum.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ define_modeling_cmd_enum! {
2525
Angle,
2626
ComponentTransform,
2727
CutType,
28+
CutStrategy,
2829
CameraMovement,
2930
ExtrudedFaceInfo,
3031
AnnotationOptions, AnnotationType, CameraDragInteractionType, Color, DistanceType, EntityType,
@@ -841,14 +842,29 @@ define_modeling_cmd_enum! {
841842
/// Which object is being filletted.
842843
pub object_id: Uuid,
843844
/// Which edge you want to fillet.
844-
pub edge_id: Uuid,
845+
pub edge_id: Option<Uuid>,
846+
/// Which edges you want to fillet.
847+
#[serde(default)]
848+
pub edge_ids: Vec<Uuid>,
845849
/// The radius of the fillet. Measured in length (using the same units that the current sketch uses). Must be positive (i.e. greater than zero).
846850
pub radius: LengthUnit,
847851
/// The maximum acceptable surface gap computed between the filleted surfaces. Must be positive (i.e. greater than zero).
848852
pub tolerance: LengthUnit,
849853
/// How to apply the cut.
850854
#[serde(default)]
851855
pub cut_type: CutType,
856+
/// Which cutting algorithm to use.
857+
#[serde(default)]
858+
pub strategy: CutStrategy,
859+
/// What IDs should the resulting faces have?
860+
/// If you've only passed one edge ID, its ID will
861+
/// be the command ID used to send this command, and this
862+
/// field should be empty.
863+
/// If you've passed `n` IDs (to fillet `n` edges), then
864+
/// this should be length `n-1`, and the first edge will use
865+
/// the command ID used to send this command.
866+
#[serde(default)]
867+
pub extra_face_ids: Vec<Uuid>,
852868
}
853869

854870
/// Determines whether a brep face is planar and returns its surface-local planar axes if so

modeling-cmds/src/shared.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,3 +1134,21 @@ impl<T: JsonSchema> JsonSchema for Opposite<T> {
11341134
.into()
11351135
}
11361136
}
1137+
1138+
/// What strategy (algorithm) should be used for cutting?
1139+
/// Defaults to Automatic.
1140+
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize, JsonSchema, Default)]
1141+
#[serde(rename_all = "snake_case")]
1142+
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
1143+
#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))]
1144+
pub enum CutStrategy {
1145+
/// Basic fillet cut. This has limitations, like the filletted edges
1146+
/// can't touch each other. But it's very fast and simple.
1147+
Basic,
1148+
/// More complicated fillet cut. It works for more use-cases, like
1149+
/// edges that touch each other. But it's slower than the Basic method.
1150+
Csg,
1151+
/// Tries the Basic method, and if that doesn't work, tries the CSG strategy.
1152+
#[default]
1153+
Automatic,
1154+
}

0 commit comments

Comments
 (0)