
BoQExtra
- 🧠 Command registration –
Commands.csregisters the AutoCAD commandBoQExtraand opens a modeless WinForms interface so the user can continue working in the DWG while the quantity tool remains active. - 📐 Length and area extraction –
LengthAreaEngine.BuildRowsreads selected entities, resolves object handles, detects layers and entity types, calculates length and area values, and prepares preview geometry for CAD quantity takeoff. - 📊 Per-entity dimension logic – the length engine calculates per-object Min L, Max L, Min V, and closed polyline state so the table shows object-level geometry data instead of only global totals.
- 🧩 Block counter system –
BlockCounterEnginecounts block references by effective block name, visibility state, handle, dynamic flag, and xref flag, then builds robust preview footprints for dynamic and nested block workflows. - 🔢 Unique block counters – the Blocks tab builds a bottom summary grouped by effective block name, making repeated CAD symbols easier to review, copy, export, and verify for BoQ schedules.
- 🏷️ Profile manager –
ProfileManagerstores editable BoQ formula profiles under%APPDATA%\BoQExtra, including decimal rules, formula formatting, CEILING rules, and automatic Profile_002 layer detection. - 📌 Automatic Profile_002 profile detection –
Profile.TryCreateKkProfileFromLayerdetects layer tokens such as220X275,400X275,515X275, and700X285, then applies the matching divisor for area-based formulas. - 📝 AutoCAD object-field builder –
AcadFieldBuildercreates object-field formula terms when possible, allowing placed MTEXT results to reference drawing object properties instead of becoming only disconnected static text. - 🧹 Selection editing tools –
SelectionEntityToolssupports selected entity deletion, layer changes, closed-polyline toggling, polyline closing, polyline joining, and parallel polyline closure without launching an extra DCL dialog. - 🔍 Preview control –
PreviewControldraws highlighted selected entities, gray context entities, block footprints, insertion markers, UCS-oriented geometry, fit selected, fit all, zoom, and pan while protecting against GDI overflow from extreme drawing coordinates. - 📤 Export and clipboard logic – the plugin copies selected formulas, table data, unique block counters, and log data to the clipboard and exports CSV or TXT files for Excel, QA review, WordPress documentation, and project quantity records.
- 🔐 Runtime diagnostics –
RuntimeInfoandAppLogrecord build version, loaded DLL path, AutoCAD version, Civil 3D assembly availability, active drawing path, warnings, errors, and user actions for troubleshooting.
- 🧠 Command registration –

LayoutTools
Key helper logic used by the tool- QuietOn and QuietOff temporarily adjust CMDECHO and attempt NOMUTT to reduce command line noise, then restore prior values.
- Robust layout filtering uses wildcard matching and optional Model inclusion, producing the displayed list and the action targets.
- Viewport collection excludes the overall paper space viewport and can ignore viewports that are Off when Skip OFF VP is enabled.
- Annotation status caching reads ANNOALLVISIBLE per tab by switching CTAB as needed, forcing paper space, and restoring the previous environment afterward.
- Zoom status persistence stores a per layout flag in the DWG using Named Object Dictionary data with XRECORD, so the status survives reopening the drawing.
- Clipboard export copies a tab separated report using an HTMLFile clipboard approach with a PowerShell and clip fallback when required.
- Temporary DCL generation creates a unique dialog name per run, writes a temp DCL file, loads it, then cleans up the file and dialog after use.

Zoom Extend Window
Notable helper functions and internal mechanisms- LV:GetLayouts Collects layout names using layoutlist for reliability.
- LV:FilterLayouts Applies wildcard filtering via wcmatch and optionally excludes MODEL.
- LV:MakeTempDCL Creates a robust temporary DCL path (mktemp with fallback to TEMP or DWGPREFIX).
- LV:WriteDCL Writes the dialog definition with a unique dialog name each run.
- LV:CopyClipboard Copies text via MSHTML clipboardData, with fallback to PowerShell Set-Clipboard and cmd clip.
- LV:ZoomExtentsLayouts Iterates layouts and runs COM zoom extents with command fallback ZOOM E.
- LV:ZoomWindowLayouts Prompts for a window once and applies it to all selected layouts with COM and command fallback ZOOM W.
- LV:Cleanup Unloads the dialog and deletes the temporary DCL file to avoid residue and lock issues.
- *error* handler ensures cleanup runs on unexpected failures and suppresses noise on normal cancel events.

LayerCreation
- • NL:_dclReadyP — checks whether core DCL functions exist as callable subrs, to decide between DCL dialog vs CLI fallback without using fboundp.
- • NL:_trim / NL:_illegalLayerNameP — trims input and validates layer names against forbidden characters and empty names.
- • NL:_getLinetypes / NL:_ensureLinetypeLoaded — enumerates available linetypes and loads missing ones from acad.lin when needed.
- • NL:_pickColor — opens the truecolor/color book dialog (acad_truecolordlg) with fallback to acad_colordlg; persists last selection.
- • NL:_parseColorText — parses manual color text input as ColorBook (BOOK$NAME), RGB (r,g,b), or ACI index, returning the selector list used for TrueColor application.
- • NL:_applyColorToLayer — applies ACI/RGB/ColorBook colors to a layer using its TrueColor object (supports SetRGB and SetColorBookColor).
- • NL:_makeOrUpdateLayer — creates the layer if missing and sets Linetype/Lineweight/Transparency using scripted -LAYER commands.
- • NL:_applyDefaultsAndMaybeSetCurrent — safely sets drawing defaults (CELTSCALE, CETRANSPARENCY, THICKNESS) and optionally sets the new layer current, using a protected setvar wrapper.
- • DCL temp helpers — generate unique temp DCL filenames, write dialog text, and ensure cleanup after closing.

CopySelection_vs.01
Geometry helpers: • tan: Simple tangent function used when computing bulge values for polyline vertex reconstruction. • LM:LWVertices: Extracts vertices of a lightweight polyline into a structured list containing position, start width, end width, and bulge for each vertex, used by the PLDUPE style segment slicing logic. • extend-ends: Uses VLA coordinates to extend the first and last segments of the new LWPOLYLINE by extS and extE along their unit direction vectors, handling both two vertex and multi vertex polylines. Segment creation core: • CS:MakeGeometry: Main builder that slices the original LWPOLYLINE between two curve parameters, builds a new open polyline on the chosen layer, then applies optional extension, rotation, distance move, and offset copy generation when Extra is enabled. Dialog and state helpers: • get-all-layers: Iterates over the drawing’s layer table via COM, collects all non xref layers into a sorted list for the layer popup. • update-layer-list: Filters the layer list by the current filter string, rebuilds the popup content, and selects either the picked layer, last used layer, or the first match as current choice. • set-extra-mode: Enables or disables all Extra related tiles (rotation, distance, offsets, extension values) depending on the Extra toggle, greying them out when Extra is off. • CS:read-values: Reads all current dialog fields (filter, layer, Extra flag, rotation choice, angle, distance, offset, offset count, and extension values), converts them to numbers, clamps offset count to non negative integers, and updates environment variables for filter and layer. • Offset presets: The offset type popup selects among DN110 and KK variants, and an action tile maps each choice to a predefined numeric offset value written back into the offset edit box. Undo session control: • applyCount and flags: Tracks how many times Apply has been used, whether there is any applied geometry present, and whether the user has interacted with Apply or Undo, to decide how OK and Cancel should behave regarding undoing or keeping changes.
CreatesXrefsLayersAssign_vs.00
Helper Functions: • XRL-GetXrefs gets all xref block names from the drawing. • XRL-GetLayers collects all layer names, sorts them, and caps the count so the DCL does not overload. • XRL-GetFirstInsertLayer tries to find on which layer a given xref is inserted, in model space and then in paper space. • XRL-EnsureLayer creates a layer if it does not exist and sets its color to 7 (white). • XRL-MoveInsertsToLayer actually reassigns all inserts of an xref to the chosen layer. • XRL-WriteDCL builds the dialog definition text on the fly with one row per xref. These helpers make the dialog flexible and let it match whatever xrefs are present in the current file.
UnReloadDetachSelectedXrefs_00
Helper function (if any):- Xref scanning: Collects Xrefs from the block table and reads Name, Type, Units, Path, and primary insert Layer.
- Path resolve (Found At): Resolves stored/relative xref paths into absolute file paths when possible (DWGPREFIX + findfile logic).
- Selection map: Maintains per-xref selection state across filter changes and UI refreshes (default all selected).
- UCS + view wrapper: Saves and restores UCS and VIEW around disruptive commands so the user’s context is preserved for bulk actions.
- Ensure xref exists: If an xref name is missing from the drawing, attaches it from Found At using the saved Type before reloading.
- Change Type (Attach/Overlay): Converts type via detach + reattach while preserving transforms; restores layer placement afterward.
- Layer enforcement: Forces all inserts of an xref onto the layer recorded in the list file; creates the layer if it does not exist.
- Zoom2Xref: Zooms to the bounding extents of the selected xref inserts in Model space.
Multiple_text_mtext_2
Local helper functions inside the routine: • *error*: Custom error handler that cleans up the created MTEXT object and any stored entities if an error or user cancel occurs. • align_Mt: Determines a compatible MTEXT attachment point from either an existing MTEXT or a TEXT alignment setting so the new MTEXT aligns like the source. • Get_MTOffset_pt: Computes a vertical offset point based on MTEXT height, bounding box, and attachment point, prepared for possible alignment offset logic. • GetTextWidth: Calculates an appropriate text width for the new MTEXT, using TEXTBOX on TEXT entities or the Width property on MTEXT objects. • ReplaceUnderline: Walks through each text string, converting “%%U” underline markers into MTEXT underline on and off codes L and l, ensuring open underlines are properly closed at the end if needed. Used system and VLA calls: • vl-load-com: Enables use of ActiveX and VLA functions within the routine. • vla-get-ActiveDocument: Gets the current drawing document object. • vla-get-ModelSpace / Paperspace: Chooses the correct space object depending on where the user is working. • vla-AddMText: Creates the final MTEXT entity containing the combined text.Copy_to_Clipboard_Xref
Internal helper functions: • c:GetTextFromEntity: Extracts readable text depending on entity type (TEXT, MTEXT, DIMENSION, LEADER, BLOCK_REFERENCE). • CTCCOPY: Collects all stored copied entities, extracts text, pushes it to clipboard, and deletes temp entities. Key AutoLISP / COM functions: • nentselp: Picks nested references inside blocks. • entmakex / entdel: Creates and deletes temporary entities. • vlax-tmatrix / transformBy: Applies nested transformation matrices. • vlax-ename->vla-object: Required for dimension & leader text access. • htmlfile COM object: Writes the cleaned result directly to Windows clipboard.
Copy_to_Clipboard
Internal helper procedures used: • writeCTCDCL: Generates a temporary DCL file containing the radio button dialog layout. • radioCTCDCL: Loads, displays, and manages the dialog interaction and stores the user’s chosen option. Text-cleaning functions: • StripMTextCodes_1: Produces one-line output by removing formatting, Unicode codes, and replacing line breaks with spaces. • StripMTextCodes_2: Produces paragraph-friendly multi-line output with cleaner break insertion rules. System / COM functions: • vlax-create-object: Creates an HTMLfile object to write cleaned text into the clipboard. • vlax-release-object: Ensures clean memory cleanup and prevents COM object leaks. • ssget / entget / vlax-ename->vla-object: Collects and analyzes selected entities to extract readable text.RotateMtextVport
Helper Functions:- vl-load-com – Loads Visual LISP COM support
- angle – Calculates viewport rotation angle
- trans – Transforms coordinates from UCS to WCS
- vlax-ename->vla-object – Converts entity name to VLA object
- vlax-put – Sets object properties
Lower
Used AutoLISP / AutoCAD built-ins: • getvar / setvar: Save and restore CMDECHO and LUPREC values. • ssget / ssname / sslength: Build and iterate through the selection set of text entities. • entget / entmod: Read and rewrite DXF data of each text entity. • assoc / subst: Extract and replace group code 1 (text string). • strcase: Convert existing text to upper or lower case. • initget / getkword: Provide and enforce the “Upper/Lower” option selection. • prompt / princ: Display clean messages and terminate silently.Upper
No additional helper functions; uses AutoLISP built-ins: – ssget – vlax-ename->vla-object – vla-get-textstring – vla-put-textstring – strcase
PrefixSuffixRound
• PSOT-Get / PSOT-Put — Read and write persistent settings (PSOT_ACT, PSOT_PFX_ADD, PSOT_PFX_REM, PSOT_SFX_ADD, PSOT_SFX_REM, PSOT_DIG) via environment variables • PSOT-Starts-With / PSOT-Ends-With — Simple string prefix/suffix checks for non-wildcard patterns • PSOT-Reverse — Reverses a string to help implement suffix wildcard matching via prefix logic • PSOT-Pattern-All-Stars — Verifies if the rest of the wildcard pattern consists only of “*” characters • PSOT-WC-Match-CAP-Core — Core recursive wildcard matcher with capture, handling “*” and “?” and returning match length and captured substring • PSOT-WC-Prefix-Match-CAP / PSOT-WC-Suffix-Match-CAP — Anchored wildcard matching at start or end of a string, with capture support • PSOT-Has-Wild — Detects whether a string contains “*” or “?” wildcards • PSOT-ReplaceAllChar — Replaces all occurrences of a single character in a string with a replacement substring • PSOT-Template-Apply — Applies a template string to a source text by replacing “?” and “*” with the original text • PSOT-AddPrefix / PSOT-AddSuffix — Adds fixed or wildcard-templated prefix/suffix to the text • PSOT-RemovePrefix / PSOT-RemoveSuffix — Removes fixed or wildcard-templated prefix/suffix, keeping captured wildcard portions where appropriate • PSOT-RoundNumberString — Parses a numeric string with distof and formats it with rtos to a given number of decimal digits • PSOT-EntType / PSOT-ReadText / PSOT-WriteText — Small wrappers for reading/writing DXF group 1 text content based on entity type • PSOT-FirstAttribOfInsert — Finds the first ATTRIB under an INSERT by walking entnext links until ATTRIB or SEQEND is found • PSOT-Transform — Dispatches text through the appropriate transform operation (prefix add/remove, suffix add/remove, or rounding) • PSOT-ProcessOne-Op — Applies the chosen transform to a single entity, including first attribute of a block insert when applicable • PSOT-Iterate-Selection-Op — Prompts selection and loops through the selection set, calling PSOT-ProcessOne-Op for each entity • PSOT-TempDclFile / PSOT-RunDialog — Build, load, and manage the temporary DCL dialog, including enabling/disabling inputs based on selected radio button and saving the user’s last choicesPlusMinusNumericValue
• _endUndo — Ends the active UNDO mark safely when the command completes or errors • _unloadDCL — Unloads the temporary DCL dialog resource if it is loaded • Custom *error* — Restores the previous *error*, prints messages for real errors, unloads the DCL, ends UNDO, and exits cleanly • PlusMinusNumericValue-Get / -Set — Read and write registry values under HKEY_CURRENT_USERSoftwarePlusMinusNumericValue for AddValue and LocValue • PlusMinusNumericValue-WriteDCL — Creates a temporary DCL file in the temp folder defining the “Plus / Minus” dialog with value and location fields and OK/Cancel buttons • PlusMinusNumericValue-ShowDCL — Loads the DCL, initializes tiles from registry or global defaults, handles OK/Cancel actions, updates registry and globals, and returns (value location) or nil • isPositionNumber — Tests whether a character at a given position is part of a number (digit, decimal point, optional leading minus when allowed) • parseString — Splits a string into a list of numeric and non-numeric substrings, with special handling for MTEXT control codes so they are kept as single tokens • adjustString — Core numeric modifier: chooses which numeric segments to change (by index, All, or interactive List), modifies them as integer or real, and rebuilds the final string while returning updated location default • myItoa — Helper inside adjustString that adjusts integer-like numbers while preserving leading zeros and sign where appropriate
Slope_Ro
• System variable handling — Disables BLIPMODE and CMDECHO temporarily for clean operation • Slope formula — Computes slope as |ΔY ÷ ΔX| with protection for division by zero • Ratio reduction — Uses repeated GCD to simplify rise and run until they cannot be reduced further • Angle calculation — Uses ATAN then converts radians to degrees • Undo grouping — Begins an UNDO group to encapsulate any future extensionsRegion2Polyline
• *error* Handles unexpected termination, prints an error message unless canceled, and ends the undo mark • arcbulge Calculates bulge from an ARC’s total angle → sin(a/4) ÷ cos(a/4) • Explode logic Uses vlax-invoke reg ‘Explode to decompose REGION into lines and arcs • Segment ordering scan Reassembles segments by repeatedly finding the next segment whose start or end matches the current chain endpoint • Bulge recording Stores bulge values at the correct vertex indices for each ARC encountered during reconstruction • Polyline builder Constructs an LWPOLYLINE using addLightWeightPolyline with transformed planar coordinates • Clean-up Deletes original REGION and exploded segments after building the new polyline
OffsetAndLayer
• *error* — Handles unexpected errors, prints messages, and closes the undo mark • get-all-layers — Collects all user layers (excluding xref layers) and sorts them alphabetically • update-layer-list — Filters layer names using wildcard matching and repopulates the popup list • DCL generator — Creates a temporary DCL file defining the dialog UI with direction radios, edit boxes, and popup list • Environment storage — Saves OFFSETVAL, OFFSETLAYER, and OFFSETDIR for future sessions • Offset attempt logic — Tries offset, compares areas, deletes incorrect output, and retries with reversed sign when neededMiddleLinePolylines_2
• vlax-curve-getStartPoint and getEndPoint Used to obtain pure geometry for any supported curve object through the curve API • vlax-make-safearray Builds a safe array of doubles containing the vertex coordinates for the new polyline • vlax-make-variant Wraps the safe array into a variant value required by the COM method • vla-AddLightWeightPolyline Called on ModelSpace to actually create the two vertex LWPOLYLINE object • vl-load-com Ensures the Visual LISP COM interface is loaded before any COM calls are made
Lengthen
Vector and poly helpers: • vxs: Multiplies a 3D vector by a scalar, used to compute extension vectors along the segment direction. • LM:bulgecentre: Calculates the centre point of an arc defined by two points and a bulge value so the routine can extend bulged polyline segments accurately. • LM:lwvertices: Extracts the list of lightweight polyline vertices along with width and bulge data into a structured list that can be passed to the extension processor. Extension engine: • LM:dex:extendpoly: Extends the first and last segments of a polyline (lightweight or old style) by separate distances for start and end, handling both straight and bulged segments without exceeding a full circle on arcs. • LM:dex:run: Core geometry driver that iterates over the selection set and applies the appropriate extension logic depending on entity type (LINE, ARC, LWPOLYLINE or POLYLINE). Dialog helpers: • DEX:make-dcl: Writes the temporary DCL file describing the Double Extend dialog and returns its file name. • DEX:read-values: Reads tile values extStart and extEnd from the dialog, converts them to numeric distances and updates the global extension variables. • DEX:dialog: Loads the DCL, initializes tiles, assigns action tiles for Apply, Undo, OK and Cancel, runs the dialog and then returns the pressed button as a numeric result code while deleting the temporary DCL file. Error and UNDO handling: • Local *error*: The command defines a local error handler that, if an error occurs while an UNDO group is active, backs out all Apply operations, closes the group and prints a message before exiting cleanly.
InteriorPolylinesArea
• writeBR2PDCL Builds a temporary DCL file containing the 7-option radio dialog • radioBR2PDCL Loads the dialog, restores last selected option, retrieves the chosen radio button, and stores it globally • c:BreakAll Breaks all selected curves at mutual intersections using an adjustable gap • c:boffset Creates boundary regions from planar curves and performs offset-edge operations dynamically or at a fixed distance • c:Region2Polyline Wrapper selecting regions for conversion • :Region2Polyline Recreates closed lightweight polylines from regions by ordering segments and applying bulges • c:DEL_OPEN_PL Deletes LINEs and open polylines inside a window but keeps closed polylines untouched • c:JoinAreas Converts closed polylines to regions, unions them, explodes back to curves, and rejoins them into unified polylinesCopySelection
• tan Computes tangent of an angle while avoiding division by near-zero cosine values • LM:LWVertices Extracts LWPolyline vertex data such as point, widths, and bulge • get-all-layers Collects all non-xref layers, sorts them, and prepares them for the layer picker • update-layer-list Updates layer popup list in the dialog according to the typed filter • DCL builder Creates a temporary dialog file containing filter input, layer list, pick-layer button, and OK/Cancel controls
AnnoAllOff
- AAOFF:WriteDcl writes the DCL definition to a temporary .dcl file used to display the selection dialog.
- AAOFF:GetTabNames enumerates the document layouts via ActiveX and returns a list of tab names including Model.
- AAOFF:MakeAllIndexString generates the space-separated index string required by a multi-select list box to select all items.
- AAOFF:IdxList->Names converts the list box index string into the corresponding tab name list for processing.
- AAOFF:SetAnnoAllVisible0 iterates selected tabs, forces paperspace on layouts, executes ANNOALLVISIBLE to set it to 0, then restores the previous tab and mode settings.
- c:AAOFF orchestrates the workflow: builds the tab list, shows the dialog, handles All/None actions, applies the setting, and cleans up temporary files.

