Short description
- Opens a dialog to pick objects once, then copies them to multiple selected paper-space layouts, showing only the total selected object count.
- Includes a wildcard layout filter and multi-select layout targeting with Select All and Select None actions.

Command:
- Commands: Copy2Layouts and macro-friendly alias _Copy2Layouts
Description:
- Creates a temporary DCL file each run and assigns a unique dialog name so the dialog definition cannot collide with older cached DCL definitions.
- Lets the user pick a selection set from the drawing and displays Total: N only, without any object-type breakdown.
- Lists only paper-space layouts (excludes Model) and supports filtering layout names using wildcard patterns * and ?.
- Copies selected objects to the target layouts using ActiveX CopyObjects into each destination layout’s paper-space block, wrapped in an UNDO Begin/End group for one-step rollback.
- Runs as a looped dialog workflow: Apply Filter and Pick return to the dialog, Copy completes the operation and exits on success, Close exits without changes.
Helper function: (if any)
- lc:unique-dialog-name generates a unique DCL dialog name from DATE to avoid dialog name collisions.
- lc:_dcl-text builds the DCL definition lines, including object picking, total count text, layout filter row, multi-select list, and copy/close buttons.
- lc:write-dcl writes the DCL lines to a temp .dcl file and returns the filename.
- lc:cleanup unloads the dialog and deletes the temp DCL file to prevent leftovers across runs.
- lc:get-paper-layouts returns layout names excluding Model.
- lc:parse-indexes converts the list box multi-select index string into a usable list of integers.
- lc:make-index-string builds “0 1 2 …” index strings for Select All behavior.
- lc:fill-layouts fills the layout list box and reapplies the stored index selection string.
- lc:get-ss-count returns the current selection set count, or zero if none is present.
- lc:set-copy-enabled enables or disables the Copy button based on whether the selection set contains objects.
- lc:apply-layout-filter applies wildcard filtering to the full layout list and resets selection to avoid index mismatch after filtering.
- lc:populate-dialog refreshes the dialog fields: filter text, layout list, total count, and Copy button availability.
- lc:select-all-layouts selects all layouts in the filtered list only.
- lc:select-none-layouts clears all selected target layouts in the dialog.
- lc:do-pick prompts the user to select objects and stores a valid PICKSET only if it has at least one entity.
- lc:copy-to-layouts converts selected entities into VLA objects, builds a safearray variant, and calls vla-CopyObjects into each destination layout block, skipping the current tab.
- lc:do-copy validates prerequisites (objects, filtered layouts, layout selection), maps indexes to layout names, runs the copy inside UNDO, and reports success or blocking errors.
- lc:bind-actions wires all dialog controls with action_tile handlers and uses dialog return codes to drive the reopen loop.
- c:Copy2Layouts controls the dialog lifecycle loop and ensures cleanup via a custom *error* handler; c:_Copy2Layouts provides an underscore alias for macros.
Functionalities:
- • Runtime DCL generation writes and loads a temp dialog with a unique name on each run.
- • Pick from drawing captures a selection set once and displays only Total: N in the dialog.
- • Layout filtering supports wildcard patterns * and ? and applies case-insensitive matching.
- • Multi-select target layouts copies to any subset of filtered layouts, with Select All and Select None for fast control.
- • Copy enable/disable disables the Copy button when no objects are selected to reduce invalid runs.
- • ActiveX CopyObjects copies converted VLA objects into each destination layout’s paper-space block to avoid command-based copy/paste issues.
- • UNDO grouping wraps the copy operation in UNDO Begin/End so the entire multi-layout copy can be undone in a single step.
- • Looped dialog workflow Apply Filter and Pick reopen the dialog, while a successful Copy ends the command.
Result:
- On successful copy, selected objects are duplicated into each chosen paper-space layout and a confirmation alert reports completion.
- If objects are not selected, shows No objects selected and instructs to use Pick first.
- If no layouts match the filter, shows No layouts match the current filter and does not copy.
- If no target layouts are selected, shows No target layouts selected and does not copy.
- On close or cancel, exits cleanly after unloading the dialog and deleting the temp DCL file, without copying anything.
Images, animations etc.



