forked from 1b-agent/opencadstudio-upstream
Complete jogged radius dimension workflow
This commit is contained in:
1 parent
bbd58eb9f2
commit
5a9894fd3e
11 files changed
+664
-85
No files matched your search
+71
-23
@@ -108,6 +108,47 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
|
||||
],
|
||||
}];
|
||||
}
|
||||
if let Dimension::LargeRadial(d) = dim {
|
||||
return vec![PropSection {
|
||||
title: t!("Misc").into_owned(),
|
||||
props: vec![
|
||||
Property {
|
||||
label: t!("Dimension style").into_owned(),
|
||||
field: "style_name",
|
||||
value: PropValue::PlainText(d.base.style_name.clone()),
|
||||
},
|
||||
edit(t!("Center X").as_ref(), "definition_x", d.definition_point.x),
|
||||
edit(t!("Center Y").as_ref(), "definition_y", d.definition_point.y),
|
||||
edit(t!("Center Z").as_ref(), "definition_z", d.definition_point.z),
|
||||
edit(t!("Chord X").as_ref(), "chord_x", d.chord_point.x),
|
||||
edit(t!("Chord Y").as_ref(), "chord_y", d.chord_point.y),
|
||||
edit(t!("Chord Z").as_ref(), "chord_z", d.chord_point.z),
|
||||
edit(
|
||||
t!("Override Center X").as_ref(),
|
||||
"override_x",
|
||||
d.override_center.x,
|
||||
),
|
||||
edit(
|
||||
t!("Override Center Y").as_ref(),
|
||||
"override_y",
|
||||
d.override_center.y,
|
||||
),
|
||||
edit(
|
||||
t!("Override Center Z").as_ref(),
|
||||
"override_z",
|
||||
d.override_center.z,
|
||||
),
|
||||
edit(t!("Jog X").as_ref(), "jog_x", d.jog_point.x),
|
||||
edit(t!("Jog Y").as_ref(), "jog_y", d.jog_point.y),
|
||||
edit(t!("Jog Z").as_ref(), "jog_z", d.jog_point.z),
|
||||
edit_angle(
|
||||
t!("Jog Angle").as_ref(),
|
||||
"jog_angle",
|
||||
d.jog_angle.to_degrees(),
|
||||
),
|
||||
],
|
||||
}];
|
||||
}
|
||||
let compact_linear = match dim {
|
||||
Dimension::Linear(d) => Some((
|
||||
&d.base,
|
||||
@@ -271,21 +312,7 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
|
||||
props.push(edit(t!("Leader 2 Y").as_ref(), "leader2_y", d.second_leader_point.y));
|
||||
props.push(edit(t!("Leader 2 Z").as_ref(), "leader2_z", d.second_leader_point.z));
|
||||
}
|
||||
Dimension::LargeRadial(d) => {
|
||||
props.push(edit(t!("Center X").as_ref(), "definition_x", d.definition_point.x));
|
||||
props.push(edit(t!("Center Y").as_ref(), "definition_y", d.definition_point.y));
|
||||
props.push(edit(t!("Center Z").as_ref(), "definition_z", d.definition_point.z));
|
||||
props.push(edit(t!("Chord X").as_ref(), "chord_x", d.chord_point.x));
|
||||
props.push(edit(t!("Chord Y").as_ref(), "chord_y", d.chord_point.y));
|
||||
props.push(edit(t!("Chord Z").as_ref(), "chord_z", d.chord_point.z));
|
||||
props.push(edit(t!("Override Center X").as_ref(), "override_x", d.override_center.x));
|
||||
props.push(edit(t!("Override Center Y").as_ref(), "override_y", d.override_center.y));
|
||||
props.push(edit(t!("Override Center Z").as_ref(), "override_z", d.override_center.z));
|
||||
props.push(edit(t!("Jog X").as_ref(), "jog_x", d.jog_point.x));
|
||||
props.push(edit(t!("Jog Y").as_ref(), "jog_y", d.jog_point.y));
|
||||
props.push(edit(t!("Jog Z").as_ref(), "jog_z", d.jog_point.z));
|
||||
props.push(edit_angle(t!("Jog Angle").as_ref(), "jog_angle", d.jog_angle.to_degrees()));
|
||||
}
|
||||
Dimension::LargeRadial(_) => unreachable!("handled by compact large-radial properties"),
|
||||
}
|
||||
vec![PropSection {
|
||||
title: t!("Geometry").into_owned(),
|
||||
@@ -1818,7 +1845,7 @@ pub fn style_sections(
|
||||
let linetype = |code, inherited| {
|
||||
linetype_name(document, ov::handle(data, code).unwrap_or(inherited))
|
||||
};
|
||||
let arrow_1 = if matches!(dimension, Dimension::Radius(_)) {
|
||||
let arrow_1 = if matches!(dimension, Dimension::Radius(_) | Dimension::LargeRadial(_)) {
|
||||
let inherited = if s.dimblk1.is_null() { s.dimblk } else { s.dimblk1 };
|
||||
let inherited_name = if s.dimblk1.is_null() {
|
||||
&s.dimblk_name
|
||||
@@ -2520,7 +2547,10 @@ pub fn style_sections(
|
||||
],
|
||||
},
|
||||
];
|
||||
if matches!(dimension, Dimension::Radius(_) | Dimension::Diameter(_)) {
|
||||
if matches!(
|
||||
dimension,
|
||||
Dimension::Radius(_) | Dimension::Diameter(_) | Dimension::LargeRadial(_)
|
||||
) {
|
||||
let dimcen = real(ov::DIMCEN, s.dimcen);
|
||||
let center_type = if dimcen > 1e-12 {
|
||||
"Center marks"
|
||||
@@ -2563,8 +2593,18 @@ pub fn style_sections(
|
||||
"dim_ext_line_ext",
|
||||
"dim_ext_line_offset",
|
||||
];
|
||||
const LARGE_RADIAL_LINE_FIELDS: &[&str] = &[
|
||||
"dim_arrowhead_1",
|
||||
"dim_arrow_size",
|
||||
"dim_line_lineweight",
|
||||
"dim_line_1",
|
||||
"dim_line_color",
|
||||
"dim_linetype",
|
||||
];
|
||||
let retained = if matches!(dimension, Dimension::Diameter(_)) {
|
||||
DIAMETER_LINE_FIELDS
|
||||
} else if matches!(dimension, Dimension::LargeRadial(_)) {
|
||||
LARGE_RADIAL_LINE_FIELDS
|
||||
} else {
|
||||
RADIUS_LINE_FIELDS
|
||||
};
|
||||
@@ -3405,9 +3445,9 @@ fn tessellate_dimension_inner(
|
||||
// DIMUPT governs interactive creation-time text placement; saved
|
||||
// geometry already carries the resulting position.
|
||||
let _ = s.dimupt;
|
||||
// DIMARCSYM only applies to arc-length dims; DIMJOGANG only to
|
||||
// jogged-radius dims. We don't ship those Dimension variants yet,
|
||||
// so the values are read for round-trip but not drawn.
|
||||
// Per-entity arc-symbol and jog-angle values are consumed by their
|
||||
// native dimension variants; the resolved style values remain the
|
||||
// creation defaults.
|
||||
let _ = (s.dimarcsym, s.dimjogang);
|
||||
// DIMUNIT is the obsolete pre-R2000 linear unit format; DIMLUNIT
|
||||
// supersedes it. Read but not honoured.
|
||||
@@ -4199,15 +4239,23 @@ fn dimension_geometry(
|
||||
let override_center = lv(d.override_center);
|
||||
let (near, far) =
|
||||
jogged_radial_break(chord, jog, override_center, d.jog_angle as f32);
|
||||
add_segment(&mut g.dim_lines, chord, near);
|
||||
add_segment(&mut g.dim_lines, near, far);
|
||||
add_segment(&mut g.dim_lines, far, override_center);
|
||||
if !suppress.dim1 {
|
||||
add_segment(&mut g.dim_lines, chord, near);
|
||||
add_segment(&mut g.dim_lines, near, far);
|
||||
add_segment(&mut g.dim_lines, far, override_center);
|
||||
}
|
||||
append_arrow(
|
||||
&mut g,
|
||||
chord,
|
||||
normalized_or(near - chord, Vec3::X),
|
||||
arrow1,
|
||||
);
|
||||
append_center_mark(
|
||||
&mut g,
|
||||
lv(d.definition_point),
|
||||
params.dimcen,
|
||||
(chord - lv(d.definition_point)).length(),
|
||||
);
|
||||
}
|
||||
}
|
||||
g
|
||||
|
||||
Reference in new issue
Block a user