SelectLayout
Helper Functions:- vla-get-Layouts – Retrieves layout collection from drawing
- vlax-for – Iterates through VLA collection objects
- vl-filename-mktemp – Creates temporary file path for DCL
- load_dialog – Loads DCL file into memory
- new_dialog – Initializes dialog box
- start_list / add_list / end_list – Populates list box with layout names
- action_tile – Defines button actions
- start_dialog – Displays dialog and waits for user input
- unload_dialog – Releases dialog from memory
- vl-file-delete – Removes temporary DCL file

GoToLayout
- _gtl:temp-dcl-path generates a unique temp DCL filepath in the TEMP directory for each run.
- _gtl:write-dcl writes the dialog definition to the temp file, including filter input, preview toggle, count text, match list, and navigation buttons.
- _gtl:layouts-raw returns layout names and adds Model so it is included in the match set.
- _gtl:sort-ci sorts strings case-insensitively for consistent ordering.
- _gtl:filter-layouts filters layout names using case-insensitive wcmatch; empty filter becomes *.
- _gtl:fill-list fills the matches list box with the current filtered list.
- gtl:_set-ctab-if-preview switches CTAB to the currently indexed match when preview is enabled.
- gtl:update rebuilds matches when the pattern changes, updates the count label, selects the first match, and enables or disables OK and navigation depending on whether any matches exist.
- gtl:on-list updates the current index from the list selection and triggers preview switching if enabled.
- gtl:prev and gtl:next navigate the match list with wrap-around and trigger preview switching if enabled.
- c:GoToLayout manages dialog lifecycle, stores the original tab, persists the last pattern, and applies or restores CTAB based on OK or Cancel.

AnnoAllOn
- AAON:WriteDcl writes the dialog definition to a temporary .dcl file used for the session.
- AAON:GetTabNames collects tab names from the document layouts via ActiveX and returns them in display order, including Model.
- AAON:MakeAllIndexString creates the list box index string needed to select every item by default and via the All button.
- AAON:IdxList->Names converts the list box selection index string into a list of tab names to process.
- AAON:SetAnnoAllVisible1 iterates selected tabs, forces paperspace on layout tabs when applicable, runs ANNOALLVISIBLE to set it to 1, then restores previous state.
- c:AAON orchestrates the workflow: builds the tab list, loads the dialog, handles All and None actions, applies updates, and performs cleanup.

Copy2Layouts
- 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.

SetUpUnits
🧩 setunits writes Civil 3D drawing settings using AeccXUiLand application automation, ActiveDocument, DrawingSettings, UnitZoneSettings, and CoordinateSystem properties.
🔎 getaeccApp reads the installed Civil 3D release from the AutoCAD registry product key and creates the correct Aecc application interface object.
🎨 rgb->aci converts external RGB flag pixel values to the nearest AutoCAD Color Index so the DCL preview can be rendered with AutoCAD image tile colors.
📁 flag-data-file builds the external path to the matching flag _data.lsp file using FLAGS_ROOT and the first letter subfolder.
🚩 draw_flag loads the country pixel list on demand, scales it to the DCL image tile, and uses run-length grouping to reduce fill_image calls.
🔄 update_zones refreshes the coordinate system list and the flag preview whenever the country or region selection changes.
MultiOffsetBothSidesWithLayer
Helper Functions Used: • OL-CollectLines — Allows multi-pass selection of line entities. • OL-GetAllLayers — Retrieves all non-XREF layers from the current drawing. • OL-ChooseLayer — Displays the layer selection dialog with name filtering and object-based layer picking. • OL-Profile-Change — Updates offset distances automatically when a profile is changed. • OL-ShowMainDialog — Handles the main configuration dialog for offset settings.
LayoutNum
- LayoutNum:WriteDCL builds a unique dialog name and writes the full DCL string to a temporary file, returning the file path and dialog name.
- LayoutNum:LayoutsTabOrder collects layout objects with their tab order and returns a sorted list used for display and renaming sequence.
- LayoutNum:RebuildDisplay applies the filter and ordering, rebuilds the layout list, preserves selection, and refreshes the preview.
- LayoutNum:GetSelectedItems maps list box indices to the underlying layout entries for consistent selection handling.
- LayoutNum:ComputeRenamePlan generates the proposed new names based on start, pad, prefix, suffix, order, and conflict policy, marking Model as non-renamable.
- LayoutNum:ValidateBeforeRename validates selection and numeric inputs and checks name uniqueness and conflicts when auto-resolve is disabled.
- LayoutNum:ApplyRename performs renames, records a frame of (object old new) for manual undo, refreshes lists, and updates defaults for convenience.
- LayoutNum:DoUndo restores the last rename frame in reverse order to avoid collisions and keeps selection on restored names after refresh.
- _StartUndo and _EndUndo manage VLA undo marks safely without invoking the UNDO command inside DCL callbacks.
- LayoutNum:Cleanup unloads the dialog and deletes the temporary DCL file to prevent leftovers across runs.
- c:LAYOUTNUM, c:_LAYOUTNUM, c:LayoutNum are safe command entry points calling LayoutNum:Run.

LockAllVp
- • Unique DCL name Generates a different dialog name each run to avoid conflicts with cached dialogs.
- • DCL writer Writes the DCL definition to a temporary file and loads it at runtime, then deletes it on exit.
- • Layout collector Builds the layout list (optionally including Model) and applies wildcard filtering using * and ?.
- • Viewport scanner Detects Paper Space viewports per layout and determines whether they are locked, unlocked, mixed, or missing.
- • Undo stack Stores changes per operation so Undo can revert the last Lock or Unlock action without calling AutoCAD UNDO from DCL callbacks.
- • Clipboard copy Copies selected layout names (and their status text) to the Windows clipboard, one line per layout.

Zoom Extend
Helper functions and mechanisms- GetLayouts reads available layouts using layoutlist.
- FilterLayouts applies wildcard filtering using wcmatch and optional Model inclusion.
- WriteDCL builds a temporary DCL file with a unique dialog name per run.
- CopyClipboard copies text via htmlfile clipboardData with PowerShell and clip fallback.
- ZoomExtentsLayouts iterates CTAB across layouts and runs Zoom Extents with COM then command fallback.
- Cleanup unloads the dialog and deletes the temporary DCL file.

Zoom Window
Helper functions and mechanisms- GetLayouts reads available layouts using layoutlist.
- FilterLayouts applies wildcard filtering using wcmatch and optional Model inclusion.
- WriteDCL builds a temporary DCL file with a unique dialog name per run.
- CopyClipboard copies text via htmlfile clipboardData with PowerShell and clip fallback.
- ZoomWindowLayouts asks for one window then iterates CTAB across layouts and applies the same window with COM then command fallback.
- Cleanup unloads the dialog and deletes the temporary DCL file.

Layouts_list
- ALLLAY:copy-clipboard copies text to the Windows clipboard, first attempting MSHTML clipboardData and then falling back to PowerShell Set-Clipboard and clip.exe using a temp file.
- ALLLAY:parse-indexes and ALLLAY:index-string convert list box selection strings to and from index lists for multi-select handling.
- ALLLAY:get-selected-names maps selected indices to the displayed layout names safely with bounds checks.
- ALLLAY:update-count updates the selected count field based on current list selection.
- ALLLAY:select-all and ALLLAY:select-none implement Select All and Select None behavior for the filtered list.
- ALLLAY:fill-list fills the list box and reselects items by name when the list is rebuilt.
- ALLLAY:rebuild rebuilds the display list by applying the filter and Model inclusion toggle, preserving selection by name.
- ALLLAY:copy-selected assembles the selected names into a line-delimited payload, copies to clipboard, and updates a message label with the copy count.
- ALLLAY:cleanup unloads the dialog and deletes the temporary DCL file; *error* ensures cleanup on exceptions.
- ALLLAY:Run coordinates layout collection, dialog creation, UI actions, and cleanup, and the commands call this runner without recursion.

FreezeLayersInVP
- str-join joins a list of strings using a separator for persistence messages and environment storage.
- split splits a string by a delimiter and drops empty parts (used for env parsing and index parsing).
- parse-indexes safely converts list-box selection strings like “0 2 5” into index lists.
- deaccent normalizes text by translating common accented Latin characters to ASCII and uppercasing for accent-insensitive matching.
- has-wildcards detects whether the filter contains * or ? to decide between wildcard and contains filtering.
- make-spaces and fmt-pad create fixed-width padding for faux column formatting.
- bool->yn converts boolean flags into Yes or No for the display row.
- aci->name converts common ACI color indices into readable color names for the display row.
- get-layer-props queries the layer object via ActiveX to retrieve On/Freeze/Lock/Plot/Color/Linetype/Description and determines whether it is an Xref layer by the presence of | in the name.
- fmt-row builds one fixed-width display line with faux columns: Src, Name, On, Frz, Lck, Plt, Color, LT, Desc.
- get-all-xrefs collects attached, resolved Xrefs by scanning block references in ModelSpace and PaperSpace and checking Xref properties and paths.
- layer-xref-name extracts the Xref name prefix from an Xref layer name of form XREFNAME|LAYER.
- get-all-layers gathers all layer names from the document’s Layers collection and sorts them.
- filter-layers applies the accent-insensitive pattern match plus Current/Xref scope rules and optional Xref-name restriction to produce filteredLayers.
- fill-layers-list fills the list box with formatted rows and maintains a row-to-layer-name mapping for index resolution.
- update-ui refreshes the Xref list, applies remembered Xref preselection, enables or disables the Xref picker, and repopulates the matching layer list.
- c:FreezeLayersInVP is the main command routine; c:FLVP calls it as an alias.

TitleBlocksTools
Helper Functions:- tbt:set-path – Resolves LISP file path from USERPROFILE environment variable
- tbt:quote – Wraps strings in double quotes for shell commands
- tbt:isStr / tbt:slen – String type checking and safe length calculation
- tbt:clipboard-put – Copies text to clipboard via MSHTML object
- tbt:join – Joins string list with separator
- tbt:get-selected-lines – Retrieves selected items from DCL list box
- tbt:open-lsp-folder – Opens Explorer with LISP file selected
- tbt:open-with-npp – Launches Notepad++ or fallback editor
- tbt:open-this-in-npp – Opens current LISP file in Notepad++
- tbt:reload-self – Reloads LISP file from disk
- tbt:copy-path – Copies LISP file path to clipboard
- tbt:help-make – Builds help text with Unicode or ASCII formatting
- tbt:help-build-display – Constructs help list with path header
- tbt:help-refresh-list – Updates DCL list box with help content
- writetbtDCL – Generates temporary DCL file with both dialogs
- tbt-help-local – Displays help dialog with action handlers
- radiotbtDCL – Main dialog runner with option selection
- csvEscape – Escapes commas, quotes, newlines for CSV format
- needsQuote / maybeExcelSafe – Detects and prefixes Excel formula values
- dwgBaseName – Extracts drawing filename without extension
- push-uniq – Adds item to list if not already present
- collectAttribs – Extracts attributes from INSERT entity
- rowsForBlockAllLayouts – Collects block data from all paper space layouts
- unionTags – Aggregates all unique attribute tags from rows
- valForTag – Retrieves attribute value for specific tag
- writeCSV-withTags – Writes CSV file with selected columns
- guess-excel-paths – Detects Excel installation locations
- try-open-excel – Attempts to open CSV in Excel via multiple methods
- pickBlockNames – Interactive block selection loop
- collectRowsForBlockNames – Aggregates rows for multiple block names
- parse-range – Parses range syntax (1,3,5-7) into index list
- LM:al-effectivename – Resolves dynamic block effective name
- LM:readcsv – Parses CSV file into matrix list
- LM:csv->lst – Parses CSV line handling quotes and separators
- LM:csv-replacequotes – Converts double quotes to single
- LM:massoc – Returns all associations of key in list
- LM:remove1st – Removes first occurrence from list
- LM:startundo / LM:endundo – Undo group management

