feat(locale): localize full interface

This commit is contained in:
Hakan Seven 2026-08-02 22:09:25 +03:00
commit 3e6693b93f
205 changed files with 32367 additions and 3808 deletions

View file

@ -1,4 +1,5 @@
use acadrust::entities::Arc;
use crate::t;
use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
@ -152,26 +153,26 @@ fn properties(arc: &Arc) -> Vec<PropSection> {
let (ex, ey, ez) = arc_pt(ea);
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Start X", "start_x", format!("{sx:.4}")),
ro("Start Y", "start_y", format!("{sy:.4}")),
ro("Start Z", "start_z", format!("{sz:.4}")),
edit("Center X", "center_x", arc.center.x),
edit("Center Y", "center_y", arc.center.y),
edit("Center Z", "center_z", arc.center.z),
ro("End X", "end_x", format!("{ex:.4}")),
ro("End Y", "end_y", format!("{ey:.4}")),
ro("End Z", "end_z", format!("{ez:.4}")),
edit("Radius", "radius", arc.radius),
edit_angle("Start angle", "start_angle", sa.to_degrees()),
edit_angle("End angle", "end_angle", ea.to_degrees()),
ro("Total angle", "total_angle", format!("{total_angle:.2}")),
ro("Arc length", "arc_length", format!("{arc_length:.4}")),
ro("Area", "area", format!("{area:.4}")),
ro("Normal X", "normal_x", format!("{:.4}", arc.normal.x)),
ro("Normal Y", "normal_y", format!("{:.4}", arc.normal.y)),
ro("Normal Z", "normal_z", format!("{:.4}", arc.normal.z)),
ro(t!("Start X").as_ref(), "start_x", format!("{sx:.4}")),
ro(t!("Start Y").as_ref(), "start_y", format!("{sy:.4}")),
ro(t!("Start Z").as_ref(), "start_z", format!("{sz:.4}")),
edit(t!("Center X").as_ref(), "center_x", arc.center.x),
edit(t!("Center Y").as_ref(), "center_y", arc.center.y),
edit(t!("Center Z").as_ref(), "center_z", arc.center.z),
ro(t!("End X").as_ref(), "end_x", format!("{ex:.4}")),
ro(t!("End Y").as_ref(), "end_y", format!("{ey:.4}")),
ro(t!("End Z").as_ref(), "end_z", format!("{ez:.4}")),
edit(t!("Radius").as_ref(), "radius", arc.radius),
edit_angle(t!("Start angle").as_ref(), "start_angle", sa.to_degrees()),
edit_angle(t!("End angle").as_ref(), "end_angle", ea.to_degrees()),
ro(t!("Total angle").as_ref(), "total_angle", format!("{total_angle:.2}")),
ro(t!("Arc length").as_ref(), "arc_length", format!("{arc_length:.4}")),
ro(t!("Area").as_ref(), "area", format!("{area:.4}")),
ro(t!("Normal X").as_ref(), "normal_x", format!("{:.4}", arc.normal.x)),
ro(t!("Normal Y").as_ref(), "normal_y", format!("{:.4}", arc.normal.y)),
ro(t!("Normal Z").as_ref(), "normal_z", format!("{:.4}", arc.normal.z)),
],
}]
}

View file