Log in to download.
Log in
Log in
XAML 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="Copy2Layouts">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Copy2Layouts">
<Bold>Function Syntax: Command</Bold>
<LineBreak/>
<Bold>Version: 2 Date: 24.12.2025</Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>AI+https://www.lee-mac.com/copytolayouts.html</Hyperlink>
<LineBreak/>
<Bold>Description</Bold><LineBreak/>
<Run>This program provides a dialog-driven workflow to </Run><Run Foreground="DarkRed">pick objects from the drawing</Run><Run>, then </Run><Run Foreground="DarkRed">copy the selected objects</Run><Run> into one or more </Run><Run Foreground="DarkRed">selected paper-space layouts</Run><Run>.</Run><LineBreak/>
<LineBreak/>
<Bold>Primary User Actions</Bold><LineBreak/>
<Run>1) The user runs the command </Run><Run Foreground="DarkRed">LCOPYLAYOUTS</Run><Run> (or the macro-safe alias </Run><Run Foreground="DarkRed">_LCOPYLAYOUTS</Run><Run>).</Run><LineBreak/>
<Run>2) The dialog opens and the user clicks </Run><Run Foreground="DarkRed">Pick from drawing</Run><Run> to select objects on screen.</Run><LineBreak/>
<Run>3) The program shows the </Run><Run Foreground="Red">total count</Run><Run> of the selected objects.</Run><LineBreak/>
<Run>4) The user filters layout names using a wildcard pattern, selects one or more layouts, then clicks </Run><Run Foreground="DarkRed">Copy to Selected Layouts</Run><Run>.</Run><LineBreak/>
<LineBreak/>
<Bold>Functionalities</Bold><LineBreak/>
<Run>• </Run><Run Foreground="DarkRed">Pick from drawing</Run><Run>: prompts the user to select any objects in the active drawing and stores the selection set for reuse.</Run><LineBreak/>
<Run>• </Run><Run Foreground="Red">Selection count only</Run><Run>: displays only the number of selected objects and does not classify objects by entity type.</Run><LineBreak/>
<Run>• </Run><Run Foreground="DarkRed">Layout list with multi-select</Run><Run>: presents a list of paper-space layouts and allows selecting multiple targets.</Run><LineBreak/>
<Run>• </Run><Run Foreground="DarkRed">Select All</Run><Run>: selects every layout currently visible in the list (after filtering).</Run><LineBreak/>
<Run>• </Run><Run Foreground="DarkRed">Select None</Run><Run>: clears all currently selected layouts.</Run><LineBreak/>
<Run>• </Run><Run Foreground="DarkRed">Layout name filter</Run><Run>: filters the layouts list using wildcard matching with </Run><Run Foreground="DarkRed">*</Run><Run> and </Run><Run Foreground="DarkRed">?</Run><Run>, then refreshes the list when the user clicks </Run><Run Foreground="DarkRed">Apply</Run><Run>.</Run><LineBreak/>
<Run>• </Run><Run Foreground="DarkRed">Copy to selected layouts</Run><Run>: copies the selected objects into each chosen layout’s paper-space block using COM automation.</Run><LineBreak/>
<Run>• </Run><Run Foreground="Red">Conversion safety</Run><Run>: skips objects that cannot be converted to VLA objects (commonly proxy or custom objects) so the copy operation can proceed without failing.</Run><LineBreak/>
<Run>• </Run><Run Foreground="Red">Unique dialog name each run</Run><Run>: generates a unique DCL dialog name and temporary file each time the command is executed to avoid naming collisions.</Run><LineBreak/>
<LineBreak/>
<Bold>Important Notes and Constraints</Bold><LineBreak/>
<Run>• Targets </Run><Run Foreground="DarkRed">paper-space layouts only</Run><Run>: the layout list excludes </Run><Run Foreground="DarkRed">Model</Run><Run>.</Run><LineBreak/>
<Run>• By default, it </Run><Run Foreground="Red">skips copying to the current layout tab</Run><Run> to reduce accidental duplication.</Run><LineBreak/>
<Run>• Copy is executed with an </Run><Run Foreground="DarkRed">UNDO Begin</Run><Run> and </Run><Run Foreground="DarkRed">UNDO End</Run><Run> wrapper, allowing the user to undo the full copy operation in one step.</Run><LineBreak/>
<Run>• The program disables </Run><Run Foreground="DarkRed">Copy to Selected Layouts</Run><Run> until a valid selection set exists.</Run><LineBreak/>
<LineBreak/>
<Bold>Recognizable Commands and Controls</Bold><LineBreak/>
<Run>• Command name: </Run><Run Foreground="DarkRed">LCOPYLAYOUTS</Run><LineBreak/>
<Run>• Alias for macros: </Run><Run Foreground="DarkRed">_LCOPYLAYOUTS</Run><LineBreak/>
<Run>• Dialog buttons: </Run><Run Foreground="DarkRed">Pick from drawing</Run><Run>, </Run><Run Foreground="DarkRed">Select All</Run><Run>, </Run><Run Foreground="DarkRed">Select None</Run><Run>, </Run><Run Foreground="DarkRed">Apply</Run><Run>, </Run><Run Foreground="DarkRed">Copy to Selected Layouts</Run><Run>, </Run><Run Foreground="DarkRed">Close</Run><Run>.</Run><LineBreak/>
<LineBreak/>
<Bold>Example Usage Narrative</Bold><LineBreak/>
<Run>This program will require the user to </Run><Run Foreground="DarkRed">select objects</Run><Run> from the drawing using the </Run><Run Foreground="DarkRed">Pick from drawing</Run><Run> button. The program will then show the </Run><Run Foreground="Red">total number of selected objects</Run><Run>. The user can optionally apply a </Run><Run Foreground="DarkRed">wildcard filter</Run><Run> to reduce the list of layouts, then </Run><Run Foreground="DarkRed">select one or more layouts</Run><Run> and run </Run><Run Foreground="DarkRed">Copy to Selected Layouts</Run><Run> to copy the selected objects into the chosen layouts.</Run><LineBreak/>
</TextBlock>
<Grid>
<Image Source="Copy2Layouts_000.jpg" Stretch="Uniform"/>
</Grid>
<Grid>
<Image Source="Copy2Layouts_001.jpg" Stretch="Uniform"/>
</Grid>
<Grid>
<Image Source="Copy2Layouts_002.jpg" Stretch="Uniform"/>
</Grid>
<Grid>
<MediaElement
Source="GIF"
Stretch="Uniform"
Visibility="Visible"/>
</Grid>
</StackPanel>
</src:RibbonToolTip.ExpandedContent>
</src:RibbonToolTip>
</ResourceDictionary>
Additional info:
Based on / Source code:
Open Website
Share this page:
Subscribe
Login
0 Comments
Oldest