Zoom2Layer
- LayerList-popup creates and manages the layer selection dialog and returns the chosen layer name when confirmed.
- Drawing-Visible-Layers-lst iterates layer records via tblnext and keeps only layers that are not off and not frozen by checking flag bits in group code 70.
- Update-List filters the full layer list using wcmatch against the current filter pattern and repopulates the list box.
- Highlight-Layer attempts to locate a layer inside the filtered list and sets the list box selection to it.
- Show-Dialog loads the temporary DCL file, wires dialog actions, returns the dialog exit code, and supports a special return value for the pick-from-drawing workflow.
- c:Zoom2Layer selects all entities on the chosen layer, aggregates bounding boxes via ActiveX GetBoundingBox, and executes ZoomWindow.

RenameLayer
- • LRN_dialog — writes the DCL definition to a temporary LayerRename.dcl file and sets fname for loading.
- • *error* handler — restores environment (CMDECHO, progress UI), deletes the temp DCL file, ends Undo mark, and reports non-cancel errors.
- • ai_table — used to retrieve a list of layer names from the drawing’s layer table.
- • acet-ui-progress — Express Tools progress meter used to show progress while iterating matching layers.
- • acet-str-replace — performs replace operation for the “Replace/With” fields when both are provided.
- • vl-string-subst — removes a substring by substituting it with an empty string for the “Remove” field.
- • -RENAME / -LAYMRG — command-line operations used to rename or merge layers as needed.

PurgeUnusedLayers
- PUL:_DCLLines builds the DCL text as a list of lines used to generate the dialog file.
- PUL:_WriteDCL writes the embedded DCL content to a temp .dcl file.
- PUL:_EnsureDCL forces a fresh DCL write to avoid stale dialog definitions.
- PUL:_SplitByComma parses the user skip list from the dialog into layer names.
- PUL:_AllLayers collects all layer names from the drawing using tblnext.
- PUL:_ScanUnusedLayers detects unused layers by checking for entities on each layer using ssget with a layer filter.
- PUL:_TryLayDel attempts deletion via -LAYDEL and uses tblsearch to confirm removal.
- PUL:_PurgeLayers purges a list of layers, temporarily suppressing command echo and returning deleted and failed counts.

LayersNameToClipboard
- • ClipPut — writes a text string to the Windows clipboard via an htmlfile COM object using parentWindow.clipboardData.setData.
- • DXF 8 — layer name group code used to extract an entity’s layer from entget data.

FreezeLayersInMS
- • flms-clean-filter — converts a legacy filter value of "T" into empty string to prevent stray T from appearing in the UI.
- • flms-has-wc — detects if a filter contains wildcard characters so the routine can treat it as a raw pattern vs auto-wrapping with *text*.
- • flms3-disp-name — strips the xref| prefix from a layer name for display only (operations still use the full name).
- • flms-pad — pads/truncates strings to fixed widths for aligned columns in a fixed-width font list box.
- • flms-aci->name — maps common ACI color indices to readable names; otherwise returns the number as a string.
- • flms3-disp-line — builds the per-layer display row: source (C/X), stripped name, On/Frz/Lck/Plt, Color, Linetype in fixed-width columns.
- • flms3-get-all-xrefs — collects and sorts xref block names from the Blocks collection using IsXRef.
- • flms3-get-layers — collects and sorts all layer names from the Layers collection (includes full names, including xref prefixes).
- • flms3-parse-indexes — parses DCL multi-select index strings (space-delimited) into integer lists.
- • flms3-restore / flms3-snapshot — restore and persist UI state (filters, toggles, selected xrefs) using getenv / setenv.

DuplicateToSelectedLayer
- • Non-Xref layer enumeration — gathers layer names from the document’s Layers collection and excludes names matching *|*.
- • Last layer persistence — reads/writes DuplicateToLayer_LastLayer via getenv / setenv for default dialog selection.
- • ssget "_P" — retrieves the “previous selection set” after COPY to identify the newly duplicated entities for subsequent operations.
DuplicateToNewLayer
- • CreateLayerLike — creates a new layer and copies key properties from an existing layer: Color, Linetype, Lineweight, Description, and (when supported) PlotStyleName.
- • ShowRenameDialog — writes a temporary DCL file, shows a dialog to collect new layer name and an assign toggle, then returns (list name assignFlag) or NIL on cancel.
- • STB/CTB awareness — checks for PlotStyleName support and safely reads it (catch-all) before applying it to the new layer.

DeleteLayerByFilter
- • DLBF-TempDclPath — generates a temp path for the dialog DCL file.
- • DLBF-WriteDcl — writes the embedded DCL string to disk and returns the path for load_dialog.
- • DLBF-GetAllLayers — enumerates drawing layers, excludes Xrefs (*|*) and reserved (0, DEFPOINTS), returns sorted list.
- • DLBF-Patternize — converts plain text into wildcard pattern (*text*) unless the user already supplied wildcard characters.
- • DLBF-FilterLayers — filters layer names by wcmatch against the pattern; empty pattern returns all candidates.
- • DLBF-Split — splits a string into tokens by delimiter character code (used to parse selection index strings).
- • DLBF-ParseIndexList — parses the list_box multi-select index string into a list of integers (space-delimited).
- • DLBF-IdxRangeStr — builds an index string "0 1 2 …" for Select All without relying on vl-number-sequence.
- • DLBF-LayDel — deletes a layer by name using ._-LAYDEL with sequence _N name "" _Y; retries with non-underscore N/Y fallback; verifies deletion by checking tblsearch.
- • DLBF-VLA-Delete — last-resort attempt to delete a layer via VLA (only succeeds when deletion is allowed).
- • DLBF-DeleteLayers — orchestrates deletion across names, blocks reserved/xref layers, counts successes, accumulates failures with reason tags.

ChangeLayerToSelected
- • get-all-layers — collects all non-Xref layer names from the document’s Layers collection and sorts them alphabetically.
- • update-layer-list — filters the layer list using a case-insensitive “contains” match (*filter*), repopulates the popup list, and sets a preselection (picked layer, else last layer, else first item).
- • Environment persistence — uses setenv / getenv to remember last filter and last selected layer between runs.

ChangeLayer
- • Drawing-Visible-Layers-lst — scans the LAYER table and returns a sorted list of layer names that are not Off (bit 1) and not Frozen (bit 4).
- • Update-List — applies wcmatch filtering to the full layer list and repopulates the DCL list_box.
- • Highlight-Layer — finds a layer name within the currently filtered list and selects/highlights it in the list box.
- • Show-Dialog — loads the generated DCL file, initializes the filter field, wires action_tile handlers, runs the dialog, unloads it, and returns the dialog result code.
- • LayerList-popup — orchestrates the DCL creation, dialog loop (including “pick from drawing”), persistence of last filter, and returns the selected layer name.

MLeaderWidthFix
- • textbox (built-in) — used to obtain TEXT extents for a width estimate from the entity’s bounding box.
- • vla-getBoundingBox — used to compute MTEXT width from lower-left / upper-right bounding box X coordinates.
- • vl-catch-all-apply — wraps property writes to avoid hard failures when setting Width or TextWidth.
- • setenv — stores the last width value as WD_LastWidth (note: the prompt default is computed from the current selection, not read back from the environment variable).
MleaderStraight
- • rh:sammlung_n — groups a flat list into chunks of N (used to convert vertex arrays into 3D point lists).
- • MleaderStraightTools:get-space-obj — returns the active VLA space object: ModelSpace if ActiveSpace is model, otherwise PaperSpace.
- • MleaderStraightTools:get-all-mleaders-current-space — builds a selection set of all MULTILEADER objects in the current space/layout using group code 410 = current CTAB name.
- • MleaderStraightTools:write-dcl-to-temp — writes embedded DCL text to a temporary .dcl file and returns the file path for loading.
NCopyExtra
Core tools and functions used: • vl-load-com: Enables COM / ActiveX access so VLA layer and entity properties can be read and written. • vlax-get-acad-object: Retrieves the main AutoCAD application object. • vla-get-ActiveDocument: Accesses the current drawing document where entities and layers live. • vla-get-Layers: Returns the Layers collection used to query existing layers and add new ones. • nentselp: Picks nested entities and returns both the entity name and the transformation matrix for proper world placement. • entget: Reads DXF data from the picked entity to get its layer name and geometry definition. • entmakex: Creates a new entity from the original entity’s DXF list in the active space. • vlax-tmatrix: Converts the nentsel transformation list into a transformation matrix object usable by VLA. • vla-transformby: Applies the nested transformation so the copy is correctly positioned and oriented. • vla-item: Fetches specific Layer objects by name from the Layers collection (both original xref layer and local layer). • vla-add: Creates a new layer when the trimmed local layer does not yet exist. • vla-put-Color / LineType / Lineweight: Transfer visual properties from the xref layer to the local mirrored layer. • vla-put-Layer: Assigns the copied entity to the desired local layer name.
TotalLengthAreaDetailed_vs_01
Helper functions • writeLengthAreaDCL Dynamically writes the DCL file that defines the dialog with radio buttons, toggles, and precision edit box. • radioLengthAreaDCL Loads the DCL, initializes default values, captures user choices, and stores them in global variables. • copy-to-clipboard Uses a hidden htmlfile object to copy plain text or Excel formulas to the Windows clipboard. • format-excel-expr Wraps the raw expression as =expression or =ceiling(expression,5) depending on the Excel and Excel ceiling toggles. • insert-result-text Converts the picked point from UCS to WCS, then inserts MText containing either only the total (for one entity) or expression equals total (for multiple entities). • TotalLengthDetailed Computes per entity length values, accumulates the total, builds the expression, calls helper functions, and prints a summary for length mode. • TotalAreaDetailed Similar to TotalLengthDetailed but for area, using only suitable closed or area capable entities.
BookmarkEntities
Short description Sort / Purpose: Bookmark entities in the current drawing and revisit them later by name, coordinates, color, and custom remarks. • Scope: Lets…
Clear_Bookmarks
• Uses the built-in alert dialog to prompt the user • Checks the returned value (=1 for OK) to determine whether clearing should proceed • Modifies the global variable *textPositions* only after confirmationAdd_Bookmark
• Global list initializer — If *textPositions* is nil, initializes it to an empty list before use • Entity type read — Uses entget and (assoc 0 …) to determine the DXF type of each entity • getboundingbox — Helper that converts an entity name to a VLA object, calls vla-getboundingbox, and returns lower-left and upper-right corners as 3D point lists • Label selection — Determines a short label string per entity type (real text for TEXT/MTEXT, type names like “LINE”, “POLYLINE”, “CIRCLE”, “SPLINE”, or “BLOCK: name”) • Bookmark builder — For each entity builds a list (txt startPt endPt) and conses it onto *textPositions*RenameBlock
- 🚀 Command entry point —
C:RenameBlockstarts the block rename workflow and manages selection, validation, rename execution, and cleanup. - 🔍 Block-only selection logic — the routine uses
ssget "_I"with anINSERTfilter for preselected blocks, then falls back toentselwhen needed. - 🧩 Dynamic block name support — the code checks
vlax-property-available-pforEffectiveNameso dynamic block references can be resolved to their effective block definition name. - 🔒 Xref protection — the routine checks the block table record and avoids processing xref-style block definitions using the
assoc 1test. - 📝 Text-editor name input — the command uses
lispedwith the current block name as the editable default, making block rename input faster and less error-prone. - 🔴 Name validation — empty strings, spaces-only names, and duplicate block names are blocked before the AutoCAD rename command is executed.
- 📌 Visual feedback —
redrawhighlights the selected block reference during the rename workflow and removes the highlight at the end. - 🔄 Undo-safe workflow — the command wraps the operation with
vla-startundomarkandvla-endundomark, making the rename action easier to reverse with AutoCAD Undo. - 🧹 Command echo handling —
CMDECHOis temporarily disabled while_.RENAMEruns, keeping the command line cleaner. - 🔐 Error cleanup — the local
*error*handler restores highlighting state, ends the undo mark, and reports non-cancel errors.
- 🚀 Command entry point —

RemovesDuplicatedBlocks
- 🚀 Command entry point –
c:remdupstarts the duplicate block cleanup process from the AutoCAD command line. - 🔍 Drawing-wide block scan –
ssget "x" '((0 . "INSERT"))collects all block references in the active DWG without requiring manual selection. - 📌 Insertion point comparison –
vla-get-InsertionPointextracts each block location so nearby duplicates can be detected by coordinate distance. - 🧩 Same-name duplicate rule – the routine compares
vla-get-Namevalues and only deletes a nearby block when the block names match. - 🔢 Tolerance-based matching – duplicates are detected when the distance between insertion points is less than or equal to
0.1drawing units. - 📐 Local crossing-window search –
ssget "c"creates a search window around each block insertion point to find nearby block references efficiently. - 🔒 Object identity protection –
vla-get-ObjectIDprevents the routine from comparing a block reference with itself. - 🔴 Duplicate deletion engine –
vla-deleteremoves confirmed duplicated block references directly from the drawing. - 🧹 Protected block exception – blocks named
ADCADD_ZZare skipped and not processed by the duplicate cleanup logic. - 🔄 Undo mark support –
vla-StartUndoMarkandvla-EndUndoMarkgroup the cleanup into an AutoCAD undo operation. - 📊 Processing feedback – the routine reports the number of found, processed, and deleted blocks using command-line output and a final
alert.
- 🚀 Command entry point –

CopyBlock
Helper functions: • LM:AcadMajorVersion: Returns the major AutoCAD version number to construct the correct ObjectDBX interface string. • LM:CopyObjects: Wraps VLA CopyObjects to copy block definitions between the active drawing and the temporary ObjectDBX document. • LM:ForceBlockContentsByLayer: For a given block name and layer, sets all entities in that block definition to that layer, color ByLayer, linetype ByLayer, and lineweight ByLayer. • LM:BuildDialogAndGet: Dynamically builds the DCL file, populates the layer list, manages filter and selection, handles “Pick from drawing”, reads all user choices, and returns new name, layer, mode, and delete flag. • LM:RenameBlockReference: Core engine called by the command; handles selection, ObjectDBX cloning and renaming, retargeting block reference, applying layer mode, and optionally deleting the original reference. Key system and VLA calls: • vla-get-ActiveDocument / vla-get-Blocks: Access the active drawing and its block table. • vla-getInterfaceObject: Creates the ObjectDBX AxDbDocument used to clone and rename block definitions safely. • vla-Copy / vla-Delete: Duplicates and optionally removes the original block reference depending on user choices. • vlax-get-or-create-object / vlax-release-object: Manage external COM objects and ensure they are properly released.ChangeBlockEntitiesLayer
Used AutoLISP and VLA functions: • vl-load-com: Enables ActiveX or VLA functions required to work with document and block objects. • ssget: Builds a selection set containing only INSERT entities which represent block references. • vlax-ename->vla-object: Converts entity names into VLA objects to access their properties through ActiveX. • vla-get-Name: Retrieves the block name from the selected block reference. • vla-get-Layer: Reads the layer name of the block reference or of entities inside the block definition. • vla-get-Blocks: Accesses the Blocks collection in the active document to search for the block definition by name. • vla-Item: Fetches a specific block definition object from the Blocks collection using the block name. • vlax-for: Iterates through each entity contained in the block definition. • vlax-property-available-p: Verifies that a given object supports a Layer property before trying to modify it. • vla-put-Layer: Writes the new layer name to each entity inside the block definition.3D_PolyOffset
- Function name: polypt
- Validates whether the selected entity is a POLYLINE.
- Iterates through all vertices until SEQEND is reached.
- Extracts X, Y, and Z coordinates (group code 10).
- Stores vertex coordinates in the global list ppt_list.
- Displays an error message if the entity is not a polyline.

SetPlotDeviceNames_00
- • vla-RefreshPlotDeviceInfo — forces the layout to refresh its list of available plot devices/configurations before querying them.
- • GetPlotDeviceNames — returns the layout’s available plot device names; these are uppercased via strcase for case-insensitive matching.
- • vl-position — checks whether the target device name exists in the normalized list of devices.

