XRefs2Layers

Short description

πŸ”—πŸ“‚ Move all AutoCAD XREF block references onto clean XREF layers using either one shared _XREF layer or individual 0-XREF_ layers.

Image 000 15

Command:

πŸš€ Primary command: XRefs2LayersOptions
πŸ”˜ Option 1: XRefsTo_Xref / X2_XREF β€” moves all detected XREF inserts to one layer named _XREF.
πŸ“‚ Option 2: XRefsToLayers / X2L β€” moves each XREF insert to its own layer using the 0-XREF_ prefix.
πŸͺŸ Dialog helper: radioX2LDCL creates a small DCL option dialog for choosing the workflow.

Description:

πŸ”— XRefs2Layers is an AutoCAD AutoLISP utility for organizing external reference inserts by layer.

πŸ“‚ The tool scans the current drawing for XREF block definitions, ignores names matching *TBLOCK*, finds matching INSERT references, and moves those references to controlled XREF layers.

🧭 The user can run a dialog-based workflow with XRefs2LayersOptions or run direct commands for a specific mode. One mode places every XREF on a shared _XREF layer, while the other mode creates separate 0-XREF_ layers for clearer drawing management.

πŸ›‘οΈ The routine uses ActiveX layer handling, undo marks, locked-layer recovery logic, and a final alert report showing how many XREFs were moved to each target layer.

Helper function: (if any)​

πŸͺŸ writeX2LDCL β€” writes the temporary DCL dialog for the two XREF layer options.
πŸ”˜ radioX2LDCL β€” loads the DCL, remembers the last selected option, and returns the selected workflow.
🧭 XRefs2LayersOptions β€” main option selector that launches the selected XREF layer command.
πŸ“‚ XRefsToLayers / X2L β€” creates or uses 0-XREF_ layers and moves each XREF to its matching named layer.
πŸ”— XRefsTo_Xref / X2_XREF β€” creates or uses the shared _XREF layer and moves all XREF inserts there.
πŸ›‘οΈ Error handlers β€” close undo marks safely and report unexpected errors without interrupting normal cancel behavior.

Functionalities:

πŸ”— XREF detection β€” scans AutoCAD Blocks collection for definitions where IsXRef is true.
🧹 TBLOCK exclusion β€” skips XREF names matching *TBLOCK* to avoid processing title-block style references.
πŸͺŸ DCL option dialog β€” provides a simple radio-button interface for choosing the layer organization mode.
πŸ“‚ Per-XREF layer mode β€” moves XREF inserts to uppercase layers named with the 0-XREF_ prefix.
🟦 Shared layer mode β€” moves all XREF inserts to one standard _XREF layer.
🧱 Layer auto-create β€” creates missing destination layers automatically.
πŸ” Locked-layer handling β€” temporarily unlocks the current layer when required so the XREF can be moved.
↩️ Undo mark support β€” wraps processing in an undo mark for safer drawing edits.
πŸ“Š Move report β€” displays a summary alert showing counts by target layer.
βš™οΈ Session memory β€” remembers the last selected radio option during the active AutoCAD session.
🚫 Zero-XREF warning β€” alerts the user when no XREFs are found in the drawing.

Result:

βœ… The result is a cleaner AutoCAD drawing where XREF references are organized on predictable layers.

πŸ“‚ CAD teams can quickly isolate, freeze, lock, audit, or plot XREF content by using either one shared _XREF layer or separate 0-XREF_ layers.

πŸ“Š The final alert gives immediate feedback about how many XREF references were moved to each layer.

Images, animations etc.

Image 000 15
Image 001 6
Image 002 9
Image 003 3
Pixel

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="XRefs2Layers">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: XRefs2LayersOptions / X2L / XRefsToLayers / X2_XREF / XRefsTo_Xref</Bold>
<LineBreak/>
<Bold>Version: 1.0 Date: 20.06.2026 6:39:04PM</Bold>
<LineBreak/>
<Hyperlink>AI+https://www.cadtutor.net/forum/topic/20566-xrefstolayerslsp-move-xrefs-to-corresponding-layers/</Hyperlink>
<LineBreak/>

