Function Syntax: XRefs2LayersOptions / X2L / XRefsToLayers / X2_XREF / XRefsTo_Xref Version: 1.0 Date: 20.06.2026 6:39:04PM AI+https://www.cadtutor.net/forum/topic/20566-xrefstolayerslsp-move-xrefs-to-corresponding-layers/ Function Syntax: XRefs2Layers Version: 1.0 🔗 SEO Friendly Description 🔗 XRefs2Layers is an AutoCAD AutoLISP tool for organizing external references by moving XREF insert references onto clean, predictable XREF layers. 📂 It improves CAD layer management, XREF visibility control, drawing cleanup, Civil 3D production organization, and DWG audit workflows. 🪟 The command includes a DCL option dialog so the user can choose between a shared XREF layer workflow and a per-XREF layer workflow. 🚀 Main Commands 🪟 Run XRefs2LayersOptions to open the option dialog. 📂 Run XRefsToLayers or X2L to move each XREF to its own 0-XREF_<XREF name> layer. 🟦 Run XRefsTo_Xref or X2_XREF to move all detected XREF inserts to one shared _XREF layer. 🧩 Functionalities 🔍 XREF scan - scans the AutoCAD Blocks collection and detects block definitions where IsXRef is true. 🧹 TBLOCK exclusion - ignores XREF names matching *TBLOCK* to avoid processing title-block style references. 🪟 Dialog selection - creates a temporary DCL window with radio buttons for choosing the target layer method. 📂 Per-XREF layer mode - creates organized layers using the 0-XREF_ prefix and the XREF name. 🟦 Shared layer mode - places every detected XREF insert on the common _XREF layer. 🧱 Automatic layer creation - creates missing destination layers before moving the XREF insert references. 🔐 Locked-layer recovery - temporarily unlocks the current layer when a layer change fails because of a locked layer state. ↩️ Undo mark support - wraps edits in an AutoCAD undo mark for safer production use. 📊 Result report - displays an alert summary with the number of XREF inserts moved to each layer. ⚙️ Session memory - remembers the last selected option while the AutoCAD session remains open. ✅ Practical Result ✅ 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. 📌 This is useful for AutoCAD users, Civil 3D teams, CAD managers, drafting technicians, and production environments with many external references. ⚠️ Important Notes ⚠️ The routine changes the layer assignment of XREF INSERT references in the active drawing. ⚠️ It does not modify the external source DWG files referenced by the XREFs. ⚠️ The per-XREF workflow can lock created XREF layers when the lock prompt is confirmed. ⚠️ Review project CAD standards before running this tool on production drawings.