SteSysVar
Helper Functions Used: • SSV:set-path — builds and stores the LISP’s own disk path so the UI can open Explorer / Notepad++ or reload itself. • writeSSVDCL — generates the full multi-tab DCL file on the fly (all 7 tabs + Help). • SSV:write-one-page — creates the dialog definition for a single tab with rows of “label + popup_list”. • SSV:open-page — displays one tab, populates its dropdowns, and wires the tab-switching buttons. • SSV:choices-for-dropdown — builds the dropdown items from the meanings/presets list (value → description). • SSV:save-index / SSV:get-saved-index — remembers what the user picked for each variable across tab switches. • SteSysVar:apply-all — after OK, iterates all variables and actually calls SETVAR with the corresponding numeric value. • SSV-help-local + SSV:help-make — build and show a help window with all tabs/variables and let user copy it to clipboard. • SSV:open-lsp-folder / SSV:open-this-in-npp / SSV:reload-self — convenience actions for opening or reloading the LISP file from the dialog.
Hide / Show Objects
Helper Functions Used: • writeHSDCL — Creates the DCL dialog definition dynamically and writes it to a temp file. • radioHSDCL — Loads and displays the dialog, handles user input, and sets the selected option variable. • to_ob_izol — Isolates the selected entities by hiding all others (sets entity visibility attribute 60 = 1 for all non-selected). • to_ob_hight — Hides only the selected entities by setting their visibility to 1. • to_ob_show — Restores visibility of all entities by setting attribute 60 = 0 for all.
Change Background Color
Helper Functions Used: • _pref-display / _pref-drafting — Access AutoCAD’s preference objects for reading and setting UI color data. • _rgb->long — Converts RGB values to AutoCAD’s long integer color format. • _bg-color-by-index — Retrieves the correct color value from the preset index. • _cursorColorForBg — Determines whether the cursor should be black or white for good visibility. • _snapshot-current / _restore-snapshot — Saves and restores the current color scheme so Cancel reverts changes. • _apply-bg — Sets background and related colors for Model/Paper spaces based on the selection. • _bg-dcl-source / _write-dcl-to-temp — Creates and writes a temporary DCL dialog file for the UI.
AnnoAllOnOff
- AAVIS:WriteDcl writes the embedded DCL definition to a temporary .dcl file for the session.
- AAVIS:GetTabNames enumerates the document layouts via ActiveX and returns a list of tab names including Model.
- AAVIS:MakeAllIndexString generates the list box index string needed to select all tabs by default and via the All button.
- AAVIS:IdxList->Names converts the list box selection index string into a list of tab names to update.
- AAVIS:SetAnnoAllVisible switches to each selected tab, forces paperspace for layouts when needed, runs ANNOALLVISIBLE with the selected value, then restores prior state.
- c:AAVIS drives the UI: sets defaults, handles All/None buttons, reads the chosen mode and tabs on OK, applies the update, and cleans up temp files.

RotateUCS
Helper / important calls in the code: • (command “_UCS” “_W”) — ensures the rotation starts from World UCS. • (command “_snapang” 0) — resets SNAPANG so draft aids are aligned. • (getangle …) — prompts the user for an angle in radians. • (* angle (/ 180 pi)) — conversion from radians to degrees. • (command “_UCS” “_Z” ang1) — rotates the UCS around Z by the given degrees. • (command “_UCS” “_Save” ucsname) — optional UCS save under the entered name.
NavvCubeDisplayOffOn
🧩 The routine uses vlax-get-acad-object to connect to the running AutoCAD application and vla-get-ActiveDocument to access the current drawing document.
🔧 It uses vla-sendcommand to send the NAVVCUBEDISPLAY values directly to AutoCAD from AutoLISP.
🔒 The code includes a vl-catch-all-apply check around the AutoCAD COM object call and loads Visual LISP COM support when needed.
Export_Import_MS_UCS
🧩 get-persisted-ucs-folder reads the last-used UCS folder from the Windows Registry.
🧩 save-persisted-ucs-folder writes the selected UCS folder path back to the Registry.
🧩 get-default-ucs-path resolves the preferred start folder from DWGPREFIX, the persisted UCS folder, or a fallback path.
🧩 c:EXPUCS_DIALOG opens the save-file dialog and dispatches to EXPUCS.
🧩 c:IMPUCS_DIALOG opens the import-file dialog and dispatches to IMPUCS.
🧩 c:EXPUCS scans the UCS symbol table using tblnext and writes UCS records to the selected .ucs file.
🧩 c:IMPUCS reads exported UCS records from a .ucs file, validates UCS entries, resolves duplicate names, and recreates records with entmake.
🧩 vl-load-com initialization enables Visual LISP COM access when AutoCAD ActiveX is available.
CopyMove2MidPoint_vs.01
🧩 Main internal function:
– MOVE_COPY_COMMON2 – shared move or copy routine used by MMid2 and CMid2.
🔧 Important AutoLISP and Visual LISP operations:
– ssget for object selection.
– getpoint for P1, P2, P3, and P4 reference picking.
– trans for UCS-to-WCS point and vector conversion.
– vla-move for moving objects.
– vla-copy for copy mode.
– vla-get-Layers and vla-get-Lock for locked-layer checking.
XrefDrawingOrder
🧠 Main helper routines and implementation details:
– AT:GetXrefNames collects xref block names from the active document using ActiveX Blocks iteration.
– MXR:SSXref builds selection sets for xref INSERT references by block name.
– MXR:MoveUnder applies DRAWORDER with the Under option to place one xref below another.
– MXR:ApplyOrder walks the ordered xref list and applies the stacked draw order pair by pair.
– MXR:SaveLastOrder and MXR:LoadLastOrder store and restore the last order from the drawing Named Object Dictionary.
– MXR:LoadSaved, MXR:SaveSaved, MXR:DelSaved, and MXR:FindSavedByName manage named xref order presets.
– AT:XrefOrderDialog creates the temporary DCL dialog, handles Apply, OK, Cancel, list movement, saved order actions, and cleanup.
ExpImpUCS
🧩 EI-write-dcl dynamically creates the DCL interface for the main import and export dialog and the help dialog.
🧩 EI-build-predefs searches OneDrive and project paths for predefined UCS_Lageplan folders such as Beu, La, Npl, Bis, and Tp.
🧩 EI-preferred-startdir resolves the best start folder using the selected predefined folder, fixed LSP folder, last used folder, or DWGPREFIX.
🧩 EI-clipboard-put copies help text and folder paths using cmd | clip.
🧩 EI-help-dialog opens a persistent help window with copy selected, copy all, copy path, Unicode toggle, Explorer, and Notepad++ actions.
🧩 EI-open-explorer-fixed opens the fixed ExpImpUCS support folder.
🧩 EI-open-npp-fixed opens the fixed LISP file in Notepad++ when available, with Notepad fallback.
🧩 _ucs-add-or-update creates a new named UCS or updates an existing one through the AutoCAD UserCoordinateSystems collection.
🧩 _preferred-dir-from-dcl honors DCL-selected directories and then falls back through helper directory providers and the current drawing folder.AreaCalc
🧩 GetObjectID — returns the AutoCAD object ID string used for field expressions.
📊 Acv21AddTable — places a native AutoCAD table with selected area report columns.
📝 AcV21AddLtTable — creates a line and text based report table directly in model space.
📏 GetTableWidths and acwidthlist — calculate dynamic column widths for table output.
🧮 Ac_MakeUnitList — fills DCL unit popup lists from the unit list.
🪟 ac_dialog — writes the temporary Area Calc v2.1 DCL dialog file.
📤 list->string and Strlcat — format CSV rows and joined text output.
🚀 C:AC — main command that selects objects, calculates areas, opens the dialog, labels objects, and writes the selected report.
LinetypeWithCharacters2
🧩 MK2:_writeDCL writes the embedded DCL dialog to a unique temporary file.
🧹 MK2:_sanitize_ltname removes invalid AutoCAD linetype name characters.
👁️ MK2:_showlt and MK2:_ltdesc generate the linetype preview text shown in the dialog status line.
📏 rjp-txtwdth calculates text width so the embedded text segment can be positioned correctly inside the LIN definition.
🎨 MK2:_pickColorTC opens AutoCAD color selection with TrueColor support and ACI fallback.
🏷️ MK2:_create_layer_core creates or updates layer properties using DXF color, lineweight, transparency, CELTSCALE, THICKNESS, and CLAYER settings.
💾 MK2:_readreg and MK2:_writereg store reusable settings under HKEY_CURRENT_USER.
LinFileDraw_vs.01
🧩 Main internal helper groups:
– linpl:write-dcl creates a uniquely named temporary embedded DCL dialog.
– linpl:cfg-read and linpl:cfg-write persist LIN file path, geometry settings, layer options, selected linetypes, and dialog coordinates.
– linpl:read-linetypes parses linetype names from the selected *.LIN file.
– linpl:ui-load-file refreshes the linetype list and preserves valid selections.
– linpl:show-main-dialog, linpl:show-types-dialog, and linpl:show-layer-dialog manage the main settings window, linetype selection, and layer selection.
– linpl:temporarily-add-lin-folder and linpl:restore-support-path temporarily add the LIN folder to the AutoCAD support path during loading.
– linpl:load-linetype-result loads each selected linetype with safe error handling.
– linpl:draw-one-row creates the sample polyline and MText label objects.
– linpl:undo-last-batch removes the last generated sample batch during the current session.
LinFileDraw
🧩 Main internal helper groups:
– linpl:write-dcl creates a uniquely named temporary embedded DCL dialog.
– linpl:cfg-read and linpl:cfg-write persist LIN file path, geometry settings, layer options, selected linetypes, and dialog coordinates.
– linpl:read-linetypes parses linetype names from the selected *.LIN file.
– linpl:ui-load-file refreshes the linetype list and preserves valid selections.
– linpl:show-main-dialog, linpl:show-types-dialog, and linpl:show-layer-dialog manage the main settings window, linetype selection, and layer selection.
– linpl:temporarily-add-lin-folder and linpl:restore-support-path temporarily add the LIN folder to the AutoCAD support path during loading.
– linpl:load-linetype-result loads each selected linetype with safe error handling.
– linpl:draw-one-row creates the sample polyline and MText label objects.
– linpl:undo-last-batch removes the last generated sample batch during the current session.
ReplaceBlockList
🧩 Important helper functions:
- 📁
REBL:CfgFilebuilds the settings file path in the system temporary folder. - 💾
REBL:SaveSettingssaves replacement filters, source filters, rules, and keep-property toggles. - 📥
REBL:LoadSettingsrestores the saved dialog state and replacement rule list. - ↔️
REBL:HScrollsupports horizontal scrolling for long block names in DCL list boxes. - 🧱
REBL:GetBlockNamesscans normal block definitions and skips xrefs, layouts, and anonymous names. - 🔍
REBL:FilterNamesfilters block names with wildcard matching. - ☑️
REBL:ParseMultiSelconverts DCL multi-select indexes into usable AutoLISP lists. - 📋
REBL:SelectedNamesreturns selected block names from the visible list. - 🪟
REBL:WriteDCLwrites the main temporary DCL dialog for the block replacement interface. - 👁️
REBL:WritePreviewDCLwrites the replacement preview dialog. - 🔢
REBL:CountInstancescounts drawing-wide instances of a source block name. - 🔎
REBL:ShowPreviewdisplays the replacement rule preview with instance counts. - 🔁
REBL:ReplaceAllperforms the actual source-to-replacement block swap.
- 📁

ExplodeLinetype
Main functions include C:ExplodeLinetype as the standardized wrapper command and C:LINEXP as the underlying text-to-line conversion routine. Internal helpers acet-txtexp-grplst and acet-txtexp-getgname identify AutoCAD groups containing selected text so those references can be removed before conversion. The routine also uses Express Tools functions such as ACET-ERROR-INIT and ACET-ERROR-RESTORE for environment recovery, ACET-GEOM-TEXTBOX for text extents, ACET-GEOM-ZOOM-FOR-SELECT and ACET-GEOM-PIXEL-UNIT for view adjustment, ACET-GEOM-VIEW-POINTS and ACET-GEOM-MIDPOINT for mirror geometry, ACET-LAYER-LOCKED for current-layer handling, ACET-CURRENTVIEWPORT-ENAME and ACET-VIEWPORT-LOCK-SET for viewport protection, ACET-WMFIN for WMF import, ACET-STR-FORMAT for status output, and BNS_SS_MOD for filtering objects on locked layers.

Entities2Layers
Main helper functions include E2L:run-dialog and E2L:write-dcl for the generated DCL interface, E2L:get-all-layers and E2L:update-layer-list for target-layer discovery and filtering, E2L:count-source-cases for optimized sort-and-group source-layer counting, E2L:counts-from-cases and E2L:update-count for live totals without a duplicate entity scan, E2L:update-source-panel and E2L:update-source-row for protected paged source-layer rendering, E2L:collect-entities for final category and scope filtering, E2L:move-entities for applying layer changes, E2L:entity-in-scope-p for layout filtering, E2L:layer-locked-p and E2L:layer-xref-p for layer validation, E2L:read-cfg / E2L:write-cfg / E2L:save-state for persistent settings, E2L:CopyTextToClipboard for copying a selected layer name, and E2L:safe-call / E2L:guarded for fault-tolerant initialization and callbacks.
AutoTrimExtendLines
🧩 Main helper functions and internal routines:
• Touch:LogAdd and Touch:LogClear manage the debug log.
• Touch:PopulateLog fills the dialog log list.
• Touch:CopyLogToClipboard copies the processing log to the Windows clipboard through clip.exe.
• Touch:SSValid? checks whether stored selection sets are still valid.
• Touch:CountStr builds entity-count summaries such as LINE:4 or LWPOLYLINE:2.
• Touch:HighlightSS highlights and unhighlights selected entities while the dialog is open.
• Touch:ObjPts extracts start and end points from LINE, LWPOLYLINE, POLYLINE, ARC, CIRCLE, ELLIPSE, and SPLINE objects.
• Touch:Intersect uses ActiveX IntersectWith to calculate trim and extension targets.
• Touch:MoveLine, Touch:MoveLWPoly, and Touch:MoveVLAEndpt apply geometry edits.
• Touch:Execute performs the trim and extend operation inside a named AutoCAD undo group.
• Touch:WriteDCL writes the temporary dialog definition.
• C:TTT is the main command.
• C:TTTCLEAR clears the stored debug log.
ToolPaletteExporter
TPE:GetToolPalettePath reads the AutoCAD ToolPalettePath setting through COM.
TPE:GetXtpPaths discovers available XTP palettes from saved folders, OneDrive folders, AutoCAD palette paths, and Documents.
TPE:ParseXtpFiles reads SourceFile entries from XTP XML text and deduplicates resolved file paths.
TPE:ResolvePath handles USERPROFILE placeholders and OneDrive folder-name variations.
TPE:CreateZip builds the final export archive through a generated PowerShell script.
TPE:ShowResultsDcl displays missing file details in a DCL dialog and supports clipboard export.
TPE:ShowDiagDcl and C:TPE_DIAG provide diagnostic reporting for palette paths, XTP discovery, and environment variables.
TPE:SaveHistory and TPE:LoadHistory store the last output folder, filter, and palette selection in the registry.
SaveCUIX
SC:FileExists checks whether a file path can be opened for reading.
SC:ReadLine reads the first line from a status file.
SC:WriteLines writes generated DCL, VBS, and PowerShell script content to disk.
SC:RunID creates a run identifier from the AutoCAD DATE system variable.
SC:Wait and SC:WaitForFile provide simple asynchronous wait logic while the external process runs.
SC:LaunchViaVBS starts PowerShell through a temporary VBS file without showing a console window.
SC:Timestamp creates the default dd.mm.yyyy_hh.mm.ss file suffix.
SC:DCLPath returns the temporary DCL dialog path.
SC:WriteDCL creates the Save CUI Package dialog definition.LoadIcons
LI:CopyIconsrecursively copies matching PNG icon files from the source folder to the destination Icons folder.LI:Rootstores the hard-coded Help_File source path.LI:Deststores the hard-coded Civil 3D support icon destination path.findfile,CUIUNLOAD, andCUILOADare used to locate and reloadCIVIL.cuix.

EditRibbonButton
ERB:Find[username] locates the best custom CUIX file by scanning support-directory CUIX files for[username]_ribbon_*definitions.ERB:ReadAllextracts ribbon panels, groups, subgroups, commands, macro links, and editable properties from CUIX XML.ERB:SaveAllapplies queued edits toRibbonRoot.cuiandMenuGroup.cui, then rebuilds the CUIX archive.ERB:DeleteCmdremoves a selected ribbon command button and deletes generated ARB menu macro entries when applicable.ERB:ReorderCmdmoves a command to top, up, down, or bottom inside the selected ribbon row.ERB:MoveCopyCmdmoves or copies command buttons between groups and subgroups, including cloned macro UID support for copied buttons.ERB:XamlKeyPickerreads XAML tooltip keys and lets the user select the correctSourceKeyfor extended help.ERB:DebugInfoandERB_Debugprovide troubleshooting information for CUIX discovery, structure cache, and reload behavior.

