forked from 1b-agent/opencadstudio-upstream
fix: align concentric constraint behavior
This commit is contained in:
1 parent
a27545c379
commit
a6a70420c4
15 files changed
+668
-46
No files matched your search
+22
-4
@@ -3,7 +3,7 @@ use crate::t;
|
||||
|
||||
use crate::command::EntityTransform;
|
||||
use crate::entities::common::{
|
||||
center_grip, edit_prop as edit, parse_f64, ro_prop as ro, square_grip,
|
||||
center_grip, edit_prop as edit, parse_f64, square_grip,
|
||||
};
|
||||
use crate::entities::traits::RenderConvertible;
|
||||
use crate::scene::convert::acad_to_render::{extrusion_wall_tris, RenderEntity, RenderObject};
|
||||
@@ -169,9 +169,9 @@ fn properties(circle: &Circle) -> Vec<PropSection> {
|
||||
edit(t!("Diameter").as_ref(), "diameter", r * 2.0),
|
||||
edit(t!("Circumference").as_ref(), "circumference", 2.0 * PI * r),
|
||||
edit(t!("Area").as_ref(), "area", PI * r * r),
|
||||
ro(t!("Normal X").as_ref(), "normal_x", format!("{:.4}", circle.normal.x)),
|
||||
ro(t!("Normal Y").as_ref(), "normal_y", format!("{:.4}", circle.normal.y)),
|
||||
ro(t!("Normal Z").as_ref(), "normal_z", format!("{:.4}", circle.normal.z)),
|
||||
edit(t!("Normal X").as_ref(), "normal_x", circle.normal.x),
|
||||
edit(t!("Normal Y").as_ref(), "normal_y", circle.normal.y),
|
||||
edit(t!("Normal Z").as_ref(), "normal_z", circle.normal.z),
|
||||
],
|
||||
}]
|
||||
}
|
||||
@@ -202,6 +202,24 @@ fn apply_geom_prop(circle: &mut Circle, field: &str, value: &str) {
|
||||
"diameter" if v > 0.0 => circle.radius = v / 2.0,
|
||||
"circumference" if v > 0.0 => circle.radius = v / (2.0 * PI),
|
||||
"area" if v > 0.0 => circle.radius = (v / PI).sqrt(),
|
||||
"normal_x" | "normal_y" | "normal_z" => {
|
||||
let center = circle.center_wcs();
|
||||
let mut normal = glam::DVec3::new(circle.normal.x, circle.normal.y, circle.normal.z);
|
||||
match field {
|
||||
"normal_x" => normal.x = v,
|
||||
"normal_y" => normal.y = v,
|
||||
"normal_z" => normal.z = v,
|
||||
_ => {}
|
||||
}
|
||||
if let Some(normal) = normal.try_normalize() {
|
||||
circle.normal = acadrust::types::Vector3::new(normal.x, normal.y, normal.z);
|
||||
let (x, y, z) = crate::scene::view::transform::wcs_point_to_ocs(
|
||||
(center.x, center.y, center.z),
|
||||
(normal.x, normal.y, normal.z),
|
||||
);
|
||||
circle.center = acadrust::types::Vector3::new(x, y, z);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user