<Bold><Run Foreground="DodgerBlue">Function Syntax: XRefs2Layers</Run></Bold><LineBreak/>
<Bold><Run Foreground="Orange">Version: 1.0</Run></Bold><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">πŸ”— SEO Friendly Description</Run></Bold><LineBreak/>
<Run Foreground="White">πŸ”— XRefs2Layers is an AutoCAD AutoLISP tool for organizing external references by moving XREF insert references onto clean, predictable XREF layers.</Run><LineBreak/>
<Run Foreground="LimeGreen">πŸ“‚ It improves CAD layer management, XREF visibility control, drawing cleanup, Civil 3D production organization, and DWG audit workflows.</Run><LineBreak/>
<Run Foreground="White">πŸͺŸ The command includes a DCL option dialog so the user can choose between a shared XREF layer workflow and a per-XREF layer workflow.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">πŸš€ Main Commands</Run></Bold><LineBreak/>
<Run Foreground="White">πŸͺŸ Run </Run><Bold><Run Foreground="Orange">XRefs2LayersOptions</Run></Bold><Run Foreground="White"> to open the option dialog.</Run><LineBreak/>
<Run Foreground="White">πŸ“‚ Run </Run><Bold><Run Foreground="Orange">XRefsToLayers</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">X2L</Run></Bold><Run Foreground="White"> to move each XREF to its own </Run><Bold><Run Foreground="LimeGreen">0-XREF_&lt;XREF name&gt;</Run></Bold><Run Foreground="White"> layer.</Run><LineBreak/>
<Run Foreground="White">🟦 Run </Run><Bold><Run Foreground="Orange">XRefsTo_Xref</Run></Bold><Run Foreground="White"> or </Run><Bold><Run Foreground="Orange">X2_XREF</Run></Bold><Run Foreground="White"> to move all detected XREF inserts to one shared </Run><Bold><Run Foreground="LimeGreen">_XREF</Run></Bold><Run Foreground="White"> layer.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="LimeGreen">🧩 Functionalities</Run></Bold><LineBreak/>
<Run Foreground="White">πŸ” </Run><Bold><Run Foreground="LimeGreen">XREF scan</Run></Bold><Run Foreground="White"> - scans the AutoCAD Blocks collection and detects block definitions where </Run><Bold><Run Foreground="Orange">IsXRef</Run></Bold><Run Foreground="White"> is true.</Run><LineBreak/>
<Run Foreground="White">🧹 </Run><Bold><Run Foreground="LimeGreen">TBLOCK exclusion</Run></Bold><Run Foreground="White"> - ignores XREF names matching </Run><Bold><Run Foreground="Orange">*TBLOCK*</Run></Bold><Run Foreground="White"> to avoid processing title-block style references.</Run><LineBreak/>
<Run Foreground="White">πŸͺŸ </Run><Bold><Run Foreground="LimeGreen">Dialog selection</Run></Bold><Run Foreground="White"> - creates a temporary DCL window with radio buttons for choosing the target layer method.</Run><LineBreak/>
<Run Foreground="White">πŸ“‚ </Run><Bold><Run Foreground="LimeGreen">Per-XREF layer mode</Run></Bold><Run Foreground="White"> - creates organized layers using the </Run><Bold><Run Foreground="Orange">0-XREF_</Run></Bold><Run Foreground="White"> prefix and the XREF name.</Run><LineBreak/>
<Run Foreground="White">🟦 </Run><Bold><Run Foreground="LimeGreen">Shared layer mode</Run></Bold><Run Foreground="White"> - places every detected XREF insert on the common </Run><Bold><Run Foreground="Orange">_XREF</Run></Bold><Run Foreground="White"> layer.</Run><LineBreak/>
<Run Foreground="White">🧱 </Run><Bold><Run Foreground="LimeGreen">Automatic layer creation</Run></Bold><Run Foreground="White"> - creates missing destination layers before moving the XREF insert references.</Run><LineBreak/>
<Run Foreground="White">πŸ” </Run><Bold><Run Foreground="LimeGreen">Locked-layer recovery</Run></Bold><Run Foreground="White"> - temporarily unlocks the current layer when a layer change fails because of a locked layer state.</Run><LineBreak/>
<Run Foreground="White">↩️ </Run><Bold><Run Foreground="LimeGreen">Undo mark support</Run></Bold><Run Foreground="White"> - wraps edits in an AutoCAD undo mark for safer production use.</Run><LineBreak/>
<Run Foreground="White">πŸ“Š </Run><Bold><Run Foreground="LimeGreen">Result report</Run></Bold><Run Foreground="White"> - displays an alert summary with the number of XREF inserts moved to each layer.</Run><LineBreak/>
<Run Foreground="White">βš™οΈ </Run><Bold><Run Foreground="LimeGreen">Session memory</Run></Bold><Run Foreground="White"> - remembers the last selected option while the AutoCAD session remains open.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DodgerBlue">βœ… Practical Result</Run></Bold><LineBreak/>
<Run Foreground="White">βœ… The drawing becomes easier to manage because all XREF inserts are placed on predictable layers for visibility control, plotting, locking, freezing, and CAD standard review.</Run><LineBreak/>
<Run Foreground="LimeGreen">πŸ“Œ This is useful for AutoCAD users, Civil 3D teams, CAD managers, drafting technicians, and production environments with many external references.</Run><LineBreak/>
<LineBreak/>
<Bold><Run Foreground="DarkRed">⚠️ Important Notes</Run></Bold><LineBreak/>
<Run Foreground="White">⚠️ The routine changes the layer assignment of XREF INSERT references in the active drawing.</Run><LineBreak/>
<Run Foreground="White">⚠️ It does not modify the external source DWG files referenced by the XREFs.</Run><LineBreak/>
<Run Foreground="White">⚠️ The per-XREF workflow can lock created XREF layers when the lock prompt is confirmed.</Run><LineBreak/>
<Run Foreground="White">⚠️ Review project CAD standards before running this tool on production drawings.</Run><LineBreak/>