CreateFolderStructure
Important internal helper groups:
- CBS:ReadCUIX reads CIVIL.cuix by extracting RibbonRoot.cui through PowerShell and collecting [username]_ribbon_* panels and Row 1 groups.
- CBS:RibbonBase, CBS:GroupDir, and CBS:TargetDir calculate the final Help_File destination path.
- CBS:BuildStructure creates the root folder, blank icon, blank LISP file, XAML copy, screenshot folders, and VLX/FAS folders.
- CBS:WriteDCL, CBS:FillList, CBS:GroupsFor, and CBS:RefPath support the runtime DCL dialog and live path preview.
- CBS:SaveHistory and CBS:LoadHistory persist the last selected ribbon, group, and folder name in the TEMP history file.
- CBS_Diag writes a support report containing environment, path, template, CUIX, cached ribbon, and path-computation details.
AutoBackupCUIX
Main helper functions:
- ABC:FileExists - checks whether a path can be opened for reading.
- ABC:ReadLine - reads one status line from a text file.
- ABC:WriteLines - writes generated VBS, PowerShell, and DCL files.
- ABC:RunID - creates a numeric run identifier from the AutoCAD DATE variable.
- ABC:WaitForFile - waits for the PowerShell done file with a timeout.
- ABC:LaunchViaVBS - launches PowerShell hidden by using a temporary VBS wrapper.
- ABC:DateOnly - returns the current date as dd.mm.yyyy.
- ABC:Timestamp - returns the current timestamp as dd.mm.yyyy_hh.mm.ss.
- ABC:CurrentHour - converts the current AutoCAD CDATE time to decimal hours.
- ABC:DoBackup - performs the complete CUIX backup and filter workflow.
- ABC:CommandEndedCallback - checks the schedule after completed commands and triggers one daily backup when due.
AddRibbonButton
Key helpers include ARB:ReadStructure for scanning RibbonRoot.cui and MenuGroup.cui, ARB:ReadXamlKeys and ARB:XamlKeyPicker for help key selection, ARB:PatchAll for queued ribbon button insertion, ARB:DeleteCmd for removing an existing command button, ARB:ReadCmdPaths for copying image and help paths from a reference command, ARB:SaveSettings and ARB:LoadSettings for APPDATA persistence, and ARB:RibbonBase and ARB:GroupPath for automatic help folder path resolution.

AECVersionPlugin
Microsoft.NET.Sdk- SDK-style project format for modern Visual Studio builds.net48- targets .NET Framework 4.8 for AutoCAD managed plugin compatibility.Library- builds a DLL that can be loaded into AutoCAD withNETLOAD.x64- matches the 64-bit AutoCAD and Civil 3D runtime requirement.UseWindowsForms- enables WinForms-based dialogs for plugin UI workflows.accoremgd.dll- AutoCAD command registration and runtime API reference.acdbmgd.dll- AutoCAD database managed API reference.acmgd.dll- AutoCAD application and document manager API reference.

ToolbarManager_vs.01
- 🧩 Command registration -
Commands.csregistersRunToolbarManager()with[CommandMethod(BuildConstants.CommandName)], making the build-specific AutoCAD command available afterNETLOAD. - 🔍 Toolbar enumeration engine -
ToolbarService.Refresh()scansAcadApplication.MenuGroupsandAcadToolbarcollections to collect toolbar labels, groups, visibility, Left, Top, Width, and Height. - 📋 Toolbar contents reader -
ToolbarService.GetToolbarItems()reads toolbar button names and command macros with late-bound COM access and caches the result for faster row selection. - 🟢 Visibility apply logic -
ApplySelectionand the toolbar grid let users turn selected AutoCAD toolbars on or off without opening multiple AutoCAD CUI or toolbar dialogs. - 📐 Fit-to-screen layout -
ToolbarService.FitToScreen()computes visible toolbar bounds and shifts floating toolbar groups back inside the real AutoCAD monitor area. - 🖥️ Monitor-aware bounds -
ScreenHelper.GetAcadWindowBounds()uses the AutoCAD main window handle,GetWindowRect, andScreen.FromHandle()to detect the actual monitor instead of guessing from viewport size. - 💾 Profile persistence -
WindowSettings.csstores named profiles, dialog positions, toolbar sets, toolbar geometry, order, and last-used profile in a plain text settings file under the user application data folder. - 🔄 Profile restore workflow -
ToolbarService.RestoreToolbarSet()turns saved toolbars on and repositions them to their stored Left and Top values when those values are available. - 📊 CSV import and export -
CsvUtil.csandWindowSettings.ExportDetailedCsv()create Excel-friendly profile and toolbar-set reports for backup, review, or transfer to another workstation. - 📌 Toolbar profile editor -
ProfileSettingsForm.csprovides profile reorder, rename, duplicate, delete, apply, export, import, toolbar move, copy, paste, distribute, align, and refresh-size actions. - 🧰 Profile panel -
ProfilePanel.csembeds the day-to-day profile save/apply controls in the main form and delegates advanced editing to the settings dialog. - 🎨 Civil 3D style UI theme -
C3DTheme.cs,Theme.cs, andButtonIconFactory.csapply a dark CAD-style palette, role-colored buttons, and generated GDI icons without relying on external image resources. - 📝 Prompt and selection dialogs -
PromptDialog.csandChooseProfileDialog.csprovide reusable text input and profile selection dialogs for rename, duplicate, import, and copy workflows. - 🔒 Logging and diagnostics -
Logger.cswrites timestamped info, warning, and error messages to the UI log and a persisted log file for troubleshooting Civil 3D toolbar behavior.
- 🧩 Command registration -

ImportBlock
- 🧠 Safe string and type guards -
ib:strp,ib:string,ib:nonblank-str-p,ib:num-p, and related helpers prevent BooleanTorNILvalues from being passed into string-only AutoLISP calls. - 📁 Configuration persistence -
ib:read-cfg,ib:save-cfg,ib:cfg-path, andImportBlock.cfgstore the last source drawing, selected block, scale options, insert option, UCS rotation option, confirmation setting, message setting, and dialog position. - 🧩 Generated DCL interface -
ib:write-dclbuilds a temporary DCL dialog with a unique dialog name each run, reducing dialog-name collisions and supporting repeatable UI loading. - 📌 Dialog position memory -
ib:done-dialog,ib:normalize-dlgpt, and the savedDLGX/DLGYvalues preserve dialog placement across command runs and AutoCAD sessions. - 🔍 External drawing scan -
LM:GetDocumentObjectopens the selected drawing through an existing document reference or ObjectDBX so block definitions can be read without manually opening the source DWG. - 🧹 Importable block filtering -
ib:list-importable-blocksexcludes xrefs, layout blocks, anonymous blocks, externally referenced names, and block names that already exist in the active drawing. - 📤 Block definition copy -
ib:import-block-definitiondeep-copies the selected block definition from the ObjectDBX drawing into the active drawingBlockscollection. - 📐 UCS-aware insertion -
ib:ucs-rotation,trans,ib:current-space, andvla-insertblocksupport insertion in the current model space or paper space context while respecting current UCS orientation when requested. - 🔒 Runtime cleanup - The local
*error*handler releases ObjectDBX objects, unloads DCL resources, deletes temporary DCL files, and reports non-cancel errors safely.
- 🧠 Safe string and type guards -

InsertBlockFilterScale
- 🚀 Command entry point -
c:InsertBlockFilterScaleloads settings, builds the block list, writes the temporary DCL file, opens the dialog, and processes insert or copy actions. - 🔍 Block filter engine -
ibb:filtersupports normal text filtering, wildcard patterns with*and?, and comma-basedwcmatchOR-style filtering. - 📌 Block list collector - the routine scans
vla-get-blocksand excludes anonymous blocks, xref definitions, and pipe-named external reference blocks. - 📐 Preview bounding box builder -
ibb:block-bboxcalculates a simple preview extent from block definition geometry before drawing the tile preview. - 🎨 DCL preview renderer -
ibb:preview-block,ibb:draw-entity,ibb:map-pt, andibb:vidraw block geometry inside the DCL image tile usingstart_image,fill_image,vector_image, andend_image. - 🔢 Multi-select support -
ibb:parse-sel,ibb:sel-names-from-raw,ibb:names->str, andibb:restore-selpreserve selected block names across filter changes. - 📝 Clipboard helper -
ibb:copy-to-clipboarduses a multi-tier strategy withhtmlfileCOM, PowerShellSet-Clipboard, andclip.exefallback. - 📍 UCS-aware insertion -
ibb:do-inserttransforms the user-picked point withtrans, adjusts rotation by the current UCS angle, and inserts the block usingvla-insertblock. - 🔐 Persistent settings -
ibb:cfg-read,ibb:cfg-write, andibb:savestore the filter, scale, rotation, selected names, and dialog position inInsertBlockFilterScale.cfg. - 🧰 Debug logging -
ibb:log,ibb:log-clear,ibb:log-print, andIBB-DEBUGhelp diagnose preview, selection, clipboard, and insert behavior.
- 🚀 Command entry point -

ExplodeBlocks
- 🚀 Command entry point -
c:ExplodeBlocksstarts the workflow, prompts for block references, counts successful and failed operations, and reports the final result. - 🔍 Block-only selection filter -
ssgetwith((0 . "INSERT"))keeps the operation focused on block references and avoids processing unrelated entities. - 🔒 Explodable property override -
_try-native-explodeopens the block definition, temporarily setsExplodableto true, runs._EXPLODE, and restores the previous setting. - 🧠 Fallback transform workflow -
_manual-explodeis used when native explode fails, especially for non-uniformly scaled block references. - 📐 Insertion matrix builder -
_blkref-matrixcreates a 4x4 transform from insertion point, X scale, Y scale, Z scale, and rotation. - 🧩 Block definition lookup -
_blkdef-from-refgets the source block table record from the selected block reference name. - 🔄 Manual object copying - the routine attempts to copy entities from the block definition and applies
vla-TransformBywithvlax-tmatrix. - 🧹 Reference cleanup - after the manual copy and transform succeeds, the original block reference is deleted with
vla-delete. - 📊 Processing feedback - the command prints per-block messages and final totals for exploded and failed block references.
- 🚀 Command entry point -

DeleteObjectFromBlock
- 🧩 Shared DCL dialog builder -
EFB:WriteDCLwrites a temporary DCL file for the extraction and delete options, so the tool can run without a permanent external DCL dependency. - 🧰 Dialog control workflow -
EFB:ShowDialogloads the generated dialog, sets Retain objects on by default, returns1for copy and remove, returns0for delete only, and returnsnilon cancel. - 🔍 Nested entity picker -
EFB:PickLoopusesnentselpso the user can pick objects inside a block reference instead of selecting only the outerINSERT. - 🔒 Block safety checks - the pick loop rejects attributes, xrefs, layout blocks, non-nested picks, and invalid nested block paths before changing the drawing.
- 📐 Matrix-based extraction -
EFB:ProcessEntityrecreates the selected nested object withentmakexand usesvla-transformbywith thenentselptransformation matrix so the copied geometry lands in the correct world position. - 🏷️ Layer cleanup logic - the code strips xref-style layer prefixes containing
|, creates a local layer when needed, and copies layer properties from the original layer when available. - 🧹 Source object removal - after extraction or delete-only processing, the original nested object is removed with
vla-Delete, which updates the block definition. - 🔄 Undo grouping and regeneration -
vla-StartUndoMark,vla-EndUndoMark, andvla-Regengroup the operation and refresh the AutoCAD viewport after each processed object.
- 🧩 Shared DCL dialog builder -

CreateMultipleRectangleBlocks
- 🧠 Dialog value parser -
MPB:parse-real,MPB:parse-int,MPB:read-tiles, andMPB:restore-tilesread and restore DCL input values for page ranges, rectangle sizes, spacing, offsets, insertion points, and checkbox options. - 🏷️ Block naming system -
MPB:zpadformats page numbers as three digits so generated block names follow the predictable formatPage_001_suffix,Page_002_suffix, and higher values. - 🎨 Layer automation -
MPB:ensure-layercreatesRECT_INNERandRECT_OUTERlayers with predefined AutoCAD color indexes when preview rectangles are drawn. - 📐 Rectangle builder -
MPB:entmake-rectcreates closedLWPOLYLINErectangles usingentmake, placing them on the selected inner or outer rectangle layer. - 🔍 Zoom and preview logic -
MPB:do-zoomandMPB:do-previewusevla-ZoomWindowwith a small padding factor to zoom to the last drawn rectangle batch. - ↩️ Undo-safe drawing batch -
MPB:exec-drawcreates an AutoCADUNDO MARKbefore drawing rectangles, whileMPB:exec-undocallsUNDO BACKto remove the last rectangle batch. - 📊 Entity collection engine -
MPB:collect-allbuilds page zones from calculated origins, scans drawing entities withentnext, ignoresVIEWPORTandSEQEND, and assigns entities to pages using their first Y coordinate. - 🧹 Optional cleanup -
MPB:make-blockcan run AutoCAD-OVERKILLon the selected page entity set before the objects are wrapped into a block definition. - 🧩 Block creation workflow -
MPB:make-blockcreates theBLOCKrecord, copies source entity DXF data while removing database-specific handles and owner data, createsENDBLK, inserts the new block, and erases the original entities. - 🔐 DCL loop control - the main command uses
action_tilereturn codes so Pick, Draw, and Undo can dismiss and reopen the dialog safely while preserving user settings.
- 🧠 Dialog value parser -

CopyBlock_vs.01
- 🚀 Command wrapper -
c:CopyBlockChangeLayerstarts the tool and callsLM:RenameBlockReferencewith copy behavior enabled. - 🧠 AutoCAD version helper -
LM:AcadMajorVersionreadsACADVERto build the correctObjectDBX.AxDbDocumentinterface name. - 🧩 Object copy engine -
LM:CopyObjectscreates a Visual LISP safe array and usesvla-CopyObjectsto transfer block definitions between the active document and the ObjectDBX database. - 🎨 Block content layer cleanup -
LM:ForceBlockContentsByLayeriterates through the new block definition and sets internal entities to the chosen layer, color256ByLayer, linetypeByLayer, and lineweight ByLayer. - 📝 DCL dialog builder -
LM:BuildDialogAndGetwrites a temporary DCL file with mode radio buttons, a new-name edit box, layer filter, layer list, pick-layer button, and delete-original toggle. - 🔍 Layer collection and filtering - the dialog reads the drawing layer table, excludes xref-dependent layers containing
|, sorts layer names, and filters the list withwcmatch. - 📌 Pick layer from drawing - the
Pick from drawingbutton temporarily closes the dialog, lets the user select an object withentsel, reads its layer from DXF group code8, and reopens the dialog. - 🔒 Selection safety checks -
LM:RenameBlockReferenceaccepts onlyINSERTentities and warns if the selected block reference is on a locked layer. - 🏷️ Unique name suggestion - the routine proposes a new block name by appending increasing suffixes such as
_1,_2, and higher values until the name is free. - 🔴 Original reference deletion - when
Delete Initial Blockis enabled, the routine deletes the original selected reference after creating and retargeting the copied block reference.
- 🚀 Command wrapper -

