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.

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.

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.
CopySelection
• 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
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_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.

XRefs2Layers
- writeX2LDCL: Writes the DCL dialog definition to a temporary .dcl file.
- radioX2LDCL: Loads the dialog, sets the last-used radio button, wires OK and Cancel actions, and returns a dialog result code.
- Error handlers: Each processing command defines a local *error* handler to close the undo mark and print non-cancel errors.
- COM initialization: Uses vl-load-com and ActiveDocument access to work with blocks, selection sets, and layers.

XrefDrawingOrder
- • String helpers: MXR:ToString, MXR:EnsureStr, MXR:Trim, MXR:JoinS, MXR:Split, MXR:Atoi.
- • List helpers: MXR:Len, MXR:Nth, MXR:Reverse, MXR:Append1, MXR:InList?, MXR:IndexOf, MXR:ListRemoveAt, MXR:ListInsertAt.
- • XREF helpers: AT:GetXrefNames, MXR:SSXref, MXR:MoveUnder, AT:Dedupe-Then-Fill.
- • Per drawing memory: MXR:GetOrdersDict, MXR:SaveLastOrder, MXR:LoadLastOrder.
- • Saved orders on disk: MXR:StorePath, MXR:LoadSaved, MXR:SaveSaved, MXR:DelSaved, MXR:FindSavedByName.

