Skip to content

Commit 040d386

Browse files
authored
Allow CSG fillets and chamfers (#873)
1 parent 98d1941 commit 040d386

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

modeling-cmds/src/def_enum.rs

Lines changed: 18 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,30 @@ 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+
#[serde(default)]
846+
pub edge_id: Option<Uuid>,
847+
/// Which edges you want to fillet.
848+
#[serde(default)]
849+
pub edge_ids: Vec<Uuid>,
845850
/// 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).
846851
pub radius: LengthUnit,
847852
/// The maximum acceptable surface gap computed between the filleted surfaces. Must be positive (i.e. greater than zero).
848853
pub tolerance: LengthUnit,
849854
/// How to apply the cut.
850855
#[serde(default)]
851856
pub cut_type: CutType,
857+
/// Which cutting algorithm to use.
858+
#[serde(default)]
859+
pub strategy: CutStrategy,
860+
/// What IDs should the resulting faces have?
861+
/// If you've only passed one edge ID, its ID will
862+
/// be the command ID used to send this command, and this
863+
/// field should be empty.
864+
/// If you've passed `n` IDs (to fillet `n` edges), then
865+
/// this should be length `n-1`, and the first edge will use
866+
/// the command ID used to send this command.
867+
#[serde(default)]
868+
pub extra_face_ids: Vec<Uuid>,
852869
}
853870

854871
/// 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)