AttachImagesToBlocks
- 🚀 Command entry points -
c:AttachImagesToBlocks,c:CopyPDFsToBlocks, andc:AddPDFsToBlockDefsstart the three user workflows while sharing the same DCL dialog and matching engine. - 🔍 Folder scan engine -
AIB:scan-foldersearches forpdf,jpg,jpeg,png,tif,tiff, andbmpfiles and supports wildcard filtering throughwcmatch. - 📌 Page-number extraction -
AIB:image-page-numreads either leading digits before the first underscore with##_*or trailing digits after the last underscore with*_#. - 🏷️ Block-name matching -
AIB:block-page-numextracts the digit run after a configured block prefix such asPage_, allowing files and blocks to match by page number. - 🧩 Match table builder -
AIB:build-matchescreates row records containing file path, base name, page number, selection state, matched block name, block reference object, block entity handle, and block insertion point. - 🎨 DCL interface generator -
AIB:write-dclwrites the runtime DCL layout, including the mode radio buttons, folder fields, matching rules, offsets, layer input, rename pattern, list box, help dialog, and suggestion dialog. - 🧠 Rule suggestion system -
AIB:suggest-rulesscores file-rule and block-prefix combinations and suggests the best matching pattern based on real files and block names in the drawing. - 📘 Help and live examples -
AIB:show-help-dlgexplains the matching rules and shows examples from the currently scanned files and model space blocks. - 📐 Attachment executor -
AIB:attach-and-captureruns the unified AutoCAD-ATTACHcommand, supports PDFs and raster images, and detects the newly created entity by comparing the drawing selection set before and after attachment. - 🧹 Layer preparation -
AIB:ensure-layercreates or activates the configured layer before attachment so generated underlays can be organized consistently. - 📤 Copy and rename workflow -
AIB:exec-copycopies files with WindowsScripting.FileSystemObjectand can name outputs from the matched block name or from a pattern using prefix, standard name, suffix, and three-digit page number. - 🔄 Block-definition embedding -
AIB:ref->def,AIB:add-obj-to-blkdef, andAIB:exec-add2blktransform the attached underlay from model space into block-definition coordinates, copy it into the block table record, and delete the temporary model space object. - 🔒 Configuration persistence -
AIB:run-dialogreads and writesAIB_settings.cfgin the DWG folder to preserve scale, offsets, layer, folders, matching rules, filter, and rename settings.
- 🚀 Command entry points -
Convert3DFaceToPolyline
- 🚀 Command description resource -
Convert3DFaceToPolyline.xamldefines the ribbon tooltip content that explains the AutoLISP command workflow. - 🔍 Selection logic -
ssgetis used by the described routine to let the user select one or more3D Faceentities from the active DWG. - 📐 Entity data extraction -
entgetretrieves the DXF data for each selected 3D face so vertex coordinates can be read from the entity definition. - 🧩 Vertex handling - the routine stores the four face corners in
pt1,pt2,pt3, andpt4before drawing the polyline. - 🟢 Polyline creation -
PLINEcreates the replacement outline from the extracted vertices. - 🔒 Closed boundary output -
_CLOSEcloses the generated polyline so the result represents the original 3D face boundary. - 🔴 Invalid face handling - if a selected 3D face does not contain the expected four vertex points, the routine reports the problem and skips the invalid object.
- 📘 Ribbon tooltip integration -
Autodesk.Windows.RibbonToolTip,StackPanel, andTextBlockare used in the XAML file to present command help inside an AutoCAD ribbon environment.
- 🚀 Command description resource -
3DF_to_3DPoly
- 🚀 Command entry point -
c:3df2pldefines the user command that starts the 3DFACE to 3D polyline conversion workflow. - 🔍 3DFACE selection filter -
ssgetuses the filter((0 . "3DFACE"))so only valid 3DFACE objects are selected for conversion. - 📐 DXF vertex extraction -
entgetreads the selected entity data, andLI_itemretrieves vertex codes10,11,12, and13. - 🧩 3D polyline creation - the AutoCAD
._3dpolycommand is called with all four source face vertices and then closed with_Close. - 🧠 Elevation preservation - the routine passes full 3D point lists to
3DPOLY, so the converted geometry keeps the original X, Y, and Z coordinates. - 🔒 System variable protection -
CMDECHOandOSMODEare saved before processing and restored through the local*error*handler. - 🧹 Civil 3D compatibility guard - the header avoids unsafe top-level COM behavior and uses a guarded Visual LISP COM-loading pattern.
- 📌 Small helper function -
LI_itemreturns the value of a requested DXF dotted pair from an association list, keeping the conversion logic concise and readable.
- 🚀 Command entry point -
BookmarkEntities
- 🚀 Command entry point -
c:BMEntityPosstarts the DCL-based bookmark manager and controls the dialog loop. - 🎨 Runtime DCL writer -
bm-write-dclcreates the temporary dialog definition usingvl-filename-mktempand loads it withload_dialog. - 🔍 Selection and bookmark capture -
bm-pick-and-storeusesssgetto collect supported AutoCAD entities and append bookmark records to*bm-list*. - 📐 Bounding box detection -
bm-get-bboxusesvla-getboundingboxfirst, then falls back to DXF coordinate data when bounding boxes are unavailable. - 📌 Zoom window generation -
bm-make-window,bm-zoom-ll-ur, andbm-apply-zoomcreate padded zoom windows and callvla-ZoomWindow. - 🔐 Handle recovery logic -
handentattempts to find the original drawing object so zoom operations can update extents after object edits. - 📊 Synchronized list-box refresh -
bm-update-listkeeps the No or Element, Coordinates, Color, and Remark list boxes aligned. - 🧠 Filtered index mapping -
*bm-index-map*maps visible rows back to original bookmark positions so duplicate, delete, zoom, and remark updates remain correct under filters. - 🏷️ Group filter builder -
bm-build-groups,bm-update-group-popup, andbm-pass-filterclassify bookmarks into All, Text, Lines, Polylines, Circles, Splines, Blocks, and Other. - 📝 Remark management -
bm-update-remark-fieldandbm-set-remarkdisplay and update user notes for the selected bookmark. - 🧩 List manipulation helpers -
bm-replace-nth,bm-remove-nth, andbm-insert-after-nthupdate the bookmark list safely. - 📤 Save, load, and import workflow -
bm-save-list,bm-load-list,bm-import-list,bm-write-list-to-file,bm-read-list-from-file, andbm-file-pathmanage persistent list files in the drawing folder.
- 🚀 Command entry point -

XrNet
- 🚀 Command registration system -
Commands.csregistersXRNET,XRSPLIT,XRPREDEFINEDFOLDERS, andXRSAVELOGas AutoCAD commands. - 🔍 Xref scanning engine -
XrefRepository.CollectAll()scans the active drawing database and collects DWG xrefs, raster images, status, units, layer, type, and path data. - 🔄 Reload and unload logic -
XrefOperations.Reload()andXrefOperations.Unload()refresh or unload selected references. - 🔴 Detach logic -
XrefOperations.Detach()removes selected DWG xrefs or raster image references from the drawing. - 📌 Apply list workflow -
XrefOperations.ApplyEntries()applies prepared xref records to the current DWG and restores important AutoCAD system variables. - 🧩 Attach and type conversion -
ApplyDwgEntry(),AttachXrefAtOrigin(), andChangeTypeIfNeeded()attach missing references and convert Overlay or Attached xref type where supported. - 🧹 Layer automation -
LayerUtil.EnsureLayer()andXrefOperations.SetLayer()create or reuse clean layers and move references onto organized xref layers. - 📊 List file input and output -
XrefListIO.ReadFile(),XrefListIO.SaveFile(),XrefListIO.ScanFile(), andXrefListIO.MergeByName()support repeatable xref list workflows. - 🧠 Xref splitter engine -
XrefSplitterEnginevalidates, merges, scans, abbreviates, re-paths, exports, and applies xref splitter entries. - 📐 Preview builder -
PreviewBuilder.Build()andPreviewBuilder.BuildExternalDwgFile()generate CAD-style preview geometry. - 🎨 Preview display control -
XrefPreviewControldisplays geometry, labels, filled areas, grid lines, backgrounds, zoom, pan, and fit view. - 🔐 Settings and diagnostics -
AppSettings,UiSettingsStore,RuntimeInfo, andAppLogstore folders, UI options, startup information, logs, and diagnostics.
- 🚀 Command registration system -

TotalLengthAreaDetailed
🧩 Important helper functions:
- writeLengthAreaDCL: creates the temporary DCL dialog.
- radioLengthAreaDCL: handles dialog options, saved settings, toggles, precision, ceiling step, result mode, and Profile_002 profile selection.
- TotalLengthDetailed: processes length-capable entities and builds length expressions.
- TotalAreaDetailed: processes area-capable entities and builds area expressions.
- copy-to-clipboard: writes the final expression or Excel formula to the clipboard using htmlfile COM.
- format-excel-expr: creates plain, Excel, CEILING, or Profile_002 formulas.
- ctc-make-object-field and ctc-build-field-mtext: generate dynamic AutoCAD field text for supported source objects.
- insert-result-text: inserts UCS-aware MTEXT in the active drawing space and places it on the first selected entity layer.
ZoomXref
zx:pair, zx:pt3, zx:nth, zx:parse-int, zx:up, zx:wmatch, zx:unit-str, zx:safe-get-units, zx:ss-xref-refs, zx:xref-layer-summary, zx:make-dcl-file, zx:alert-help, zx:get-xref-items, zx:filter-items, zx:ss-bbox, zx:zoom-ll-ur, zx:fill-lists, zx:filter-apply, zx:apply-zoom

XRefs2Layers
🪟 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.
LayerList
- 🚀 Command entry point —
c:llfpstarts the export workflow, asks the user where to save the report, and confirms whether the layer list was created. - 🔍 Layer scanning engine —
ax:layer-listloops throughvla-get-Layersfrom the active document and collects each layer record. - 📊 Layer property extraction — The routine reads name, on/off, frozen/thawed, locked/not locked, color, linetype, lineweight, plot style, plottable status, and viewport default freeze state.
- 🎨 Color formatting — AutoCAD color indexes 1 to 7 are converted to readable names such as Red, Yellow, Green, Cyan, Blue, Magenta, and White; higher color indexes are written as numbers.
- 📐 Lineweight formatting — The code converts AutoCAD lineweight values to readable decimal values and writes
Defaultwhen the layer uses default lineweight. - 🧠 Sorted output — The layer list is sorted alphabetically using
vl-sortandstrcase, making the exported report easier to review. - 📤 Text file writer —
layer-list-fprintwrites the header row and layer records to the selected.txtfile. - 🔐 COM startup check — The code verifies Visual LISP COM availability and loads COM support when needed before accessing the AutoCAD ActiveX API.
- 🚀 Command entry point —
ConvertPolylineAndText2Mleader
Comming soon ...ConvertLeaderAndText2Mleader
Comming soon ...AddVertex2Mleader
🔧 Internal helper: ip
The helper function processes the flat coordinate list returned by getleaderlinevertices, groups coordinates into 3D points, measures the distance from the picked point to existing leader vertices, determines the insertion position, then returns a rebuilt vertex coordinate list for setleaderlinevertices.

FixLineTextOverlap
🔧 Key helper logic:
• ++rarify enforces minimum spacing between consecutive X positions while preserving order.
• getRec extracts TEXT and MTEXT insertion data and detects left or right justification.
• setIP writes updated insertion points back to TEXT or MTEXT using OCS and WCS transformation.
• group-by-y groups text by horizontal row using a tolerance based on TEXTSIZE.
• order-side identifies the nearest item to the rail and orders the remaining labels outward.
• place-side moves text in controlled spacing increments on the left or right side of the rail.
• _RunLine_Overlap_Text_Overlap runs the line cleanup and text cleanup as a combined command.CopyPaste2BasePoint
🧰 CB_PB_COMMON_SETVAR: starts an undo mark, stores current drafting variables, disables OSMODE, disables 3DOSMODE when available, suppresses CMDECHO, and optionally sets AECBOSMODE to zero.
🔁 CB_PB_COMMON_RESTORE: restores OSMODE, AECBOSMODE, 3DOSMODE, and CMDECHO, then closes the undo mark and clears temporary global values.
🧠 GET_AECBOSMODE: checks whether AECBOSMODE exists and extracts its current value from the AutoCAD command prompt so the previous setting can be restored safely.
🔌 vl-load-com handling: ensures Visual LISP COM access is available before ActiveDocument and undo mark operations are used.
CopyMove2MidPoint
🧩 Main internal function:
- MOVE_COPY_COMMON2 - shared move or copy routine used by MMid2 and CMid2.
🔧 Important AutoLISP and Visual LISP operations:
- ssget for object selection.
- getpoint for P1, P2, P3, and P4 reference picking.
- trans for UCS-to-WCS point and vector conversion.
- vla-move for moving objects.
- vla-copy for copy mode.
- vla-get-Layers and vla-get-Lock for locked-layer checking.CookieCutter2
Main helper functions include CC:TraceObject, CC:TracePline, CC:TraceCE, and CC:TraceSpline for boundary tracing; CC:GetInters for ActiveX intersection detection; CC:Inside for point-in-polygon testing; CC:CommandExplode and CC:ExpNestedBlock for block processing; CC:AttributesToText for attribute conversion; CC:UnlockLayers and CC:RelockLayers for layer-state handling; CC:ZoomToPointList and Extents for view control; SortInterPoints for ordered trim points; and the CC2M:TraceObject family for multi-boundary outside-erasing support.

CenterAreaCentroid
🧩 writeCACDCL creates the temporary DCL dialog file.
🧩 radioCACDCL loads the dialog, stores the selected radio option, and remembers the last option during the session.
🧩 MostInnerPoint calculates an internal point for closed planar polyline or spline objects using offset and binary-search style refinement.
🧩 MostInnerPoint2 selects the source entity and creates the final POINT entity.
🧩 get_centroid converts the selected polyline to a region, reads the centroid, and places a TEXT label.TotalLengthPolyline
🧩 C:TLEN - Main AutoCAD command definition for selection, length calculation, total summation, and result display.
📌 ssget - Collects the user selection set.
📐 distance - Calculates LINE entity length from start point to end point.
🔢 getvar perimeter - Reads the perimeter result after using the AutoCAD AREA command object option.
📝 rtos - Formats the final total length for the AutoCAD alert message.TotalLengthAll
🧠 The routine uses AutoCAD Visual LISP curve functions to convert selected entity names to VLA objects and calculate each object length with vlax-curve-getDistAtParam and vlax-curve-getEndParam.
🔎 It uses a selection filter for curve-style entities and excludes MLINE objects from the calculation workflow.
TLength
🧩 c:TLENGTH is the main AutoCAD command function.
📋 copy-to-clipboard creates an htmlfile COM object and writes the measured numeric result to the Windows clipboard.
🔄 vl-load-com support is guarded with a validator-safe COM availability check.SumLengthField
🧰 Important helper functions included in the project:
- lengthfield - builds the total length or perimeter field expression.
- areafield - builds the total area field expression.
- LM:outputtext - places the field into MText, a table cell, text, attributes, attributed blocks, or MLeader content.
- LM:ssget - wraps AutoCAD selection with a custom prompt.
- LM:getcell - detects table cells from picked points.
- LM:listbox - displays a temporary DCL attribute selector when multiple attributes are available.
- LM:getmleaderattributes and LM:setmleaderattributevalue - read and update MLeader block attributes.
- LM:objectid and LM:intobjectid - generate ObjectID strings used inside AutoCAD FIELD expressions.
- LM:startundo and LM:endundo - manage undo grouping.PolylineArea
📋 copy-to-clipboard - creates an htmlfile COM object and writes the final numeric area value to the Windows clipboard.
🧮 _.AREA Object mode - reads each selected polyline area through the native AutoCAD command system.
📏 DIMUNIT check - detects imperial dimension settings and formats the result accordingly.
PLLengthByLayer
🧩 Helper functions:
- vl-string-pad-right pads layer names in the command-line table for readable alignment.
- LM:uniquefilename creates a safe TXT or CSV output path without overwriting an existing report.
- The error handler closes the export file handle if an error occurs during report writing.
- ActiveX object access is used to read each lightweight polyline length.Exp_Imp_NamedViews
NV-isStr, NV-path-join, NV-trim, NV-last-dir, NV-set-last-dir, NV-dir-exists-p, NV-unique, NV-split, NV-to-str, NV-ascii-only, NV-for-copy, NV-clipboard-put, NV-persisted-is-predef-p, NV-get-export-startdir, NV-onedrive-roots, NV-resolve-under-any-root, NV-build-predefs, NV-pick-startdir, NV-open-explorer-fixed, NV-find-notepadpp, NV-open-npp-fixed, NV-reload-fixed, NV-write-dcl, NV-help-lines, NV-help-dialog, NVUI_show, NV-on-accept, NV-write-viewsIO-startdir, NV-dispatch, get-persisted-folder, save-persisted-folder, get-default-views-path, ExportViews, ImportViews, dropCodes