@ -16,6 +16,7 @@ use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Pr
use crate::scene::model::wire_model::SnapHint;
use crate::scene::text::lff;
use crate::scene::view::transform;
use crate::t;
// ── Shared helpers ────────────────────────────────────────────────────────────
@ -414,22 +415,22 @@ impl PropertyEditable for AttributeDefinition {
fn geometry_properties(&self, text_style_names: &[String]) -> Vec<PropSection> {
let mut text_props = vec![
Property {
label: "Tag".into(),
label: t!("Tag").into_owned(),
field: "att_tag",
value: PropValue::EditText(self.tag.clone()),
},
Property {
label: "Prompt".into(),
label: t!("Prompt").into_owned(),
field: "att_prompt",
value: PropValue::EditText(self.prompt.clone()),
},
Property {
label: "Value".into(),
label: t!("Value").into_owned(),
field: "att_default",
value: PropValue::EditText(self.default_value.clone()),
},
Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "att_style",
value: PropValue::Choice {
selected: if self.text_style.trim().is_empty() {
@ -441,12 +442,12 @@ impl PropertyEditable for AttributeDefinition {
},
},
ro(
"Annotative",
t!("Annotative").as_ref(),
"att_annotative",
bool_yn(self.flags.annotative),
),
Property {
label: "Justify".into(),
label: t!("Justify").into_owned(),
field: "att_halign",
value: PropValue::Choice {
selected: halign_str(self.horizontal_alignment).to_string(),
@ -457,7 +458,7 @@ impl PropertyEditable for AttributeDefinition {
},
},
Property {
label: "V-Align".into(),
label: t!("V-Align").into_owned(),
field: "att_valign",
value: PropValue::Choice {
selected: valign_str(self.vertical_alignment).to_string(),
@ -467,25 +468,25 @@ impl PropertyEditable for AttributeDefinition {
.collect(),
},
},
edit("Height", "att_h", self.height),
edit_angle("Rotation", "att_rot", self.rotation.to_degrees()),
edit("Width factor", "att_wf", self.width_factor),
edit_angle("Obliquing", "att_ob", self.oblique_angle.to_degrees()),
edit("Text alignment X", "att_ax", self.alignment_point.x),
edit("Text alignment Y", "att_ay", self.alignment_point.y),
edit("Text alignment Z", "att_az", self.alignment_point.z),
edit(t!("Height").as_ref(), "att_h", self.height),
edit_angle(t!("Rotation").as_ref(), "att_rot", self.rotation.to_degrees()),
edit(t!("Width factor").as_ref(), "att_wf", self.width_factor),
edit_angle(t!("Obliquing").as_ref(), "att_ob", self.oblique_angle.to_degrees()),
edit(t!("Text alignment X").as_ref(), "att_ax", self.alignment_point.x),
edit(t!("Text alignment Y").as_ref(), "att_ay", self.alignment_point.y),
edit(t!("Text alignment Z").as_ref(), "att_az", self.alignment_point.z),
ro(
"Boundary width",
t!("Boundary width").as_ref(),
"att_field_len",
self.field_length.to_string(),
),
ro(
"Upside down",
t!("Upside down").as_ref(),
"att_upside_down",
bool_yn(self.text_generation_flags & 0x4 != 0),
),
ro(
"Backward",
t!("Backward").as_ref(),
"att_backward",
bool_yn(self.text_generation_flags & 0x2 != 0),
),
@ -499,27 +500,27 @@ impl PropertyEditable for AttributeDefinition {
}
vec![
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: text_props,
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "att_ix", self.insertion_point.x),
edit("Position Y", "att_iy", self.insertion_point.y),
edit("Position Z", "att_iz", self.insertion_point.z),
edit(t!("Position X").as_ref(), "att_ix", self.insertion_point.x),
edit(t!("Position Y").as_ref(), "att_iy", self.insertion_point.y),
edit(t!("Position Z").as_ref(), "att_iz", self.insertion_point.z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
ro("Invisible", "att_invisible", bool_yn(self.flags.invisible)),
ro("Constant", "att_constant", bool_yn(self.flags.constant)),
ro("Verify", "att_verify", bool_yn(self.flags.verify)),
ro("Preset", "att_preset", bool_yn(self.flags.preset)),
ro("Lock position", "att_lock_pos", bool_yn(self.lock_position)),
ro(t!("Invisible").as_ref(), "att_invisible", bool_yn(self.flags.invisible)),
ro(t!("Constant").as_ref(), "att_constant", bool_yn(self.flags.constant)),
ro(t!("Verify").as_ref(), "att_verify", bool_yn(self.flags.verify)),
ro(t!("Preset").as_ref(), "att_preset", bool_yn(self.flags.preset)),
ro(t!("Lock position").as_ref(), "att_lock_pos", bool_yn(self.lock_position)),
Property {
label: "Multiple lines".into(),
label: t!("Multiple lines").into_owned(),
field: "att_mtext_flag",
value: PropValue::Choice {
selected: mtext_flag_str(self.mtext_flag).to_string(),
@ -686,21 +687,21 @@ impl PropertyEditable for AttributeEntity {
fn geometry_properties(&self, text_style_names: &[String]) -> Vec<PropSection> {
vec![
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: vec![
Property {
label: "Tag".into(),
label: t!("Tag").into_owned(),
field: "atte_tag",
value: PropValue::EditText(self.tag.clone()),
},
ro("Prompt", "atte_prompt", String::new()),
ro(t!("Prompt").as_ref(), "atte_prompt", String::new()),
Property {
label: "Value".into(),
label: t!("Value").into_owned(),
field: "atte_val",
value: PropValue::EditText(self.value.clone()),
},
Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "atte_style",
value: PropValue::Choice {
selected: if self.text_style.trim().is_empty() {
@ -712,7 +713,7 @@ impl PropertyEditable for AttributeEntity {
},
},
Property {
label: "Justify".into(),
label: t!("Justify").into_owned(),
field: "atte_halign",
value: PropValue::Choice {
selected: halign_str(self.horizontal_alignment).to_string(),
@ -723,7 +724,7 @@ impl PropertyEditable for AttributeEntity {
},
},
Property {
label: "V-Align".into(),
label: t!("V-Align").into_owned(),
field: "atte_valign",
value: PropValue::Choice {
selected: valign_str(self.vertical_alignment).to_string(),
@ -734,56 +735,56 @@ impl PropertyEditable for AttributeEntity {
},
},
ro(
"Annotative",
t!("Annotative").as_ref(),
"atte_annotative",
bool_yn(self.flags.annotative),
),
edit("Height", "atte_h", self.height),
edit_angle("Rotation", "atte_rot", self.rotation.to_degrees()),
edit("Width factor", "atte_wf", self.width_factor),
edit_angle("Obliquing", "atte_ob", self.oblique_angle.to_degrees()),
edit("Text alignment X", "atte_ax", self.alignment_point.x),
edit("Text alignment Y", "atte_ay", self.alignment_point.y),
edit("Text alignment Z", "atte_az", self.alignment_point.z),
edit(t!("Height").as_ref(), "atte_h", self.height),
edit_angle(t!("Rotation").as_ref(), "atte_rot", self.rotation.to_degrees()),
edit(t!("Width factor").as_ref(), "atte_wf", self.width_factor),
edit_angle(t!("Obliquing").as_ref(), "atte_ob", self.oblique_angle.to_degrees()),
edit(t!("Text alignment X").as_ref(), "atte_ax", self.alignment_point.x),
edit(t!("Text alignment Y").as_ref(), "atte_ay", self.alignment_point.y),
edit(t!("Text alignment Z").as_ref(), "atte_az", self.alignment_point.z),
ro(
"Boundary width",
t!("Boundary width").as_ref(),
"atte_field_len",
self.field_length.to_string(),
),
],
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "atte_ix", self.insertion_point.x),
edit("Position Y", "atte_iy", self.insertion_point.y),
edit("Position Z", "atte_iz", self.insertion_point.z),
edit(t!("Position X").as_ref(), "atte_ix", self.insertion_point.x),
edit(t!("Position Y").as_ref(), "atte_iy", self.insertion_point.y),
edit(t!("Position Z").as_ref(), "atte_iz", self.insertion_point.z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
ro(
"Upside down",
t!("Upside down").as_ref(),
"atte_upside_down",
bool_yn(self.text_generation_flags & 0x4 != 0),
),
ro(
"Backward",
t!("Backward").as_ref(),
"atte_backward",
bool_yn(self.text_generation_flags & 0x2 != 0),
),
ro("Invisible", "atte_invisible", bool_yn(self.flags.invisible)),
ro(t!("Invisible").as_ref(), "atte_invisible", bool_yn(self.flags.invisible)),
ro(
"Multiple lines",
t!("Multiple lines").as_ref(),
"atte_mtext_flag",
mtext_flag_str(self.mtext_flag),
),
ro("Constant", "atte_constant", bool_yn(self.flags.constant)),
ro("Verify", "atte_verify", bool_yn(self.flags.verify)),
ro("Preset", "atte_preset", bool_yn(self.flags.preset)),
ro(t!("Constant").as_ref(), "atte_constant", bool_yn(self.flags.constant)),
ro(t!("Verify").as_ref(), "atte_verify", bool_yn(self.flags.verify)),
ro(t!("Preset").as_ref(), "atte_preset", bool_yn(self.flags.preset)),
ro(
"Lock position",
t!("Lock position").as_ref(),
"atte_lock_pos",
bool_yn(self.lock_position),
),

View file

@ -1,4 +1,5 @@
use acadrust::entities::Circle;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{
@ -134,18 +135,18 @@ fn properties(circle: &Circle) -> Vec<PropSection> {
use std::f64::consts::PI;
let r = circle.radius;
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Center X", "center_x", circle.center.x),
edit("Center Y", "center_y", circle.center.y),
edit("Center Z", "center_z", circle.center.z),
edit("Radius", "radius", r),
edit("Diameter", "diameter", r * 2.0),
edit("Circumference", "circumference", 2.0 * PI * r),
edit("Area", "area", PI * r * r),
ro("Normal X", "normal_x", format!("{:.4}", circle.normal.x)),
ro("Normal Y", "normal_y", format!("{:.4}", circle.normal.y)),
ro("Normal Z", "normal_z", format!("{:.4}", circle.normal.z)),
edit(t!("Center X").as_ref(), "center_x", circle.center.x),
edit(t!("Center Y").as_ref(), "center_y", circle.center.y),
edit(t!("Center Z").as_ref(), "center_z", circle.center.z),
edit(t!("Radius").as_ref(), "radius", r),
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)),
],
}]
}

View file

@ -187,7 +187,7 @@ pub fn triangle_grip(id: usize, world: glam::DVec3) -> GripDef {
/// LINEAR formatter, so LUNITS=Architectural showed a block rotation as
/// feet-and-inches and the string wouldn't parse back (#297). Value in
/// DEGREES, matching every angle call site.
pub fn edit_angle_prop(label: &'static str, field: &'static str, value_deg: f64) -> Property {
pub fn edit_angle_prop(label: &str, field: &'static str, value_deg: f64) -> Property {
Property {
label: label.into(),
field,
@ -195,7 +195,7 @@ pub fn edit_angle_prop(label: &'static str, field: &'static str, value_deg: f64)
}
}
pub fn edit_prop(label: &'static str, field: &'static str, value: f64) -> Property {
pub fn edit_prop(label: &str, field: &'static str, value: f64) -> Property {
Property {
label: label.into(),
field,
@ -203,7 +203,7 @@ pub fn edit_prop(label: &'static str, field: &'static str, value: f64) -> Proper
}
}
pub fn ro_prop(label: &'static str, field: &'static str, value: impl Into<String>) -> Property {
pub fn ro_prop(label: &str, field: &'static str, value: impl Into<String>) -> Property {
Property {
label: label.into(),
field,
@ -215,7 +215,7 @@ pub fn ro_prop(label: &'static str, field: &'static str, value: impl Into<String
/// read-only value using the same length formatting. Used where a field's
/// editability depends on entity state (e.g. a text point that is only live for
/// certain justifications, or an MText column dimension).
pub fn num_prop(label: &'static str, field: &'static str, value: f64, editable: bool) -> Property {
pub fn num_prop(label: &str, field: &'static str, value: f64, editable: bool) -> Property {
if editable {
edit_prop(label, field, value)
} else {
@ -226,7 +226,7 @@ pub fn num_prop(label: &'static str, field: &'static str, value: f64, editable:
/// A ◀ / ▶ index navigator row (e.g. a polyline's Current Vertex). `display` is
/// the label shown between the arrows (e.g. "2 / 7").
pub fn stepper_prop(
label: &'static str,
label: &str,
field: &'static str,
display: impl Into<String>,
) -> Property {

View file

@ -12,46 +12,47 @@ use crate::entities::common::{
};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable};
use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::t;
fn base_props(base: &DimensionBase) -> Vec<crate::scene::model::object::Property> {
vec![
crate::scene::model::object::Property {
label: "Text".into(),
label: t!("Text").into_owned(),
field: "text",
value: crate::scene::model::object::PropValue::EditText(base.text.clone()),
},
crate::scene::model::object::Property {
label: "User Text".into(),
label: t!("User Text").into_owned(),
field: "user_text",
value: crate::scene::model::object::PropValue::EditText(
base.user_text.clone().unwrap_or_default(),
),
},
crate::scene::model::object::Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "style_name",
value: crate::scene::model::object::PropValue::EditText(base.style_name.clone()),
},
edit("Text X", "text_x", base.text_middle_point.x),
edit("Text Y", "text_y", base.text_middle_point.y),
edit("Text Z", "text_z", base.text_middle_point.z),
edit(t!("Text X").as_ref(), "text_x", base.text_middle_point.x),
edit(t!("Text Y").as_ref(), "text_y", base.text_middle_point.y),
edit(t!("Text Z").as_ref(), "text_z", base.text_middle_point.z),
edit(
"Text Rotation (deg)",
t!("Text Rotation (deg)").as_ref(),
"text_rotation",
base.text_rotation.to_degrees(),
),
edit(
"Horizontal Dir (deg)",
t!("Horizontal Dir (deg)").as_ref(),
"horizontal_direction",
base.horizontal_direction.to_degrees(),
),
edit(
"Line Spacing",
t!("Line Spacing").as_ref(),
"line_spacing_factor",
base.line_spacing_factor,
),
ro(
"Measurement",
t!("Measurement").as_ref(),
"measurement",
format!("{:.4}", base.actual_measurement),
),
@ -68,7 +69,7 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
d.definition_point,
));
props.push(edit(
"Ext Rotation (deg)",
t!("Ext Rotation (deg)").as_ref(),
"ext_line_rotation",
d.ext_line_rotation.to_degrees(),
));
@ -79,20 +80,20 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
d.second_point,
d.definition_point,
));
props.push(edit_angle("Rotation", "rotation", d.rotation.to_degrees()));
props.push(edit_angle(t!("Rotation").as_ref(), "rotation", d.rotation.to_degrees()));
props.push(edit(
"Ext Rotation (deg)",
t!("Ext Rotation (deg)").as_ref(),
"ext_line_rotation",
d.ext_line_rotation.to_degrees(),
));
}
Dimension::Radius(d) => {
props.extend(radius_like_props(d.angle_vertex, d.definition_point));
props.push(edit("Leader Length", "leader_length", d.leader_length));
props.push(edit(t!("Leader Length").as_ref(), "leader_length", d.leader_length));
}
Dimension::Diameter(d) => {
props.extend(radius_like_props(d.angle_vertex, d.definition_point));
props.push(edit("Leader Length", "leader_length", d.leader_length));
props.push(edit(t!("Leader Length").as_ref(), "leader_length", d.leader_length));
}
Dimension::Angular2Ln(d) => {
props.extend(angular_props(
@ -101,9 +102,9 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
d.second_point,
d.definition_point,
));
props.push(edit("Arc X", "dimension_arc_x", d.dimension_arc.x));
props.push(edit("Arc Y", "dimension_arc_y", d.dimension_arc.y));
props.push(edit("Arc Z", "dimension_arc_z", d.dimension_arc.z));
props.push(edit(t!("Arc X").as_ref(), "dimension_arc_x", d.dimension_arc.x));
props.push(edit(t!("Arc Y").as_ref(), "dimension_arc_y", d.dimension_arc.y));
props.push(edit(t!("Arc Z").as_ref(), "dimension_arc_z", d.dimension_arc.z));
}
Dimension::Angular3Pt(d) => {
props.extend(angular_props(
@ -114,17 +115,17 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
));
}
Dimension::Ordinate(d) => {
props.push(edit("Origin X", "definition_x", d.definition_point.x));
props.push(edit("Origin Y", "definition_y", d.definition_point.y));
props.push(edit("Origin Z", "definition_z", d.definition_point.z));
props.push(edit("Feature X", "feature_x", d.feature_location.x));
props.push(edit("Feature Y", "feature_y", d.feature_location.y));
props.push(edit("Feature Z", "feature_z", d.feature_location.z));
props.push(edit("Leader X", "leader_x", d.leader_endpoint.x));
props.push(edit("Leader Y", "leader_y", d.leader_endpoint.y));
props.push(edit("Leader Z", "leader_z", d.leader_endpoint.z));
props.push(edit(t!("Origin X").as_ref(), "definition_x", d.definition_point.x));
props.push(edit(t!("Origin Y").as_ref(), "definition_y", d.definition_point.y));
props.push(edit(t!("Origin Z").as_ref(), "definition_z", d.definition_point.z));
props.push(edit(t!("Feature X").as_ref(), "feature_x", d.feature_location.x));
props.push(edit(t!("Feature Y").as_ref(), "feature_y", d.feature_location.y));
props.push(edit(t!("Feature Z").as_ref(), "feature_z", d.feature_location.z));
props.push(edit(t!("Leader X").as_ref(), "leader_x", d.leader_endpoint.x));
props.push(edit(t!("Leader Y").as_ref(), "leader_y", d.leader_endpoint.y));
props.push(edit(t!("Leader Z").as_ref(), "leader_z", d.leader_endpoint.z));
props.push(ro(
"Ordinate Type",
t!("Ordinate Type").as_ref(),
"ordinate_type",
if d.is_ordinate_type_x { "X" } else { "Y" },
));
@ -137,42 +138,42 @@ fn properties(dim: &Dimension) -> Vec<PropSection> {
d.definition_point,
));
props.push(edit(
"Arc Start (deg)",
t!("Arc Start (deg)").as_ref(),
"arc_start_parameter",
d.arc_start_parameter.to_degrees(),
));
props.push(edit(
"Arc End (deg)",
t!("Arc End (deg)").as_ref(),
"arc_end_parameter",
d.arc_end_parameter.to_degrees(),
));
props.push(ro("Partial", "is_partial", d.is_partial.to_string()));
props.push(ro("Has Leader", "has_leader", d.has_leader.to_string()));
props.push(edit("Leader 1 X", "leader1_x", d.first_leader_point.x));
props.push(edit("Leader 1 Y", "leader1_y", d.first_leader_point.y));
props.push(edit("Leader 1 Z", "leader1_z", d.first_leader_point.z));
props.push(edit("Leader 2 X", "leader2_x", d.second_leader_point.x));
props.push(edit("Leader 2 Y", "leader2_y", d.second_leader_point.y));
props.push(edit("Leader 2 Z", "leader2_z", d.second_leader_point.z));
props.push(ro(t!("Partial").as_ref(), "is_partial", d.is_partial.to_string()));
props.push(ro(t!("Has Leader").as_ref(), "has_leader", d.has_leader.to_string()));
props.push(edit(t!("Leader 1 X").as_ref(), "leader1_x", d.first_leader_point.x));
props.push(edit(t!("Leader 1 Y").as_ref(), "leader1_y", d.first_leader_point.y));
props.push(edit(t!("Leader 1 Z").as_ref(), "leader1_z", d.first_leader_point.z));
props.push(edit(t!("Leader 2 X").as_ref(), "leader2_x", d.second_leader_point.x));
props.push(edit(t!("Leader 2 Y").as_ref(), "leader2_y", d.second_leader_point.y));
props.push(edit(t!("Leader 2 Z").as_ref(), "leader2_z", d.second_leader_point.z));
}
Dimension::LargeRadial(d) => {
props.push(edit("Center X", "definition_x", d.definition_point.x));
props.push(edit("Center Y", "definition_y", d.definition_point.y));
props.push(edit("Center Z", "definition_z", d.definition_point.z));
props.push(edit("Chord X", "chord_x", d.chord_point.x));
props.push(edit("Chord Y", "chord_y", d.chord_point.y));
props.push(edit("Chord Z", "chord_z", d.chord_point.z));
props.push(edit("Override Center X", "override_x", d.override_center.x));
props.push(edit("Override Center Y", "override_y", d.override_center.y));
props.push(edit("Override Center Z", "override_z", d.override_center.z));
props.push(edit("Jog X", "jog_x", d.jog_point.x));
props.push(edit("Jog Y", "jog_y", d.jog_point.y));
props.push(edit("Jog Z", "jog_z", d.jog_point.z));
props.push(edit_angle("Jog Angle", "jog_angle", d.jog_angle.to_degrees()));
props.push(edit(t!("Center X").as_ref(), "definition_x", d.definition_point.x));
props.push(edit(t!("Center Y").as_ref(), "definition_y", d.definition_point.y));
props.push(edit(t!("Center Z").as_ref(), "definition_z", d.definition_point.z));
props.push(edit(t!("Chord X").as_ref(), "chord_x", d.chord_point.x));
props.push(edit(t!("Chord Y").as_ref(), "chord_y", d.chord_point.y));
props.push(edit(t!("Chord Z").as_ref(), "chord_z", d.chord_point.z));
props.push(edit(t!("Override Center X").as_ref(), "override_x", d.override_center.x));
props.push(edit(t!("Override Center Y").as_ref(), "override_y", d.override_center.y));
props.push(edit(t!("Override Center Z").as_ref(), "override_z", d.override_center.z));
props.push(edit(t!("Jog X").as_ref(), "jog_x", d.jog_point.x));
props.push(edit(t!("Jog Y").as_ref(), "jog_y", d.jog_point.y));
props.push(edit(t!("Jog Z").as_ref(), "jog_z", d.jog_point.z));
props.push(edit_angle(t!("Jog Angle").as_ref(), "jog_angle", d.jog_angle.to_degrees()));
}
}
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props,
}]
}
@ -183,15 +184,15 @@ fn linear_like_props(
definition: acadrust::types::Vector3,
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("First X", "first_x", first.x),
edit("First Y", "first_y", first.y),
edit("First Z", "first_z", first.z),
edit("Second X", "second_x", second.x),
edit("Second Y", "second_y", second.y),
edit("Second Z", "second_z", second.z),
edit("Definition X", "definition_x", definition.x),
edit("Definition Y", "definition_y", definition.y),
edit("Definition Z", "definition_z", definition.z),
edit(t!("First X").as_ref(), "first_x", first.x),
edit(t!("First Y").as_ref(), "first_y", first.y),
edit(t!("First Z").as_ref(), "first_z", first.z),
edit(t!("Second X").as_ref(), "second_x", second.x),
edit(t!("Second Y").as_ref(), "second_y", second.y),
edit(t!("Second Z").as_ref(), "second_z", second.z),
edit(t!("Definition X").as_ref(), "definition_x", definition.x),
edit(t!("Definition Y").as_ref(), "definition_y", definition.y),
edit(t!("Definition Z").as_ref(), "definition_z", definition.z),
]
}
@ -200,12 +201,12 @@ fn radius_like_props(
point: acadrust::types::Vector3,
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("Center X", "center_x", center.x),
edit("Center Y", "center_y", center.y),
edit("Center Z", "center_z", center.z),
edit("Point X", "point_x", point.x),
edit("Point Y", "point_y", point.y),
edit("Point Z", "point_z", point.z),
edit(t!("Center X").as_ref(), "center_x", center.x),
edit(t!("Center Y").as_ref(), "center_y", center.y),
edit(t!("Center Z").as_ref(), "center_z", center.z),
edit(t!("Point X").as_ref(), "point_x", point.x),
edit(t!("Point Y").as_ref(), "point_y", point.y),
edit(t!("Point Z").as_ref(), "point_z", point.z),
]
}
@ -216,18 +217,18 @@ fn angular_props(
definition: acadrust::types::Vector3,
) -> Vec<crate::scene::model::object::Property> {
vec![
edit("Vertex X", "vertex_x", vertex.x),
edit("Vertex Y", "vertex_y", vertex.y),
edit("Vertex Z", "vertex_z", vertex.z),
edit("First X", "first_x", first.x),
edit("First Y", "first_y", first.y),
edit("First Z", "first_z", first.z),
edit("Second X", "second_x", second.x),
edit("Second Y", "second_y", second.y),
edit("Second Z", "second_z", second.z),
edit("Definition X", "definition_x", definition.x),
edit("Definition Y", "definition_y", definition.y),
edit("Definition Z", "definition_z", definition.z),
edit(t!("Vertex X").as_ref(), "vertex_x", vertex.x),
edit(t!("Vertex Y").as_ref(), "vertex_y", vertex.y),
edit(t!("Vertex Z").as_ref(), "vertex_z", vertex.z),
edit(t!("First X").as_ref(), "first_x", first.x),
edit(t!("First Y").as_ref(), "first_y", first.y),
edit(t!("First Z").as_ref(), "first_z", first.z),
edit(t!("Second X").as_ref(), "second_x", second.x),
edit(t!("Second Y").as_ref(), "second_y", second.y),
edit(t!("Second Z").as_ref(), "second_z", second.z),
edit(t!("Definition X").as_ref(), "definition_x", definition.x),
edit(t!("Definition Y").as_ref(), "definition_y", definition.y),
edit(t!("Definition Z").as_ref(), "definition_z", definition.z),
]
}
@ -1150,133 +1151,133 @@ pub fn style_sections(style: &DimStyle) -> Vec<crate::scene::model::object::Prop
vec![
PropSection {
title: "Lines & Arrows".into(),
title: t!("Lines & Arrows").into_owned(),
props: vec![
ro("Arrow size", "dim_arrow_size", f(s.dimasz)),
ro("Dim line color", "dim_line_color", s.dimclrd.to_string()),
ro(t!("Arrow size").as_ref(), "dim_arrow_size", f(s.dimasz)),
ro(t!("Dim line color").as_ref(), "dim_line_color", s.dimclrd.to_string()),
ro(
"Dim line lineweight",
t!("Dim line lineweight").as_ref(),
"dim_line_lineweight",
s.dimlwd.to_string(),
),
ro("Ext line color", "dim_ext_line_color", s.dimclre.to_string()),
ro(t!("Ext line color").as_ref(), "dim_ext_line_color", s.dimclre.to_string()),
ro(
"Ext line lineweight",
t!("Ext line lineweight").as_ref(),
"dim_ext_line_lineweight",
s.dimlwe.to_string(),
),
ro("Dim line 1", "dim_line_1", onoff(!s.dimsd1)),
ro("Dim line 2", "dim_line_2", onoff(!s.dimsd2)),
ro("Ext line 1", "dim_ext_line_1", onoff(!s.dimse1)),
ro("Ext line 2", "dim_ext_line_2", onoff(!s.dimse2)),
ro("Dim line ext", "dim_line_ext", f(s.dimdle)),
ro("Ext line ext", "dim_ext_line_ext", f(s.dimexe)),
ro("Ext line offset", "dim_ext_line_offset", f(s.dimexo)),
ro("Ext line fixed", "dim_ext_line_fixed", yn(s.dimfxlon)),
ro(t!("Dim line 1").as_ref(), "dim_line_1", onoff(!s.dimsd1)),
ro(t!("Dim line 2").as_ref(), "dim_line_2", onoff(!s.dimsd2)),
ro(t!("Ext line 1").as_ref(), "dim_ext_line_1", onoff(!s.dimse1)),
ro(t!("Ext line 2").as_ref(), "dim_ext_line_2", onoff(!s.dimse2)),
ro(t!("Dim line ext").as_ref(), "dim_line_ext", f(s.dimdle)),
ro(t!("Ext line ext").as_ref(), "dim_ext_line_ext", f(s.dimexe)),
ro(t!("Ext line offset").as_ref(), "dim_ext_line_offset", f(s.dimexo)),
ro(t!("Ext line fixed").as_ref(), "dim_ext_line_fixed", yn(s.dimfxlon)),
ro(
"Ext line fixed length",
t!("Ext line fixed length").as_ref(),
"dim_ext_line_fixed_length",
f(s.dimfxl),
),
],
},
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: vec![
ro("Fill color", "dim_text_fill_color", s.dimtfillclr.to_string()),
ro("Text color", "dim_text_color", s.dimclrt.to_string()),
ro("Text height", "dim_text_height", f(s.dimtxt)),
ro("Text offset", "dim_text_offset", f(s.dimgap)),
ro("Text pos vert", "dim_text_pos_vert", s.dimtad.to_string()),
ro("Text pos hor", "dim_text_pos_hor", s.dimjust.to_string()),
ro("Text outside align", "dim_text_outside_align", yn(s.dimtoh)),
ro("Text inside align", "dim_text_inside_align", yn(s.dimtih)),
ro("Text style", "dim_text_style", s.dimtxsty.clone()),
ro(t!("Fill color").as_ref(), "dim_text_fill_color", s.dimtfillclr.to_string()),
ro(t!("Text color").as_ref(), "dim_text_color", s.dimclrt.to_string()),
ro(t!("Text height").as_ref(), "dim_text_height", f(s.dimtxt)),
ro(t!("Text offset").as_ref(), "dim_text_offset", f(s.dimgap)),
ro(t!("Text pos vert").as_ref(), "dim_text_pos_vert", s.dimtad.to_string()),
ro(t!("Text pos hor").as_ref(), "dim_text_pos_hor", s.dimjust.to_string()),
ro(t!("Text outside align").as_ref(), "dim_text_outside_align", yn(s.dimtoh)),
ro(t!("Text inside align").as_ref(), "dim_text_inside_align", yn(s.dimtih)),
ro(t!("Text style").as_ref(), "dim_text_style", s.dimtxsty.clone()),
],
},
PropSection {
title: "Fit".into(),
title: t!("Fit").into_owned(),
props: vec![
ro("Fit", "dim_fit", s.dimatfit.to_string()),
ro("Text inside", "dim_text_inside", yn(s.dimtix)),
ro("Text movement", "dim_text_movement", s.dimtmove.to_string()),
ro("Dim scale overall", "dim_scale_overall", f(s.dimscale)),
ro("Dim line forced", "dim_line_forced", yn(s.dimtofl)),
ro("Dim line inside", "dim_line_inside", yn(s.dimsoxd)),
ro(t!("Fit").as_ref(), "dim_fit", s.dimatfit.to_string()),
ro(t!("Text inside").as_ref(), "dim_text_inside", yn(s.dimtix)),
ro(t!("Text movement").as_ref(), "dim_text_movement", s.dimtmove.to_string()),
ro(t!("Dim scale overall").as_ref(), "dim_scale_overall", f(s.dimscale)),
ro(t!("Dim line forced").as_ref(), "dim_line_forced", yn(s.dimtofl)),
ro(t!("Dim line inside").as_ref(), "dim_line_inside", yn(s.dimsoxd)),
],
},
PropSection {
title: "Primary Units".into(),
title: t!("Primary Units").into_owned(),
props: vec![
ro("Dim units", "dim_units", s.dimlunit.to_string()),
ro("Precision", "dim_precision", s.dimdec.to_string()),
ro("Decimal separator", "dim_decimal_separator", dsep),
ro("Dim prefix/suffix", "dim_prefix_suffix", s.dimpost.clone()),
ro("Dim roundoff", "dim_roundoff", f(s.dimrnd)),
ro(t!("Dim units").as_ref(), "dim_units", s.dimlunit.to_string()),
ro(t!("Precision").as_ref(), "dim_precision", s.dimdec.to_string()),
ro(t!("Decimal separator").as_ref(), "dim_decimal_separator", dsep),
ro(t!("Dim prefix/suffix").as_ref(), "dim_prefix_suffix", s.dimpost.clone()),
ro(t!("Dim roundoff").as_ref(), "dim_roundoff", f(s.dimrnd)),
ro(
"Suppress leading zeros",
t!("Suppress leading zeros").as_ref(),
"dim_suppress_leading_zeros",
yn(s.dimzin & 4 != 0),
),
ro(
"Suppress trailing zeros",
t!("Suppress trailing zeros").as_ref(),
"dim_suppress_trailing_zeros",
yn(s.dimzin & 8 != 0),
),
ro("Dim scale linear", "dim_scale_linear", f(s.dimlfac)),
ro("Angle format", "dim_angle_format", s.dimaunit.to_string()),
ro("Angle precision", "dim_angle_precision", s.dimadec.to_string()),
ro(t!("Dim scale linear").as_ref(), "dim_scale_linear", f(s.dimlfac)),
ro(t!("Angle format").as_ref(), "dim_angle_format", s.dimaunit.to_string()),
ro(t!("Angle precision").as_ref(), "dim_angle_precision", s.dimadec.to_string()),
],
},
PropSection {
title: "Alternate Units".into(),
title: t!("Alternate Units").into_owned(),
props: vec![
ro("Alt enabled", "dim_alt_enabled", yn(s.dimalt)),
ro("Alt format", "dim_alt_format", s.dimaltu.to_string()),
ro("Alt precision", "dim_alt_precision", s.dimaltd.to_string()),
ro("Alt scale factor", "dim_alt_scale_factor", f(s.dimaltf)),
ro("Alt roundoff", "dim_alt_roundoff", f(s.dimaltrnd)),
ro("Alt prefix/suffix", "dim_alt_prefix_suffix", s.dimapost.clone()),
ro(t!("Alt enabled").as_ref(), "dim_alt_enabled", yn(s.dimalt)),
ro(t!("Alt format").as_ref(), "dim_alt_format", s.dimaltu.to_string()),
ro(t!("Alt precision").as_ref(), "dim_alt_precision", s.dimaltd.to_string()),
ro(t!("Alt scale factor").as_ref(), "dim_alt_scale_factor", f(s.dimaltf)),
ro(t!("Alt roundoff").as_ref(), "dim_alt_roundoff", f(s.dimaltrnd)),
ro(t!("Alt prefix/suffix").as_ref(), "dim_alt_prefix_suffix", s.dimapost.clone()),
ro(
"Alt suppress leading zeros",
t!("Alt suppress leading zeros").as_ref(),
"dim_alt_suppress_leading_zeros",
yn(s.dimaltz & 4 != 0),
),
ro(
"Alt suppress trailing zeros",
t!("Alt suppress trailing zeros").as_ref(),
"dim_alt_suppress_trailing_zeros",
yn(s.dimaltz & 8 != 0),
),
],
},
PropSection {
title: "Tolerances".into(),
title: t!("Tolerances").into_owned(),
props: vec![
ro("Tolerance display", "dim_tolerance_display", tol_display),
ro("Tolerance limit lower", "dim_tolerance_limit_lower", f(s.dimtm)),
ro("Tolerance limit upper", "dim_tolerance_limit_upper", f(s.dimtp)),
ro(t!("Tolerance display").as_ref(), "dim_tolerance_display", tol_display),
ro(t!("Tolerance limit lower").as_ref(), "dim_tolerance_limit_lower", f(s.dimtm)),
ro(t!("Tolerance limit upper").as_ref(), "dim_tolerance_limit_upper", f(s.dimtp)),
ro(
"Tolerance precision",
t!("Tolerance precision").as_ref(),
"dim_tolerance_precision",
s.dimtdec.to_string(),
),
ro(
"Tolerance text height",
t!("Tolerance text height").as_ref(),
"dim_tolerance_text_height",
f(s.dimtfac),
),
ro(
"Tolerance pos vert",
t!("Tolerance pos vert").as_ref(),
"dim_tolerance_pos_vert",
s.dimtolj.to_string(),
),
ro(
"Tolerance suppress leading zeros",
t!("Tolerance suppress leading zeros").as_ref(),
"dim_tolerance_suppress_leading_zeros",
yn(s.dimtzin & 4 != 0),
),
ro(
"Tolerance suppress trailing zeros",
t!("Tolerance suppress trailing zeros").as_ref(),
"dim_tolerance_suppress_trailing_zeros",
yn(s.dimtzin & 8 != 0),
),

View file

@ -1,4 +1,5 @@
use acadrust::entities::Ellipse;
use crate::t;
use truck_modeling::{builder, BSplineCurve, Curve, Edge, KnotVec, Point3, Wire};
use crate::command::EntityTransform;
@ -194,35 +195,35 @@ fn properties(ell: &Ellipse) -> Vec<PropSection> {
let props = ell.mass_props();
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Start X", "start_x", format!("{:.4}", start.x)),
ro("Start Y", "start_y", format!("{:.4}", start.y)),
ro("Start Z", "start_z", format!("{:.4}", start.z)),
edit("Center X", "center_x", ell.center.x),
edit("Center Y", "center_y", ell.center.y),
edit("Center Z", "center_z", ell.center.z),
ro("End X", "end_x", format!("{:.4}", end.x)),
ro("End Y", "end_y", format!("{:.4}", end.y)),
ro("End Z", "end_z", format!("{:.4}", end.z)),
edit("Major radius", "major_r", r_major),
edit("Minor radius", "minor_r", r_minor),
edit("Radius ratio", "ratio", ell.minor_axis_ratio),
edit("Start angle", "start_angle", start_angle),
edit("End angle", "end_angle", end_angle),
ro("Major axis vector X", "major_x", format!("{:.4}", major_vec.x)),
ro("Major axis vector Y", "major_y", format!("{:.4}", major_vec.y)),
ro("Major axis vector Z", "major_z", format!("{:.4}", major_vec.z)),
ro("Minor axis vector X", "minor_x", format!("{:.4}", minor_vec.x)),
ro("Minor axis vector Y", "minor_y", format!("{:.4}", minor_vec.y)),
ro("Minor axis vector Z", "minor_z", format!("{:.4}", minor_vec.z)),
ro("Area", "area", format!("{:.4}", props.area)),
ro("Start parameter", "start_param", format!("{:.4}", ell.start_parameter)),
ro("End parameter", "end_param", format!("{:.4}", ell.end_parameter)),
ro("Length", "length", format!("{:.4}", props.perimeter)),
ro("Normal X", "normal_x", format!("{:.4}", ell.normal.x)),
ro("Normal Y", "normal_y", format!("{:.4}", ell.normal.y)),
ro("Normal Z", "normal_z", format!("{:.4}", ell.normal.z)),
ro(t!("Start X").as_ref(), "start_x", format!("{:.4}", start.x)),
ro(t!("Start Y").as_ref(), "start_y", format!("{:.4}", start.y)),
ro(t!("Start Z").as_ref(), "start_z", format!("{:.4}", start.z)),
edit(t!("Center X").as_ref(), "center_x", ell.center.x),
edit(t!("Center Y").as_ref(), "center_y", ell.center.y),
edit(t!("Center Z").as_ref(), "center_z", ell.center.z),
ro(t!("End X").as_ref(), "end_x", format!("{:.4}", end.x)),
ro(t!("End Y").as_ref(), "end_y", format!("{:.4}", end.y)),
ro(t!("End Z").as_ref(), "end_z", format!("{:.4}", end.z)),
edit(t!("Major radius").as_ref(), "major_r", r_major),
edit(t!("Minor radius").as_ref(), "minor_r", r_minor),
edit(t!("Radius ratio").as_ref(), "ratio", ell.minor_axis_ratio),
edit(t!("Start angle").as_ref(), "start_angle", start_angle),
edit(t!("End angle").as_ref(), "end_angle", end_angle),
ro(t!("Major axis vector X").as_ref(), "major_x", format!("{:.4}", major_vec.x)),
ro(t!("Major axis vector Y").as_ref(), "major_y", format!("{:.4}", major_vec.y)),
ro(t!("Major axis vector Z").as_ref(), "major_z", format!("{:.4}", major_vec.z)),
ro(t!("Minor axis vector X").as_ref(), "minor_x", format!("{:.4}", minor_vec.x)),
ro(t!("Minor axis vector Y").as_ref(), "minor_y", format!("{:.4}", minor_vec.y)),
ro(t!("Minor axis vector Z").as_ref(), "minor_z", format!("{:.4}", minor_vec.z)),
ro(t!("Area").as_ref(), "area", format!("{:.4}", props.area)),
ro(t!("Start parameter").as_ref(), "start_param", format!("{:.4}", ell.start_parameter)),
ro(t!("End parameter").as_ref(), "end_param", format!("{:.4}", ell.end_parameter)),
ro(t!("Length").as_ref(), "length", format!("{:.4}", props.perimeter)),
ro(t!("Normal X").as_ref(), "normal_x", format!("{:.4}", ell.normal.x)),
ro(t!("Normal Y").as_ref(), "normal_y", format!("{:.4}", ell.normal.y)),
ro(t!("Normal Z").as_ref(), "normal_z", format!("{:.4}", ell.normal.z)),
],
}]
}

View file

@ -3,6 +3,7 @@ use acadrust::entities::{
PointCloudData, PointCloudExData, RemoteTextData, SectionObjectData,
};
use acadrust::types::{Handle, Transform, Vector3};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{
@ -29,7 +30,7 @@ fn handle_text(handle: Handle) -> String {
}
}
fn text_prop(label: &'static str, field: &'static str, value: &str) -> Property {
fn text_prop(label: &str, field: &'static str, value: &str) -> Property {
Property {
label: label.into(),
field,
@ -37,7 +38,7 @@ fn text_prop(label: &'static str, field: &'static str, value: &str) -> Property
}
}
fn bool_prop(label: &'static str, field: &'static str, value: bool) -> Property {
fn bool_prop(label: &str, field: &'static str, value: bool) -> Property {
Property {
label: label.into(),
field,
@ -481,40 +482,36 @@ fn section_properties(data: &SectionObjectData) -> Vec<PropSection> {
.join("\n");
vec![
PropSection {
title: "Section Object".into(),
title: t!("Section Object").into_owned(),
props: vec![
text_prop("Name", "ext_section_name", &data.name),
ro_prop("State", "ext_section_state", data.state.to_string()),
ro_prop("Flags", "ext_section_flags", data.flags.to_string()),
ro_prop(
"Vertical Direction",
text_prop(t!("Name").as_ref(), "ext_section_name", &data.name),
ro_prop(t!("State").as_ref(), "ext_section_state", data.state.to_string()),
ro_prop(t!("Flags").as_ref(), "ext_section_flags", data.flags.to_string()),
ro_prop(t!("Vertical Direction").as_ref(),
"ext_section_vertical",
vector_text(data.vertical_direction),
),
edit_prop("Top Height", "ext_section_top", data.top_height),
edit_prop("Bottom Height", "ext_section_bottom", data.bottom_height),
ro_prop(
"Indicator Alpha",
edit_prop(t!("Top Height").as_ref(), "ext_section_top", data.top_height),
edit_prop(t!("Bottom Height").as_ref(), "ext_section_bottom", data.bottom_height),
ro_prop(t!("Indicator Alpha").as_ref(),
"ext_section_alpha",
data.indicator_alpha.to_string(),
),
ro_prop(
"Indicator Color",
ro_prop(t!("Indicator Color").as_ref(),
"ext_section_color",
format!("{:?}", data.indicator_color),
),
ro_prop(
"Settings",
ro_prop(t!("Settings").as_ref(),
"ext_section_settings",
handle_text(data.settings_handle),
),
],
},
PropSection {
title: "Section Vertices".into(),
title: t!("Section Vertices").into_owned(),
props: vec![
ro_prop("Cutting Line", "ext_section_vertices", vertices),
ro_prop("Back Line", "ext_section_back_vertices", back_vertices),
ro_prop(t!("Cutting Line").as_ref(), "ext_section_vertices", vertices),
ro_prop(t!("Back Line").as_ref(), "ext_section_back_vertices", back_vertices),
],
},
]
@ -522,114 +519,102 @@ fn section_properties(data: &SectionObjectData) -> Vec<PropSection> {
fn arc_text_properties(data: &ArcAlignedTextData) -> Vec<PropSection> {
vec![PropSection {
title: "Arc-Aligned Text".into(),
title: t!("Arc-Aligned Text").into_owned(),
props: vec![
text_prop("Text", "ext_arc_text", &data.text),
text_prop("Font", "ext_arc_font", &data.font_name),
text_prop("Big Font", "ext_arc_big_font", &data.big_font_name),
text_prop("Style", "ext_arc_style", &data.style_name),
ro_prop("Center", "ext_arc_center", vector_text(data.center)),
edit_prop("Radius", "ext_arc_radius", data.radius),
edit_prop("X Scale", "ext_arc_xscale", data.x_scale),
edit_prop("Text Size", "ext_arc_size", data.text_size),
edit_prop(
"Character Spacing",
text_prop(t!("Text").as_ref(), "ext_arc_text", &data.text),
text_prop(t!("Font").as_ref(), "ext_arc_font", &data.font_name),
text_prop(t!("Big Font").as_ref(), "ext_arc_big_font", &data.big_font_name),
text_prop(t!("Style").as_ref(), "ext_arc_style", &data.style_name),
ro_prop(t!("Center").as_ref(), "ext_arc_center", vector_text(data.center)),
edit_prop(t!("Radius").as_ref(), "ext_arc_radius", data.radius),
edit_prop(t!("X Scale").as_ref(), "ext_arc_xscale", data.x_scale),
edit_prop(t!("Text Size").as_ref(), "ext_arc_size", data.text_size),
edit_prop(t!("Character Spacing").as_ref(),
"ext_arc_spacing",
data.character_spacing,
),
edit_prop(
"Offset From Arc",
edit_prop(t!("Offset From Arc").as_ref(),
"ext_arc_offset",
data.offset_from_arc,
),
edit_prop("Right Offset", "ext_arc_right", data.right_offset),
edit_prop("Left Offset", "ext_arc_left", data.left_offset),
edit_angle_prop(
"Start Angle",
edit_prop(t!("Right Offset").as_ref(), "ext_arc_right", data.right_offset),
edit_prop(t!("Left Offset").as_ref(), "ext_arc_left", data.left_offset),
edit_angle_prop(t!("Start Angle").as_ref(),
"ext_arc_start",
data.start_angle.to_degrees(),
),
edit_angle_prop("End Angle", "ext_arc_end", data.end_angle.to_degrees()),
bool_prop("Reverse", "ext_arc_reverse", data.reverse),
ro_prop(
"Text Direction",
edit_angle_prop(t!("End Angle").as_ref(), "ext_arc_end", data.end_angle.to_degrees()),
bool_prop(t!("Reverse").as_ref(), "ext_arc_reverse", data.reverse),
ro_prop(t!("Text Direction").as_ref(),
"ext_arc_direction",
data.text_direction.to_string(),
),
ro_prop("Alignment", "ext_arc_alignment", data.alignment.to_string()),
ro_prop(
"Text Position",
ro_prop(t!("Alignment").as_ref(), "ext_arc_alignment", data.alignment.to_string()),
ro_prop(t!("Text Position").as_ref(),
"ext_arc_position",
data.text_position.to_string(),
),
bool_prop("Bold", "ext_arc_bold", data.bold),
bool_prop("Italic", "ext_arc_italic", data.italic),
bool_prop("Underlined", "ext_arc_underlined", data.underlined),
ro_prop(
"Character Set",
bool_prop(t!("Bold").as_ref(), "ext_arc_bold", data.bold),
bool_prop(t!("Italic").as_ref(), "ext_arc_italic", data.italic),
bool_prop(t!("Underlined").as_ref(), "ext_arc_underlined", data.underlined),
ro_prop(t!("Character Set").as_ref(),
"ext_arc_charset",
data.character_set.to_string(),
),
ro_prop(
"Pitch And Family",
ro_prop(t!("Pitch And Family").as_ref(),
"ext_arc_pitch",
data.pitch_and_family.to_string(),
),
bool_prop("SHX", "ext_arc_shx", data.is_shx),
ro_prop("Text Color", "ext_arc_color", data.text_color.to_string()),
ro_prop("Normal", "ext_arc_normal", vector_text(data.normal)),
bool_prop("Wizard Flag", "ext_arc_wizard", data.wizard_flag),
ro_prop("Arc", "ext_arc_handle", handle_text(data.arc_handle)),
bool_prop(t!("SHX").as_ref(), "ext_arc_shx", data.is_shx),
ro_prop(t!("Text Color").as_ref(), "ext_arc_color", data.text_color.to_string()),
ro_prop(t!("Normal").as_ref(), "ext_arc_normal", vector_text(data.normal)),
bool_prop(t!("Wizard Flag").as_ref(), "ext_arc_wizard", data.wizard_flag),
ro_prop(t!("Arc").as_ref(), "ext_arc_handle", handle_text(data.arc_handle)),
],
}]
}
fn remote_text_properties(data: &RemoteTextData) -> Vec<PropSection> {
vec![PropSection {
title: "Remote Text".into(),
title: t!("Remote Text").into_owned(),
props: vec![
text_prop("Text", "ext_rtext_text", &data.text),
ro_prop("Position", "ext_rtext_position", vector_text(data.position)),
ro_prop("Normal", "ext_rtext_normal", vector_text(data.normal)),
edit_angle_prop(
"Rotation",
text_prop(t!("Text").as_ref(), "ext_rtext_text", &data.text),
ro_prop(t!("Position").as_ref(), "ext_rtext_position", vector_text(data.position)),
ro_prop(t!("Normal").as_ref(), "ext_rtext_normal", vector_text(data.normal)),
edit_angle_prop(t!("Rotation").as_ref(),
"ext_rtext_rotation",
data.rotation.to_degrees(),
),
edit_prop("Height", "ext_rtext_height", data.height),
text_prop("Style Name", "ext_rtext_style", &data.style_name),
ro_prop(
"Style Handle",
edit_prop(t!("Height").as_ref(), "ext_rtext_height", data.height),
text_prop(t!("Style Name").as_ref(), "ext_rtext_style", &data.style_name),
ro_prop(t!("Style Handle").as_ref(),
"ext_rtext_style_handle",
handle_text(data.style_handle),
),
ro_prop("Flags", "ext_rtext_flags", data.flags.to_string()),
ro_prop(t!("Flags").as_ref(), "ext_rtext_flags", data.flags.to_string()),
],
}]
}
fn geo_marker_properties(data: &GeoPositionMarkerData) -> Vec<PropSection> {
vec![PropSection {
title: "Geographic Position Marker".into(),
title: t!("Geographic Position Marker").into_owned(),
props: vec![
ro_prop(
"Class Version",
ro_prop(t!("Class Version").as_ref(),
"ext_geo_version",
data.class_version.to_string(),
),
ro_prop("Position", "ext_geo_position", vector_text(data.position)),
edit_prop("Radius", "ext_geo_radius", data.radius),
text_prop("Notes", "ext_geo_notes", &data.notes),
edit_prop("Landing Gap", "ext_geo_gap", data.landing_gap),
bool_prop("Text Visible", "ext_geo_visible", data.mtext_visible),
ro_prop(
"Text Alignment",
ro_prop(t!("Position").as_ref(), "ext_geo_position", vector_text(data.position)),
edit_prop(t!("Radius").as_ref(), "ext_geo_radius", data.radius),
text_prop(t!("Notes").as_ref(), "ext_geo_notes", &data.notes),
edit_prop(t!("Landing Gap").as_ref(), "ext_geo_gap", data.landing_gap),
bool_prop(t!("Text Visible").as_ref(), "ext_geo_visible", data.mtext_visible),
ro_prop(t!("Text Alignment").as_ref(),
"ext_geo_alignment",
data.text_alignment.to_string(),
),
bool_prop("Frame Text", "ext_geo_frame", data.enable_frame_text),
ro_prop(
"Embedded MText",
bool_prop(t!("Frame Text").as_ref(), "ext_geo_frame", data.enable_frame_text),
ro_prop(t!("Embedded MText").as_ref(),
"ext_geo_mtext",
data.embedded_mtext
.as_ref()
@ -660,91 +645,77 @@ fn point_cloud_properties(data: &PointCloudData) -> Vec<PropSection> {
.join("\n");
vec![
PropSection {
title: "Point Cloud".into(),
title: t!("Point Cloud").into_owned(),
props: vec![
ro_prop(
"Class Version",
ro_prop(t!("Class Version").as_ref(),
"ext_pc_version",
data.class_version.to_string(),
),
ro_prop("Origin", "ext_pc_origin", vector_text(data.origin)),
text_prop("Saved File", "ext_pc_file", &data.saved_filename),
ro_prop(
"Source Files",
ro_prop(t!("Origin").as_ref(), "ext_pc_origin", vector_text(data.origin)),
text_prop(t!("Saved File").as_ref(), "ext_pc_file", &data.saved_filename),
ro_prop(t!("Source Files").as_ref(),
"ext_pc_sources",
data.source_files.join("\n"),
),
ro_prop("Extents Min", "ext_pc_min", vector_text(data.extents_min)),
ro_prop("Extents Max", "ext_pc_max", vector_text(data.extents_max)),
ro_prop(
"Point Count",
ro_prop(t!("Extents Min").as_ref(), "ext_pc_min", vector_text(data.extents_min)),
ro_prop(t!("Extents Max").as_ref(), "ext_pc_max", vector_text(data.extents_max)),
ro_prop(t!("Point Count").as_ref(),
"ext_pc_count",
data.point_count.to_string(),
),
text_prop("UCS Name", "ext_pc_ucs", &data.ucs_name),
ro_prop(
"UCS Origin",
text_prop(t!("UCS Name").as_ref(), "ext_pc_ucs", &data.ucs_name),
ro_prop(t!("UCS Origin").as_ref(),
"ext_pc_ucs_origin",
vector_text(data.ucs_origin),
),
ro_prop(
"UCS X",
ro_prop(t!("UCS X").as_ref(),
"ext_pc_ucs_x",
vector_text(data.ucs_x_direction),
),
ro_prop(
"UCS Y",
ro_prop(t!("UCS Y").as_ref(),
"ext_pc_ucs_y",
vector_text(data.ucs_y_direction),
),
ro_prop(
"UCS Z",
ro_prop(t!("UCS Z").as_ref(),
"ext_pc_ucs_z",
vector_text(data.ucs_z_direction),
),
ro_prop(
"Definition",
ro_prop(t!("Definition").as_ref(),
"ext_pc_definition",
handle_text(data.definition_handle),
),
ro_prop(
"Reactor",
ro_prop(t!("Reactor").as_ref(),
"ext_pc_reactor",
handle_text(data.reactor_handle),
),
],
},
PropSection {
title: "Point Cloud Display".into(),
title: t!("Point Cloud Display").into_owned(),
props: vec![
bool_prop("Show Intensity", "ext_pc_show_intensity", data.show_intensity),
ro_prop(
"Intensity Scheme",
bool_prop(t!("Show Intensity").as_ref(), "ext_pc_show_intensity", data.show_intensity),
ro_prop(t!("Intensity Scheme").as_ref(),
"ext_pc_intensity_scheme",
data.intensity_scheme.to_string(),
),
edit_prop(
"Minimum Intensity",
edit_prop(t!("Minimum Intensity").as_ref(),
"ext_pc_intensity_min",
data.minimum_intensity,
),
edit_prop(
"Maximum Intensity",
edit_prop(t!("Maximum Intensity").as_ref(),
"ext_pc_intensity_max",
data.maximum_intensity,
),
edit_prop(
"Low Threshold",
edit_prop(t!("Low Threshold").as_ref(),
"ext_pc_low_threshold",
data.low_intensity_threshold,
),
edit_prop(
"High Threshold",
edit_prop(t!("High Threshold").as_ref(),
"ext_pc_high_threshold",
data.high_intensity_threshold,
),
bool_prop("Show Clipping", "ext_pc_show_clipping", data.show_clipping),
ro_prop("Clippings", "ext_pc_clippings", clips),
bool_prop(t!("Show Clipping").as_ref(), "ext_pc_show_clipping", data.show_clipping),
ro_prop(t!("Clippings").as_ref(), "ext_pc_clippings", clips),
],
},
]
@ -770,92 +741,77 @@ fn point_cloud_ex_properties(data: &PointCloudExData) -> Vec<PropSection> {
.join("\n");
vec![
PropSection {
title: "Point Cloud Ex".into(),
title: t!("Point Cloud Ex").into_owned(),
props: vec![
ro_prop(
"Class Version",
ro_prop(t!("Class Version").as_ref(),
"ext_pcx_version",
data.class_version.to_string(),
),
text_prop("Name", "ext_pcx_name", &data.name),
ro_prop("Extents Min", "ext_pcx_min", vector_text(data.extents_min)),
ro_prop("Extents Max", "ext_pcx_max", vector_text(data.extents_max)),
ro_prop(
"UCS Origin",
text_prop(t!("Name").as_ref(), "ext_pcx_name", &data.name),
ro_prop(t!("Extents Min").as_ref(), "ext_pcx_min", vector_text(data.extents_min)),
ro_prop(t!("Extents Max").as_ref(), "ext_pcx_max", vector_text(data.extents_max)),
ro_prop(t!("UCS Origin").as_ref(),
"ext_pcx_ucs_origin",
vector_text(data.ucs_origin),
),
ro_prop(
"UCS X",
ro_prop(t!("UCS X").as_ref(),
"ext_pcx_ucs_x",
vector_text(data.ucs_x_direction),
),
ro_prop(
"UCS Y",
ro_prop(t!("UCS Y").as_ref(),
"ext_pcx_ucs_y",
vector_text(data.ucs_y_direction),
),
ro_prop(
"UCS Z",
ro_prop(t!("UCS Z").as_ref(),
"ext_pcx_ucs_z",
vector_text(data.ucs_z_direction),
),
bool_prop("Locked", "ext_pcx_locked", data.locked),
ro_prop(
"Definition",
bool_prop(t!("Locked").as_ref(), "ext_pcx_locked", data.locked),
ro_prop(t!("Definition").as_ref(),
"ext_pcx_definition",
handle_text(data.definition_handle),
),
ro_prop(
"Reactor",
ro_prop(t!("Reactor").as_ref(),
"ext_pcx_reactor",
handle_text(data.reactor_handle),
),
],
},
PropSection {
title: "Point Cloud Ex Display".into(),
title: t!("Point Cloud Ex Display").into_owned(),
props: vec![
bool_prop(
"Show Intensity",
bool_prop(t!("Show Intensity").as_ref(),
"ext_pcx_show_intensity",
data.show_intensity,
),
bool_prop("Show Cropping", "ext_pcx_show_cropping", data.show_cropping),
ro_prop(
"Unknown Flags",
bool_prop(t!("Show Cropping").as_ref(), "ext_pcx_show_cropping", data.show_cropping),
ro_prop(t!("Unknown Flags").as_ref(),
"ext_pcx_unknown",
format!("{}, {}", data.unknown_bl0, data.unknown_bl1),
),
ro_prop(
"Stylization Type",
ro_prop(t!("Stylization Type").as_ref(),
"ext_pcx_stylization",
data.stylization_type.to_string(),
),
text_prop(
"Intensity Color Scheme",
text_prop(t!("Intensity Color Scheme").as_ref(),
"ext_pcx_intensity_scheme",
&data.intensity_color_scheme,
),
text_prop(
"Current Color Scheme",
text_prop(t!("Current Color Scheme").as_ref(),
"ext_pcx_current_scheme",
&data.current_color_scheme,
),
text_prop(
"Classification Scheme",
text_prop(t!("Classification Scheme").as_ref(),
"ext_pcx_class_scheme",
&data.classification_color_scheme,
),
edit_prop("Elevation Min", "ext_pcx_elevation_min", data.elevation_min),
edit_prop("Elevation Max", "ext_pcx_elevation_max", data.elevation_max),
ro_prop(
"Intensity Range",
edit_prop(t!("Elevation Min").as_ref(), "ext_pcx_elevation_min", data.elevation_min),
edit_prop(t!("Elevation Max").as_ref(), "ext_pcx_elevation_max", data.elevation_max),
ro_prop(t!("Intensity Range").as_ref(),
"ext_pcx_intensity_range",
format!("{}..{}", data.intensity_min, data.intensity_max),
),
ro_prop(
"Out Of Range Behavior",
ro_prop(t!("Out Of Range Behavior").as_ref(),
"ext_pcx_out_of_range",
format!(
"intensity {}; elevation {}",
@ -863,22 +819,19 @@ fn point_cloud_ex_properties(data: &PointCloudExData) -> Vec<PropSection> {
data.elevation_out_of_range_behavior
),
),
bool_prop(
"Fixed Elevation Range",
bool_prop(t!("Fixed Elevation Range").as_ref(),
"ext_pcx_fixed_range",
data.elevation_apply_to_fixed_range,
),
bool_prop(
"Intensity Gradient",
bool_prop(t!("Intensity Gradient").as_ref(),
"ext_pcx_intensity_gradient",
data.intensity_as_gradient,
),
bool_prop(
"Elevation Gradient",
bool_prop(t!("Elevation Gradient").as_ref(),
"ext_pcx_elevation_gradient",
data.elevation_as_gradient,
),
ro_prop("Croppings", "ext_pcx_croppings", crops),
ro_prop(t!("Croppings").as_ref(), "ext_pcx_croppings", crops),
],
},
]
@ -918,25 +871,23 @@ fn reference_properties(
fn properties(entity: &ExtendedEntity) -> Vec<PropSection> {
match &entity.data {
ExtendedEntityData::Camera { view_handle } => vec![PropSection {
title: "Camera".into(),
props: vec![ro_prop("View", "ext_camera_view", handle_text(*view_handle))],
title: t!("Camera").into_owned(),
props: vec![ro_prop(t!("View").as_ref(), "ext_camera_view", handle_text(*view_handle))],
}],
ExtendedEntityData::SectionObject(data) => section_properties(data),
ExtendedEntityData::ArcAlignedText(data) => arc_text_properties(data),
ExtendedEntityData::RemoteText(data) => remote_text_properties(data),
ExtendedEntityData::GeoPositionMarker(data) => geo_marker_properties(data),
ExtendedEntityData::CoordinationModel(data) => vec![PropSection {
title: "Coordination Model".into(),
title: t!("Coordination Model").into_owned(),
props: vec![
ro_prop("Flags", "ext_coord_flags", data.flags.to_string()),
ro_prop(
"Definition",
ro_prop(t!("Flags").as_ref(), "ext_coord_flags", data.flags.to_string()),
ro_prop(t!("Definition").as_ref(),
"ext_coord_definition",
handle_text(data.definition_handle),
),
edit_prop("Unit Factor", "ext_coord_unit", data.unit_factor),
ro_prop(
"Transform",
edit_prop(t!("Unit Factor").as_ref(), "ext_coord_unit", data.unit_factor),
ro_prop(t!("Transform").as_ref(),
"ext_coord_transform",
data.transform
.chunks_exact(4)
@ -954,68 +905,60 @@ fn properties(entity: &ExtendedEntity) -> Vec<PropSection> {
ExtendedEntityData::PointCloud(data) => point_cloud_properties(data),
ExtendedEntityData::PointCloudEx(data) => point_cloud_ex_properties(data),
ExtendedEntityData::Proxy(data) => vec![PropSection {
title: "Proxy Entity".into(),
title: t!("Proxy Entity").into_owned(),
props: vec![
ro_prop("Proxy ID", "ext_proxy_id", data.proxy_id.to_string()),
ro_prop("Class ID", "ext_proxy_class", data.class_id.to_string()),
ro_prop("DXF Subclass", "ext_proxy_subclass", data.dxf_subclass.clone()),
ro_prop("Version", "ext_proxy_version", data.version.to_string()),
ro_prop(
"DWG Version",
ro_prop(t!("Proxy ID").as_ref(), "ext_proxy_id", data.proxy_id.to_string()),
ro_prop(t!("Class ID").as_ref(), "ext_proxy_class", data.class_id.to_string()),
ro_prop(t!("DXF Subclass").as_ref(), "ext_proxy_subclass", data.dxf_subclass.clone()),
ro_prop(t!("Version").as_ref(), "ext_proxy_version", data.version.to_string()),
ro_prop(t!("DWG Version").as_ref(),
"ext_proxy_dwg_version",
format!("{}.{}", data.dwg_version, data.maintenance_version),
),
ro_prop("From DXF", "ext_proxy_from_dxf", data.from_dxf.to_string()),
ro_prop(
"Graphics",
ro_prop(t!("From DXF").as_ref(), "ext_proxy_from_dxf", data.from_dxf.to_string()),
ro_prop(t!("Graphics").as_ref(),
"ext_proxy_graphics",
format!("{} bits", data.graphics.bit_count),
),
ro_prop(
"Payload",
ro_prop(t!("Payload").as_ref(),
"ext_proxy_payload",
format!("{} bits", data.payload.bit_count),
),
ro_prop(
"Text Payload",
ro_prop(t!("Text Payload").as_ref(),
"ext_proxy_text_payload",
format!("{} bits", data.text_payload.bit_count),
),
ro_prop(
"Object References",
ro_prop(t!("Object References").as_ref(),
"ext_proxy_references",
reference_properties(&data.object_ids),
),
],
}],
ExtendedEntityData::OleFrame(data) => vec![PropSection {
title: "OLE Frame".into(),
title: t!("OLE Frame").into_owned(),
props: vec![
ro_prop("Flag", "ext_ole_flag", data.flag.to_string()),
ro_prop("Mode", "ext_ole_mode", data.mode.to_string()),
ro_prop(
"Storage Size",
ro_prop(t!("Flag").as_ref(), "ext_ole_flag", data.flag.to_string()),
ro_prop(t!("Mode").as_ref(), "ext_ole_mode", data.mode.to_string()),
ro_prop(t!("Storage Size").as_ref(),
"ext_ole_size",
format!("{} bytes", data.storage.encoded_len()),
),
],
}],
ExtendedEntityData::LayoutPrintConfig(data) => vec![PropSection {
title: "Layout Print Configuration".into(),
title: t!("Layout Print Configuration").into_owned(),
props: vec![
ro_prop(
"Class Version",
ro_prop(t!("Class Version").as_ref(),
"ext_print_version",
data.class_version.to_string(),
),
ro_prop("Flag", "ext_print_flag", data.flag.to_string()),
ro_prop(t!("Flag").as_ref(), "ext_print_flag", data.flag.to_string()),
],
}],
ExtendedEntityData::Format(data) => vec![PropSection {
title: "Format".into(),
title: t!("Format").into_owned(),
props: vec![
ro_prop(
"DWG Payload",
ro_prop(t!("DWG Payload").as_ref(),
"ext_format_dwg",
format!(
"{} bytes / {} handle bits",
@ -1023,54 +966,47 @@ fn properties(entity: &ExtendedEntity) -> Vec<PropSection> {
data.raw_dwg_handle_bits
),
),
ro_prop(
"DWG Version",
ro_prop(t!("DWG Version").as_ref(),
"ext_format_version",
format!("{:?}", data.raw_dwg_version),
),
ro_prop(
"DXF Codes",
ro_prop(t!("DXF Codes").as_ref(),
"ext_format_dxf",
data.raw_dxf_codes.as_ref().map_or(0, Vec::len).to_string(),
),
],
}],
ExtendedEntityData::Legacy(data) => vec![PropSection {
title: "Legacy Entity".into(),
props: vec![ro_prop("Data", "ext_legacy_data", format!("{data:#?}"))],
title: t!("Legacy Entity").into_owned(),
props: vec![ro_prop(t!("Data").as_ref(), "ext_legacy_data", format!("{data:#?}"))],
}],
ExtendedEntityData::DynamicBlock(data) => vec![PropSection {
title: "Dynamic Block Entity".into(),
title: t!("Dynamic Block Entity").into_owned(),
props: vec![
ro_prop(
"Class",
ro_prop(t!("Class").as_ref(),
"ext_dynamic_class",
data.entity_dxf_name().unwrap_or("Helper"),
),
ro_prop("Decoded Data", "ext_dynamic_data", format!("{data:#?}")),
ro_prop(t!("Decoded Data").as_ref(), "ext_dynamic_data", format!("{data:#?}")),
],
}],
ExtendedEntityData::RegisteredClass(data) => vec![PropSection {
title: "Registered Class Entity".into(),
title: t!("Registered Class Entity").into_owned(),
props: vec![
ro_prop("DXF Name", "ext_registered_dxf", data.dxf_name.clone()),
ro_prop(
"C++ Class",
ro_prop(t!("DXF Name").as_ref(), "ext_registered_dxf", data.dxf_name.clone()),
ro_prop(t!("C++ Class").as_ref(),
"ext_registered_cpp",
data.cpp_class_name.clone(),
),
ro_prop(
"Properties",
ro_prop(t!("Properties").as_ref(),
"ext_registered_properties",
semantic_properties(&data.properties),
),
ro_prop(
"Payload",
ro_prop(t!("Payload").as_ref(),
"ext_registered_payload",
format!("{} bits", data.payload.bit_count),
),
ro_prop(
"Object References",
ro_prop(t!("Object References").as_ref(),
"ext_registered_references",
reference_properties(&data.object_ids),
),

View file

@ -1,5 +1,6 @@
use acadrust::entities::{BoundaryEdge, Hatch};
use glam::Vec3;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, circle_grip, edit_angle_prop as edit_angle, edit_prop as edit, parse_f64, ro_prop as ro};
@ -264,10 +265,10 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
let centered = if g.shift.abs() < 1e-9 { "Yes" } else { "No" };
let mut sections = vec![
PropSection {
title: "Pattern".into(),
title: t!("Pattern").into_owned(),
props: vec![
Property {
label: "Type".into(),
label: t!("Type").into_owned(),
field: "fill_type",
value: PropValue::Choice {
selected: grad_type.to_string(),
@ -279,7 +280,7 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
crate::scene::model::hatch_model::GradientKind::from_name(&g.name);
let _ = invert;
Property {
label: "Gradient type".into(),
label: t!("Gradient type").into_owned(),
field: "gradient_type",
value: PropValue::Choice {
selected: kind.label().to_string(),
@ -291,7 +292,7 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
}
},
Property {
label: "Invert".into(),
label: t!("Invert").into_owned(),
field: "gradient_invert",
value: PropValue::BoolToggle {
field: "gradient_invert",
@ -302,39 +303,38 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
},
},
Property {
label: "Color 1".into(),
label: t!("Color 1").into_owned(),
field: "gradient_color_1",
value: PropValue::ColorChoice(grad_c1),
},
Property {
label: "Color 2".into(),
label: t!("Color 2").into_owned(),
field: "gradient_color_2",
value: PropValue::ColorChoice(grad_c2),
},
edit_angle("Angle", "pattern_angle", g.angle.to_degrees()),
ro("Centered", "gradient_centered", centered),
edit_angle(t!("Angle").as_ref(), "pattern_angle", g.angle.to_degrees()),
ro(t!("Centered").as_ref(), "gradient_centered", centered),
],
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Elevation", "elevation", h.elevation),
ro("Area", "area", format!("{:.4}", area)),
ro("Cumulative area", "cumulative_area", format!("{:.4}", area)),
edit(t!("Elevation").as_ref(), "elevation", h.elevation),
ro(t!("Area").as_ref(), "area", format!("{:.4}", area)),
ro(t!("Cumulative area").as_ref(), "cumulative_area", format!("{:.4}", area)),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
ro(
"Associative",
ro(t!("Associative").as_ref(),
"associative",
if h.is_associative { "Yes" } else { "No" },
),
ro("Annotative", "annotative", String::new()),
ro("Island detection style", "style", style),
ro(t!("Annotative").as_ref(), "annotative", String::new()),
ro(t!("Island detection style").as_ref(), "style", style),
Property {
label: "Background".into(),
label: t!("Background").into_owned(),
field: "bg_enabled",
value: PropValue::BoolToggle {
field: "bg_enabled",
@ -347,7 +347,7 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
if bg_on {
if let Some(sec) = sections.last_mut() {
sec.props.push(Property {
label: "Background color".into(),
label: t!("Background color").into_owned(),
field: "background_color",
value: PropValue::ColorChoice(bg_col),
});
@ -360,7 +360,7 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
// ── Hatch (pattern / solid) ────────────────────────────────────────────
// "Type" = pattern definition source (Predefined / User Defined / Custom).
let type_row = Property {
label: "Type".into(),
label: t!("Type").into_owned(),
field: "pattern_type_label",
value: PropValue::Choice {
selected: pattern_type.to_string(),
@ -368,12 +368,12 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
},
};
let pattern_name_row = Property {
label: "Pattern name".into(),
label: t!("Pattern name").into_owned(),
field: "pattern_name",
value: PropValue::HatchPatternChoice(h.pattern.name.clone()),
};
let associative_row = Property {
label: "Associative".into(),
label: t!("Associative").into_owned(),
field: "associative",
value: PropValue::BoolToggle {
field: "associative",
@ -381,7 +381,7 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
},
};
let double_row = Property {
label: "Double".into(),
label: t!("Double").into_owned(),
field: "double",
value: PropValue::BoolToggle {
field: "double",
@ -389,15 +389,14 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
},
};
let island_row = Property {
label: "Island detection style".into(),
label: t!("Island detection style").into_owned(),
field: "style",
value: PropValue::Choice {
selected: style.to_string(),
options: vec!["Normal".into(), "Outer".into(), "Ignore".into()],
},
};
let spacing_row = edit(
"Spacing",
let spacing_row = edit(t!("Spacing").as_ref(),
"spacing",
h.pattern
.lines
@ -415,22 +414,22 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
let mut sections = vec![
PropSection {
title: "Pattern".into(),
title: t!("Pattern").into_owned(),
props: vec![
type_row,
pattern_name_row,
ro("Annotative", "annotative", String::new()),
edit_angle("Angle", "pattern_angle", h.pattern_angle.to_degrees()),
edit("Scale", "pattern_scale", h.pattern_scale),
edit("Origin X", "origin_x", origin_x),
edit("Origin Y", "origin_y", origin_y),
ro(t!("Annotative").as_ref(), "annotative", String::new()),
edit_angle(t!("Angle").as_ref(), "pattern_angle", h.pattern_angle.to_degrees()),
edit(t!("Scale").as_ref(), "pattern_scale", h.pattern_scale),
edit(t!("Origin X").as_ref(), "origin_x", origin_x),
edit(t!("Origin Y").as_ref(), "origin_y", origin_y),
spacing_row,
ro("ISO pen width", "iso_pen_width", String::new()),
ro(t!("ISO pen width").as_ref(), "iso_pen_width", String::new()),
double_row,
associative_row,
island_row,
Property {
label: "Background".into(),
label: t!("Background").into_owned(),
field: "bg_enabled",
value: PropValue::BoolToggle {
field: "bg_enabled",
@ -440,18 +439,18 @@ fn properties(h: &Hatch) -> Vec<PropSection> {
],
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Elevation", "elevation", h.elevation),
ro("Area", "area", format!("{:.4}", area)),
ro("Cumulative area", "cumulative_area", format!("{:.4}", area)),
edit(t!("Elevation").as_ref(), "elevation", h.elevation),
ro(t!("Area").as_ref(), "area", format!("{:.4}", area)),
ro(t!("Cumulative area").as_ref(), "cumulative_area", format!("{:.4}", area)),
],
},
];
if bg_on {
if let Some(sec) = sections.first_mut() {
sec.props.push(Property {
label: "Background color".into(),
label: t!("Background color").into_owned(),
field: "background_color",
value: PropValue::ColorChoice(bg_col),
});

View file

@ -7,6 +7,7 @@
// as the Geometry property group.
use acadrust::entities::{Helix, HelixConstraint};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::ro_prop as ro;
@ -70,20 +71,20 @@ fn properties(helix: &Helix) -> Vec<PropSection> {
};
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Base point X", "base_x", format!("{:.4}", bp.x)),
ro("Base point Y", "base_y", format!("{:.4}", bp.y)),
ro("Base point Z", "base_z", format!("{:.4}", bp.z)),
ro("Number of turns", "num_turns", format!("{turns:.4}")),
ro("Turn height", "turn_height", format!("{turn_height:.4}")),
ro("Turns", "turns", format!("{turns:.4}")),
ro("Height", "height", format!("{height:.4}")),
ro("Base radius", "base_radius", format!("{base_radius:.4}")),
ro("Top radius", "top_radius", format!("{top_radius:.4}")),
ro("Turn slope", "turn_slope", format!("{turn_slope:.4}")),
ro("Twist", "twist", twist),
ro("Constrain", "constrain", constrain),
ro(t!("Base point X").as_ref(), "base_x", format!("{:.4}", bp.x)),
ro(t!("Base point Y").as_ref(), "base_y", format!("{:.4}", bp.y)),
ro(t!("Base point Z").as_ref(), "base_z", format!("{:.4}", bp.z)),
ro(t!("Number of turns").as_ref(), "num_turns", format!("{turns:.4}")),
ro(t!("Turn height").as_ref(), "turn_height", format!("{turn_height:.4}")),
ro(t!("Turns").as_ref(), "turns", format!("{turns:.4}")),
ro(t!("Height").as_ref(), "height", format!("{height:.4}")),
ro(t!("Base radius").as_ref(), "base_radius", format!("{base_radius:.4}")),
ro(t!("Top radius").as_ref(), "top_radius", format!("{top_radius:.4}")),
ro(t!("Turn slope").as_ref(), "turn_slope", format!("{turn_slope:.4}")),
ro(t!("Twist").as_ref(), "twist", twist),
ro(t!("Constrain").as_ref(), "constrain", constrain),
],
}]
}

View file

@ -10,6 +10,7 @@ use crate::entities::traits::TruckConvertible;
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::TangentGeom;
use crate::t;
// ── TruckConvertible (used for snap/grip key-vertices) ─────────────────────
@ -219,27 +220,27 @@ fn properties(leader: &Leader) -> Vec<PropSection> {
// Geometry sits right after General — a leader owns editable path vertices,
// navigated one at a time by the Current Vertex spinner.
let mut geometry = vec![stepper("Current Vertex", "current_vertex", vertex_label)];
let mut geometry = vec![stepper(t!("Current Vertex").as_ref(), "current_vertex", vertex_label)];
if let Some(v) = leader.vertices.get(vi) {
geometry.push(edit("Vertex X", "vertex_x", v.x));
geometry.push(edit("Vertex Y", "vertex_y", v.y));
geometry.push(edit("Vertex Z", "vertex_z", v.z));
geometry.push(edit(t!("Vertex X").as_ref(), "vertex_x", v.x));
geometry.push(edit(t!("Vertex Y").as_ref(), "vertex_y", v.y));
geometry.push(edit(t!("Vertex Z").as_ref(), "vertex_z", v.z));
} else {
geometry.push(ro("Vertex X", "vertex_x", String::new()));
geometry.push(ro("Vertex Y", "vertex_y", String::new()));
geometry.push(ro("Vertex Z", "vertex_z", String::new()));
geometry.push(ro(t!("Vertex X").as_ref(), "vertex_x", String::new()));
geometry.push(ro(t!("Vertex Y").as_ref(), "vertex_y", String::new()));
geometry.push(ro(t!("Vertex Z").as_ref(), "vertex_z", String::new()));
}
// Misc: Dim style (upgraded to a dropdown by the panel builder), the
// combined path/arrow Type, and annotative state (from the dim style).
let misc = vec![
Property {
label: "Dim style".into(),
label: t!("Dim style").into_owned(),
field: "dimension_style",
value: PropValue::EditText(leader.dimension_style.clone()),
},
choice_prop(
"Type",
t!("Type").as_ref(),
"leader_type",
leader_type_str(&leader.path_type, leader.arrow_enabled),
&[
@ -249,42 +250,42 @@ fn properties(leader: &Leader) -> Vec<PropSection> {
"Spline without arrow",
],
),
ro("Annotative", "annotative", "No"),
ro(t!("Annotative").as_ref(), "annotative", "No"),
];
// Lines & Arrows / Text / Fit are dimension-style-derived; the panel builder
// resolves leader.dimension_style and fills these values from the DimStyle.
let lines_arrows = vec![
ro("Arrow", "arrow_block", "Closed filled"),
ro("Arrow size", "arrow_size", String::new()),
ro("Dim line lineweight", "dim_line_lw", "ByLayer"),
ro("Dim line color", "dim_line_color", "ByLayer"),
ro(t!("Arrow").as_ref(), "arrow_block", "Closed filled"),
ro(t!("Arrow size").as_ref(), "arrow_size", String::new()),
ro(t!("Dim line lineweight").as_ref(), "dim_line_lw", "ByLayer"),
ro(t!("Dim line color").as_ref(), "dim_line_color", "ByLayer"),
];
let text = vec![
ro("Text offset", "text_offset", String::new()),
ro("Text pos vert", "text_pos_vert", String::new()),
ro(t!("Text offset").as_ref(), "text_offset", String::new()),
ro(t!("Text pos vert").as_ref(), "text_pos_vert", String::new()),
];
let fit = vec![ro("Dim scale overall", "dim_scale_overall", String::new())];
let fit = vec![ro(t!("Dim scale overall").as_ref(), "dim_scale_overall", String::new())];
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: geometry,
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: misc,
},
PropSection {
title: "Lines & Arrows".into(),
title: t!("Lines & Arrows").into_owned(),
props: lines_arrows,
},
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: text,
},
PropSection {
title: "Fit".into(),
title: t!("Fit").into_owned(),
props: fit,
},
]

View file

@ -11,6 +11,7 @@
use acadrust::entities::Light;
use acadrust::EntityType;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{
@ -262,27 +263,27 @@ impl PropertyEditable for Light {
_ => "Point",
};
let mut props = vec![
ro_prop("Name", "li_name", self.name.clone()),
ro_prop("Type", "li_type", kind),
edit("Position X", "li_px", self.position.x),
edit("Position Y", "li_py", self.position.y),
edit("Position Z", "li_pz", self.position.z),
ro_prop(t!("Name").as_ref(), "li_name", self.name.clone()),
ro_prop(t!("Type").as_ref(), "li_type", kind),
edit(t!("Position X").as_ref(), "li_px", self.position.x),
edit(t!("Position Y").as_ref(), "li_py", self.position.y),
edit(t!("Position Z").as_ref(), "li_pz", self.position.z),
];
if self.light_type != 2 {
props.push(edit("Target X", "li_tx", self.target.x));
props.push(edit("Target Y", "li_ty", self.target.y));
props.push(edit("Target Z", "li_tz", self.target.z));
props.push(edit(t!("Target X").as_ref(), "li_tx", self.target.x));
props.push(edit(t!("Target Y").as_ref(), "li_ty", self.target.y));
props.push(edit(t!("Target Z").as_ref(), "li_tz", self.target.z));
}
let mut sections = vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props,
},
PropSection {
title: "Light".into(),
title: t!("Light").into_owned(),
props: vec![
Property {
label: "On".into(),
label: t!("On").into_owned(),
field: "li_status",
value: PropValue::BoolToggle {
field: "li_status",
@ -290,17 +291,17 @@ impl PropertyEditable for Light {
},
},
Property {
label: "Plot Glyph".into(),
label: t!("Plot Glyph").into_owned(),
field: "li_plot_glyph",
value: PropValue::BoolToggle {
field: "li_plot_glyph",
value: self.plot_glyph,
},
},
ro_prop("Color", "li_color", format!("{:?}", self.light_color)),
edit("Intensity", "li_intensity", self.intensity),
ro_prop(t!("Color").as_ref(), "li_color", format!("{:?}", self.light_color)),
edit(t!("Intensity").as_ref(), "li_intensity", self.intensity),
Property {
label: "Attenuation".into(),
label: t!("Attenuation").into_owned(),
field: "li_attenuation",
value: PropValue::Choice {
selected: match self.attenuation_type {
@ -317,42 +318,39 @@ impl PropertyEditable for Light {
},
},
Property {
label: "Use Limits".into(),
label: t!("Use Limits").into_owned(),
field: "li_use_limits",
value: PropValue::BoolToggle {
field: "li_use_limits",
value: self.use_attenuation_limits,
},
},
edit("Start Limit", "li_start", self.attenuation_start_limit),
edit("End Limit", "li_end", self.attenuation_end_limit),
edit_angle_prop(
"Hotspot Angle",
edit(t!("Start Limit").as_ref(), "li_start", self.attenuation_start_limit),
edit(t!("End Limit").as_ref(), "li_end", self.attenuation_end_limit),
edit_angle_prop(t!("Hotspot Angle").as_ref(),
"li_hotspot",
self.hotspot_angle.to_degrees(),
),
edit_angle_prop(
"Falloff Angle",
edit_angle_prop(t!("Falloff Angle").as_ref(),
"li_falloff",
self.falloff_angle.to_degrees(),
),
],
},
PropSection {
title: "Shadows".into(),
title: t!("Shadows").into_owned(),
props: vec![
Property {
label: "Cast Shadows".into(),
label: t!("Cast Shadows").into_owned(),
field: "li_shadows",
value: PropValue::BoolToggle {
field: "li_shadows",
value: self.cast_shadows,
},
},
ro_prop("Type", "li_shadow_type", self.shadow_type.to_string()),
ro_prop("Map Size", "li_shadow_size", self.shadow_map_size.to_string()),
ro_prop(
"Softness",
ro_prop(t!("Type").as_ref(), "li_shadow_type", self.shadow_type.to_string()),
ro_prop(t!("Map Size").as_ref(), "li_shadow_size", self.shadow_map_size.to_string()),
ro_prop(t!("Softness").as_ref(),
"li_shadow_softness",
self.shadow_map_softness.to_string(),
),
@ -361,36 +359,30 @@ impl PropertyEditable for Light {
];
if let Some(photo) = &self.photometric_data {
sections.push(PropSection {
title: "Photometric".into(),
title: t!("Photometric").into_owned(),
props: vec![
ro_prop("Web File", "li_web_file", photo.web_file.clone()),
ro_prop(
"Physical Method",
ro_prop(t!("Web File").as_ref(), "li_web_file", photo.web_file.clone()),
ro_prop(t!("Physical Method").as_ref(),
"li_physical_method",
photo.physical_intensity_method.to_string(),
),
edit(
"Physical Intensity",
edit(t!("Physical Intensity").as_ref(),
"li_physical_intensity",
photo.physical_intensity,
),
edit(
"Illuminance Distance",
edit(t!("Illuminance Distance").as_ref(),
"li_illuminance_distance",
photo.illuminance_distance,
),
edit(
"Color Temperature",
edit(t!("Color Temperature").as_ref(),
"li_color_temperature",
photo.lamp_color_temperature,
),
ro_prop(
"Lamp Preset",
ro_prop(t!("Lamp Preset").as_ref(),
"li_lamp_preset",
photo.lamp_color_preset.to_string(),
),
ro_prop(
"Shape",
ro_prop(t!("Shape").as_ref(),
"li_shape",
format!(
"{} · {:.6} × {:.6} · radius {:.6}",
@ -400,8 +392,7 @@ impl PropertyEditable for Light {
photo.extended_light_radius
),
),
ro_prop(
"Web",
ro_prop(t!("Web").as_ref(),
"li_web",
format!(
"type {}; symmetry {}; flux {:.6}; angles {:?}; rotation {:.6},{:.6},{:.6}",

View file

@ -1,4 +1,5 @@
use acadrust::{entities::Line, Entity};
use crate::t;
use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
@ -81,19 +82,19 @@ fn properties(line: &Line) -> Vec<PropSection> {
let dz = line.end.z - line.start.z;
let angle = dy.atan2(dx).to_degrees().rem_euclid(360.0);
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Start X", "start_x", line.start.x),
edit("Start Y", "start_y", line.start.y),
edit("Start Z", "start_z", line.start.z),
edit("End X", "end_x", line.end.x),
edit("End Y", "end_y", line.end.y),
edit("End Z", "end_z", line.end.z),
ro("Delta X", "delta_x", format!("{dx:.4}")),
ro("Delta Y", "delta_y", format!("{dy:.4}")),
ro("Delta Z", "delta_z", format!("{dz:.4}")),
ro("Length", "length", format!("{:.4}", line.length())),
ro("Angle", "angle", format!("{angle:.2}")),
edit(t!("Start X").as_ref(), "start_x", line.start.x),
edit(t!("Start Y").as_ref(), "start_y", line.start.y),
edit(t!("Start Z").as_ref(), "start_z", line.start.z),
edit(t!("End X").as_ref(), "end_x", line.end.x),
edit(t!("End Y").as_ref(), "end_y", line.end.y),
edit(t!("End Z").as_ref(), "end_z", line.end.z),
ro(t!("Delta X").as_ref(), "delta_x", format!("{dx:.4}")),
ro(t!("Delta Y").as_ref(), "delta_y", format!("{dy:.4}")),
ro(t!("Delta Z").as_ref(), "delta_z", format!("{dz:.4}")),
ro(t!("Length").as_ref(), "length", format!("{:.4}", line.length())),
ro(t!("Angle").as_ref(), "angle", format!("{angle:.2}")),
],
}]
}

View file

@ -1,4 +1,5 @@
use acadrust::entities::{LwPolyline, LwVertex};
use crate::t;
use truck_modeling::{builder, Edge, Point3, Wire};
use crate::command::EntityTransform;
@ -616,24 +617,24 @@ fn properties(pline: &LwPolyline) -> Vec<PropSection> {
};
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
stepper("Current Vertex", "current_vertex", vertex_label),
edit("Vertex X", "vertex_x", vx),
edit("Vertex Y", "vertex_y", vy),
edit("Start segment width", "start_width", start_w),
edit("End segment width", "end_width", end_w),
edit("Global width", "global_width", pline.constant_width),
edit("Elevation", "elevation", pline.elevation),
ro("Area", "area", format!("{:.4}", mp.area)),
ro("Length", "length", format!("{:.4}", mp.perimeter)),
stepper(t!("Current Vertex").as_ref(), "current_vertex", vertex_label),
edit(t!("Vertex X").as_ref(), "vertex_x", vx),
edit(t!("Vertex Y").as_ref(), "vertex_y", vy),
edit(t!("Start segment width").as_ref(), "start_width", start_w),
edit(t!("End segment width").as_ref(), "end_width", end_w),
edit(t!("Global width").as_ref(), "global_width", pline.constant_width),
edit(t!("Elevation").as_ref(), "elevation", pline.elevation),
ro(t!("Area").as_ref(), "area", format!("{:.4}", mp.area)),
ro(t!("Length").as_ref(), "length", format!("{:.4}", mp.perimeter)),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
Property {
label: "Closed".into(),
label: t!("Closed").into_owned(),
field: "closed",
value: PropValue::BoolToggle {
field: "closed",
@ -641,7 +642,7 @@ fn properties(pline: &LwPolyline) -> Vec<PropSection> {
},
},
Property {
label: "Linetype generation".into(),
label: t!("Linetype generation").into_owned(),
field: "plinegen",
value: PropValue::BoolToggle {
field: "plinegen",

View file

@ -1,5 +1,6 @@
use acadrust::entities::{mesh::Mesh, polygon_mesh::PolygonMesh, Face3D, PolyfaceMesh};
use glam::Vec3;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{parse_f64, ro_prop as ro, square_grip};
@ -249,25 +250,25 @@ impl PropertyEditable for Face3D {
let inv = self.invisible_edges;
let edge = |hidden: bool| if hidden { "Invisible" } else { "Visible" };
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Current vertex", "f3_current", String::new()),
edit("Vertex 1 X", "f3_p1x", self.first_corner.x),
edit("Vertex 1 Y", "f3_p1y", self.first_corner.y),
edit("Vertex 1 Z", "f3_p1z", self.first_corner.z),
edit("Vertex 2 X", "f3_p2x", self.second_corner.x),
edit("Vertex 2 Y", "f3_p2y", self.second_corner.y),
edit("Vertex 2 Z", "f3_p2z", self.second_corner.z),
edit("Vertex 3 X", "f3_p3x", self.third_corner.x),
edit("Vertex 3 Y", "f3_p3y", self.third_corner.y),
edit("Vertex 3 Z", "f3_p3z", self.third_corner.z),
edit("Vertex 4 X", "f3_p4x", self.fourth_corner.x),
edit("Vertex 4 Y", "f3_p4y", self.fourth_corner.y),
edit("Vertex 4 Z", "f3_p4z", self.fourth_corner.z),
ro("Edge 1", "f3_edge1", edge(inv.is_first_invisible())),
ro("Edge 2", "f3_edge2", edge(inv.is_second_invisible())),
ro("Edge 3", "f3_edge3", edge(inv.is_third_invisible())),
ro("Edge 4", "f3_edge4", edge(inv.is_fourth_invisible())),
ro(t!("Current vertex").as_ref(), "f3_current", String::new()),
edit(t!("Vertex 1 X").as_ref(), "f3_p1x", self.first_corner.x),
edit(t!("Vertex 1 Y").as_ref(), "f3_p1y", self.first_corner.y),
edit(t!("Vertex 1 Z").as_ref(), "f3_p1z", self.first_corner.z),
edit(t!("Vertex 2 X").as_ref(), "f3_p2x", self.second_corner.x),
edit(t!("Vertex 2 Y").as_ref(), "f3_p2y", self.second_corner.y),
edit(t!("Vertex 2 Z").as_ref(), "f3_p2z", self.second_corner.z),
edit(t!("Vertex 3 X").as_ref(), "f3_p3x", self.third_corner.x),
edit(t!("Vertex 3 Y").as_ref(), "f3_p3y", self.third_corner.y),
edit(t!("Vertex 3 Z").as_ref(), "f3_p3z", self.third_corner.z),
edit(t!("Vertex 4 X").as_ref(), "f3_p4x", self.fourth_corner.x),
edit(t!("Vertex 4 Y").as_ref(), "f3_p4y", self.fourth_corner.y),
edit(t!("Vertex 4 Z").as_ref(), "f3_p4z", self.fourth_corner.z),
ro(t!("Edge 1").as_ref(), "f3_edge1", edge(inv.is_first_invisible())),
ro(t!("Edge 2").as_ref(), "f3_edge2", edge(inv.is_second_invisible())),
ro(t!("Edge 3").as_ref(), "f3_edge3", edge(inv.is_third_invisible())),
ro(t!("Edge 4").as_ref(), "f3_edge4", edge(inv.is_fourth_invisible())),
],
}]
}
@ -380,37 +381,34 @@ impl PropertyEditable for PolygonMesh {
let face_count = cells_m * cells_n;
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Vertex", "pm_vertex", String::new()),
ro(
"Vertex X",
ro(t!("Vertex").as_ref(), "pm_vertex", String::new()),
ro(t!("Vertex X").as_ref(),
"pm_vx",
first.map(|v| format!("{:.4}", v.location.x)).unwrap_or_default(),
),
ro(
"Vertex Y",
ro(t!("Vertex Y").as_ref(),
"pm_vy",
first.map(|v| format!("{:.4}", v.location.y)).unwrap_or_default(),
),
ro(
"Vertex Z",
ro(t!("Vertex Z").as_ref(),
"pm_vz",
first.map(|v| format!("{:.4}", v.location.z)).unwrap_or_default(),
),
ro("M vertex count", "pm_m", self.m_vertex_count.to_string()),
ro("N vertex count", "pm_n", self.n_vertex_count.to_string()),
ro("M closed", "pm_closed_m", yesno(self.is_closed_m())),
ro("N closed", "pm_closed_n", yesno(self.is_closed_n())),
ro("M density", "pm_smooth_m", self.m_smooth_density.to_string()),
ro("N density", "pm_smooth_n", self.n_smooth_density.to_string()),
ro("Vertex count", "pm_v", self.vertices.len().to_string()),
ro("Face count", "pm_faces", face_count.to_string()),
ro(t!("M vertex count").as_ref(), "pm_m", self.m_vertex_count.to_string()),
ro(t!("N vertex count").as_ref(), "pm_n", self.n_vertex_count.to_string()),
ro(t!("M closed").as_ref(), "pm_closed_m", yesno(self.is_closed_m())),
ro(t!("N closed").as_ref(), "pm_closed_n", yesno(self.is_closed_n())),
ro(t!("M density").as_ref(), "pm_smooth_m", self.m_smooth_density.to_string()),
ro(t!("N density").as_ref(), "pm_smooth_n", self.n_smooth_density.to_string()),
ro(t!("Vertex count").as_ref(), "pm_v", self.vertices.len().to_string()),
ro(t!("Face count").as_ref(), "pm_faces", face_count.to_string()),
],
},
PropSection {
title: "Misc".into(),
props: vec![ro("Fit/smooth", "pm_smooth", smooth)],
title: t!("Misc").into_owned(),
props: vec![ro(t!("Fit/smooth").as_ref(), "pm_smooth", smooth)],
},
]
}
@ -495,39 +493,36 @@ impl PropertyEditable for PolyfaceMesh {
let first = self.vertices.first();
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Vertex", "pfm_vertex", String::new()),
ro(
"Vertex X",
ro(t!("Vertex").as_ref(), "pfm_vertex", String::new()),
ro(t!("Vertex X").as_ref(),
"pfm_vx",
first.map(|v| format!("{:.4}", v.location.x)).unwrap_or_default(),
),
ro(
"Vertex Y",
ro(t!("Vertex Y").as_ref(),
"pfm_vy",
first.map(|v| format!("{:.4}", v.location.y)).unwrap_or_default(),
),
ro(
"Vertex Z",
ro(t!("Vertex Z").as_ref(),
"pfm_vz",
first.map(|v| format!("{:.4}", v.location.z)).unwrap_or_default(),
),
// Polyface meshes store an explicit vertex/face list rather
// than an M×N grid, so the grid-only rows are not applicable.
ro("M vertex count", "pfm_m", String::new()),
ro("N vertex count", "pfm_n", String::new()),
ro("M closed", "pfm_closed_m", String::new()),
ro("N closed", "pfm_closed_n", String::new()),
ro("M density", "pfm_density_m", String::new()),
ro("N density", "pfm_density_n", String::new()),
ro("Vertex count", "pfm_v", self.vertices.len().to_string()),
ro("Face count", "pfm_f", self.faces.len().to_string()),
ro(t!("M vertex count").as_ref(), "pfm_m", String::new()),
ro(t!("N vertex count").as_ref(), "pfm_n", String::new()),
ro(t!("M closed").as_ref(), "pfm_closed_m", String::new()),
ro(t!("N closed").as_ref(), "pfm_closed_n", String::new()),
ro(t!("M density").as_ref(), "pfm_density_m", String::new()),
ro(t!("N density").as_ref(), "pfm_density_n", String::new()),
ro(t!("Vertex count").as_ref(), "pfm_v", self.vertices.len().to_string()),
ro(t!("Face count").as_ref(), "pfm_f", self.faces.len().to_string()),
],
},
PropSection {
title: "Misc".into(),
props: vec![ro("Fit/smooth", "pfm_smooth", smooth)],
title: t!("Misc").into_owned(),
props: vec![ro(t!("Fit/smooth").as_ref(), "pfm_smooth", smooth)],
},
]
}
@ -1149,26 +1144,25 @@ impl PropertyEditable for Mesh {
let watertight =
!self.faces.is_empty() && edge_use.values().all(|&c| c == 2);
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
Property {
label: "Level of Smoothness".into(),
label: t!("Level of Smoothness").into_owned(),
field: "msh_subdiv_edit",
value: PropValue::EditText(self.subdivision_level.to_string()),
},
Property {
label: "Blend Creases".into(),
label: t!("Blend Creases").into_owned(),
field: "msh_blend_crease",
value: PropValue::BoolToggle {
field: "msh_blend_crease",
value: self.blend_crease,
},
},
ro("Number of Faces", "msh_f", self.faces.len().to_string()),
ro("Number of Vertices", "msh_v", self.vertices.len().to_string()),
ro("Number of Edges", "msh_e", self.edges.len().to_string()),
ro(
"Creased Edges",
ro(t!("Number of Faces").as_ref(), "msh_f", self.faces.len().to_string()),
ro(t!("Number of Vertices").as_ref(), "msh_v", self.vertices.len().to_string()),
ro(t!("Number of Edges").as_ref(), "msh_e", self.edges.len().to_string()),
ro(t!("Creased Edges").as_ref(),
"msh_creased",
self.edges
.iter()
@ -1176,14 +1170,12 @@ impl PropertyEditable for Mesh {
.count()
.to_string(),
),
ro(
"Override Option",
ro(t!("Override Option").as_ref(),
"msh_override",
self.override_option.to_string(),
),
ro("Number of Grips", "msh_grips", self.vertices.len().to_string()),
ro(
"Watertight",
ro(t!("Number of Grips").as_ref(), "msh_grips", self.vertices.len().to_string()),
ro(t!("Watertight").as_ref(),
"msh_watertight",
if watertight { "Yes" } else { "No" },
),

View file

@ -1,4 +1,5 @@
use acadrust::entities::MLine;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
@ -336,24 +337,24 @@ impl PropertyEditable for MLine {
let cur_z = cur.map(|v| v.position.z).unwrap_or(0.0);
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Vertex", "ml_vertex", if self.vertices.is_empty() { String::new() } else { "1".to_string() }),
edit("Vertex X", "ml_vertex_x", cur_x),
edit("Vertex Y", "ml_vertex_y", cur_y),
edit("Vertex Z", "ml_vertex_z", cur_z),
ro(t!("Vertex").as_ref(), "ml_vertex", if self.vertices.is_empty() { String::new() } else { "1".to_string() }),
edit(t!("Vertex X").as_ref(), "ml_vertex_x", cur_x),
edit(t!("Vertex Y").as_ref(), "ml_vertex_y", cur_y),
edit(t!("Vertex Z").as_ref(), "ml_vertex_z", cur_z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "ml_style",
value: PropValue::EditText(self.style_name.clone()),
},
Property {
label: "Style justification".into(),
label: t!("Style justification").into_owned(),
field: "ml_justification",
value: PropValue::Choice {
selected: just_str.to_string(),
@ -363,7 +364,7 @@ impl PropertyEditable for MLine {
.collect(),
},
},
edit("Style scale", "ml_scale", self.scale_factor),
edit(t!("Style scale").as_ref(), "ml_scale", self.scale_factor),
],
},
]

View file

@ -11,6 +11,7 @@ use crate::entities::traits::{Grippable, PropertyEditable, Transformable, TruckC
use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
use crate::t;
/// The entity's `column_data` as the layout's column description.
///
@ -254,15 +255,15 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
let height_editable = col_type == 1 || (col_type == 2 && !t.column_data.auto_height);
vec![
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: vec![
Property {
label: "Contents".into(),
label: t!("Contents").into_owned(),
field: "content",
value: PropValue::EditText(t.value.clone()),
},
Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "style",
value: PropValue::Choice {
selected: if t.style.trim().is_empty() {
@ -274,12 +275,12 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
},
},
ro(
"Annotative",
t!("Annotative").as_ref(),
"annotative",
if t.is_annotative { "Yes" } else { "No" },
),
Property {
label: "Justify".into(),
label: t!("Justify").into_owned(),
field: "justify",
value: PropValue::Choice {
selected: attachment_str(&t.attachment_point).to_string(),
@ -300,7 +301,7 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
},
},
Property {
label: "Direction".into(),
label: t!("Direction").into_owned(),
field: "direction",
value: PropValue::Choice {
selected: drawing_dir_str(&t.drawing_direction).to_string(),
@ -310,12 +311,12 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
.collect(),
},
},
edit("Text height", "height", t.height),
edit_angle("Rotation", "rotation", t.rotation.to_degrees()),
edit("Line space factor", "line_spacing", t.line_spacing_factor),
edit("Line space distance", "line_space_distance", line_space_distance),
edit(t!("Text height").as_ref(), "height", t.height),
edit_angle(t!("Rotation").as_ref(), "rotation", t.rotation.to_degrees()),
edit(t!("Line space factor").as_ref(), "line_spacing", t.line_spacing_factor),
edit(t!("Line space distance").as_ref(), "line_space_distance", line_space_distance),
Property {
label: "Line space style".into(),
label: t!("Line space style").into_owned(),
field: "line_space_style",
value: PropValue::Choice {
selected: match t.line_spacing_style {
@ -330,7 +331,7 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
},
},
Property {
label: "Background mask".into(),
label: t!("Background mask").into_owned(),
field: "background_mask",
value: PropValue::Choice {
selected: if t.background_fill_flags & 0x01 != 0 {
@ -346,15 +347,15 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
.collect(),
},
},
num_row("Defined width", "rect_w", t.rectangle_width, width_editable),
num_row(t!("Defined width").as_ref(), "rect_w", t.rectangle_width, width_editable),
num_row(
"Defined height",
t!("Defined height").as_ref(),
"rect_h",
t.rectangle_height.unwrap_or(0.0),
height_editable,
),
Property {
label: "Columns".into(),
label: t!("Columns").into_owned(),
field: "columns",
value: PropValue::Choice {
selected: columns_str(&t.column_data).to_string(),
@ -366,20 +367,20 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
},
// Count / width / gutter are live only when columns are on.
num_row(
"Column count",
t!("Column count").as_ref(),
"col_count",
t.column_data.column_count as f64,
col_type != 0,
),
num_row("Column width", "col_width", t.column_data.width, col_type != 0),
num_row(t!("Column width").as_ref(), "col_width", t.column_data.width, col_type != 0),
num_row(
"Column gutter",
t!("Column gutter").as_ref(),
"col_gutter",
t.column_data.gutter,
col_type != 0,
),
Property {
label: "Text frame".into(),
label: t!("Text frame").into_owned(),
field: "text_frame",
value: PropValue::BoolToggle {
field: "text_frame",
@ -389,11 +390,11 @@ fn properties(t: &MText, text_style_names: &[String]) -> Vec<PropSection> {
],
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "ins_x", t.insertion_point.x),
edit("Position Y", "ins_y", t.insertion_point.y),
edit("Position Z", "ins_z", t.insertion_point.z),
edit(t!("Position X").as_ref(), "ins_x", t.insertion_point.x),
edit(t!("Position Y").as_ref(), "ins_y", t.insertion_point.y),
edit(t!("Position Z").as_ref(), "ins_z", t.insertion_point.z),
],
},
]

View file

@ -6,6 +6,7 @@ use acadrust::entities::{
use crate::entities::text_support::{
layout_mtext, resolve_text_style, MTextRenderOpts, MTextVAnchor, ResolvedTextStyle,
};
use crate::t;
/// Map MLEADER's vertical attachment enum onto the shared `MTextVAnchor`
/// used by `layout_mtext`. Replaces the old `v_offset_for_attachment`
@ -650,19 +651,19 @@ fn properties(ml: &MultiLeader) -> Vec<PropSection> {
// ── Misc ─────────────────────────────────────────────────────────────
let misc = PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
// Overall scale is grayed when annotative (annotation scale drives sizing).
num_row(
"Overall scale",
t!("Overall scale").as_ref(),
"scale_factor",
ml.scale_factor,
!ml.enable_annotation_scale,
),
// Style name is resolved from style_handle by the panel builder (needs doc).
ro("Multileader style", "mleader_style", "Standard"),
ro(t!("Multileader style").as_ref(), "mleader_style", "Standard"),
bool_toggle(
"Annotative",
t!("Annotative").as_ref(),
"enable_annotation_scale",
ml.enable_annotation_scale,
),
@ -673,127 +674,127 @@ fn properties(ml: &MultiLeader) -> Vec<PropSection> {
// Landing rows are folded in here: the standalone "Leader Structure" group
// is a style-dialog tab, not a palette group.
let leaders = PropSection {
title: "Leaders".into(),
title: t!("Leaders").into_owned(),
props: vec![
choice(
"Leader type",
t!("Leader type").as_ref(),
"path_type",
leader_type_str(&ml.path_type),
&["Straight", "Spline", "None"],
),
Property {
label: "Leader color".into(),
label: t!("Leader color").into_owned(),
field: "line_color",
value: PropValue::ColorChoice(ml.line_color),
},
// Linetype name resolved from line_type_handle by the panel builder.
ro("Leader linetype", "line_type_handle", "ByBlock"),
ro(t!("Leader linetype").as_ref(), "line_type_handle", "ByBlock"),
Property {
label: "Leader lineweight".into(),
label: t!("Leader lineweight").into_owned(),
field: "line_weight",
value: PropValue::LwChoice(ml.line_weight),
},
// Arrowhead block name resolved by the panel builder (default "Closed filled").
ro("Arrowhead", "arrowhead_handle", "Closed filled"),
edit("Arrowhead size", "arrowhead_size", ml.arrowhead_size),
bool_toggle("Horizontal Landing", "enable_dogleg", ml.enable_dogleg),
ro(t!("Arrowhead").as_ref(), "arrowhead_handle", "Closed filled"),
edit(t!("Arrowhead size").as_ref(), "arrowhead_size", ml.arrowhead_size),
bool_toggle(t!("Horizontal Landing").as_ref(), "enable_dogleg", ml.enable_dogleg),
num_row(
"Landing distance",
t!("Landing distance").as_ref(),
"landing_distance",
ml.dogleg_length,
ml.enable_dogleg,
),
bool_toggle("Leader extension", "enable_landing", ml.enable_landing),
bool_toggle(t!("Leader extension").as_ref(), "enable_landing", ml.enable_landing),
],
};
// ── Text (shown only for MText content) ──────────────────────────────
let text = PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: vec![
Property {
label: "Contents".into(),
label: t!("Contents").into_owned(),
field: "text_string",
value: PropValue::EditText(ctx.text_string.clone()),
},
// Text-style name resolved from text_style_handle by the panel builder.
ro("Text style", "text_style_handle", "Standard"),
ro(t!("Text style").as_ref(), "text_style_handle", "Standard"),
choice(
"Justify",
t!("Justify").as_ref(),
"text_alignment",
text_align_str(&ml.text_alignment),
&["Left", "Center", "Right"],
),
choice(
"Direction",
t!("Direction").as_ref(),
"text_flow_direction",
flow_dir_str(&ctx.text_flow_direction),
&["By style", "Left to right", "Top to bottom"],
),
edit("Width", "text_width", ctx.text_width),
edit("Height", "text_height", ml.text_height),
edit_angle("Rotation", "text_rotation", ctx.text_rotation.to_degrees()),
edit("Line space factor", "line_spacing", ctx.line_spacing_factor),
edit(t!("Width").as_ref(), "text_width", ctx.text_width),
edit(t!("Height").as_ref(), "text_height", ml.text_height),
edit_angle(t!("Rotation").as_ref(), "text_rotation", ctx.text_rotation.to_degrees()),
edit(t!("Line space factor").as_ref(), "line_spacing", ctx.line_spacing_factor),
edit(
"Line space distance",
t!("Line space distance").as_ref(),
"line_space_distance",
ml.text_height * 1.666_666_666_666_667 * ctx.line_spacing_factor,
),
choice(
"Line space style",
t!("Line space style").as_ref(),
"line_space_style",
line_style_str(&ctx.line_spacing_style),
&["At least", "Exactly"],
),
bool_toggle(
"Background mask",
t!("Background mask").as_ref(),
"background_fill_enabled",
ctx.background_fill_enabled,
),
choice(
"Attachment type",
t!("Attachment type").as_ref(),
"text_attachment_direction",
attach_dir_str(&ml.text_attachment_direction),
&["Horizontal", "Vertical"],
),
choice(
"Left Attachment",
t!("Left Attachment").as_ref(),
"text_left_attachment",
attachment_str(&ml.text_left_attachment),
&ATTACH_LABELS,
),
choice(
"Right Attachment",
t!("Right Attachment").as_ref(),
"text_right_attachment",
attachment_str(&ml.text_right_attachment),
&ATTACH_LABELS,
),
edit("Landing gap", "landing_gap", ctx.landing_gap),
bool_toggle("Text frame", "text_frame", ml.text_frame),
edit(t!("Landing gap").as_ref(), "landing_gap", ctx.landing_gap),
bool_toggle(t!("Text frame").as_ref(), "text_frame", ml.text_frame),
],
};
// ── Block ────────────────────────────────────────────────────────────
let block = PropSection {
title: "Block".into(),
title: t!("Block").into_owned(),
props: vec![
ro(
"Source block",
t!("Source block").as_ref(),
"block_content_handle",
hexh(ml.block_content_handle),
),
ro(
"Block connection",
t!("Block connection").as_ref(),
"block_connection_type",
format!("{:?}", ml.block_connection_type),
),
ro(
"Block color",
t!("Block color").as_ref(),
"block_content_color",
format!("{:?}", ml.block_content_color),
),
ro(
"Block scale",
t!("Block scale").as_ref(),
"block_scale",
format!(
"{:.3} × {:.3} × {:.3}",
@ -801,7 +802,7 @@ fn properties(ml: &MultiLeader) -> Vec<PropSection> {
),
),
edit(
"Block rotation",
t!("Block rotation").as_ref(),
"block_rotation",
ml.block_rotation.to_degrees(),
),

View file

@ -1,5 +1,6 @@
use acadrust::entities::Point;
use acadrust::EntityType;
use crate::t;
use truck_modeling::{builder, Point3};
use crate::command::EntityTransform;
@ -187,11 +188,11 @@ fn grips(pt: &Point) -> Vec<GripDef> {
fn properties(pt: &Point) -> Vec<PropSection> {
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "loc_x", pt.location.x),
edit("Position Y", "loc_y", pt.location.y),
edit("Position Z", "loc_z", pt.location.z),
edit(t!("Position X").as_ref(), "loc_x", pt.location.x),
edit(t!("Position Y").as_ref(), "loc_y", pt.location.y),
edit(t!("Position Z").as_ref(), "loc_z", pt.location.z),
],
}]
}

View file

@ -1,4 +1,5 @@
use acadrust::entities::{Polyline, Polyline2D, Polyline3D};
use crate::t;
use truck_modeling::{builder, Edge, Point3, Wire};
use crate::command::EntityTransform;
@ -123,11 +124,11 @@ impl Grippable for Polyline {
impl PropertyEditable for Polyline {
fn geometry_properties(&self, _text_style_names: &[String]) -> Vec<PropSection> {
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Vertices", "vertices", self.vertices.len().to_string()),
ro(t!("Vertices").as_ref(), "vertices", self.vertices.len().to_string()),
Property {
label: "Closed".into(),
label: t!("Closed").into_owned(),
field: "pl_closed",
value: PropValue::BoolToggle {
field: "pl_closed",
@ -565,24 +566,24 @@ impl PropertyEditable for Polyline2D {
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
stepper("Current Vertex", "pl2_current_vertex", vertex_label),
edit("Vertex X", "pl2_vertex_x", vertex_x),
edit("Vertex Y", "pl2_vertex_y", vertex_y),
edit("Start segment width", "pl2_seg_start_w", seg_start_w),
edit("End segment width", "pl2_seg_end_w", seg_end_w),
edit("Global width", "pl2_start_w", self.start_width),
edit("Elevation", "pl2_elevation", self.elevation),
ro("Area", "pl2_area", format!("{area:.4}")),
ro("Length", "pl2_length", format!("{length:.4}")),
stepper(t!("Current Vertex").as_ref(), "pl2_current_vertex", vertex_label),
edit(t!("Vertex X").as_ref(), "pl2_vertex_x", vertex_x),
edit(t!("Vertex Y").as_ref(), "pl2_vertex_y", vertex_y),
edit(t!("Start segment width").as_ref(), "pl2_seg_start_w", seg_start_w),
edit(t!("End segment width").as_ref(), "pl2_seg_end_w", seg_end_w),
edit(t!("Global width").as_ref(), "pl2_start_w", self.start_width),
edit(t!("Elevation").as_ref(), "pl2_elevation", self.elevation),
ro(t!("Area").as_ref(), "pl2_area", format!("{area:.4}")),
ro(t!("Length").as_ref(), "pl2_length", format!("{length:.4}")),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
Property {
label: "Closed".into(),
label: t!("Closed").into_owned(),
field: "pl2_closed",
value: PropValue::BoolToggle {
field: "pl2_closed",
@ -590,7 +591,7 @@ impl PropertyEditable for Polyline2D {
},
},
Property {
label: "Linetype generation".into(),
label: t!("Linetype generation").into_owned(),
field: "pl2_ltype_gen",
value: PropValue::BoolToggle {
field: "pl2_ltype_gen",
@ -838,26 +839,26 @@ impl PropertyEditable for Polyline3D {
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Vertex", "pl3_vertex", if n > 0 { "1" } else { "" }),
edit("Vertex X", "pl3_vertex_x", vertex_x),
edit("Vertex Y", "pl3_vertex_y", vertex_y),
edit("Vertex Z", "pl3_vertex_z", vertex_z),
ro(t!("Vertex").as_ref(), "pl3_vertex", if n > 0 { "1" } else { "" }),
edit(t!("Vertex X").as_ref(), "pl3_vertex_x", vertex_x),
edit(t!("Vertex Y").as_ref(), "pl3_vertex_y", vertex_y),
edit(t!("Vertex Z").as_ref(), "pl3_vertex_z", vertex_z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
Property {
label: "Closed".into(),
label: t!("Closed").into_owned(),
field: "pl3_closed",
value: PropValue::BoolToggle {
field: "pl3_closed",
value: self.is_closed(),
},
},
ro("Fit/Smooth", "pl3_smooth", fit_smooth),
ro(t!("Fit/Smooth").as_ref(), "pl3_smooth", fit_smooth),
],
},
]

View file

@ -1,4 +1,5 @@
use acadrust::entities::{RasterImage, Wipeout};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, ro_prop as ro, square_grip};
@ -289,27 +290,27 @@ impl PropertyEditable for RasterImage {
let transparency = format!("{:.0}%", self.common.transparency.as_percent() * 100.0);
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "ri_ox", self.insertion_point.x),
edit("Position Y", "ri_oy", self.insertion_point.y),
edit("Position Z", "ri_oz", self.insertion_point.z),
ro("Rotation", "ri_rotation", format!("{:.4}", rotation_deg)),
ro("Width", "ri_width", format!("{:.4}", self.width())),
ro("Height", "ri_height", format!("{:.4}", self.height())),
ro("Scale", "ri_scale", format!("{:.4}", scale)),
edit(t!("Position X").as_ref(), "ri_ox", self.insertion_point.x),
edit(t!("Position Y").as_ref(), "ri_oy", self.insertion_point.y),
edit(t!("Position Z").as_ref(), "ri_oz", self.insertion_point.z),
ro(t!("Rotation").as_ref(), "ri_rotation", format!("{:.4}", rotation_deg)),
ro(t!("Width").as_ref(), "ri_width", format!("{:.4}", self.width())),
ro(t!("Height").as_ref(), "ri_height", format!("{:.4}", self.height())),
ro(t!("Scale").as_ref(), "ri_scale", format!("{:.4}", scale)),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
ro("Name", "ri_name", self.file_name().to_string()),
edit("Brightness", "ri_bright", self.brightness as f64),
edit("Contrast", "ri_contrast", self.contrast as f64),
edit("Fade", "ri_fade", self.fade as f64),
ro("Transparency", "ri_transparency", transparency),
ro(t!("Name").as_ref(), "ri_name", self.file_name().to_string()),
edit(t!("Brightness").as_ref(), "ri_bright", self.brightness as f64),
edit(t!("Contrast").as_ref(), "ri_contrast", self.contrast as f64),
edit(t!("Fade").as_ref(), "ri_fade", self.fade as f64),
ro(t!("Transparency").as_ref(), "ri_transparency", transparency),
Property {
label: "Show image".into(),
label: t!("Show image").into_owned(),
field: "ri_show_image",
value: PropValue::BoolToggle {
field: "ri_show_image",
@ -317,7 +318,7 @@ impl PropertyEditable for RasterImage {
},
},
Property {
label: "Show clipped".into(),
label: t!("Show clipped").into_owned(),
field: "ri_show_clipped",
value: PropValue::BoolToggle {
field: "ri_show_clipped",
@ -325,7 +326,7 @@ impl PropertyEditable for RasterImage {
},
},
Property {
label: "Clip inverted".into(),
label: t!("Clip inverted").into_owned(),
field: "ri_clip_inverted",
value: PropValue::BoolToggle {
field: "ri_clip_inverted",
@ -596,18 +597,18 @@ impl PropertyEditable for Wipeout {
.contains(acadrust::entities::WipeoutDisplayFlags::TRANSPARENCY_ON);
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "wo_ox", self.insertion_point.x),
edit("Position Y", "wo_oy", self.insertion_point.y),
edit("Position Z", "wo_oz", self.insertion_point.z),
edit(t!("Position X").as_ref(), "wo_ox", self.insertion_point.x),
edit(t!("Position Y").as_ref(), "wo_oy", self.insertion_point.y),
edit(t!("Position Z").as_ref(), "wo_oz", self.insertion_point.z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
Property {
label: "Show image".into(),
label: t!("Show image").into_owned(),
field: "wo_show_image",
value: PropValue::BoolToggle {
field: "wo_show_image",
@ -615,7 +616,7 @@ impl PropertyEditable for Wipeout {
},
},
Property {
label: "Show clipped".into(),
label: t!("Show clipped").into_owned(),
field: "wo_show_clipped",
value: PropValue::BoolToggle {
field: "wo_show_clipped",
@ -623,7 +624,7 @@ impl PropertyEditable for Wipeout {
},
},
Property {
label: "Background transparency".into(),
label: t!("Background transparency").into_owned(),
field: "wo_bg_transparency",
value: PropValue::BoolToggle {
field: "wo_bg_transparency",

View file

@ -1,4 +1,5 @@
use acadrust::entities::{Ray, XLine};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, square_grip};
@ -91,14 +92,14 @@ impl Grippable for Ray {
impl PropertyEditable for Ray {
fn geometry_properties(&self, _text_style_names: &[String]) -> Vec<PropSection> {
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Start X", "ray_bx", self.base_point.x),
edit("Start Y", "ray_by", self.base_point.y),
edit("Start Z", "ray_bz", self.base_point.z),
edit("Direction vector X", "ray_dx", self.direction.x),
edit("Direction vector Y", "ray_dy", self.direction.y),
edit("Direction vector Z", "ray_dz", self.direction.z),
edit(t!("Start X").as_ref(), "ray_bx", self.base_point.x),
edit(t!("Start Y").as_ref(), "ray_by", self.base_point.y),
edit(t!("Start Z").as_ref(), "ray_bz", self.base_point.z),
edit(t!("Direction vector X").as_ref(), "ray_dx", self.direction.x),
edit(t!("Direction vector Y").as_ref(), "ray_dy", self.direction.y),
edit(t!("Direction vector Z").as_ref(), "ray_dz", self.direction.z),
],
}]
}
@ -229,14 +230,14 @@ impl Grippable for XLine {
impl PropertyEditable for XLine {
fn geometry_properties(&self, _text_style_names: &[String]) -> Vec<PropSection> {
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Base X", "xl_bx", self.base_point.x),
edit("Base Y", "xl_by", self.base_point.y),
edit("Base Z", "xl_bz", self.base_point.z),
edit("Direction vector X", "xl_dx", self.direction.x),
edit("Direction vector Y", "xl_dy", self.direction.y),
edit("Direction vector Z", "xl_dz", self.direction.z),
edit(t!("Base X").as_ref(), "xl_bx", self.base_point.x),
edit(t!("Base Y").as_ref(), "xl_by", self.base_point.y),
edit(t!("Base Z").as_ref(), "xl_bz", self.base_point.z),
edit(t!("Direction vector X").as_ref(), "xl_dx", self.direction.x),
edit(t!("Direction vector Y").as_ref(), "xl_dy", self.direction.y),
edit(t!("Direction vector Z").as_ref(), "xl_dz", self.direction.z),
],
}]
}

View file

@ -6,6 +6,7 @@
// gives a rough indication of the glyph orientation.
use acadrust::entities::Shape;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{edit_angle_prop as edit_angle, edit_prop as edit, ro_prop as ro, square_grip};
@ -254,29 +255,29 @@ impl PropertyEditable for Shape {
_ => "(none)".to_string(),
};
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
ro("Name", "shp_name", self.shape_name.clone()),
ro("Number", "shp_number", self.shape_number.to_string()),
ro(t!("Name").as_ref(), "shp_name", self.shape_name.clone()),
ro(t!("Number").as_ref(), "shp_number", self.shape_number.to_string()),
Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "shp_style",
value: PropValue::Choice {
selected: self.style_name.clone(),
options: text_style_names.to_vec(),
},
},
ro("Style Handle", "shp_style_handle", style_handle_display),
edit("Insert X", "shp_ix", self.insertion_point.x),
edit("Insert Y", "shp_iy", self.insertion_point.y),
edit("Insert Z", "shp_iz", self.insertion_point.z),
edit("Size", "shp_sz", self.size),
edit_angle("Rotation", "shp_rot", self.rotation.to_degrees()),
edit("Width Factor", "shp_xs", self.relative_x_scale),
edit_angle("Oblique Angle", "shp_ob", self.oblique_angle.to_degrees()),
edit("Normal X", "shp_nx", self.normal.x),
edit("Normal Y", "shp_ny", self.normal.y),
edit("Normal Z", "shp_nz", self.normal.z),
ro(t!("Style Handle").as_ref(), "shp_style_handle", style_handle_display),
edit(t!("Insert X").as_ref(), "shp_ix", self.insertion_point.x),
edit(t!("Insert Y").as_ref(), "shp_iy", self.insertion_point.y),
edit(t!("Insert Z").as_ref(), "shp_iz", self.insertion_point.z),
edit(t!("Size").as_ref(), "shp_sz", self.size),
edit_angle(t!("Rotation").as_ref(), "shp_rot", self.rotation.to_degrees()),
edit(t!("Width Factor").as_ref(), "shp_xs", self.relative_x_scale),
edit_angle(t!("Oblique Angle").as_ref(), "shp_ob", self.oblique_angle.to_degrees()),
edit(t!("Normal X").as_ref(), "shp_nx", self.normal.x),
edit(t!("Normal Y").as_ref(), "shp_ny", self.normal.y),
edit(t!("Normal Z").as_ref(), "shp_nz", self.normal.z),
],
}]
}

View file

@ -8,6 +8,7 @@
// Grips: 4 corner grip points.
use acadrust::entities::Solid;
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{edit_prop as edit, ro_prop as ro, square_grip};
@ -153,21 +154,21 @@ impl PropertyEditable for Solid {
// field on the entity); reported from the first corner's Z.
let elevation = self.first_corner.z;
vec![PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Point 1 X", "sl_p1x", self.first_corner.x),
edit("Point 1 Y", "sl_p1y", self.first_corner.y),
edit("Point 1 Z", "sl_p1z", self.first_corner.z),
edit("Point 2 X", "sl_p2x", self.second_corner.x),
edit("Point 2 Y", "sl_p2y", self.second_corner.y),
edit("Point 2 Z", "sl_p2z", self.second_corner.z),
edit("Point 3 X", "sl_p3x", self.third_corner.x),
edit("Point 3 Y", "sl_p3y", self.third_corner.y),
edit("Point 3 Z", "sl_p3z", self.third_corner.z),
edit("Point 4 X", "sl_p4x", self.fourth_corner.x),
edit("Point 4 Y", "sl_p4y", self.fourth_corner.y),
edit("Point 4 Z", "sl_p4z", self.fourth_corner.z),
ro("Elevation", "sl_elev", format!("{:.4}", elevation)),
edit(t!("Point 1 X").as_ref(), "sl_p1x", self.first_corner.x),
edit(t!("Point 1 Y").as_ref(), "sl_p1y", self.first_corner.y),
edit(t!("Point 1 Z").as_ref(), "sl_p1z", self.first_corner.z),
edit(t!("Point 2 X").as_ref(), "sl_p2x", self.second_corner.x),
edit(t!("Point 2 Y").as_ref(), "sl_p2y", self.second_corner.y),
edit(t!("Point 2 Z").as_ref(), "sl_p2z", self.second_corner.z),
edit(t!("Point 3 X").as_ref(), "sl_p3x", self.third_corner.x),
edit(t!("Point 3 Y").as_ref(), "sl_p3y", self.third_corner.y),
edit(t!("Point 3 Z").as_ref(), "sl_p3z", self.third_corner.z),
edit(t!("Point 4 X").as_ref(), "sl_p4x", self.fourth_corner.x),
edit(t!("Point 4 Y").as_ref(), "sl_p4y", self.fourth_corner.y),
edit(t!("Point 4 Z").as_ref(), "sl_p4z", self.fourth_corner.z),
ro(t!("Elevation").as_ref(), "sl_elev", format!("{:.4}", elevation)),
],
}]
}

View file

@ -7,6 +7,7 @@
// the MeshModel vertices to match.
use acadrust::entities::{Body, Region, Solid3D, Surface};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_prop as edit, parse_f64, ro_prop as ro};
use crate::entities::traits::{Grippable, PropertyEditable, Transformable};
@ -119,46 +120,40 @@ fn acis_sections(
);
vec![
PropSection {
title: "Modeler Geometry".into(),
title: t!("Modeler Geometry").into_owned(),
props: vec![
ro(
"Format",
ro(t!("Format").as_ref(),
"acis_format",
if acis.is_binary { "SAB" } else { "SAT" },
),
ro("Version", "acis_version", format!("{:?}", acis.version)),
ro("Data Size", "acis_size", format!("{} bytes", acis.size())),
ro("Revision", "acis_revision", revision),
ro("Material Bindings", "acis_materials", bindings),
ro("Extra Modeler Data", "acis_extra", extra),
ro("History", "acis_history", handle_text(history)),
ro(t!("Version").as_ref(), "acis_version", format!("{:?}", acis.version)),
ro(t!("Data Size").as_ref(), "acis_size", format!("{} bytes", acis.size())),
ro(t!("Revision").as_ref(), "acis_revision", revision),
ro(t!("Material Bindings").as_ref(), "acis_materials", bindings),
ro(t!("Extra Modeler Data").as_ref(), "acis_extra", extra),
ro(t!("History").as_ref(), "acis_history", handle_text(history)),
],
},
PropSection {
title: "Modeler Display Data".into(),
title: t!("Modeler Display Data").into_owned(),
props: vec![
ro(
"Wireframe Cache",
ro(t!("Wireframe Cache").as_ref(),
"acis_wireframe",
yes_no(acis.wireframe_data_present),
),
ro(
"Reference Point",
ro(t!("Reference Point").as_ref(),
"acis_wireframe_point",
yes_no(acis.wireframe_point_present),
),
ro(
"Isoline List",
ro(t!("Isoline List").as_ref(),
"acis_wireframe_isolines",
yes_no(acis.wireframe_isoline_present),
),
ro(
"Isolines",
ro(t!("Isolines").as_ref(),
"acis_isolines",
acis.wireframe_isolines.to_string(),
),
ro(
"Wires",
ro(t!("Wires").as_ref(),
"acis_wires",
format!(
"{} (unknown {}, silhouette {}, visible {}, hidden {}, isoline {}; {} points; {} transformed)",
@ -172,8 +167,7 @@ fn acis_sections(
transformed
),
),
ro(
"View Silhouettes",
ro(t!("View Silhouettes").as_ref(),
"acis_silhouettes",
format!(
"{} views; {} wires",
@ -194,11 +188,11 @@ fn position_section(prefix: &str, p: &acadrust::types::Vector3) -> PropSection {
_ => ["s3d_px", "s3d_py", "s3d_pz"],
};
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", fields[0], p.x),
edit("Position Y", fields[1], p.y),
edit("Position Z", fields[2], p.z),
edit(t!("Position X").as_ref(), fields[0], p.x),
edit(t!("Position Y").as_ref(), fields[1], p.y),
edit(t!("Position Z").as_ref(), fields[2], p.z),
],
}
}
@ -259,7 +253,7 @@ impl PropertyEditable for Solid3D {
acis_sections(&self.acis_data, &self.wires, &self.silhouettes, self.history_handle);
sections[0]
.props
.insert(0, ro("UID", "s3d_uid", self.uid.clone()));
.insert(0, ro(t!("UID").as_ref(), "s3d_uid", self.uid.clone()));
sections.push(position_section("s3d", &self.point_of_reference));
sections
}
@ -304,14 +298,14 @@ impl PropertyEditable for Region {
acis_sections(&self.acis_data, &self.wires, &self.silhouettes, self.history_handle);
sections[0]
.props
.insert(0, ro("UID", "rgn_uid", self.uid.clone()));
.insert(0, ro(t!("UID").as_ref(), "rgn_uid", self.uid.clone()));
let mut geometry = position_section("rgn", &self.point_of_reference);
geometry
.props
.push(ro("Area", "rgn_area", format!("{area:.4}")));
.push(ro(t!("Area").as_ref(), "rgn_area", format!("{area:.4}")));
geometry
.props
.push(ro("Perimeter", "rgn_perimeter", format!("{perimeter:.4}")));
.push(ro(t!("Perimeter").as_ref(), "rgn_perimeter", format!("{perimeter:.4}")));
sections.push(geometry);
sections
}
@ -355,7 +349,7 @@ impl PropertyEditable for Body {
acis_sections(&self.acis_data, &self.wires, &self.silhouettes, self.history_handle);
sections[0]
.props
.insert(0, ro("UID", "bdy_uid", self.uid.clone()));
.insert(0, ro(t!("UID").as_ref(), "bdy_uid", self.uid.clone()));
sections.push(position_section("bdy", &self.point_of_reference));
sections
}
@ -433,19 +427,16 @@ fn sweep_options_text(options: &acadrust::entities::SurfaceSweepOptions) -> Stri
fn surface_construction_section(surface: &Surface) -> PropSection {
use acadrust::entities::SurfaceData;
let mut props = vec![
ro("Kind", "srf_kind", format!("{:?}", surface.kind)),
ro(
"Modeler Format",
ro(t!("Kind").as_ref(), "srf_kind", format!("{:?}", surface.kind)),
ro(t!("Modeler Format").as_ref(),
"srf_modeler_version",
surface.modeler_format_version.to_string(),
),
edit(
"U Isolines",
edit(t!("U Isolines").as_ref(),
"srf_u_isolines",
surface.u_isolines as f64,
),
edit(
"V Isolines",
edit(t!("V Isolines").as_ref(),
"srf_v_isolines",
surface.v_isolines as f64,
),
@ -453,8 +444,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
match &surface.surface_data {
SurfaceData::Generic => {}
SurfaceData::Plane { class_version } => {
props.push(ro(
"Class Version",
props.push(ro(t!("Class Version").as_ref(),
"srf_class_version",
class_version.to_string(),
));
@ -466,25 +456,21 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
sweep_transform,
} => {
props.extend([
ro(
"Sweep Entity",
ro(t!("Sweep Entity").as_ref(),
"srf_sweep_entity",
embedded_name(sweep_entity.as_ref()),
),
ro("Sweep Vector", "srf_sweep_vector", vector_text(sweep_vector)),
ro("Sweep Options", "srf_sweep_options", sweep_options_text(options)),
ro(
"Sweep Transform",
ro(t!("Sweep Vector").as_ref(), "srf_sweep_vector", vector_text(sweep_vector)),
ro(t!("Sweep Options").as_ref(), "srf_sweep_options", sweep_options_text(options)),
ro(t!("Sweep Transform").as_ref(),
"srf_sweep_transform",
matrix_text(sweep_transform),
),
ro(
"Sweep Entity Transform",
ro(t!("Sweep Entity Transform").as_ref(),
"srf_sweep_entity_transform",
matrix_text(&options.sweep_entity_transform),
),
ro(
"Path Entity Transform",
ro(t!("Path Entity Transform").as_ref(),
"srf_path_entity_transform",
matrix_text(&options.path_entity_transform),
),
@ -513,8 +499,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
path_curve,
} => {
props.extend([
ro(
"Embedded Curves",
ro(t!("Embedded Curves").as_ref(),
"srf_loft_embedded",
format!(
"{} cross sections; {} guides; path {}",
@ -523,8 +508,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
embedded_name(path_entity.as_ref())
),
),
ro(
"Database Curves",
ro(t!("Database Curves").as_ref(),
"srf_loft_handles",
format!(
"{} cross sections; {} guides; path {}",
@ -533,8 +517,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
handle_text(*path_curve)
),
),
ro(
"Draft",
ro(t!("Draft").as_ref(),
"srf_loft_draft",
format!(
"type {}; angle {:.6}→{:.6}; magnitude {:.6}→{:.6}",
@ -545,8 +528,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
end_draft_magnitude
),
),
ro(
"Loft Flags",
ro(t!("Loft Flags").as_ref(),
"srf_loft_flags",
format!(
"arc-length {}; no-twist {}; align {}; simple {}; closed {}; solid {}; ruled {}; virtual-guide {}",
@ -560,8 +542,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
yes_no(*virtual_guide)
),
),
ro(
"Loft Transform",
ro(t!("Loft Transform").as_ref(),
"srf_loft_transform",
matrix_text(loft_transform),
),
@ -584,33 +565,28 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
close_to_axis,
} => {
props.extend([
ro(
"Revolve Entity",
ro(t!("Revolve Entity").as_ref(),
"srf_revolve_entity",
embedded_name(revolve_entity.as_ref()),
),
ro(
"Class / Entity",
ro(t!("Class / Entity").as_ref(),
"srf_revolve_ids",
format!("{class_version} / {entity_id}"),
),
ro("Axis Point", "srf_axis_point", vector_text(axis_point)),
ro("Axis Vector", "srf_axis_vector", vector_text(axis_vector)),
ro(
"Angles",
ro(t!("Axis Point").as_ref(), "srf_axis_point", vector_text(axis_point)),
ro(t!("Axis Vector").as_ref(), "srf_axis_vector", vector_text(axis_vector)),
ro(t!("Angles").as_ref(),
"srf_revolve_angles",
format!(
"start {:.6}; revolve {:.6}; draft {:.6}; twist {:.6}",
start_angle, revolve_angle, draft_angle, twist_angle
),
),
ro(
"Draft Distances",
ro(t!("Draft Distances").as_ref(),
"srf_revolve_draft_distances",
format!("{draft_start_distance:.6}→{draft_end_distance:.6}"),
),
ro(
"Revolve Flags",
ro(t!("Revolve Flags").as_ref(),
"srf_revolve_flags",
format!(
"solid {}; close-to-axis {}",
@ -618,8 +594,7 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
yes_no(*close_to_axis)
),
),
ro(
"Entity Transform",
ro(t!("Entity Transform").as_ref(),
"srf_revolve_transform",
matrix_text(entity_transform),
),
@ -634,13 +609,11 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
options,
} => {
props.extend([
ro(
"Class Version",
ro(t!("Class Version").as_ref(),
"srf_class_version",
class_version.to_string(),
),
ro(
"Sweep / Path",
ro(t!("Sweep / Path").as_ref(),
"srf_swept_entities",
format!(
"{} / {}",
@ -648,24 +621,20 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
embedded_name(path_entity.as_ref())
),
),
ro("Sweep Options", "srf_sweep_options", sweep_options_text(options)),
ro(
"Sweep Transform",
ro(t!("Sweep Options").as_ref(), "srf_sweep_options", sweep_options_text(options)),
ro(t!("Sweep Transform").as_ref(),
"srf_sweep_transform",
matrix_text(sweep_transform),
),
ro(
"Path Transform",
ro(t!("Path Transform").as_ref(),
"srf_path_transform",
matrix_text(path_transform),
),
ro(
"Sweep Entity Transform",
ro(t!("Sweep Entity Transform").as_ref(),
"srf_sweep_entity_transform",
matrix_text(&options.sweep_entity_transform),
),
ro(
"Path Entity Transform",
ro(t!("Path Entity Transform").as_ref(),
"srf_path_entity_transform",
matrix_text(&options.path_entity_transform),
),
@ -680,25 +649,23 @@ fn surface_construction_section(surface: &Surface) -> PropSection {
v_vector2,
} => {
props.extend([
ro(
"NURB Version",
ro(t!("NURB Version").as_ref(),
"srf_nurb_version",
short_170.to_string(),
),
ro(
"CV Hull",
ro(t!("CV Hull").as_ref(),
"srf_nurb_cv_hull",
yes_no(*cv_hull_display),
),
ro("U Vector 1", "srf_nurb_u1", vector_text(u_vector1)),
ro("V Vector 1", "srf_nurb_v1", vector_text(v_vector1)),
ro("U Vector 2", "srf_nurb_u2", vector_text(u_vector2)),
ro("V Vector 2", "srf_nurb_v2", vector_text(v_vector2)),
ro(t!("U Vector 1").as_ref(), "srf_nurb_u1", vector_text(u_vector1)),
ro(t!("V Vector 1").as_ref(), "srf_nurb_v1", vector_text(v_vector1)),
ro(t!("U Vector 2").as_ref(), "srf_nurb_u2", vector_text(u_vector2)),
ro(t!("V Vector 2").as_ref(), "srf_nurb_v2", vector_text(v_vector2)),
]);
}
}
PropSection {
title: "Surface Construction".into(),
title: t!("Surface Construction").into_owned(),
props,
}
}

View file

@ -1,4 +1,5 @@
use acadrust::entities::Spline;
use crate::t;
use truck_modeling::{
base::{BoundedCurve, ParametricCurve, Vector4},
builder, BSplineCurve, Curve, Edge, KnotVec, NurbsCurve, Point3, Wire,
@ -383,58 +384,58 @@ fn properties(spline: &Spline) -> Vec<PropSection> {
vec![
PropSection {
title: "Data Points".into(),
title: t!("Data Points").into_owned(),
props: vec![
ro("Show", "show", show),
ro("Degree", "degree", spline.degree.to_string()),
ro(t!("Show").as_ref(), "show", show),
ro(t!("Degree").as_ref(), "degree", spline.degree.to_string()),
ro(
"Control Point Count",
t!("Control Point Count").as_ref(),
"ctrl_pt_count",
spline.control_points.len().to_string(),
),
ro("Control Point", "ctrl_pt_index", "0"),
ro(t!("Control Point").as_ref(), "ctrl_pt_index", "0"),
edit(
"Control Point X",
t!("Control Point X").as_ref(),
"ctrl_pt_x",
cp0.map(|p| p.x).unwrap_or(0.0),
),
edit(
"Control Point Y",
t!("Control Point Y").as_ref(),
"ctrl_pt_y",
cp0.map(|p| p.y).unwrap_or(0.0),
),
edit(
"Control Point Z",
t!("Control Point Z").as_ref(),
"ctrl_pt_z",
cp0.map(|p| p.z).unwrap_or(0.0),
),
edit("Weight", "weight", w0.unwrap_or(1.0)),
ro("Knot Parameterization", "knot_param", knot_param),
edit(t!("Weight").as_ref(), "weight", w0.unwrap_or(1.0)),
ro(t!("Knot Parameterization").as_ref(), "knot_param", knot_param),
ro(
"Fit Point Count",
t!("Fit Point Count").as_ref(),
"fit_pt_count",
spline.fit_points.len().to_string(),
),
ro("Fit Point", "fit_pt_index", "0"),
edit("Fit Point X", "fit_pt_x", fp0.map(|p| p.x).unwrap_or(0.0)),
edit("Fit Point Y", "fit_pt_y", fp0.map(|p| p.y).unwrap_or(0.0)),
edit("Fit Point Z", "fit_pt_z", fp0.map(|p| p.z).unwrap_or(0.0)),
edit("Fit Tolerance", "fit_tolerance", spline.fit_tolerance),
edit("Start Tangent X", "start_tan_x", spline.begin_tangent.x),
edit("Start Tangent Y", "start_tan_y", spline.begin_tangent.y),
edit("Start Tangent Z", "start_tan_z", spline.begin_tangent.z),
edit("End Tangent X", "end_tan_x", spline.end_tangent.x),
edit("End Tangent Y", "end_tan_y", spline.end_tangent.y),
edit("End Tangent Z", "end_tan_z", spline.end_tangent.z),
ro(t!("Fit Point").as_ref(), "fit_pt_index", "0"),
edit(t!("Fit Point X").as_ref(), "fit_pt_x", fp0.map(|p| p.x).unwrap_or(0.0)),
edit(t!("Fit Point Y").as_ref(), "fit_pt_y", fp0.map(|p| p.y).unwrap_or(0.0)),
edit(t!("Fit Point Z").as_ref(), "fit_pt_z", fp0.map(|p| p.z).unwrap_or(0.0)),
edit(t!("Fit Tolerance").as_ref(), "fit_tolerance", spline.fit_tolerance),
edit(t!("Start Tangent X").as_ref(), "start_tan_x", spline.begin_tangent.x),
edit(t!("Start Tangent Y").as_ref(), "start_tan_y", spline.begin_tangent.y),
edit(t!("Start Tangent Z").as_ref(), "start_tan_z", spline.begin_tangent.z),
edit(t!("End Tangent X").as_ref(), "end_tan_x", spline.end_tangent.x),
edit(t!("End Tangent Y").as_ref(), "end_tan_y", spline.end_tangent.y),
edit(t!("End Tangent Z").as_ref(), "end_tan_z", spline.end_tangent.z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
ro("Closed", "closed", yes_no(closed)),
ro("Planar", "planar", yes_no(spline.flags.planar)),
ro("Length", "length", format!("{length:.4}")),
ro("Area", "area", area),
ro(t!("Closed").as_ref(), "closed", yes_no(closed)),
ro(t!("Planar").as_ref(), "planar", yes_no(spline.flags.planar)),
ro(t!("Length").as_ref(), "length", format!("{length:.4}")),
ro(t!("Area").as_ref(), "area", area),
],
},
]

View file

@ -11,6 +11,7 @@ use crate::scene::convert::acad_to_truck::{TruckEntity, TruckObject};
use crate::scene::model::object::{GripApply, GripDef, PropSection, Property, PropValue};
use crate::scene::view::transform;
use crate::scene::model::wire_model::SnapHint;
use crate::t;
fn v3(v: &acadrust::types::Vector3) -> Vec3 {
Vec3::new(v.x as f32, v.y as f32, v.z as f32)
@ -1773,7 +1774,7 @@ impl PropertyEditable for Table {
_ => "(none)".to_string(),
}
};
let toggle = |label: &'static str, field: &'static str, b: bool| -> Property {
let toggle = |label: &str, field: &'static str, b: bool| -> Property {
Property {
label: label.into(),
field,
@ -1806,93 +1807,93 @@ impl PropertyEditable for Table {
vec![
PropSection {
title: "Table".into(),
title: t!("Table").into_owned(),
props: vec![
ro(
"Table style",
t!("Table style").as_ref(),
"tbl_style_handle",
fmt_h(&self.table_style_handle),
),
ro("Rows", "tbl_rows", self.rows.len().to_string()),
ro("Columns", "tbl_cols", self.columns.len().to_string()),
ro("Contents", "tbl_contents", content_count.to_string()),
ro(t!("Rows").as_ref(), "tbl_rows", self.rows.len().to_string()),
ro(t!("Columns").as_ref(), "tbl_cols", self.columns.len().to_string()),
ro(t!("Contents").as_ref(), "tbl_contents", content_count.to_string()),
ro(
"Block contents",
t!("Block contents").as_ref(),
"tbl_block_contents",
block_content_count.to_string(),
),
ro(
"Field contents",
t!("Field contents").as_ref(),
"tbl_field_contents",
field_content_count.to_string(),
),
ro(
"Merged ranges",
t!("Merged ranges").as_ref(),
"tbl_merged_ranges",
self.merged_ranges.len().to_string(),
),
ro(
"Linked cells",
t!("Linked cells").as_ref(),
"tbl_linked_cells",
linked_cell_count.to_string(),
),
ro("Direction", "tbl_direction", format!("{:.4}", direction_deg)),
ro(t!("Direction").as_ref(), "tbl_direction", format!("{:.4}", direction_deg)),
ro(
"Table width",
t!("Table width").as_ref(),
"tbl_width",
format!("{:.4}", self.total_width()),
),
ro(
"Table height",
t!("Table height").as_ref(),
"tbl_height",
format!("{:.4}", self.total_height()),
),
],
},
PropSection {
title: "Table Breaks".into(),
title: t!("Table Breaks").into_owned(),
props: vec![
toggle(
"Enabled",
t!("Enabled").as_ref(),
"tbl_break_enabled",
self.break_options.contains(BreakOptionFlags::ENABLE_BREAKS),
),
ro(
"Direction",
t!("Direction").as_ref(),
"tbl_break_direction",
format!("{:?}", self.break_flow_direction),
),
toggle(
"Repeat top labels",
t!("Repeat top labels").as_ref(),
"tbl_break_repeat_top",
self.break_options
.contains(BreakOptionFlags::REPEAT_TOP_LABELS),
),
toggle(
"Repeat bottom labels",
t!("Repeat bottom labels").as_ref(),
"tbl_break_repeat_bottom",
self.break_options
.contains(BreakOptionFlags::REPEAT_BOTTOM_LABELS),
),
toggle(
"Manual positions",
t!("Manual positions").as_ref(),
"tbl_break_manual_positions",
self.break_options
.contains(BreakOptionFlags::ALLOW_MANUAL_POSITIONS),
),
toggle(
"Manual heights",
t!("Manual heights").as_ref(),
"tbl_break_manual_heights",
self.break_options
.contains(BreakOptionFlags::ALLOW_MANUAL_HEIGHTS),
),
ro(
"Segments",
t!("Segments").as_ref(),
"tbl_break_segments",
self.break_ranges.len().max(self.break_data.len()).to_string(),
),
ro("Break heights", "tbl_break_height", break_heights),
edit("Spacing", "tbl_break_spacing", self.break_spacing),
ro(t!("Break heights").as_ref(), "tbl_break_height", break_heights),
edit(t!("Spacing").as_ref(), "tbl_break_spacing", self.break_spacing),
],
},
]

View file

@ -12,6 +12,7 @@ use crate::scene::convert::acad_to_truck::{GlyphRun, TextStroke, TruckEntity, Tr
use crate::scene::text::lff;
use crate::scene::model::object::{GripApply, GripDef, PropSection, PropValue, Property};
use crate::scene::model::wire_model::SnapHint;
use crate::t;
/// Combined single-line-text justification (horizontal × vertical) shown as one
/// dropdown value. Horizontal-only modes (Aligned/Middle/Fit) ignore the
@ -273,15 +274,15 @@ fn properties(t: &Text, text_style_names: &[String]) -> Vec<PropSection> {
};
vec![
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: vec![
Property {
label: "Contents".into(),
label: t!("Contents").into_owned(),
field: "content",
value: PropValue::EditText(t.value.clone()),
},
Property {
label: "Style".into(),
label: t!("Style").into_owned(),
field: "style",
value: PropValue::Choice {
selected: if t.style.trim().is_empty() {
@ -292,9 +293,9 @@ fn properties(t: &Text, text_style_names: &[String]) -> Vec<PropSection> {
options: text_style_names.to_vec(),
},
},
ro("Annotative", "annotative", "No"),
ro(t!("Annotative").as_ref(), "annotative", "No"),
Property {
label: "Justify".into(),
label: t!("Justify").into_owned(),
field: "justify",
value: PropValue::Choice {
selected: text_justify_str(
@ -324,28 +325,28 @@ fn properties(t: &Text, text_style_names: &[String]) -> Vec<PropSection> {
.collect(),
},
},
edit("Height", "height", t.height),
edit_angle("Rotation", "rotation", t.rotation.to_degrees()),
edit("Width factor", "width_factor", t.width_factor),
edit_angle("Obliquing", "oblique_angle", t.oblique_angle.to_degrees()),
num_row("Text alignment X", "align_x", ax, align_editable),
num_row("Text alignment Y", "align_y", ay, align_editable),
num_row("Text alignment Z", "align_z", az, align_editable),
edit(t!("Height").as_ref(), "height", t.height),
edit_angle(t!("Rotation").as_ref(), "rotation", t.rotation.to_degrees()),
edit(t!("Width factor").as_ref(), "width_factor", t.width_factor),
edit_angle(t!("Obliquing").as_ref(), "oblique_angle", t.oblique_angle.to_degrees()),
num_row(t!("Text alignment X").as_ref(), "align_x", ax, align_editable),
num_row(t!("Text alignment Y").as_ref(), "align_y", ay, align_editable),
num_row(t!("Text alignment Z").as_ref(), "align_z", az, align_editable),
],
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
num_row("Position X", "ins_x", t.insertion_point.x, pos_editable),
num_row("Position Y", "ins_y", t.insertion_point.y, pos_editable),
num_row("Position Z", "ins_z", t.insertion_point.z, pos_editable),
num_row(t!("Position X").as_ref(), "ins_x", t.insertion_point.x, pos_editable),
num_row(t!("Position Y").as_ref(), "ins_y", t.insertion_point.y, pos_editable),
num_row(t!("Position Z").as_ref(), "ins_z", t.insertion_point.z, pos_editable),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
Property {
label: "Upside down".into(),
label: t!("Upside down").into_owned(),
field: "upside_down",
value: PropValue::BoolToggle {
field: "upside_down",
@ -353,7 +354,7 @@ fn properties(t: &Text, text_style_names: &[String]) -> Vec<PropSection> {
},
},
Property {
label: "Backward".into(),
label: t!("Backward").into_owned(),
field: "backward",
value: PropValue::BoolToggle {
field: "backward",

View file

@ -8,6 +8,7 @@ use crate::scene::model::object::{GripApply, GripDef, PropSection};
use crate::scene::model::wire_model::SnapHint;
use crate::scene::text::lff;
use crate::scene::view::transform;
use crate::t;
// ── GDT text parser ───────────────────────────────────────────────────────────
@ -541,25 +542,25 @@ impl PropertyEditable for Tolerance {
fn geometry_properties(&self, _text_style_names: &[String]) -> Vec<PropSection> {
vec![
PropSection {
title: "Text".into(),
title: t!("Text").into_owned(),
props: vec![
ro("Text style", "tol_text_style", String::new()),
edit("Text height", "tol_text_height", self.text_height),
ro(t!("Text style").as_ref(), "tol_text_style", String::new()),
edit(t!("Text height").as_ref(), "tol_text_height", self.text_height),
],
},
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "tol_ix", self.insertion_point.x),
edit("Position Y", "tol_iy", self.insertion_point.y),
edit("Position Z", "tol_iz", self.insertion_point.z),
edit(t!("Position X").as_ref(), "tol_ix", self.insertion_point.x),
edit(t!("Position Y").as_ref(), "tol_iy", self.insertion_point.y),
edit(t!("Position Z").as_ref(), "tol_iz", self.insertion_point.z),
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
ro(
"Dimension style",
t!("Dimension style").as_ref(),
"tol_dim_style",
if self.dimension_style_name.is_empty() {
"(default)".to_string()
@ -567,9 +568,9 @@ impl PropertyEditable for Tolerance {
self.dimension_style_name.clone()
},
),
edit("Direction X", "tol_dir_x", self.direction.x),
edit("Direction Y", "tol_dir_y", self.direction.y),
edit("Direction Z", "tol_dir_z", self.direction.z),
edit(t!("Direction X").as_ref(), "tol_dir_x", self.direction.x),
edit(t!("Direction Y").as_ref(), "tol_dir_y", self.direction.y),
edit(t!("Direction Z").as_ref(), "tol_dir_z", self.direction.z),
],
},
]

View file

@ -5,6 +5,7 @@
// Props: position, scales, rotation, contrast, fade, flags.
use acadrust::entities::{Underlay, UnderlayDisplayFlags};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{center_grip, edit_angle_prop as edit_angle, edit_prop as edit, ro_prop as ro, square_grip};
@ -224,26 +225,26 @@ impl PropertyEditable for Underlay {
vec![
PropSection {
title: "Geometry".into(),
title: t!("Geometry").into_owned(),
props: vec![
edit("Position X", "ul_ix", self.insertion_point.x),
edit("Position Y", "ul_iy", self.insertion_point.y),
edit("Position Z", "ul_iz", self.insertion_point.z),
edit("Scale X", "ul_sx", self.x_scale),
edit("Scale Y", "ul_sy", self.y_scale),
edit("Scale Z", "ul_sz", self.z_scale),
ro("Width", "ul_width", format!("{:.4}", width)),
ro("Height", "ul_height", format!("{:.4}", height)),
edit_angle("Rotation", "ul_rot", self.rotation.to_degrees()),
edit(t!("Position X").as_ref(), "ul_ix", self.insertion_point.x),
edit(t!("Position Y").as_ref(), "ul_iy", self.insertion_point.y),
edit(t!("Position Z").as_ref(), "ul_iz", self.insertion_point.z),
edit(t!("Scale X").as_ref(), "ul_sx", self.x_scale),
edit(t!("Scale Y").as_ref(), "ul_sy", self.y_scale),
edit(t!("Scale Z").as_ref(), "ul_sz", self.z_scale),
ro(t!("Width").as_ref(), "ul_width", format!("{:.4}", width)),
ro(t!("Height").as_ref(), "ul_height", format!("{:.4}", height)),
edit_angle(t!("Rotation").as_ref(), "ul_rot", self.rotation.to_degrees()),
],
},
PropSection {
title: "Underlay Adjust".into(),
title: t!("Underlay Adjust").into_owned(),
props: vec![
edit("Contrast", "ul_contrast", self.contrast as f64),
edit("Fade", "ul_fade", self.fade as f64),
edit(t!("Contrast").as_ref(), "ul_contrast", self.contrast as f64),
edit(t!("Fade").as_ref(), "ul_fade", self.fade as f64),
Property {
label: "Monochrome".into(),
label: t!("Monochrome").into_owned(),
field: "ul_mono",
value: PropValue::BoolToggle {
field: "ul_mono",
@ -251,7 +252,7 @@ impl PropertyEditable for Underlay {
},
},
Property {
label: "Adjust Colors for Background".into(),
label: t!("Adjust Colors for Background").into_owned(),
field: "ul_adjust_bg",
value: PropValue::BoolToggle {
field: "ul_adjust_bg",
@ -261,14 +262,14 @@ impl PropertyEditable for Underlay {
],
},
PropSection {
title: "Misc".into(),
title: t!("Misc").into_owned(),
props: vec![
// Underlay name/path/layers live on the separate
// UnderlayDefinition object, not reachable from the entity.
ro("Underlay name", "ul_name", String::new()),
ro("Underlay path", "ul_path", String::new()),
ro(t!("Underlay name").as_ref(), "ul_name", String::new()),
ro(t!("Underlay path").as_ref(), "ul_path", String::new()),
Property {
label: "Show underlay".into(),
label: t!("Show underlay").into_owned(),
field: "ul_on",
value: PropValue::BoolToggle {
field: "ul_on",
@ -276,7 +277,7 @@ impl PropertyEditable for Underlay {
},
},
Property {
label: "Clipping".into(),
label: t!("Clipping").into_owned(),
field: "ul_clip",
value: PropValue::BoolToggle {
field: "ul_clip",
@ -284,14 +285,14 @@ impl PropertyEditable for Underlay {
},
},
Property {
label: "Show clipped".into(),
label: t!("Show clipped").into_owned(),
field: "ul_clip_inverted",
value: PropValue::BoolToggle {
field: "ul_clip_inverted",
value: self.clip_inverted,
},
},
ro("Underlay layers", "ul_layers", String::new()),
ro(t!("Underlay layers").as_ref(), "ul_layers", String::new()),
],
},
]

View file

@ -1,4 +1,5 @@
use acadrust::entities::{SectionSymbol, ViewBorder};
use crate::t;
use crate::command::EntityTransform;
use crate::entities::common::{edit_angle_prop, edit_prop, parse_f64, ro_prop, square_grip};
@ -83,37 +84,31 @@ impl PropertyEditable for SectionSymbol {
.join("\n");
vec![
PropSection {
title: "Section Symbol".into(),
title: t!("Section Symbol").into_owned(),
props: vec![
edit_prop("Symbol Scale", "section_scale", self.symbol_scale),
ro_prop(
"View Symbol Version",
edit_prop(t!("Symbol Scale").as_ref(), "section_scale", self.symbol_scale),
ro_prop(t!("View Symbol Version").as_ref(),
"section_view_version",
self.view_symbol_version.to_string(),
),
ro_prop("Version", "section_version", self.version.to_string()),
ro_prop(
"Style",
ro_prop(t!("Version").as_ref(), "section_version", self.version.to_string()),
ro_prop(t!("Style").as_ref(),
"section_style",
handle_text(self.style_handle),
),
ro_prop(
"View Representation",
ro_prop(t!("View Representation").as_ref(),
"section_view_rep",
handle_text(self.view_rep_handle),
),
ro_prop(
"View Symbol Flags",
ro_prop(t!("View Symbol Flags").as_ref(),
"section_view_flags",
self.raw_view_symbol_70.to_string(),
),
ro_prop(
"Point Count",
ro_prop(t!("Point Count").as_ref(),
"section_point_count",
self.points.len().to_string(),
),
ro_prop(
"Stored Point Counts",
ro_prop(t!("Stored Point Counts").as_ref(),
"section_raw_counts",
format!(
"{}, {}, flags {}",
@ -122,12 +117,12 @@ impl PropertyEditable for SectionSymbol {
self.raw_flags_90
),
),
ro_prop("Identifier", "section_label", self.label.clone()),
ro_prop(t!("Identifier").as_ref(), "section_label", self.label.clone()),
],
},
PropSection {
title: "Section Points".into(),
props: vec![ro_prop("Records", "section_points", point_data)],
title: t!("Section Points").into_owned(),
props: vec![ro_prop(t!("Records").as_ref(), "section_points", point_data)],
},
]
}
@ -197,34 +192,29 @@ impl Grippable for ViewBorder {
impl PropertyEditable for ViewBorder {
fn geometry_properties(&self, _text_style_names: &[String]) -> Vec<PropSection> {
vec![PropSection {
title: "Drawing View".into(),
title: t!("Drawing View").into_owned(),
props: vec![
edit_prop("Center X", "view_border_x", self.center[0]),
edit_prop("Center Y", "view_border_y", self.center[1]),
ro_prop(
"Width",
edit_prop(t!("Center X").as_ref(), "view_border_x", self.center[0]),
edit_prop(t!("Center Y").as_ref(), "view_border_y", self.center[1]),
ro_prop(t!("Width").as_ref(),
"view_border_width",
format!("{:.6}", self.max[0] - self.min[0]),
),
ro_prop(
"Height",
ro_prop(t!("Height").as_ref(),
"view_border_height",
format!("{:.6}", self.max[1] - self.min[1]),
),
edit_prop("Scale", "view_border_scale", self.scale),
edit_angle_prop(
"Rotation",
edit_prop(t!("Scale").as_ref(), "view_border_scale", self.scale),
edit_angle_prop(t!("Rotation").as_ref(),
"view_border_rotation",
self.rotation_angle.to_degrees(),
),
ro_prop("Version", "view_border_version", self.version.to_string()),
ro_prop(
"Active Viewport",
ro_prop(t!("Version").as_ref(), "view_border_version", self.version.to_string()),
ro_prop(t!("Active Viewport").as_ref(),
"view_border_viewport",
handle_text(self.active_viewport),
),
ro_prop(
"Scale Object",
ro_prop(t!("Scale Object").as_ref(),
"view_border_scale_handle",
handle_text(self.scale_handle),
),