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
@@ -18,6 +18,7 @@ pub struct DimensionCreationDefaults {
|
||||
pub text_height: f64,
|
||||
pub gap: f64,
|
||||
pub arrow_size: f64,
|
||||
pub jog_angle: f64,
|
||||
pub scale: f64,
|
||||
pub annotative: bool,
|
||||
}
|
||||
@@ -92,6 +93,9 @@ pub fn current_dimension_defaults(doc: &CadDocument) -> DimensionCreationDefault
|
||||
text_height: style.as_ref().map_or(2.5, |style| style.dimtxt),
|
||||
gap: style.as_ref().map_or(0.625, |style| style.dimgap),
|
||||
arrow_size: style.as_ref().map_or(2.5, |style| style.dimasz),
|
||||
jog_angle: style
|
||||
.as_ref()
|
||||
.map_or(std::f64::consts::FRAC_PI_4, |style| style.dimjogang),
|
||||
scale: style.as_ref().map_or(1.0, |style| {
|
||||
if style.annotative {
|
||||
1.0
|
||||
|
||||
@@ -460,6 +460,7 @@ pub(crate) fn radial_extension_points(
|
||||
let target_point = match dimension_entity {
|
||||
Dimension::Radius(radius) => radius.definition_point,
|
||||
Dimension::Diameter(diameter) => diameter.angle_vertex,
|
||||
Dimension::LargeRadial(radial) => radial.chord_point,
|
||||
_ => return None,
|
||||
};
|
||||
let association = document.objects.values().find_map(|object| {
|
||||
@@ -556,6 +557,11 @@ impl Scene {
|
||||
diameter.measurement() * 0.5,
|
||||
diameter.angle_vertex,
|
||||
)),
|
||||
Dimension::LargeRadial(radial) => Some((
|
||||
radial.definition_point,
|
||||
radial.measurement(),
|
||||
radial.chord_point,
|
||||
)),
|
||||
_ => None,
|
||||
};
|
||||
if let Some((center, measured_radius, chord)) = radial_data {
|
||||
@@ -711,6 +717,11 @@ impl Scene {
|
||||
diameter.measurement() * 0.5,
|
||||
diameter.angle_vertex,
|
||||
)),
|
||||
Dimension::LargeRadial(radial) => Some((
|
||||
radial.definition_point,
|
||||
radial.measurement(),
|
||||
radial.chord_point,
|
||||
)),
|
||||
_ => None,
|
||||
};
|
||||
if let Some((center, radius, chord)) = radial_data {
|
||||
@@ -892,6 +903,33 @@ impl Scene {
|
||||
}
|
||||
diameter.base.actual_measurement = diameter.measurement();
|
||||
}
|
||||
Dimension::LargeRadial(radial) => {
|
||||
let Some((source, angle)) = radial_source else {
|
||||
continue;
|
||||
};
|
||||
let old_center = radial.definition_point;
|
||||
let new_center = source.center_world();
|
||||
let new_chord = source.point_at_angle(angle);
|
||||
let center_delta = Vector3::new(
|
||||
new_center.x - old_center.x,
|
||||
new_center.y - old_center.y,
|
||||
new_center.z - old_center.z,
|
||||
);
|
||||
radial.definition_point = new_center;
|
||||
radial.base.definition_point = new_center;
|
||||
radial.chord_point = new_chord;
|
||||
if point_distance_squared(center_delta, Vector3::default()) > 1e-18 {
|
||||
radial.override_center = radial.override_center + center_delta;
|
||||
radial.jog_point = radial.jog_point + center_delta;
|
||||
if radial.base.text_user_positioned {
|
||||
radial.base.text_middle_point =
|
||||
radial.base.text_middle_point + center_delta;
|
||||
radial.base.insertion_point =
|
||||
radial.base.insertion_point + center_delta;
|
||||
}
|
||||
}
|
||||
radial.base.actual_measurement = radial.measurement();
|
||||
}
|
||||
Dimension::Ordinate(ordinate) => {
|
||||
if let Some(feature) = resolved[0] {
|
||||
ordinate.feature_location = feature;
|
||||
|
||||
Reference in new issue
Block a user