NamedViewList
🧠 The program includes a portable helper set designed to avoid non-portable string helpers and keep the routine robust across AutoCAD environments:
- NVL-trim: trims spaces from view names and rename inputs.
- NVL-strcmp and NVL-cicmp: compare names for sorting and duplicate checks.
- NVL-sort: insertion-sort implementation for predictable view ordering.
- NVL-filter: filters view names by wildcard-style matching.
- NVL-parse-indexes: converts DCL list_box index strings into integer lists.
- NVL-del-view: deletes a Named View with ActiveX error protection.
- NVL-zoom-view: applies a Named View to the active viewport without closing the dialog.
- NVL-rename-at-index: validates and renames a selected Named View.
DynamicBlockFilter
- 🚀 Command wrapper -
c:DynamicBlockFilterruns the filter and applies the returned selection set withsssetfirst. - 🧠 Reusable selection function -
DynamicBlockFilterreturns a real AutoCAD selection set, so it can be called from another LISP routine or from an active command selection prompt. - 🔍 Dynamic block validation - the code checks
vla-get-ObjectNameforAcDbBlockReferenceand checksvla-get-IsDynamicBlockbefore reading dynamic properties. - 🧩 Effective name matching -
vla-get-EffectiveNameis used so dynamic anonymous block references can still be matched to the original dynamic block definition. - 📊 DCL property dialog -
DynBlkPropValuewrites a temporary DCL file with popup lists, edit boxes, radio buttons, and OK or Cancel controls. - 🏷️ Allowed value handling - dynamic properties with
AllowedValuesbecome popup filters and include*as a match-all option. - 📐 Numeric tolerance support - free numeric properties include a Fuzz field and compare values with
equal, reducing false mismatches caused by floating-point precision. - 🧮 Unit-aware conversion -
ToString,angtos,rtos,angtof, anddistofhelp compare angle, distance, and text-like dynamic property values. - 🔄 Selection scope control - the dialog lets the user filter either All drawing or a user-picked Selection set.
- 🔒 System variable restoration - the routine stores
DIMZIN, temporarily changes it for cleaner numeric formatting, and restores it in the error handler.
- 🚀 Command wrapper -

DynamicBlockCounter
- 🚀 Command entry point -
c:dbcountstarts the block counting workflow and controls selection, counting, command-line reporting, and optional file export. - 🔍 Current layout scan -
ssget "_X"searches forINSERTobjects in the current layout, usingCTABwhen in paper space andModelwhen in model space. - 🧩 Effective block name detection -
LM:blocknameusesEffectiveNamewhen available, which gives clearer results for dynamic blocks that normally use anonymous internal names. - 🔢 Nested count accumulator -
LM:nassoc++builds and increments a nested association list so each block name and optional visibility state is counted reliably. - 👁️ Visibility parameter lookup -
LM:getvisibilityparameternamereads theACAD_ENHANCEDBLOCKextension dictionary and finds theBLOCKVISIBILITYPARAMETERdefinition when a dynamic block supports visibility states. - 📐 Dynamic property reading -
vlax-invokewithgetdynamicblockpropertiesextracts the current visibility value from each dynamic block reference. - 📝 Command-line formatting -
LM:padbetweencreates aligned block count output using separator lines and padded columns for easy reading in AutoCAD text history. - 📤 TXT and CSV export -
LM:uniquefilenameprevents file overwrite by creating a unique report filename in the drawing folder before writing the block count data. - 🔐 Error-safe cleanup - the local
*error*handler closes open files, restoresNOMUTT, and avoids noisy messages when the user cancels the command.
- 🚀 Command entry point -

DelUnusedBlocks
- 🚀 Command entry point —
c:DelUnusedBlocksstarts the AutoCAD block cleanup workflow, scans unused definitions, builds the DCL dialog, reads settings, and launches deletion. - 🔍 Unused block detection — the code uses
tblnext "BLOCK", DXF group code70, andDUB:block-inserted-pto find block definitions that are not currently inserted in the drawing. - 🔒 Protected block filtering — anonymous blocks, xrefs, externally dependent blocks, xref-dependent definitions, resolved xrefs, and layout block records are skipped using the block table flag mask.
- 📋 DCL dialog generation —
DUB:write-dclandDUB:dcl-textcreate a temporary DCL file at runtime with a multi-select list box, Select All, Select None, confirmation toggle, Delete, and Cancel buttons. - 🧠 Selection state mapping —
DUB:all-index-string,DUB:names->index-string, andDUB:index-string->namesconvert between DCL list indexes and real block names so saved selections can be restored. - 🧹 Deletion engine —
DUB:delete-selectedloops through selected unused block names and callsDUB:delete-blockto remove each definition withvla-delete. - ⚠️ Confirmation safety —
DUB:yes-pasks for Yes or No confirmation before deleting selected definitions when the confirmation toggle is enabled. - 💾 Persistent settings —
DUB:read-cfg,DUB:write-state,DUB:write-cfg, andDUB:cfg-pathstore confirmation preference, last selected names, and dialog position inDelUnusedBlocks.cfg. - 📌 Dialog position restore —
DUB:restore-dialog-pointandDUB:valid-point-premember the previous DCL window position using the Lee Mac dialog-position pattern. - 🔐 Safe COM wrapper —
LM:catchapplywraps ActiveX calls withvl-catch-all-apply, helping the tool avoid hard failures when a block cannot be accessed or deleted.
- 🚀 Command entry point —

DelSelectBlock
- 🚀 Command entry point -
C:DelSelectBlockloads settings, opens the dialog, counts matching block references, asks for confirmation when enabled, deletes matching references, and reports the result. - 🧩 Dynamic DCL generation -
DSB:DclLines,DSB:WriteDcl, andDSB:UniqueDialogNamecreate a temporary DCL dialog file at runtime, so no external DCL file is required. - 📋 Block name collection -
DSB:InsertBlockNamesscans the drawing withssget "_X"and theINSERTfilter to collect unique raw block names. - 🧠 History and settings logic -
DSB:AddHistory,DSB:LoadSettings, andDSB:SaveSettingspreserve the last used block name, recent block names, options, and dialog position. - 🔍 Pick from drawing workflow -
DSB:PickBlockNamelets the user select a block reference, validates that the object type isINSERT, and returns the selected raw block name. - 🔐 Wildcard-safe block matching -
DSB:EscapeWildcardsescapes wildcard characters such as*,?,#, brackets, commas, and backticks so anonymous block names can be matched literally. - 🧹 Deletion engine -
DSB:DeleteByNamebuilds a selection set by name, converts each entity to a VLA object withvlax-ename->vla-object, and deletes it withvla-delete. - 🔴 Optional purge logic -
DSB:PurgeBlockByNameattempts to delete the block definition from theBlockscollection after matching instances are deleted. - 📌 Confirmation safety -
DSB:ConfirmDeleteasks the user whether to delete the detected number of instances when the confirmation toggle is enabled. - 📘 Failure reporting - locked layers, protected entities, or other deletion failures are counted and reported to the AutoCAD command line.
- 🚀 Command entry point -

DeleteBlocks
- 🚀 Command entry point -
c:delblocksbuilds the block list and launches the DCL dialog immediately. - 🔍 Block data scanner -
LM:delblocks:buildblockdatareads the block table and countsINSERTreferences for each block name. - 🧩 Effective block name support -
LM:blocknameusesEffectiveNamewhere available, which improves dynamic block name handling. - 📊 Instance count display - each row is formatted as a block name plus count, such as
BOLT (12x)orBOLT (unused). - 🔍 Filter logic -
_applyfilterfilters the block list by name usingwcmatchand case-insensitive comparison. - 🔄 Sort logic -
_checksortdirswitches the block list betweenAZandZAordering. - 📌 DCL dialog generator -
LM:delblocks:listboxwrites a temporary DCL file with a unique filename to avoid stale dialog file conflicts. - 🧠 Registry persistence -
LM:delblocks:regreadandLM:delblocks:regsavestore filter text, horizontal scroll position, sort direction, dialog width, and dialog height underHKCU\Software\LM_DelBlocks. - 🟧 Select unused helper -
_purgeunusedselects block definitions with a zero instance count so they can be removed more quickly. - 🔴 Nested block warning -
LM:delblocks:nestedmapdetects block names used inside other block definitions and prompts before deletion. - 🔒 Layer lock handling -
LM:deleteblockstemporarily unlocks locked layers, deletes matching references, deletes block definitions where possible, and restores the previous lock state. - 🧹 Undo grouping -
LM:startundoandLM:endundowrap deletion operations in an AutoCAD undo mark.
- 🚀 Command entry point -

XrefOffsetLayer
- Plugin.cs defines AutoCAD command registration, load messages, versioned command aliases, and
IExtensionApplicationstartup behavior. - XolCommandRunner.cs opens the modeless offset dialog and runs the standalone Xref layer-copy command.
- XolForm.cs builds the WinForms interface, entity grid, distance controls, layer mode controls, undo button, clipboard export, and log panel.
- XolOffsetEngine.cs clones picked Xref curves into the host drawing, runs
Curve.GetOffsetCurves, transforms the results through nested containers, and appends the final offset geometry. - XolLayerCloner.cs clones source Xref layer definitions into the host drawing and repoints offset entities from dependent layers to host layers.
- XolNestedPicker.cs handles nested entity selection,
FullSubentityPathconstruction, highlighting, and Xref validation. - XolSettings.cs persists dialog position, size, offset distance, layer mode, and flip direction in
%APPDATA%\XrefOffsetLayer\XrefOffsetLayer.cfg. - XolLogger.cs records live command messages and saves diagnostic logs for troubleshooting and future improvements.
- Plugin.cs defines AutoCAD command registration, load messages, versioned command aliases, and

LayersImportExport
Main components include Commands for registering LAYERSIMPORTEXPORT_016, LAYEREXPORT_016, LAYERIMPORT_016, and LAYERSETTINGS_016; MainForm and its Export, Import, Settings, and ContextMenus partial classes for the modeless interface; LayerCadService for extracting current-drawing and directory layers, Xref selection, preview collection, viewport highlighting, snapshots, import application, Xref-layer reset, colour resolution, and linetype discovery; LayerFileCodec for UTF-8 CSV and XML reading and writing; LayerOptions and LayerColumns for selectable layer fields and row models; PreviewPanel and PreviewGeometry for GDI+ and AutoCAD GraphicsSystem previews; AciColorPickerDialog and ListPickerDialog for colour, linetype, and lineweight editing; ProjectFolderStore for the schema-versioned project-folder database; SettingsStore and AppSettings for persistent configuration; AppLog for live logs, saved logs, and diagnostic packages; WildcardUtil for column filters; ColourCodec for ACI and true-colour conversion; and ButtonIconFactory / C3DTheme for self-contained Civil 3D-style interface presentation.

ChangeBlockLayer
Main components include Plugin for build-version reporting and command registration, CblCommandRunner for opening and replacing the modeless form, CblForm for nested-entity picking, destination-layer selection, the candidate grid, highlighting, Apply, OK, Undo Apply, and logging, CblNestedPicker.BuildPath for constructing FullSubentityPath values, CblNestedPicker.SetHighlight for highlighting or unhighlighting only the selected nested entity, CblNestedPicker.IsInsideXref for Xref-container detection, CblLayerChanger.ApplyChecked for validating the destination layer and changing checked entity layers, CblLayerChanger.UndoApply for restoring original layers from the latest operation, CblLogger for live and saved diagnostic logs, Models for candidate and undo records, and C3DTheme for the Civil 3D-inspired Windows Forms appearance.

CommandSearchExtra
Key helper modules include CommandSearchPalette for the modeless UI, CuixEngine for CUIX XML and ZIP editing, ButtonData for Ribbon command records, LispLoaderHost and LoaderWindow for embedded and standalone loader interfaces, DiskScanner for folder discovery, FileLoader for LSP/VLX/FAS/DLL loading, LspCommandExtractor and LspAnalyzer for AutoLISP parsing, AdvancedFilter for wildcard and numeric filters, CommandValidationService for audit rules, ReportExportService for CSV/HTML export, DocumentationGenerator for command catalog output, FileMetadataService for date/size/backup metadata, and LogManager for live diagnostics.

CommandSearch Lisp Loader Only
Key project modules:
- PluginApp.cs initializes the AutoCAD extension, prints the version banner, and hides the palette on terminate.
- Commands/CommandSearchCommands.cs registers CMDSEARCH, CMDSEARCHCLOSE, LISPLOADEXTRA, LISPLOADREPORT, CMDSEARCHTESTS, and LISPLOADDIAG.
- UI/CommandSearchPalette.cs builds the modeless ribbon command search and maintenance palette.
- UI/AddButtonDialog.cs provides Add and Edit button dialogs for ribbon command metadata.
- Engine/CuixEngine.cs reads and writes CUIX XML data from RibbonRoot.cui, MenuGroup.cui, QuickAccessToolbarRoot.cui, and workspace data.
- Engine/ButtonData.cs stores ribbon button, macro, image, XAML, and command metadata.
- Lisp/LispLoaderHost.cs provides the embedded Lisp Loader user control.
- Lisp/LoaderWindow.cs provides the standalone loader window launched by LISPLOADEXTRA.
- Lisp/DiskScanner.cs scans Help_File folders for loadable LSP, VLX, FAS, and DLL files.
- Lisp/FileLoader.cs loads support files safely through AutoCAD application context, batch loading, SendStringToExecute, and acedInvoke fallback logic.
- Lisp/LspAnalyzer.cs and Lisp/LspCommandExtractor.cs extract AutoLISP defun command data while avoiding comments and strings.
- Lisp/CommandValidationService.cs detects duplicate commands, missing images, missing XAML files, macro-to-defun mismatches, missing dependencies, and hard-coded path warnings.
- Lisp/ReportWindow.cs, ReportExportService.cs, LoadSession.cs, LoadResult.cs, and LogManager.cs handle reporting, export, history, and live logging.
- Lisp/AdvancedFilter.cs provides wildcard, exclude, empty, missing, duplicate, and numeric filter logic.
- Lisp/FileMetadataService.cs, LayoutSettingsStore.cs, ConfigReader.cs, EditorLauncher.cs, DocumentationGenerator.cs, VersionStamp.cs, and CoreLogicSelfTests.cs support metadata, persistence, configuration, editing, documentation, versioning, and tests.
DeleteBlockCrossings
- 🚀 Command registration -
Plugin.csregistersDELETEBLOCKCROSSINGS,DBC, andABBSthrough AutoCADCommandMethodattributes. - 🧩 Command runner -
DeleteBlockCrossingsCommandRunner.Run()collects the pickfirst selection or prompts forINSERTentities, clears the implied selection, loads persisted settings, and opens the modeless form. - 🔍 Block candidate collector -
DbcScanner.CollectBlocks()reads selectedBlockReferenceobjects, resolves effective dynamic block names, stores handles, layers, owner spaces, and calculated block frames. - 📐 Crossing scanner -
DbcScanner.ScanCrossings()scans entities in the block owner space, detects curves and nearby block references, and creates practical diagnostics for trimming and review. - 🧠 Intersection and sampling logic -
GeometryUtil.Intersections(),PolylineSamplesTouchOrEnterPolygon(), andApproximateSamplePolygonIntersections()improve detection when AutoCADIntersectWithreturns incomplete points for splines or polylines. - 📊 Status classification - candidate rows are classified as
CROSSING,TOUCHING,CROSSING - CHECK,PROJECTED,EXTENTS TOUCH, orINTERFERING BLOCKto separate safe trim rows from review-only diagnostics. - ✂️ Trim engine -
DbcTrimmer.TrimChecked()processes checked trim-capable rows, splits curves at calculated break points withCurve.GetSplitCurves(), keeps outside pieces, and erases the original curve. - ↩️ Undo apply system -
TrimApplyRecordandUndoApply()store original entity clones and created object IDs so the last apply operation can be reverted. - 🎨 Preview and highlight -
PreviewSampler.Sample()and the WinForms preview panel display the selected block frame and candidate geometry while AutoCAD viewport highlighting helps identify the active row. - 🔐 Settings and diagnostics -
DbcSettingsstores form bounds and enabled block names, whileDbcLoggerrecords operation history and exports diagnostic reports. - 🧰 Build lock workaround - the project uses timestamped output folders and timestamped DLL names so AutoCAD does not block rebuilding the original DLL after
NETLOAD.
- 🚀 Command registration -

