forked from 1b-agent/opencadstudio-upstream
Polish automatic constraint integration
This commit is contained in:
1 parent
c9eeb6f66e
commit
f61174eaad
3 files changed
+20
-11
No files matched your search
+2
-4
@@ -67,10 +67,8 @@ impl Default for AutoConstrainSettings {
|
|||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
priority: AutoConstraintKind::ALL.to_vec(),
|
priority: AutoConstraintKind::ALL.to_vec(),
|
||||||
// Equal remains available in the priority list, but the reference
|
// Keep Equal available without creating redundant relations
|
||||||
// application does not enable it in a fresh profile. Enabling it
|
// between equal-length segments by default.
|
||||||
// by default adds a redundant relation between equal-length line
|
|
||||||
// segments (including adjacent polyline segments).
|
|
||||||
enabled: AutoConstraintKind::ALL
|
enabled: AutoConstraintKind::ALL
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter(|kind| *kind != AutoConstraintKind::Equal)
|
.filter(|kind| *kind != AutoConstraintKind::Equal)
|
||||||
|
|||||||
+1
-1
@@ -12591,7 +12591,7 @@ mod layout_cache_tests {
|
|||||||
let mut arc = acadrust::entities::Arc::default();
|
let mut arc = acadrust::entities::Arc::default();
|
||||||
arc.radius = 25.0;
|
arc.radius = 25.0;
|
||||||
arc.start_angle = 0.0;
|
arc.start_angle = 0.0;
|
||||||
arc.end_angle = 3.14159;
|
arc.end_angle = std::f64::consts::PI;
|
||||||
let a_h = s.add_entity(EntityType::Arc(arc));
|
let a_h = s.add_entity(EntityType::Arc(arc));
|
||||||
|
|
||||||
let line = acadrust::entities::Line::from_points(
|
let line = acadrust::entities::Line::from_points(
|
||||||
|
|||||||
@@ -1356,9 +1356,18 @@ mod tests {
|
|||||||
std::f64::consts::PI,
|
std::f64::consts::PI,
|
||||||
));
|
));
|
||||||
|
|
||||||
assert_eq!(driven_ref_for_grip(&arc, handle, 0), Some(ParametricRef::center(handle)));
|
assert_eq!(
|
||||||
assert_eq!(driven_ref_for_grip(&arc, handle, 1), Some(ParametricRef::point(handle, 0)));
|
driven_ref_for_grip(&arc, handle, 0),
|
||||||
assert_eq!(driven_ref_for_grip(&arc, handle, 2), Some(ParametricRef::point(handle, 1)));
|
Some(ParametricRef::center(handle))
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
driven_ref_for_grip(&arc, handle, 1),
|
||||||
|
Some(ParametricRef::point(handle, 0))
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
driven_ref_for_grip(&arc, handle, 2),
|
||||||
|
Some(ParametricRef::point(handle, 1))
|
||||||
|
);
|
||||||
assert_eq!(driven_ref_for_grip(&arc, handle, 3), None);
|
assert_eq!(driven_ref_for_grip(&arc, handle, 3), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1528,9 +1537,11 @@ mod tests {
|
|||||||
fn hidden_constraint_stays_hidden_when_related_entity_is_selected() {
|
fn hidden_constraint_stays_hidden_when_related_entity_is_selected() {
|
||||||
let mut scene = super::super::Scene::new();
|
let mut scene = super::super::Scene::new();
|
||||||
let scope = ParametricScope::ModelSpace;
|
let scope = ParametricScope::ModelSpace;
|
||||||
let id = scene
|
let id = scene.parametric_constraint_set_mut(scope).add(
|
||||||
.parametric_constraint_set_mut(scope)
|
ConstraintKind::Horizontal,
|
||||||
.add(ConstraintKind::Horizontal, vec![ParametricRef::whole(h(1))], None);
|
vec![ParametricRef::whole(h(1))],
|
||||||
|
None,
|
||||||
|
);
|
||||||
scene.hidden_parametric_constraints.insert((scope, id));
|
scene.hidden_parametric_constraints.insert((scope, id));
|
||||||
|
|
||||||
assert!(!scene.should_display_parametric_constraint(scope, id, true, 2));
|
assert!(!scene.should_display_parametric_constraint(scope, id, true, 2));
|
||||||
|
|||||||
Reference in new issue
Block a user