feat(entities): surface remaining 2D + Region fields in properties

Closes out the 2D-entity audit (and the Region partner that ships next
to Solid3D / Body). Round-trip-only metadata fields plus a few editable
ones gain Properties-panel rows so the values the parser populates are
visible and don't get silently dropped on save:

- Hatch: seed_points count, pixel_size, normal
- Polyline2D: smooth_surface, default_start_width, default_end_width,
  thickness, normal (with editors for the widths/thickness)
- Region: uid, silhouettes (shared file with Solid3D / Body)
- Underlay: clip_inverted
- RasterImage: class_version, definition_handle, definition_reactor_handle
- Wipeout: class_version, clip_mode, definition_handle,
  definition_reactor_handle
- Leader: annotation_handle, override_color
- Tolerance: dimension_style_name, dimension_style_handle, dimension_gap,
  text_height (editable), direction, normal
- MLine: style_handle, style_element_count, justification picker
- Ole2Frame: version, source_application, binary_data size, dwg_mode,
  dwg_trailing_byte, is_paper_space
- Viewport: snap_base/spacing/angle, twist_angle, front/back clip Z,
  circle_sides, grid_flags, grid_major, base_ucs_handle, ucs_ortho_type,
  background_handle, shade_plot_handle, visual_style_handle,
  default_lighting, default_lighting_type, ambient_color (with editors
  for the snap / clip / circle_sides values)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-05-19 21:28:16 +03:00
commit 0b4facc50d
10 changed files with 361 additions and 1 deletions

View file

@ -347,11 +347,29 @@ impl Grippable for Polyline2D {
impl PropertyEditable for Polyline2D {
fn geometry_properties(&self, _text_style_names: &[String]) -> PropSection {
let smooth = match self.smooth_surface {
acadrust::entities::SmoothSurfaceType::None => "None",
acadrust::entities::SmoothSurfaceType::QuadraticBSpline => "Quadratic",
acadrust::entities::SmoothSurfaceType::CubicBSpline => "Cubic",
acadrust::entities::SmoothSurfaceType::Bezier => "Bezier",
};
PropSection {
title: "Geometry".into(),
props: vec![
ro("Vertices", "vertices", self.vertices.len().to_string()),
edit("Elevation", "pl2_elevation", self.elevation),
edit("Default Start W", "pl2_start_w", self.start_width),
edit("Default End W", "pl2_end_w", self.end_width),
edit("Thickness", "pl2_thickness", self.thickness),
ro("Smooth Surface", "pl2_smooth", smooth),
ro(
"Normal",
"pl2_normal",
format!(
"{:.3}, {:.3}, {:.3}",
self.normal.x, self.normal.y, self.normal.z
),
),
Property {
label: "Closed".into(),
field: "pl2_closed",
@ -383,6 +401,25 @@ impl PropertyEditable for Polyline2D {
self.elevation = v;
}
}
"pl2_start_w" => {
if let Ok(v) = value.trim().parse::<f64>() {
if v >= 0.0 {
self.start_width = v;
}
}
}
"pl2_end_w" => {
if let Ok(v) = value.trim().parse::<f64>() {
if v >= 0.0 {
self.end_width = v;
}
}
}
"pl2_thickness" => {
if let Ok(v) = value.trim().parse::<f64>() {
self.thickness = v;
}
}
_ => {}
}
}