forked from 1b-agent/opencadstudio-upstream
Angular dimensional constraint: reference flow, dynamic angular dimension, angN parameters
DCANGULAR picks two lines, an arc or three points, takes the dimension line location to choose the sector and the value or name, and creates the dynamic two-line or three-point angular dimension driven by an angN parameter. Reference messages for invalid, repeated and parallel sides, existing names and invalid names; angle values display within one turn at the angular precision; the first side (or vertex and first point) stays when the value changes; the ribbon Dimensional panel follows the reference order. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
960d51d955
commit
4ad4041858
8 files changed
+928
-162
No files matched your search
@@ -1093,7 +1093,7 @@ fn point_angle_in_frame(vertex: DVec3, point: DVec3, frame: (f64, f64)) -> bool
|
||||
(angle - frame.0).rem_euclid(std::f64::consts::TAU) <= sweep + 1.0e-9
|
||||
}
|
||||
|
||||
fn two_line_frame(
|
||||
pub(crate) fn two_line_frame(
|
||||
first_start: DVec3,
|
||||
first_end: DVec3,
|
||||
second_start: DVec3,
|
||||
@@ -1186,6 +1186,51 @@ fn angular_preview_with_frame(
|
||||
points
|
||||
}
|
||||
|
||||
/// A two-line angular dimension whose arc sits at `arc_point`, for a
|
||||
/// dimensional constraint; `None` when the lines are parallel or the arc
|
||||
/// point picks no sector.
|
||||
pub(crate) fn angular_two_line_entity(
|
||||
first_start: DVec3,
|
||||
first_end: DVec3,
|
||||
second_start: DVec3,
|
||||
second_end: DVec3,
|
||||
arc_point: DVec3,
|
||||
text: Option<String>,
|
||||
) -> Option<EntityType> {
|
||||
two_line_frame(first_start, first_end, second_start, second_end, arc_point)?;
|
||||
let mut dim = DimensionAngular2Ln::default();
|
||||
dim.first_point = v3(first_start);
|
||||
dim.second_point = v3(first_end);
|
||||
dim.angle_vertex = v3(second_start);
|
||||
dim.definition_point = v3(second_end);
|
||||
dim.dimension_arc = v3(arc_point);
|
||||
dim.base.definition_point = dim.definition_point;
|
||||
dim.base.text_middle_point = dim.dimension_arc;
|
||||
dim.base.insertion_point = dim.dimension_arc;
|
||||
dim.base.actual_measurement = dim.measurement_degrees();
|
||||
crate::entities::dimension::set_dimension_text_override(&mut dim.base, text);
|
||||
Some(EntityType::Dimension(Dimension::Angular2Ln(dim)))
|
||||
}
|
||||
|
||||
/// A three-point angular dimension (vertex, two points, arc point), for a
|
||||
/// dimensional constraint.
|
||||
pub(crate) fn angular_three_point_entity(
|
||||
vertex: DVec3,
|
||||
first: DVec3,
|
||||
second: DVec3,
|
||||
arc_point: DVec3,
|
||||
text: Option<String>,
|
||||
) -> Option<EntityType> {
|
||||
let mut dim = DimensionAngular3Pt::new(v3(vertex), v3(first), v3(second));
|
||||
dim.definition_point = v3(arc_point);
|
||||
dim.base.definition_point = dim.definition_point;
|
||||
dim.base.text_middle_point = dim.definition_point;
|
||||
dim.base.insertion_point = dim.definition_point;
|
||||
dim.base.actual_measurement = dim.measurement_degrees();
|
||||
crate::entities::dimension::set_dimension_text_override(&mut dim.base, text);
|
||||
Some(EntityType::Dimension(Dimension::Angular3Pt(dim)))
|
||||
}
|
||||
|
||||
fn v3(point: DVec3) -> Vector3 {
|
||||
Vector3::new(point.x, point.y, point.z)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user