Function Syntax: XrefsDrawingOrder Version: 1.0 Date: 23.07.2026 5:39:51AM https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/re-arrange-xrefs-in-a-drawing/td-p/11385801 Description 🧭 XrefDrawingOrder is an AutoCAD and Civil 3D XREF draw order manager that helps users organize external references from a modeless WinForms dialog. The tool improves CAD production by replacing repetitive manual DRAWORDER work with searchable xref lists, visual preview, saved order presets, Apply, Undo, and diagnostic logging. Main Commands 🧰 Run XrefDrawingOrder_017 after NETLOAD to open the full XREF Drawing Order manager. ⚡ Run XRDO_017 as the short command alias for the same tool. 📦 The output DLL is XrefDrawingOrder_017.dll, generated from the build number in the project file. SEO Optimized Overview 📘 This AutoCAD xref management plugin scans the active drawing for external references and displays each xref with its order, name, attach or overlay type, status, layer, instance count, and path. 🔍 Users can filter xrefs, reorder them by buttons or drag and drop, preview the visual stacking order, save named xref order presets, and apply the final draw order directly to the drawing. 🧠 The tool is designed for CAD managers, Civil 3D users, infrastructure design teams, railway drawing production, project templates, xref-heavy drawings, and AutoCAD workflows that need consistent external reference stacking. 🧩 Version 017 adds diagnostic preview logging for selected xrefs, including insertion point, rotation, scale, transformed local coordinates, entity counts, and skipped geometry. Functionalities 🔍 Filter xrefs quickly - searches the xref list by name so large project drawings remain easier to control. 📊 Review xref metadata - shows xref type, load status, layer, instance count, and saved file path in one grid. ↕️ Reorder front-to-back display - moves selected xrefs Up, Down, Top, Bottom, or by drag and drop while preserving multi-selection order. 🚀 Apply drawing order - queues AutoCAD DRAWORDER operations through Document.SendStringToExecute from the modeless dialog. ↩️ Undo last applied order - restores the previous applied xref arrangement when the last operation needs to be reversed. 💾 Save named xref presets - stores reusable xref order lists in %APPDATA%\XrefDrawingOrder\SavedOrders.txt. 🧠 Remember drawing order - saves the last used order in the drawing Named Objects Dictionary under XREFDRAWORDER_ORDERS. 📥 Import and export TXT order files - shares order standards between drawings or stores project-specific xref arrangements. 🖼️ Preview xref extents and geometry - displays bounding boxes and available real geometry for visual checking before applying. 🔎 Zoom to selected xref - focuses both the AutoCAD view and the preview panel on the selected external reference. 🟦 Control preview display - supports zoom percentages, mouse-wheel zoom, black or white background, grid display, and Fast or Full preview modes. 🧮 Log preview diagnostics - records rotation, scale, insertion point, local and transformed coordinates, and entity counts for selected xrefs. 🔄 Reload or unload xrefs - updates selected xref references without leaving the manager. ⚠️ Detach selected xrefs - removes selected external references with a warning confirmation. 🔗 Convert Attach and Overlay - changes the reference type when project dependency behavior needs adjustment. 🏷️ Set xref layer - updates the layer for one or more selected xref block references. 📁 Use folder favorites - remembers common import and export folders for faster order-list workflows. 📋 Copy names and paths - copies selected xref names or source paths to the clipboard for reporting. 📝 Export diagnostic logs - provides live log messages and persistent log files for troubleshooting. Module Breakdown 🧩 Commands.cs - command registration, load banner, and modeless dialog launch. 🧩 MainForm.cs - grid logic, apply and undo workflow, saved orders, folder favorites, xref actions, preview refresh, and logs. 🧩 MainForm.Layout.cs - responsive WinForms layout, themed buttons, context menus, drag and drop, and preview toolbar wiring. 🧩 XrefOrderService.cs - AutoCAD database operations, xref enumeration, DRAWORDER execution, NOD persistence, and preview geometry extraction. 🧩 PreviewPanel.cs - double-buffered xref preview, focus, zoom, grid, and background rendering. 🧩 ListReorder.cs - reusable list movement logic for selected xref groups. 🧩 FolderFavoritesDialog.cs - favorite folder management for import and export dialogs. 🧩 C3DTheme.cs - dark AutoCAD Civil 3D style theme and button role styling. Practical Result ✅ The final result is a faster and more controlled AutoCAD xref draw order workflow for xref-heavy Civil 3D drawings, project templates, reference base plans, utility plans, survey backgrounds, and infrastructure production sheets. Users can standardize external reference stacking, audit xref status, preview order changes, save repeatable arrangements, and reduce manual DRAWORDER mistakes. Important Notes ⚠️ Build 017 targets .NET Framework 4.8 x64 and direct AutoCAD 2024 managed references: AcMgd, AcDbMgd, and AcCoreMgd. ⚠️ Nested xrefs without top-level INSERT instances are skipped during draw order application because their order is controlled inside the parent xref source file. ⚠️ Detach removes xrefs and their drawing instances, so it should be used only after confirmation. ⚠️ Full geometry preview is approximate and can fall back to bounding boxes for unsupported content. Tags 🏷️ AutoCAD xref draw order, Civil 3D xref manager, XREF DRAWORDER tool, AutoCAD external reference utility, XrefDrawingOrder_017, XRDO_017, NETLOAD AutoCAD plugin, AutoCAD 2024 plugin, xref preview panel, xref reload unload detach, xref attach overlay conversion, xref layer manager, saved xref order presets, CAD manager tool, Civil 3D production workflow, infrastructure CAD automation, AutoCAD WinForms plugin, drawing order automation.