forked from 1b-agent/opencadstudio-upstream
Angular dimension drawing: ray-based three-point frame, text beside the arc
Three-point angular dimensions take their sweep from the two rays and the arc point (extension lines follow their own rays, straight and reflex angles draw), dynamic angular dimensions store no text point so DIMTAD places the text beside an unbroken arc, and dynamic dimensions carry a DIMGAP override of a quarter text height. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
4ad4041858
commit
160930b99a
4 files changed
+56
-15
No files matched your search
@@ -2252,7 +2252,7 @@ impl super::Scene {
|
||||
if self.dimension_is_annotational(handle) {
|
||||
continue;
|
||||
}
|
||||
for code in [ov::DIMSCALE, ov::DIMTIH, ov::DIMTOH] {
|
||||
for code in [ov::DIMSCALE, ov::DIMGAP, ov::DIMTIH, ov::DIMTOH] {
|
||||
ov::set(&mut document, handle, code, None);
|
||||
}
|
||||
}
|
||||
@@ -2304,6 +2304,10 @@ impl super::Scene {
|
||||
use crate::entities::dim_override as ov;
|
||||
let xdata = &dimension.base().common.extended_data;
|
||||
let current = ov::real(xdata, ov::DIMSCALE);
|
||||
// The gap between the text and its line is a quarter of the text
|
||||
// height on screen, whatever the style's DIMGAP is in units.
|
||||
let gap = text_height * 0.25;
|
||||
let gap_set = ov::real(xdata, ov::DIMGAP).is_some_and(|value| (value - gap).abs() < 1e-12);
|
||||
// The reference draws dynamic distance text horizontally; an
|
||||
// angle's text keeps its style's alignment.
|
||||
let angular = matches!(
|
||||
@@ -2313,7 +2317,7 @@ impl super::Scene {
|
||||
);
|
||||
let horizontal = angular
|
||||
|| (ov::int(xdata, ov::DIMTIH) == Some(1) && ov::int(xdata, ov::DIMTOH) == Some(1));
|
||||
if current.is_some_and(|value| (value - scale).abs() < 1e-9) && horizontal {
|
||||
if current.is_some_and(|value| (value - scale).abs() < 1e-9) && horizontal && gap_set {
|
||||
continue;
|
||||
}
|
||||
ov::set(
|
||||
@@ -2322,6 +2326,14 @@ impl super::Scene {
|
||||
ov::DIMSCALE,
|
||||
Some(acadrust::xdata::XDataValue::Real(scale)),
|
||||
);
|
||||
if !gap_set {
|
||||
ov::set(
|
||||
&mut self.document,
|
||||
handle,
|
||||
ov::DIMGAP,
|
||||
Some(acadrust::xdata::XDataValue::Real(gap)),
|
||||
);
|
||||
}
|
||||
if !horizontal {
|
||||
for code in [ov::DIMTIH, ov::DIMTOH] {
|
||||
ov::set(
|
||||
|
||||
Reference in new issue
Block a user