forked from 1b-agent/opencadstudio-upstream
Align radius dimension properties and graphics
This commit is contained in:
1 parent
d33c52a0b8
commit
205893c784
2 files changed
+227
-26
No files matched your search
@@ -352,6 +352,7 @@ fn inherited_real(doc: &CadDocument, handle: Handle, code: i16) -> f64 {
|
||||
};
|
||||
match code {
|
||||
DIMGAP => style.dimgap,
|
||||
DIMCEN => style.dimcen,
|
||||
DIMTP => style.dimtp,
|
||||
DIMTM => style.dimtm,
|
||||
_ => 0.0,
|
||||
@@ -390,6 +391,30 @@ pub fn set_property(
|
||||
value: &str,
|
||||
) -> bool {
|
||||
let trimmed = value.trim();
|
||||
if field == "dim_center_type" {
|
||||
let current = inherited_real(doc, handle, DIMCEN);
|
||||
let size = current.abs().max(0.01);
|
||||
let value = match trimmed.to_ascii_lowercase().as_str() {
|
||||
"none" => 0.0,
|
||||
"mark" => size,
|
||||
"lines" => -size,
|
||||
_ => return false,
|
||||
};
|
||||
set(doc, handle, DIMCEN, Some(XDataValue::Real(value)));
|
||||
return true;
|
||||
}
|
||||
if field == "dim_center_size" {
|
||||
let Ok(size) = trimmed.parse::<f64>() else {
|
||||
return false;
|
||||
};
|
||||
if !size.is_finite() || size < 0.0 {
|
||||
return false;
|
||||
}
|
||||
let current = inherited_real(doc, handle, DIMCEN);
|
||||
let value = if current < 0.0 { -size } else { size };
|
||||
set(doc, handle, DIMCEN, Some(XDataValue::Real(value)));
|
||||
return true;
|
||||
}
|
||||
let handle_field = match field {
|
||||
"dim_arrowhead_1" => Some(DIMBLK1),
|
||||
"dim_arrowhead_2" => Some(DIMBLK2),
|
||||
|
||||
Reference in new issue
Block a user