Complete Coincident command behavior

This commit is contained in:
ramox81 committed 2026-09-15 14:00:26 +03:00
1 parent dfe8b77cca
commit ba2b371269
13 files changed
+1183 -207

No files matched your search

+25 -5
View File
@@ -1237,6 +1237,17 @@ pub enum ExtrudeExtent {
Path(Handle),
}
/// One ordered selection used by the Coincident command. A click can name
/// either a constraint point on an entity or the entity's whole curve. Typed
/// coordinates have no entity handle and are resolved by the host after the
/// command returns.
#[derive(Clone, Copy, Debug)]
pub struct CoincidentPick {
pub handle: Option<Handle>,
pub point: DVec3,
pub whole_curve: bool,
}
/// Construction options shared by SWEEP creation and its live preview.
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct SweepOptions {
@@ -1466,14 +1477,21 @@ pub enum CmdResult {
/// Undo-history label, e.g. `"Horizontal constraint"`.
label: &'static str,
},
/// Adds a Coincident constraint between the sub-entity points nearest
/// the two picked positions. The host resolves the raw points because
/// `CadCommand` has no document access.
/// Adds an ordered Coincident relation. Point/point selections create a
/// Coincident constraint; point/curve selections create the corresponding
/// point-on-curve relation while retaining Coincident command semantics.
AddCoincidentConstraint {
point_a: DVec3,
point_b: DVec3,
first: CoincidentPick,
second: CoincidentPick,
/// Keep the first curve active and accept another point.
multiple: bool,
label: &'static str,
},
/// Apply only Coincident relations that already exist geometrically in
/// the selected set.
AddAutoCoincidentConstraints {
handles: Vec<Handle>,
},
/// Add a persistent `CenterPoint`/`Midpoint`/`PointOnCurve` constraint
/// (`crate::modules::parametric::point_on_entity`) between one
/// picked point and `target`, a whole entity selected before the tool
@@ -2681,6 +2699,8 @@ mod constraint_registry_tests {
let names = all_registered_command_names();
for id in [
"CCONSTRAINT",
"GCCOINCIDENT",
"GEOMCONSTRAINT",
"EDCONSTRAINT",
"CPCONSTRAINT",
"MPCONSTRAINT",