forked from 1b-agent/opencadstudio-upstream
arc: Arc length is editable in Properties
Typing a length keeps the start angle and moves the end along the circle; a length outside (0, 2πr) is ignored (#1408). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6f14b53aff
commit
bfc9ead28d
1 file changed
+5
-5
+5
-5
@@ -210,11 +210,7 @@ fn properties(arc: &Arc) -> Vec<PropSection> {
|
|||||||
"total_angle",
|
"total_angle",
|
||||||
format_angle(total_angle.to_radians()),
|
format_angle(total_angle.to_radians()),
|
||||||
),
|
),
|
||||||
ro(
|
edit(t!("Arc length").as_ref(), "arc_length", arc_length),
|
||||||
t!("Arc length").as_ref(),
|
|
||||||
"arc_length",
|
|
||||||
format_length(arc_length),
|
|
||||||
),
|
|
||||||
ro(t!("Area").as_ref(), "area", format_area(area)),
|
ro(t!("Area").as_ref(), "area", format_area(area)),
|
||||||
edit(t!("Normal X").as_ref(), "normal_x", arc.normal.x),
|
edit(t!("Normal X").as_ref(), "normal_x", arc.normal.x),
|
||||||
edit(t!("Normal Y").as_ref(), "normal_y", arc.normal.y),
|
edit(t!("Normal Y").as_ref(), "normal_y", arc.normal.y),
|
||||||
@@ -248,6 +244,10 @@ fn apply_geom_prop(arc: &mut Arc, field: &str, value: &str) {
|
|||||||
"radius" if v > 0.0 => arc.radius = v,
|
"radius" if v > 0.0 => arc.radius = v,
|
||||||
"start_angle" => arc.start_angle = v.to_radians(),
|
"start_angle" => arc.start_angle = v.to_radians(),
|
||||||
"end_angle" => arc.end_angle = v.to_radians(),
|
"end_angle" => arc.end_angle = v.to_radians(),
|
||||||
|
// The start stays put; the end moves along the circle.
|
||||||
|
"arc_length" if v > 0.0 && v < TAU * arc.radius => {
|
||||||
|
arc.end_angle = (arc.start_angle + v / arc.radius).rem_euclid(TAU);
|
||||||
|
}
|
||||||
"normal_x" | "normal_y" | "normal_z" => {
|
"normal_x" | "normal_y" | "normal_z" => {
|
||||||
let center = arc.center_wcs();
|
let center = arc.center_wcs();
|
||||||
let mut normal = kernel::space::Vec3::new(arc.normal.x, arc.normal.y, arc.normal.z);
|
let mut normal = kernel::space::Vec3::new(arc.normal.x, arc.normal.y, arc.normal.z);
|
||||||
|
|||||||
Reference in new issue
Block a user