ZoomXref
Helper functions used- • zx:pair Builds a two-item cons pair (used for returning LL and UR).
- • zx:pt3 Builds a 3D point list (x y z).
- • zx:nth Safe 0-based index accessor without NTH.
- • zx:parse-int Parses digits-only integer strings (used to read list-box index).
- • zx:up ASCII uppercase for case-insensitive matching.
- • zx:wmatch Wildcard matcher supporting * and ? (case-insensitive).
- • zx:unit-str Maps AcInsertUnits enum to readable text (Meters, Feet, Unitless, etc).
- • zx:safe-get-units vla-get-Units with error trapping to avoid failures.
- • zx:ss-xref-refs ssget of INSERT entities for a block name in Model Space only.
- • zx:xref-layer-summary Computes layer display value: single layer, Multiple, or —.
- • zx:make-dcl-file Writes a temporary DCL file defining the dialog layout.
- • zx:alert-help Help dialog describing filtering, columns, and zoom behavior.
- • zx:get-xref-items Builds item triplets (name unit layer) from the drawing Blocks collection.
- • zx:filter-items Filters items by wildcard pattern while preserving order.
- • zx:ss-bbox Merges bounding boxes across a selection set into one LL and UR pair.
- • zx:zoom-ll-ur Pure ActiveX zoom via vla-ZoomWindow (no command calls).
- • zx:fill-lists Populates the three list boxes and keeps selection aligned.
- • zx:filter-apply Reads filter tile, normalizes empty to *, updates filtered list and refreshes UI.
- • zx:apply-zoom Resolves current selection, builds selection set, computes bbox, performs zoom, prints status text.
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
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.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 – strcaseRegion2Polyline
• *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
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.
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 choices
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 extensions
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 needed
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.MiddleLinePolylines_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
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 polylinesCloseParalelPolylines
• 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
BookmarkEntities
Short description Sort / Purpose: Bookmark entities in the current drawing and revisit them later by name, coordinates, color, and custom remarks. • Scope: Lets…
PlusMinusNumericValue
• _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
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.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.
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.
Exp_Imp_NamedViews
Path & string helpers: • NV-isStr / NV-trim / NV-to-str: Safe string tests and trimming, plus uniform conversion of values to printable strings. • NV-path-join: Joins folder + filename with correct backslashes, tolerating existing trailing slash or empty base. • NV-dir-exists-p: Safety check for whether a given string points to an existing directory. • NV-unique / NV-split: Removes duplicates from lists and splits strings into lists by a delimiter, used for parsing selection strings and building unique root lists. OneDrive-aware roots & predefined folders: • NV-onedrive-roots: Scans environment variables and registry for OneDrive paths (personal, business, and account-specific), plus%USERPROFILE%OneDrive*folders, then normalizes the unique list of candidate roots. • NV-resolve-under-any-root: Combines each discovered OneDrive root with a given relative subpath (e.g.LucruP_B001595P_Project_02_extraNamed_Views) and returns the first existing directory. • NV-build-predefs: Uses the resolver to build real paths for multiple project-specific Named_Views folders and stores them in *EINVU_predef_values* for use in the popup list. • NV-persisted-is-predef-p / NV-get-export-startdir: Distinguishes between user-picked folders and auto-predefined folders, and selects the best starting directory for export dialogs. Clipboard & Unicode helpers: • NV-ascii-only / NV-for-copy: Optionally strip non-ASCII characters from strings when Unicode is off, guaranteeing safer plain-text copies. • NV-clipboard-put (two variants): One variant writes via a temporary file piped throughcmd | clip, the other uses COM (htmlfile object) to push text to the Windows clipboard directly. • NV-help-lines: Constructs the full list of help lines (start folder rules, commands, operations, predefined folder states) using bullet symbols depending on Unicode mode. • NV-help-copy-selected / NV-help-copy-all / NV-help-copy-path: Read list box selection, map indices to help lines, and copy text or start folder path to clipboard, updating the Unicode status label in the dialog. • NV-help-toggle-unicode: Flips Unicode mode on/off, regenerates the help lines, repopulates the list, and updates the “Unicode: On/Off” status text. DCL / UI helpers: • NV-write-dcl: Dynamically writes a DCL file containing both the main options dialog (ExpImpNVU_PREDEF_FIX) and the help dialog (NV_HelpDlg). • NV-help-dialog: Loads the help dialog from the DCL, fills the list with help lines, wires up copy/toggle buttons, and runs the modal session. • NVUI_show: Top-level UI builder and runner for the main options dialog; initializes radio buttons, popup list, and helper buttons (Explorer, Notepad++, Reload, Help), then returns 1 (OK) or 0 (Cancel). • NV-on-accept: Reads user selections from the main dialog (mode + predefined index), updates globals, and closes the dialog with success code. ViewsIO / Registry helpers: • NV-write-viewsIO-startdir: Writes the chosen import folder to the JTBWorld viewsIO registry key so the external tool will default there. • get-persisted-folder / save-persisted-folder: Minimal key/value reader/writer for the viewsIO registry path.
NamedViewList
• NVL-len — Wrapper for strlen to get string length • NVL-up — Uppercases strings using strcase for case-insensitive operations • NVL-trim — Trims leading and trailing spaces from a string without using vl-string-trim • NVL-strcmp — Lexicographic string compare (case-sensitive) returning -1, 0, or 1 • NVL-cicmp — Case-insensitive comparator built on NVL-strcmp and NVL-up • NVL-sort — Insertion sort utility that sorts a list using a comparator function symbol • NVL-filter — Filters a list by predicate function symbol, returning only items that match • NVL-pos — Returns zero-based index of an item in a list or nil if not found • NVL-any — Returns T if any element in a list satisfies the predicate function • NVL-replace-char — Replaces all occurrences of one character in a string with another • NVL-parse-indexes — Converts list_box selection string (space/comma separated) into a list of integers • NVL-del-view — Safely deletes a named view by name via ActiveX (vla-item / vla-delete) • NVL-zoom-view — Zooms to a named view using Document.ActiveViewport.SetView and reapplies viewport • NVL-fill-list — Populates the list_box with the current filtered view list and updates the count label • NVL-apply-filter — Applies the current filter text and case-match setting to update viewFiltered and the UI • NVL-rename-at-index — Renames a view at a specific filtered index, checks for name conflicts, runs RENAME, and refreshes lists • *error* — Global error handler that reports errors (except cancel/exit), unloads dialog, deletes temp DCL, and exits cleanly
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.
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.
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.
FixLineTextOverlap
Helper for X spacing: • ++rarify: Takes a list of X coordinates and a minimum spacing value and produces a new list where each successive value is at least that spacing apart, preserving overall order. Text overlap helpers: • getRec: Builds a record (ename type isLeft ipWCS) for each TEXT or MTEXT, computing a consistent world coordinate insertion point based on alignment. • setIP: Converts a new world insertion point back into the entity coordinate system and updates the proper DXF group (10 or 11) for TEXT or MTEXT, then calls ENTUPD. • group-by-y: Sorts records by Y coordinate and clusters them into groups where Y differences are below a given tolerance, to represent per row stacks of labels. • order-side: For a given side relative to the rail finds the closest item as anchor then orders the remaining items from near to far so spacing is applied outward. • place-side: Applies incremental offsets of spacing along one side, leaving the anchor fixed and moving later items step by step, then writes all new positions back with setIP. System helpers and globals: • Global *distance*: Holds the spacing distance chosen in Line_Overlap and reused by Text_Overlap and the combined runner. • Global *lastPick*: Stores the last crank point used in Line_Overlap so Text_Overlap can reuse its X coordinate as a default rail. • Local *error*: The Line_Overlap routine redefines *error* to ensure that an UNDO group is ended and that error messages are printed cleanly when something goes wrong.
SetUpUnits
Helper Functions Used: • setunits — main worker function at the top of the file; it connects to the Civil 3D COM object, gets the active document settings and writes the selected CS code, drawing scale, angular units and drawing units into DrawingSettings → UnitZoneSettings. • getaeccApp (defined inside setunits) — looks in the Windows registry for the installed Civil 3D “Aecc” library (e.g. “AeccXUiLand”) and returns the correct COM object, so the code works across Civil 3D versions. • The command c:settupunits itself — builds the DCL on the fly using (open), (write-line), loads it, shows it, and then calls (setunits …) if the user pressed OK. • A large internal list called something like zoneDB that stores pairs/triples of “Country / Coordinate system codes” — this is used to fill the two popup lists (country and zone).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.

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.
Export Import Custom MS_UCS
Helper Functions / Utilities: • EI-isStr, EI-trim, EI-split, EI-unique — string and list utilities for trimming spaces, splitting by “;” or “,”, removing duplicates while keeping order. • EI-last-dir, EI-set-last-dir — remember the last used folder and reuse it next time the user exports/imports. • EI-onedrive-roots — discovers all possible OneDrive root folders from environment and registry. • EI-resolve-under-any-root — tries to append a subfolder to every discovered OneDrive root and returns the first that really exists. • EI-build-predefs — builds the list of “Project_00X_UCS_export” folders and stores the resolved paths in *EIUCS_predef_values*. • EI-write-dcl — generates 2 DCL dialogs: the main “ExpImpUCS” and the “EI_HelpDlg”. • EI-help-lines — builds the text lines that appear in the Help dialog (start folder, LSP path, operations list, predefined folders with “(selected)” marker). • EI-clipboard-put — copy text to Windows clipboard using temp file + cmd or using COM htmlfile, depending on version in the file. • EI-open-explorer-fixed, EI-open-npp-fixed — buttons in the dialog that open the fixed LSP folder or the LSP file in Notepad++. • EI-main-dialog — shows the main “Export / Import UCS” dialog, wires all action tiles, and stores the user’s last selection.
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).
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.
Text2Multileader_00
- • rjp-getbbwdth — gets an object’s bounding box and returns a width estimate by measuring the horizontal span between the lower-left corner and the upper-right X at the same Y.
- • vl-sort + insertion point pairing — builds (insertionpoint . text) pairs and sorts them by insertion point Y to determine concatenation order.

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

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.

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.

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.

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.

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.

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

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.

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.

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

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.

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.

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.

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

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

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

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

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.

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.

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.

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.

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.

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.

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.

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.

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.
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*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 entityCopy_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.
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.
