Complete associative centerline workflow

This commit is contained in:
ramox81 committed 2026-08-21 11:01:18 +03:00
1 parent 573ed3245e
commit eba4fb87a8
14 files changed
+683 -223

No files matched your search

+35 -1
View File
@@ -473,11 +473,45 @@ impl OpenCADStudio {
"CENTERLINE" => {
use crate::modules::draw::draw::centerline::CenterLineCommand;
let new_cmd = CenterLineCommand::new();
let settings = self.tabs[i].scene.centerline_settings();
let new_cmd = CenterLineCommand::new(settings);
self.command_line.push_info(&new_cmd.prompt());
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
}
"CENTERRESET" => {
let handles = self.tabs[i].scene.selected_handles_in_order();
self.push_undo_snapshot(i, "CENTERRESET");
let count = self.tabs[i].scene.reset_centerlines(&handles);
if count > 0 {
self.tabs[i].dirty = true;
}
self.command_line
.push_output(&format!("CENTERRESET: {count} centerline(s) updated."));
}
"CENTERREASSOCIATE" => {
let handles = self.tabs[i].scene.selected_handles_in_order();
self.push_undo_snapshot(i, "CENTERREASSOCIATE");
let count = self.tabs[i].scene.set_centerline_association(&handles, true);
if count > 0 {
self.tabs[i].dirty = true;
}
self.command_line
.push_output(&format!("CENTERREASSOCIATE: {count} centerline(s) associated."));
}
"CENTERDISASSOCIATE" => {
let handles = self.tabs[i].scene.selected_handles_in_order();
self.push_undo_snapshot(i, "CENTERDISASSOCIATE");
let count = self.tabs[i].scene.set_centerline_association(&handles, false);
if count > 0 {
self.tabs[i].dirty = true;
}
self.command_line
.push_output(&format!("CENTERDISASSOCIATE: {count} centerline(s) detached."));
}
"DIMCENTER" | "CENTERMARK" => {
use crate::modules::draw::draw::dimcenter::DimCenterCommand;
let new_cmd = DimCenterCommand::new();
+39 -1
View File
@@ -933,6 +933,11 @@ impl OpenCADStudio {
| "SKETCHINC"
| "SKPOLY"
| "SKTOLERANCE"
| "CENTEREXE"
| "CENTERLAYER"
| "CENTERLTYPE"
| "CENTERLTSCALE"
| "CENTERLTYPEFILE"
) =>
{
return self.dispatch_styleprops(&format!("SETVAR {cmd}"), i);
@@ -955,7 +960,7 @@ impl OpenCADStudio {
let value = it.next().map(|s| s.trim().to_string());
if name.is_empty() || name == "?" {
self.command_line.push_info(
"SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG ATTREQ ATTDIA DIMASSOC ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE | CLAYER CELTYPE TEXTSTYLE (read-only)",
"SETVAR: LTSCALE CELTSCALE PDMODE PDSIZE TEXTSIZE ORTHOMODE FILLMODE MIRRTEXT FRAME IMAGEFRAME PDFFRAME WIPEOUTFRAME XCLIPFRAME POINTCLOUDCLIPFRAME ZOOMWHEEL ZOOMFACTOR CURSORSIZE PICKBOX CURSORTYPE SNAPANG ATTREQ ATTDIA DIMASSOC ANGBASE ANGDIR SKETCHINC SKPOLY SKTOLERANCE CENTEREXE CENTERLAYER CENTERLTYPE CENTERLTSCALE CENTERLTYPEFILE | CLAYER CELTYPE TEXTSTYLE (read-only)",
);
} else {
let frame_kind = crate::scene::frame::kind_for_name(&name);
@@ -1032,6 +1037,39 @@ impl OpenCADStudio {
}
return Some(self.finish_dispatch(cmd));
}
if matches!(
name.as_str(),
"CENTEREXE"
| "CENTERLAYER"
| "CENTERLTYPE"
| "CENTERLTSCALE"
| "CENTERLTYPEFILE"
) {
let settings = self.tabs[i].scene.centerline_settings();
let current = match name.as_str() {
"CENTEREXE" => settings.extension.to_string(),
"CENTERLAYER" => settings.layer,
"CENTERLTYPE" => settings.linetype,
"CENTERLTSCALE" => settings.linetype_scale.to_string(),
"CENTERLTYPEFILE" => settings.linetype_file,
_ => unreachable!(),
};
if let Some(value) = &value {
match self.tabs[i].scene.set_centerline_setting(&name, value) {
Ok(message) => {
self.tabs[i].dirty = true;
self.command_line.push_output(&message);
}
Err(error) => self.command_line.push_error(&error),
}
} else {
self.command_line.push_output(crate::tf!(
"Enter new value for {name} <{current}>:"
).as_ref());
self.pending_setvar = Some(name.clone());
}
return Some(self.finish_dispatch(cmd));
}
// Parse a boolean given as 0/1 or ON/OFF.
let parse_bool = |s: &str| match s.to_uppercase().as_str() {
"1" | "ON" | "TRUE" => Some(true),
+30
View File
@@ -1844,6 +1844,36 @@ impl OpenCADStudio {
&mut entity,
);
// Smart centre lines carry their own drawing-level creation style.
// Apply it after the generic ribbon style so ordinary LINE entities
// keep the existing path while centre lines honour their settings.
if acadrust::entities::CenterLineAssociation::read(
&entity.common().extended_data,
)
.is_some()
{
let settings = self.tabs[i].scene.centerline_settings();
if !settings.layer.eq_ignore_ascii_case("Current") {
entity.common_mut().layer = settings.layer;
}
if !settings.linetype.eq_ignore_ascii_case("Current") {
entity.common_mut().linetype = settings.linetype;
}
entity.common_mut().linetype_scale = settings.linetype_scale;
if !self.tabs[i]
.scene
.document
.app_ids
.contains(acadrust::entities::CENTERLINE_XDATA_APPLICATION)
{
let mut app = acadrust::tables::AppId::new(
acadrust::entities::CENTERLINE_XDATA_APPLICATION,
);
app.handle = self.tabs[i].scene.document.allocate_handle();
let _ = self.tabs[i].scene.document.app_ids.add(app);
}
}
let text_style_annotative = match &entity {
acadrust::EntityType::Text(text) => {
crate::scene::annotative::text_style_is_annotative(