diff --git a/src/app/commands/inquiry.rs b/src/app/commands/inquiry.rs index 08f920696..8ef4d558d 100644 --- a/src/app/commands/inquiry.rs +++ b/src/app/commands/inquiry.rs @@ -1373,6 +1373,7 @@ impl OpenCADStudio { crate::entities::names::dxf_name(e).to_string(), c.layer.clone(), c.color, + c.transparency, c.linetype.clone(), c.linetype_scale, c.line_weight, @@ -1384,7 +1385,7 @@ impl OpenCADStudio { }, ) }); - let Some((verb, kind, layer, color, linetype, lt_scale, lw, template_dimstyle)) = info + let Some((verb, kind, layer, color, transparency, linetype, lt_scale, lw, template_dimstyle)) = info else { self.command_line .push_error(crate::t!("ADDSELECTED: selected object not found.").as_ref()); @@ -1408,6 +1409,7 @@ impl OpenCADStudio { layer_name: self.tabs[i].scene.document.header.current_layer_name.clone(), layer_handle: self.tabs[i].scene.document.header.current_layer_handle, color: self.tabs[i].scene.document.header.current_entity_color, + transparency: self.tabs[i].scene.document.current_entity_transparency(), linetype_name: self.tabs[i].scene.document.header.current_linetype_name.clone(), linetype_handle: self.tabs[i].scene.document.header.current_linetype_handle, line_weight: self.tabs[i].scene.document.header.current_line_weight, @@ -1422,6 +1424,11 @@ impl OpenCADStudio { ribbon_lineweight: self.ribbon.active_lineweight, }; self.add_selected_restore = Some(restore); + if !self.tabs[i].scene.document.set_current_entity_transparency(transparency) { + self.add_selected_restore = None; + self.command_line.push_error("ADDSELECTED: template transparency cannot be adopted."); + return Task::none(); + } // Adopt the template's general properties as the current defaults. The // entity-creation path stamps new objects from the tab's active layer @@ -1504,6 +1511,9 @@ impl OpenCADStudio { h.current_dimstyle_name = r.dimstyle_name; h.current_dimstyle_handle = r.dimstyle_handle; } + if !self.tabs[i].scene.document.set_current_entity_transparency(r.transparency) { + self.command_line.push_error("ADDSELECTED: current transparency could not be restored."); + } self.tabs[i].active_layer = r.tab_active_layer; self.tabs[i].layers.current_layer = r.tab_layers_current; self.ribbon.active_layer = r.ribbon_layer; diff --git a/src/app/mod.rs b/src/app/mod.rs index 0c2cd3e73..ebee3b5a1 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -307,6 +307,7 @@ struct AddSelectedRestore { layer_name: String, layer_handle: acadrust::types::Handle, color: AcadColor, + transparency: acadrust::types::Transparency, linetype_name: String, linetype_handle: acadrust::types::Handle, line_weight: i16,