Layouts: a viewport on first opening (LAYOUTCREATEVIEWPORT)

A layout opened for the first time - one whose sheet viewport had to be
made, or one created in this session - gets a viewport centred on the
printable area, 0.8 of its width and height, zoomed to the model's
extents, while LAYOUTCREATEVIEWPORT is on. The profile variable takes
ON/OFF or 1/0 and is kept with the settings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-13 11:09:03 +03:00
1 parent 5d0390bcdf
commit e3a0ff1bad
9 files changed
+117 -14

No files matched your search

+2
View File
@@ -796,6 +796,7 @@ impl OpenCADStudio {
surface_associativity: crate::scene::model::sweep_model::surface_associativity(),
ucs_ortho: crate::modules::view::view_cmd::ucs_ortho(),
ucs_view: crate::modules::view::view_cmd::ucs_view(),
layout_create_viewport: crate::scene::layout_create_viewport(),
ncopy_bind: self.ncopy_bind,
cursor_type: self.cursor_type,
crosshair_color: self.crosshair_color,
@@ -911,6 +912,7 @@ impl OpenCADStudio {
crate::scene::model::sweep_model::set_surface_associativity(s.surface_associativity);
crate::modules::view::view_cmd::set_ucs_ortho(s.ucs_ortho);
crate::modules::view::view_cmd::set_ucs_view(s.ucs_view);
crate::scene::set_layout_create_viewport(s.layout_create_viewport);
self.ncopy_bind = s.ncopy_bind;
self.cursor_type = s.cursor_type;
self.crosshair_color = s.crosshair_color;
+11 -4
View File
@@ -6549,10 +6549,17 @@ properties={:.1}ms picked={}",
self.tabs[i].scene.ensure_sheet_viewport(&new_name);
let switch_task = self.on_layout_switch(new_name.clone());
self.tabs[i].scene.fit_all();
self.command_line.push_output(
crate::tf!("Layout \"{new_name}\" created — use MVIEW to add a viewport")
.as_ref(),
);
// Opened, it already has its first viewport unless
// LAYOUTCREATEVIEWPORT is off.
if crate::scene::layout_create_viewport() {
let name = new_name.clone();
self.command_line.push_output(crate::tf!("Layout '{name}' created.").as_ref());
} else {
self.command_line.push_output(
crate::tf!("Layout \"{new_name}\" created — use MVIEW to add a viewport")
.as_ref(),
);
}
// The option that greets every new layout with its page setup.
let switch_task = if self.plot_dialog.page_setup_on_new_layout {
Task::batch([switch_task, self.on_plot_dialog_open()])