Dynamic angular constraint: screen-size extension lines, reference grips, Properties parity

Dynamic dimensions carry DIMEXO/DIMEXE/DIMASZ overrides in text-height
ratios, a two-line angular dimension draws extension lines only beyond
its sides, a selected dynamic angle shows triangle grips at the arc ends
with squares at the arc point and text, and the constraint dimension's
Properties follow the reference: kind titles, General before Constraint,
angular-precision Value and Measurement, drawn text position, reference
row order for Fit, Primary Units and Tolerances, and text/dimension line
alignment rows reading On as the aligned state.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Fable 5.1 committed 2026-09-22 11:58:59 +03:00
1 parent 160930b99a
commit b435af64cd
5 files changed
+302 -44

No files matched your search

+5 -3
View File
@@ -702,12 +702,14 @@ pub fn set_property(
| "dim_alt_precision"
| "dim_tolerance_precision"
| "dim_alt_tolerance_precision" => parse_precision_label(trimmed),
// "On" is text aligned with its dimension line: the horizontal
// flag (DIMTIH/DIMTOH) off.
"dim_text_outside_align" | "dim_text_inside_align" | "dim_line_inside" => {
yes(trimmed).map(|value| i16::from(value == 0))
}
"dim_ext_line_fixed"
| "dim_text_outside_align"
| "dim_text_inside_align"
| "dim_text_inside"
| "dim_line_forced"
| "dim_line_inside"
| "dim_alt_enabled" => yes(trimmed),
"dim_decimal_separator" => trimmed
.chars()
+168 -19
View File
@@ -2143,7 +2143,7 @@ pub fn style_sections(
choice(
t!("Text outside align").as_ref(),
"dim_text_outside_align",
on(int(ov::DIMTOH, s.dimtoh as i16) != 0),
on(int(ov::DIMTOH, s.dimtoh as i16) == 0),
&["On", "Off"],
true,
),
@@ -2178,9 +2178,15 @@ pub fn style_sections(
choice(
t!("Text inside align").as_ref(),
"dim_text_inside_align",
on(int(ov::DIMTIH, s.dimtih as i16) != 0),
on(int(ov::DIMTIH, s.dimtih as i16) == 0),
&["On", "Off"],
dimtix || matches!(dimension, Dimension::LargeRadial(_)),
dimtix
|| matches!(
dimension,
Dimension::LargeRadial(_)
| Dimension::Angular2Ln(_)
| Dimension::Angular3Pt(_)
),
),
property(
t!("Text position X").as_ref(),
@@ -2283,7 +2289,7 @@ pub fn style_sections(
choice(
t!("Dim line inside").as_ref(),
"dim_line_inside",
on(int(ov::DIMSOXD, s.dimsoxd as i16) != 0),
on(int(ov::DIMSOXD, s.dimsoxd as i16) == 0),
&["On", "Off"],
true,
),
@@ -2999,13 +3005,105 @@ pub fn style_sections(
];
}
sections.retain(|section| section.title != t!("Alternate Units").as_ref());
let by_order = |order: &'static [&'static str]| {
move |property: &Property| {
order
.iter()
.position(|field| *field == property.field)
.unwrap_or(order.len())
}
};
if let Some(tolerances) = sections
.iter_mut()
.find(|section| section.title == t!("Tolerances").as_ref())
{
tolerances
.props
.retain(|property| !property.field.starts_with("dim_alt_tolerance_"));
tolerances.props.retain(|property| {
!property.field.starts_with("dim_alt_tolerance_")
&& !matches!(
property.field,
"dim_tolerance_suppress_zero_feet" | "dim_tolerance_suppress_zero_inches"
)
});
tolerances.props.sort_by_key(by_order(&[
"dim_tolerance_alignment",
"dim_tolerance_display",
"dim_tolerance_limit_lower",
"dim_tolerance_limit_upper",
"dim_tolerance_pos_vert",
"dim_tolerance_precision",
"dim_tolerance_suppress_leading_zeros",
"dim_tolerance_suppress_trailing_zeros",
"dim_tolerance_text_height",
]));
}
// An arc has no dimension line extension.
if let Some(lines) = sections
.iter_mut()
.find(|section| section.title == t!("Lines & Arrows").as_ref())
{
lines.props.retain(|property| property.field != "dim_line_ext");
}
if let Some(fit) = sections
.iter_mut()
.find(|section| section.title == t!("Fit").as_ref())
{
fit.props.sort_by_key(by_order(&[
"dim_line_forced",
"dim_line_inside",
"dim_scale_overall",
"dim_fit",
"dim_text_inside",
"dim_text_movement",
]));
}
if let Some(units) = sections
.iter_mut()
.find(|section| section.title == t!("Primary Units").as_ref())
{
units.props.sort_by_key(by_order(&[
"dim_decimal_separator",
"dim_prefix",
"dim_suffix",
"dim_angle_suppress_leading_zeros",
"dim_angle_suppress_trailing_zeros",
"dim_angle_precision",
"dim_angle_units",
]));
}
// The measurement reads at the angular precision, and automatic text
// reports where it is drawn rather than an unset point.
if let Some(text_section) = sections
.iter_mut()
.find(|section| section.title == t!("Text").as_ref())
{
let automatic = stored_text_point(dimension)
.is_none()
.then(|| styled_dimension_text_position(dimension, s, 1.0));
for property in &mut text_section.props {
match property.field {
"measurement" => {
// The row shows the number at the angular precision,
// without the text's degree sign.
let value = format_angular_value(
displayed_measurement(dimension, Some(s)),
Some(s),
);
property.value =
PropValue::ReadOnly(value.trim_end_matches('°').to_string());
}
"text_x" => {
if let Some(position) = automatic {
property.value = PropValue::EditText(format!("{:.4}", position.x));
}
}
"text_y" => {
if let Some(position) = automatic {
property.value = PropValue::EditText(format!("{:.4}", position.y));
}
}
_ => {}
}
}
}
}
@@ -4724,18 +4822,51 @@ fn dimension_geometry(
let (p3, p4) = (lv(d.angle_vertex), lv(d.definition_point));
let arc_point = lv(d.dimension_arc);
match two_line_angle_frame(p1, p2, p3, p4, arc_point) {
Some((vertex, start, end)) => append_angular_dimension(
&mut g,
vertex,
vertex,
vertex,
arc_point,
arrow1,
arrow2,
Some((start, end)),
params,
suppress,
),
Some((vertex, start, end)) => {
// An extension line runs from a side's nearer end out to
// the arc only where the arc lies beyond that side; where
// the arc crosses the side itself there is nothing to add.
let radius = vertex.distance(arc_point);
let side = |angle: f32| -> (Vec3, bool) {
let dir = Vec3::new(angle.cos(), angle.sin(), 0.0);
let deviation =
|a: Vec3, b: Vec3| normalized_or(b - a, dir).cross(dir).length();
let (a, b) = if deviation(p1, p2) <= deviation(p3, p4) {
(p1, p2)
} else {
(p3, p4)
};
let along = |p: Vec3| (p - vertex).dot(dir);
let (lo, hi) = (along(a).min(along(b)), along(a).max(along(b)));
let arc_end = vertex + dir * radius;
let near = if a.distance(arc_end) <= b.distance(arc_end) {
a
} else {
b
};
(near, radius >= lo - 1e-6 && radius <= hi + 1e-6)
};
let (first, first_covered) = side(start);
let (second, second_covered) = side(end);
let suppress = SuppressFlags {
ext1: suppress.ext1 || first_covered,
ext2: suppress.ext2 || second_covered,
dim1: suppress.dim1,
dim2: suppress.dim2,
};
append_angular_dimension(
&mut g,
vertex,
first,
second,
arc_point,
arrow1,
arrow2,
Some((start, end)),
params,
suppress,
)
}
// Parallel lines have no vertex and so no angle to draw; the
// extension lines alone say where the dimension was.
None => {
@@ -6357,6 +6488,24 @@ pub(crate) fn dynamic_dimension_lock_anchor(
))
}
/// The two ends of an angular dimension's arc, each with the direction
/// pointing away from the arc: where a dynamic angle's triangle grips sit.
pub(crate) fn angular_arc_ends(dim: &Dimension) -> Option<[(glam::DVec3, glam::DVec3); 2]> {
let (vertex, start, end, radius) = angular_dimension_frame(dim)?;
let point = |angle: f32| {
let p = vertex + Vec3::new(angle.cos(), angle.sin(), 0.0) * radius;
glam::DVec3::new(p.x as f64, p.y as f64, p.z as f64)
};
let away = |angle: f32, sign: f32| {
glam::DVec3::new(
(-angle.sin() * sign) as f64,
(angle.cos() * sign) as f64,
0.0,
)
};
Some([(point(start), away(start, -1.0)), (point(end), away(end, 1.0))])
}
fn dimension_text_natural_rotation(dim: &Dimension) -> f64 {
let angle = match dim {
Dimension::Linear(d) => d.rotation,