Function Syntax: DuplicateLayouts Version: 1.1 Date: 20.06.2026 6:38:55PM N/A DuplicateLayouts summary This program opens a Dialog UI (DCL) that lets the user pick existing layout tabs, set how many copies to create for each one, then duplicates them using the AutoCAD -LAYOUT Copy command with safe fallbacks and unique naming. What the user must do Run the command DuplicateLayouts to open the dialog. Select a layout from Available Layouts and enter a Number of copies, then press Set Count to add it to the summary list. Press Apply to duplicate and keep the dialog open, or press OK to duplicate and exit. Optionally use Undo to undo the most recent session operation, or use Delete to remove an entry from the summary or delete an actual layout tab from the drawing depending on selection context. Key actions and controls Available Layouts list shows all layouts except Model. Number of copies input controls how many duplicates to create for the currently selected available layout. Set Count adds or updates the selected layout in the summary map as layoutName : copyCount. Selected Layouts and Copies summary shows the queued duplication plan. Apply duplicates the queued items and reopens the dialog. OK duplicates if there are queued items, otherwise exits without changes. Undo runs a single step undo for the most recent session operation and reopens the dialog. Delete behaves in two ways based on where the selection is made. If a summary row is selected, Delete removes that queued item from the summary list only. If no summary row is selected but an available layout is selected, Delete deletes that layout tab from the drawing. FunctionalitiesDCL dialog driven workflow for selecting layouts and copy counts. • Builds the available layout list by reading the drawing Layouts collection and excluding Model. • Stores session state in globals so the dialog can be reopened without losing selections and counts. • Creates duplicates by calling -LAYOUT Copy with multiple fallback variants to maximize compatibility. • Generates unique destination names in the format BaseName_### using zero padded numbering and existence checks. • Wraps duplication batches in an undo mark so each Apply or OK duplication can be undone in a single step. • Provides session undo via UNDO 1 limited to operations performed during the current dialog session. • Deletes a real layout tab by switching away from that tab if active, then calling the layout object delete method, and tracking it as undoable. • Keeps OK enabled at all times and disables Apply when nothing is queued, and disables Undo when no session operations exist. • Writes a temporary DCL file, loads it, runs the dialog loop, then unloads the dialog and deletes the temp DCL file on exit. Important behaviors and safeguards The tool will not duplicate anything unless at least one layout has been added to the summary using Set Count. When OK is pressed with no queued items, the program exits silently without alerts. When Apply is pressed with no queued items, the program shows an alert telling the user no layouts are selected. The tool never lists or duplicates Model and will block deletion of Model with an alert. If the active tab is being deleted, the program switches to Model first to avoid deleting the current tab. Undo tracking is session based using an internal counter, so the dialog only enables Undo when it knows it executed at least one undo mark operation in this run. Summary result This tool provides a dialog based batch process to queue multiple layouts with copy counts, duplicate them into uniquely named layout tabs, optionally delete a selected layout tab, and undo the most recent session operations using AutoCAD undo. Description 📄 DuplicateLayouts is an AutoCAD and Civil 3D AutoLISP utility for duplicating layout tabs from a dialog-driven workflow. 🔁 It lets CAD users select one or more existing paper-space layouts, assign copy counts, create unique layout names automatically, and manage layout duplication without manually repeating the AutoCAD LAYOUT Copy command. Function Syntax 🚀 Main dialog command: DuplicateLayouts 🧰 Load the LSP with APPLOAD and run the command in AutoCAD or Civil 3D. SEO Optimized Overview 📄 DuplicateLayouts is an SEO-friendly AutoCAD layout duplication tool designed for drawing sheets, paper-space tabs, plotting workflows, and Civil 3D sheet production. 🔁 The routine builds a temporary DCL dialog named Duplicate Layouts with an Available Layouts list, Number of copies input, Selected Layouts and Copies summary, Apply, Undo, Delete, OK, and Cancel controls. 🧠 Each selected source layout can receive its own copy count. The tool generates unique names by appending three-digit suffixes such as Layout_001, Layout_002, and Layout_003. 🧩 Layout duplication is performed through the AutoCAD -LAYOUT Copy workflow, with fallback command keywords to improve compatibility across localized or command-option variations. 🗑️ The Delete button can remove a selected entry from the summary list or delete an actual layout tab from the drawing when a layout is selected in the Available Layouts list. 📌 This is useful for batch sheet creation, repeating plotting layouts, Civil 3D plan set preparation, viewport-based drawing sheets, and production drawings where many similar tabs must be generated quickly. Primary Workflow 1️⃣ Load DuplicateLayouts into AutoCAD or Civil 3D with APPLOAD. 2️⃣ Run DuplicateLayouts from the command line. 3️⃣ Use the dialog or command prompts to select the target layouts, layers, viewports, or plot settings. 4️⃣ Review the preview, status list, or command-line feedback before applying changes. 5️⃣ Apply the operation and verify the result in the active drawing. Main Functionalities ✅ Select layout tabs from a DCL list box and assign individual copy counts. ✅ Build a summary list of source layouts and requested copy quantities before committing changes. ✅ Duplicate multiple paper-space layouts in one operation. ✅ Automatically avoid name collisions by generating Layout_001-style unique names. ✅ Apply changes while keeping the dialog open for repeated duplication batches. ✅ Use OK to duplicate selected layouts and close the tool. ✅ Use Undo to roll back the latest session operation. ✅ Delete a selected summary row or delete a drawing layout tab directly from the dialog. ✅ Exclude Model from duplication targets to protect the model-space tab. Important Commands and Helper Functions 🧩 DL_WriteDCL dynamically writes the temporary dup_layouts.dcl dialog file. 🧩 DL_GetLayoutNames collects all drawing layouts except Model for the available layout list. 🧩 DL_Pad3 formats generated layout suffixes with three digits. 🧩 DL_LayoutExistsP verifies whether a proposed layout name already exists in the Layouts collection. 🧩 DL_NextUniqueName creates the next available unique destination layout name. 🧩 DL_CopyLayoutSafe runs -LAYOUT Copy with fallback option names to duplicate source tabs. 🧩 DL_DoDuplicate processes the selected layout and copy-count map inside an AutoCAD undo mark. 🧩 DL_DeleteLayoutFromDrawing deletes a selected layout tab safely and moves CTAB to Model when needed. 🧩 DL_DoUndo performs a single AutoCAD UNDO step for the latest Apply or Delete action. Practical Result 🎯 The result is a faster layout duplication workflow for AutoCAD and Civil 3D drawings. 📄 Users can create many paper-space tabs from existing layouts without repeating manual LAYOUT Copy operations. ✅ DuplicateLayouts improves sheet setup speed, reduces layout naming mistakes, and supports consistent production drawing preparation for plotting, plan sheets, and sheet-set workflows. Important Notes ⚠️ The routine modifies layout tabs in the active drawing, so testing on a backup drawing is recommended before large batch operations. ⚠️ Delete can remove a real layout tab from the drawing when no summary row is selected and an available layout is selected. ⚠️ Undo relies on AutoCAD's UNDO command for the latest session operation. ⚠️ Generated names use the source layout name plus a three-digit suffix; rename manually later if a different sheet naming standard is required. Tags 🏷️ AutoCAD, 🏷️ Civil 3D, 🏷️ AutoLISP, 🏷️ Visual LISP, 🏷️ DCL dialog, 🏷️ CAD automation, 🏷️ CAD productivity, 🏷️ Layout tabs, 🏷️ Paper space, 🏷️ Duplicate layouts, 🏷️ Batch layout creation, 🏷️ Sheet setup, 🏷️ Plan sheets, 🏷️ Plot layouts, 🏷️ LAYOUT Copy, 🏷️ Undo workflow, 🏷️ Drawing production