</TextBlock>
            
<Grid>
<Image Source="Image_000.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_001.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_002.jpg" Stretch="Uniform"/>
</Grid>

<Grid>
<Image Source="Image_003.jpg" Stretch="Uniform"/>
</Grid>




</StackPanel>
</src:RibbonToolTip.ExpandedContent>
</src:RibbonToolTip>
</ResourceDictionary>

Share this page:

Leave a Reply

Page Tag: 🏷️ Xref_menu

  • XRefs2Layers

    β€”

    by

    Short descriptionπŸ”—πŸ“‚ Move all AutoCAD XREF block references onto clean XREF layers using either one shared _XREF layer or individual 0-XREF_ layers. Command:πŸš€ Primary command: XRefs2LayersOptions πŸ”˜ Option 1: XRefsTo_Xref / X2_XREF β€” moves all detected XREF inserts to one layer named _XREF. πŸ“‚ Option 2: XRefsToLayers / X2L β€” moves each XREF insert to…

  • XrefsDrawingOrder

    β€”

    by

    Short description🧭 AutoCAD and Civil 3D .NET tool for managing XREF draw order with a modeless WinForms dialog, live preview, Apply and Undo, saved xref order presets, folder favorites, xref reload/unload controls, layer updates, and diagnostic logging. Command:🧰 Main commands: – XrefDrawingOrder_017 β€” opens the full XREF Drawing Order manager for build 017. – XRDO_017…

  • UnReloadDetachSelectedXrefs_00

    β€”

    by

    Short description Sort / Purpose: Interactive Xref management tool for AutoCAD that saves, reloads, and bulk-edits Xref state via a dialog, while preserving the current UCS and view for bulk actions. β€’ Type of tool: Dialog-driven Xref control command with filters, selection, zoom-to-xref, save/load list, and batch operations. β€’ Scope: Works on all Xrefs in…

  • ResetXrefLayers

    β€”

    by

    Short description Comming soon … Command: Comming soon … Description: Comming soon … Helper function: (if any)​ Comming soon … Functionalities: Comming soon … Result: Comming soon … Images, animations etc. Lisp code: Expand Code ⬇ Select Code Copy Code Comming soon … /* ======= Theme ======= */ .lsp-theme { –bg: #111; –border: #2a2a2a; –text:…

  • Xref_menu

    Lisp code: Expand Code ↓ Select Code Copy Code ; — auto-generated by LispLoader — ; Menu: Xref_menu ; Generated: 2026-06-09 07:42:24 (setq base "C:\\Users\\mateid\\OneDrive – DB E.C.O. Group\\@C3D\\@Dan_Templates\\Acad\\Support_files\\Lisps\\Help_File\\") (load (strcat base "Xref_menu\\AttachMultipleImages\\AttachMultipleImages.lsp")) (load (strcat base "Xref_menu\\AttachMultipleImagesPdfs\\AttachMultipleImagesPdfs.lsp")) (load (strcat base "Xref_menu\\AttachXrefsInLayouts\\AttachXrefsInLayouts.lsp")) (load (strcat base "Xref_menu\\Block2Xref\\BlockToXref.lsp")) (load (strcat base "Xref_menu\\ChangeColorInArea\\ChangeColorInArea.lsp")) (load (strcat base "Xref_menu\\ChangeXrefFromLayer\\ChangeXrefFromLayer.lsp")) (load (strcat…