XrefsDrawingOrder
📦 Main project modules:
- Commands.cs — AutoCAD plugin entry point, initialization banner, NETLOAD command registration, command aliases XrefDrawingOrder_017 and XRDO_017.
- MainForm.cs — dialog behavior, refresh logic, filtering, xref status operations, Apply, Undo, saved orders, folder favorites, preview coordination, logging, copy actions, and selected xref tools.
- MainForm.Layout.cs — responsive WinForms layout, themed controls, grid setup, context menu wiring, drag and drop ordering, preview toolbar, saved order controls, and log panel.
- XrefOrderService.cs — AutoCAD database access, xref enumeration, metadata collection, reload, unload, detach, attach or overlay conversion, layer updates, draw order application, NOD persistence, preview segment extraction, and AppData file persistence.
- PreviewPanel.cs — custom double-buffered drawing preview for xref bounding boxes and extracted geometry segments with zoom, focus, grid, and black or white background support.
- ListReorder.cs — pure list manipulation helper for Up, Down, Top, Bottom, and drag-to-index multi-selection movement.
- FolderFavoritesDialog.cs — folder favorite editor for import/export starting directories.
- TextPromptDialog.cs — compact prompt dialog used for renamed saved orders and layer edits.
- ButtonIconFactory.cs — generated 16 by 16 button icons without external image dependencies.
- C3DTheme.cs — dark AutoCAD/Civil 3D style theme, button roles, and control styling.
- Logger.cs — timestamped session log plus persistent log file under %APPDATA%\XrefDrawingOrder.
- XrefDrawingOrder_017.csproj — .NET Framework 4.8 x64 project file, AutoCAD 2024 managed references, and build-number generated command naming.LayerLeaderPlugin_test
Comming soon ...
RibbonManagerPlugin
PluginApp.Initialize initializes the AutoCAD extension and prints the v5.0 load message.
RibbonManagerCommands exposes RIBBONMGR and RIBBONMGRCLOSE command methods.
CuixEngine provides CUIX ZIP/XML loading, panel/group/button discovery, add/edit/delete/reorder operations, QAT reading, workspace reading, double-click action discovery, XML writing, backup creation, and menu reload support.
ButtonData stores command, macro, group, image, help, tooltip, keytip, style, and menu macro metadata.
RibbonManagerPalette builds the modeless AutoCAD palette with Ribbon, Toolbars, QAT, Workspaces, Double-Click, Image Paths, Help Files, and Custom Paths tabs.
AddButtonDialog provides the add/edit form with command auto-fill, macro generation, image browser, XAML help browser, and button metadata editing.
RotateUcs_vs.01
- 🚀 Plugin initialization —
RotateUcsApp.Initializeprints the load banner, build stamp, and available commands when the DLL is loaded. - 🧩 Palette instance manager —
RotateUcsPaletteHostkeeps a single modelessRotateUcsPaletteinstance alive and activates it when the command is run again. - 📌 Command registration — the
Commandsclass exposesROTATEUCS,RUCS,RU1, andRUEthrough AutoCADCommandMethodattributes. - 🧠 UCS service layer —
UcsServicemanages UCS enumeration, filtering, sorting, rotation, save, restore, rename, delete, CSV import, CSV export, and viewport UCS transfer. - 🔢 Angle normalization —
NormalizeAnglekeeps rotation values inside the 0 to 360 degree range. - 📐 Entity angle extraction —
EntityAngleExtractor.GetAngleDegreesreads supported AutoCAD geometry and returns the most useful angle for UCS rotation. - 🧩 Polyline segment logic — the entity extractor uses nearest segment midpoint logic so picked polyline angles come from the segment closest to the pick point.
- 🎯 Arc tangent logic — arc angle extraction calculates the radius angle from the arc center to the picked point, then adds 90 degrees to obtain the tangent direction.
- 🔍 Wildcard filter helper —
WildcardMatch.IsMatchsupports simple*and?wildcard matching for UCS list filtering. - 📘 2D preview control —
UcsPreviewControldraws WCS reference axes and rotated UCS X and Y axes using GDI drawing. - 🎯 Viewport highlight helper —
UcsHighlighterusesTransientManagerto draw temporary X-axis, Y-axis, and origin marker graphics in the AutoCAD viewport. - 💾 Registry settings —
Settings.LoadandSettings.Savepersist user options underHKCU\Software\RotateUCS. - 📋 Logging system —
Loggerwrites timestamped log lines to memory and to daily log files under%AppData%\RotateUCS\Logs. - 🪟 Detached log viewer —
LogWindowdisplays the session log, saves logs to a chosen file, and opens the log folder in Windows Explorer. - 🎨 Dark UI theme —
C3DThemeapplies the project’s dark CAD interface styling to WinForms controls. - ✏️ Rename prompt —
InputBox.Showprovides a small modal text prompt used when renaming a UCS record. - 📘 Build metadata —
BuildInfo.VersionandBuildInfo.BuildStampstore the plugin version and load banner stamp.
- 🚀 Plugin initialization —

UnReloadDetachSelectedXrefs_vs.02
- 🚀 Command registration system -
Commands.csregistersXRNET,XRSPLIT,XRPREDEFINEDFOLDERS, andXRSAVELOGas AutoCAD commands for direct command-line access. - 🔍 Xref scanning engine -
XrefRepository.CollectAll()scans the active drawing database and collects DWG xrefs, raster images, reference status, type, units, layer, path, and related object data. - 🔄 Reload and unload logic -
XrefOperations.Reload()andXrefOperations.Unload()update selected drawing references or temporarily unload them to improve drawing performance and reference control. - 🔴 Detach logic -
XrefOperations.Detach()removes selected DWG xrefs or raster image references when the drawing needs cleanup or dependency reduction. - 📌 Apply list workflow -
XrefOperations.ApplyEntries()applies prepared xref records to the active drawing and restores important AutoCAD system variables after processing. - 🧩 Attach and type conversion -
ApplyDwgEntry(),AttachXrefAtOrigin(), andChangeTypeIfNeeded()attach missing references and convert xrefs betweenOverlayandAttachedwhere supported. - 🧹 Layer automation -
LayerUtil.EnsureLayer()andXrefOperations.SetLayer()create or reuse organized layers and move selected references onto clean xref layers. - 📊 List file input and output -
XrefListIO.ReadFile(),XrefListIO.SaveFile(),XrefListIO.ScanFile(), andXrefListIO.MergeByName()support repeatable xref list workflows. - 🧠 Xref splitter engine -
XrefSplitterEnginevalidates, merges, scans, abbreviates, re-paths, exports, and applies xref splitter entries for structured project reference management. - 📐 Preview builder -
PreviewBuilder.Build()andPreviewBuilder.BuildExternalDwgFile()generate CAD-style preview geometry from the active drawing or an external DWG file. - 🎨 Preview display control -
XrefPreviewControldisplays geometry, labels, filled areas, grid lines, background presets, zoom, pan, fit view, and empty-preview messages. - 🏷️ Preview color and visibility logic -
PreviewColorUtil.ResolveColor(),PreviewColorUtil.ResolveLineWeight100mm(), andPreviewColorUtil.IsVisible()improve CAD-like preview display behavior. - 🔐 Settings and diagnostics -
AppSettings,UiSettingsStore,RuntimeInfo, andAppLogstore predefined folders, UI settings, startup information, logs, and diagnostics under%APPDATA%\XRNET\. - 🟧 WinForms icon system -
ButtonIconFactory.csandC3DTheme.StyleButton()assign real bitmap icons throughButton.Imagefor reliable button icons in WinForms.
- 🚀 Command registration system -

UnReloadDetachSelectedXrefs_01
Helper logic and protections- Discovery reads xrefs from the drawing Blocks table and builds the list with Name, Type (Attached or Overlay), Units, Found At, and Layer.
- Filtering supports wildcard patterns for name and layer, plus Type and Units dropdown filters.
- Selection map stores selection state by xref name and keeps it consistent while filters change.
- UCS and view preservation wraps actions to restore UCS and view after each operation.
- Layer robustness sanitizes illegal layer characters, creates missing layers, and can move all xref inserts to the stored layer.
- Zoom2Xref computes the Model Space bounding box of selected xref inserts and zooms to it without closing the dialog.
- Predefined folder resolution uses the selected list entry to set the default start directory for Save List and Load List dialogs.
Text2Multileader_01
Helper function- rjp-getbbwdth computes the text object width by calling vla-getboundingbox and measuring the horizontal distance between bounding box corners.
- The widest text object determines the final TextWidth assigned to the created MLEADER.

SetPublishLocation_01
Helper functions and internal logic- Layout filtering using wildcard match and optional Model exclusion.
- Synchronized selection across list boxes so row selection stays consistent across all columns.
- Horizontal scroll clipping implemented by caching full strings per column and re-filling list boxes with substring windows based on slider offsets.
- Media mapping cache translates canonical media names to display names per plot device, minimizing repeated device queries.
- Viewport discovery collects paper-space viewports excluding the overall viewport and ignores viewports that are off.
- Zoom status persistence stores only the extents marker in a named object dictionary entry so the Zoom column can show ZExt only when explicitly applied by this tool.

DuplicateLayouts_01
Key helper behavior- Builds the available layout list by iterating the Layouts collection and excluding Model.
- Maintains stable session state using globals for selected layouts, delete target, and undo availability.
- Generates unique destination names using BaseName_### with zero padded numbering and an existence check before each creation.
- Copies layouts using -LAYOUT Copy with multiple fallback variants to handle command localization or option differences.
- Wraps duplication and deletion in StartUndoMark and EndUndoMark so each operation can be reverted cleanly.
- Implements session undo by issuing UNDO 1 and tracking a session counter to enable or disable the Undo button.
- Writes a temporary DCL file, loads it, runs the dialog loop, then unloads the dialog and deletes the temp file on exit.

CreatesXrefsLayersAssign_01
Key Helpers and What They Do- XRL-GetXrefs Collects XREF block names from the Blocks collection.
- XRL-EnsureLayer Creates a layer if missing and enforces color 7 (white).
- XRL-PutLayerSafe Moves an entity to a layer and safely handles locked source layers (temporary unlock and restore).
- XRL-BuildXrefLayerMap Builds the Current Layer summary per XREF by scanning INSERT entities and tracking their layers.
- XRL-UpdateLayerList Filters non-Xref layers and populates the Matching Layers dropdown using the typed filter text.
- XRL-FillLists Refreshes the three list columns and preserves selection when possible.
- XRL-ZoomXrefCB Zooms to the selected XREF Model Space inserts using a merged bounding box and ActiveX ZoomWindow.

Slope_01
Main helper functions used by c:slope_p: • PLTXT-MAKE-DCL – Builds the temporary DCL dialog definition file for the Slope Label UI. • SPU-ParseInt / SPU-GetLightingUnits / SPU-SetLightingUnits – Small utilities to read integers safely and sync dialog “Units / Lighting” with drawing variables. • SPU_UpdateAngEnable – Enables/disables the angle-format radio buttons when “Combine” is toggled. • SPU_SetUnits – Applies all unit-related settings (LUNITS, AUNITS, LIGHTINGUNITS, precisions) from the dialog to the drawing. • PLTXT-GetVertices / PLTXT-GetSegListFromEntity – Extract vertices and build per-segment (p0,p1) lists from LINE / LWPOLYLINE / POLYLINE entities. • PLTXT-READ-VALUES – Reads text height, H-scale, V-scale and all prefix/suffix strings from the dialog and stores them in globals. • PLTXT-AngToString – Converts an angle (radians) into formatted text according to the chosen angle format (deg, dms, grad, rad) and AUPREC. • PLTXT-SHOW-DIALOG – Drives the dialog lifecycle: initializes tiles from current globals, wires all actions, and returns OK/Cancel result. • PLTXT-CREATE-MTEXT – Core geometry/annotation engine: computes slope, text content, offset direction, and creates the MTEXT entity for one segment. • PLTXT-Loop-2Pts – Implements the “2 Points” picking loop and calls PLTXT-CREATE-MTEXT for each pair. • PLTXT-Loop-Ent – Implements the “Select Line/Segment” loop; for each selected entity it builds segment lists and calls PLTXT-CREATE-MTEXT on each.
ToolbarManager
Filter & group helpers: • tbm-match: Performs case insensitive wildcard matching between the filter pattern and toolbar label, treating an empty pattern as a match for everything. • tbm-get-toolbars: Walks through all menu groups and their toolbars via COM, building and sorting the master list *tbm-all* with label, object handle, visibility flag, and group name. • tbm-build-groups: Extracts unique group names from the master toolbar list, initializes *tbm-groups* with "All", and appends group names as they are found. DCL / UI helpers: • tbm-write-dcl: Creates and writes the temporary DCL file that defines the Toolbar Manager dialog layout, ready to be loaded with load_dialog. • tbm-refresh-list: Rebuilds the visible list of toolbars according to the current filter, group, and visible only flags, fills the list box, and preselects currently visible toolbars in that view. • tbm-select-all: Selects all rows in the current list view by generating a space separated index string for the list box selection tile. Apply helper: • tbm-apply-from-sel: Interprets the list box index string, maps it back to indices in *tbm-all* via *tbm-view*, and for each toolbar in the view sets Visible true if selected, false if not, updating *tbm-all* to reflect the new visibility state.Slope_00
• SLP-ParseReal — Converts string to real, returns default if empty • SLP-ParseInt — Converts string to integer, returns default if empty • SLP-S — Ensures non-nil safe string • SLP-Round — Sym metric rounding for positive/negative values • SLP-AbsInt — Returns absolute integer for slope math • SLP-GCD — Computes greatest common divisor to reduce ratios • SLP-ReduceRounded — Rounds run & rise, reduces them to smallest integers H,V • SLP-Fixed — Fixed-decimal formatter enforcing trailing zeros • SLP_Place — Core slope creation: computes geometry, formats text, offsets below/above, creates TEXT entityCloseParalelPolylines
• System variable handling Saves CMDECHO and PEDITACCEPT, forces silent and auto-accept mode, restores afterward • Entity type validator Converts each selection into a VLA object and verifies type (Polyline, Line, Arc, Spline) • Polyline opener Closed LWPOLYLINE objects are automatically set to open before processing • get-pts helper Returns start and end points of any supported object type • Selection set builder Collects both main entities and the two connector lines for a final PEDIT join
DuplicateLayouts_00
- writeDCL writes the dialog definition to a temporary .dcl file used for the session.
- getLayoutNames enumerates document layouts via ActiveX, excluding Model, and builds the available layout list displayed in the dialog.
- updateSummary repopulates the summary list box from the internal layoutMap so the UI reflects current selections and counts.
- action_tile \"set\" reads the selected layout index and copy count, then inserts or replaces the layout entry inside layoutMap.
- action_tile \"delete\" removes the highlighted summary entry from layoutMap and refreshes the summary list.
- c:DuplicateLayouts controls the full lifecycle: DCL creation, list population, dialog execution, cleanup, and layout copy execution.

DB_Planung_Gelände
Groups of helper functions: • Path and help handling: DB-PG-abs-path-p, DB-PG-resolve, DB-PG-open-file, DB-PG-open-help, and DB-PG-open-dwg resolve help image and DWG paths and open them via Explorer or associated viewer. • Compatibility helpers: DB-PG-stringp, DB-PG-atof, DB-PG-atoi, and DB-PG-pos safely convert string tile values to numeric types with defaults and minimum bounds. • List builders: DB-PG-layer-names and DB-PG-style-names collect and case sort existing layers and styles, while DB-PG-uniq, DB-PG-filter-nil, DB-PG-ensure-nonempty, and DB-PG-build-lists produce unique, non empty global lists for the popup controls. • UI mapping helpers: DB-PG-index-of, DB-PG-maybe-style, and DB-PG-get-popup handle mapping between string values and popup indices, and optional style overrides. • INI helpers: DB-PG-ini-path, DB-PG-write-ini, DB-PG-parse-line, and DB-PG-read-ini create, parse, and apply configuration from a simple key equal value text file in the drawing folder. • Dialog state helpers: writeDB_P_GDCL writes the DCL, DB-PG-mode-tiles, DB-PG-set-pl-styles-enabled, and DB-PG-set-ge-styles-enabled enable or gray related tiles, and DB-PG-toggle, DB-PG-enforce-all keep offset edit toggles and fields synchronized. • Accept and dialog driver: DB-PG-accept reads the final tile values back into global variables and computes dependent fields like scale factor, while radioDB_P_GDCL builds the DCL, loads it, initializes tiles, sets action tiles, and runs the dialog loop until the user accepts or cancels. • Geometry helper: verteximos extracts ordered vertex lists from LINE, LWPOLYLINE, and POLYLINE entities so the routines can find band endpoints and reference points along cartridges. • Error handlers: Each main routine and the launcher temporarily overrides *error* with a local handler that restores system variables, view, and previous error handler on exceptions or user cancel.
CubeDisplay_Off_On
Helper Functions and Commands Used: • (vl-load-com) — enables the Visual LISP COM interface for ActiveX communication. • (vla-get-activedocument (vlax-get-acad-object)) — retrieves the active drawing object. • (vla-sendcommand acadDoc "_.NAVVCUBEDISPLAY 1 ") — disables the ViewCube display. • (vla-sendcommand acadDoc "_.NAVVCUBEDISPLAY 3 ") — re-enables and refreshes the cube display.
