DuplicateLayouts_01

Short description

DuplicateLayouts provides a DCL Dialog_UI to queue layout tabs with copy counts, then batch duplicate them using -LAYOUT Copy with safe fallbacks and unique naming.
duplicatelayouts 000

Command:

Commands
  • DuplicateLayouts opens the dialog and runs the full tool workflow.

Description:

What the user does
  • Run DuplicateLayouts to open the DCL dialog.
  • Select a layout in Available Layouts and enter Number of copies.
  • Press Set Count to add or update that layout in Selected Layouts and Copies summary.
  • Press Apply to duplicate and keep the dialog open, or press OK to duplicate and exit.
  • Press Undo to undo the last session operation, then continue working in the dialog.
  • Press Delete to remove an item from the summary when a summary row is selected, otherwise delete the selected available layout tab from the drawing.

Helper function: (if any)​

Key helper behavior
  • Builds the available layout list by iterating the Layouts collection and excluding Model.
  • Maintains stable session state using globals for selected layouts, delete target, and undo availability.
  • Generates unique destination names using BaseName_### with zero padded numbering and an existence check before each creation.
  • Copies layouts using -LAYOUT Copy with multiple fallback variants to handle command localization or option differences.
  • Wraps duplication and deletion in StartUndoMark and EndUndoMark so each operation can be reverted cleanly.
  • Implements session undo by issuing UNDO 1 and tracking a session counter to enable or disable the Undo button.
  • Writes a temporary DCL file, loads it, runs the dialog loop, then unloads the dialog and deletes the temp file on exit.

Functionalities:

Functionalities
  • Queue layouts for duplication
    • Select an available layout and set Number of copies.
    • Press Set Count to add or update the queued entry in the summary list.
    • Displays queued items as layout : count for review before applying.
  • Batch duplicate layouts
    • Apply duplicates all queued layouts and keeps the dialog open for additional changes.
    • OK duplicates all queued layouts then exits, and exits silently if nothing is queued.
    • Each duplicate is created with a unique name BaseName_### to prevent naming conflicts.
  • Delete behavior
    • If a summary row is selected, Delete removes that queued entry only and does not change the drawing.
    • If no summary row is selected and an available layout is selected, Delete deletes that layout tab from the drawing and switches CTAB to Model first if the tab was active.
    • Deletion blocks invalid targets such as Model and missing layouts with clear alerts.
  • Undo within the session
    • Undo runs a single step undo using UNDO 1 for the last duplication batch or delete operation executed in this dialog session.
    • The tool enables the Undo button only after at least one operation was performed during the session.
  • UI rules
    • Apply is disabled until at least one layout is queued with Set Count.
    • OK remains enabled always, and will only duplicate when there are queued items.

Result:

Tags
  • Layouts, DCL, Dialog_UI, General_AutoCAD, Extra_AutoCAD, Lisp
Suggested relevant tags not in the provided list
  • Undo or UndoMark grouping
  • Naming or UniqueName generation
  • Batch duplication workflow

Images, animations etc.

duplicatelayouts 000
Pixel

Additional info:

Share this page:

Leave a Reply

Page Tag: 🏷️ Layouts_menu

  • DuplicateLayouts_01

    Short description DuplicateLayouts provides a DCL Dialog_UI to queue layout tabs with copy counts, then batch duplicate them using -LAYOUT Copy with safe fallbacks and unique naming. Command: Commands DuplicateLayouts opens the dialog and runs the full tool workflow. Description: What the user does Run DuplicateLayouts to open the DCL dialog. Select a layout in…

  • DuplicateLayouts

    XAML code: Expand Code ↓ Select Code Copy Code <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows"> <src:RibbonToolTip x:Key="DuplicateLayouts"> <src:RibbonToolTip.ExpandedContent> <StackPanel> <TextBlock Background="AntiqueWhite" TextAlignment="Left"> <Bold>Function Syntax: DuplicateLayouts</Bold> <LineBreak/> <Hyperlink>N/A</Hyperlink> <LineBreak/> <Bold>DuplicateLayouts summary</Bold><LineBreak/> This program opens a <DarkRed>Dialog UI (DCL)</DarkRed> that lets the user pick existing <DarkRed>layout tabs</DarkRed>, set how many copies to create for each one, then duplicates them…

  • LayoutTools

    Short description LayoutTools manages layout tabs to batch Lock or Unlock viewports, toggle AnnON or AnnOFF, and apply Zoom Extents or Zoom Window in Paper Space across selected or displayed layouts, with status tracking stored in the DWG. Command: Commands and aliases LayoutTools opens the main dialog. LayoutTools is an alias that runs the same…

  • Zoom Extend Window

    Short description What this LISP does ZEZW opens a DCL dialog to multi-select layouts and then applies Zoom Extents or Zoom Window in Paper Space on the selected layouts. Key concept The zoom action runs after the dialog closes for stability and predictable execution. Command: Commands ZEZW Main command that launches the selection dialog and…

  • AnnoAllOnOff

    Short description Single dialog that sets ANNOALLVISIBLE to 1 or 0 for a chosen set of Model/Layout tabs. Combines the functionality of AAON and AAOFF with mode radio buttons and tab multi-select in one UI. Command: Command: AAVIS Description: Generates an embedded DCL dialog at runtime that provides a Mode selector and a multi-select list…

  • AnnoAllOff

    Short description Opens a DCL picker to choose Model/Layout tabs, then sets ANNOALLVISIBLE to 0 on the selected tabs. Provides quick selection controls for All or None before applying the change. Command: Command: AAOFF Description: Builds a temporary DCL dialog at runtime that lists all tabs (including Model) and allows multi-selection. After the user confirms…

  • SelectLayout

    Short description Select Layout from Dialog Displays a dialog box listing all paper space layouts for quick selection and activation. Command: Command: SelectLayout Description: This command creates an interactive dialog box to switch between layouts: Retrieves all paper space layouts from the current drawing (excludes Model space) Generates a temporary DCL dialog file with a…