AutoTrimExtendLines

Short description

🚀 AutoCAD AutoLISP trim and extend utility with a DCL dialog for trimming, extending, and cleaning selected drawing geometry to bounding edges.

Command:

TTT
TTTCLEAR

Description:

🚀 AutoTrimExtendLines is an AutoCAD AutoLISP productivity tool for automatic trim and extend workflows using selected bounding edges and selected objects to modify.

🧰 The main command TTT opens a custom DCL dialog named Touch / Trim-Extend to Edge v4. From the dialog, the user picks bounding edges, picks the objects to modify, chooses Trim only, Extend only, or Trim and Extend, then applies the operation interactively.

📐 The routine uses ActiveX IntersectWith geometry logic to find intersection points between boundary objects and objects to modify. It then moves the nearest start or end point of supported geometry to the computed trim or extension point.

🔄 Apply keeps the dialog open, allowing repeated editing without restarting the command. OK applies the operation and closes the dialog. Cancel exits safely and clears all temporary highlighting.

🧠 The tool is designed for AutoCAD and Civil 3D drafting cleanup tasks where multiple linear or curve objects must be extended or trimmed to one or more reference edges.

Helper function: (if any)​

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

Functionalities:

✅ Key functionalities:

🚀 DCL-based trim and extend control panel for AutoCAD and Civil 3D.
📐 Three operation modes: Trim only, Extend only, and Trim and Extend.
🧱 Separate selection workflow for bounding edges and objects to modify.
🔍 Supported bounding edges include LINE, LWPOLYLINE, POLYLINE, ARC, CIRCLE, SPLINE, and ELLIPSE.
✏️ Supported editable objects include LINE, LWPOLYLINE, POLYLINE, ARC, and SPLINE.
🟡 Live selection highlighting with redraw mode 3 and highlight cleanup with redraw mode 4.
🔄 Apply button processes edits and reopens the dialog with selections preserved.
↩️ Undo Last button reverses the last operation using AutoCAD UNDO 1.
🧾 Debug log list inside the dialog shows processed objects, intersections, distances, modified counts, and skipped objects.
📋 Copy Log to Clipboard exports the debug log for troubleshooting and documentation.
💾 Dialog position memory stores the last DCL window location during the AutoCAD session.
🧹 Temporary DCL file is created, loaded, unloaded, and deleted safely on every dialog loop.
🔒 Error handling clears highlights, unloads the dialog, deletes temp files, and ends undo marks safely.

Result:

🎯 Result:

AutoTrimExtendLines provides a faster CAD cleanup workflow for extending and trimming selected geometry to bounding edges. The user can pick boundary objects, pick objects to modify, apply the operation, review the debug result, undo if needed, and continue working from the same dialog.

Images, animations etc.

Pixel

XAML code:

Comming soon ...

Share this page:

Page Tag: 🏷️ AutoLISP

  • AutoTrimExtendLines

    Short description🚀 AutoCAD AutoLISP trim and extend utility with a DCL dialog for trimming, extending, and cleaning selected drawing geometry to bounding edges. Command:TTT TTTCLEAR Description:🚀 AutoTrimExtendLines is an AutoCAD AutoLISP productivity tool for automatic trim and extend workflows using selected bounding edges and selected objects to modify. 🧰 The main command TTT opens a…

  • SetPlotDeviceNames

    Short description🖨️ SetPlotDeviceNames is an AutoCAD/Civil 3D AutoLISP DCL manager for batch editing layout plot devices, page setups, paper sizes, viewport locks, annotation visibility, and zoom settings. 📐 It provides filtered layout selection, synchronized columns, per-column horizontal scrolling, and apply tools for production plotting workflows. Command:🚀 Main command: SetPlotDeviceNames 🔍 Layout filter: supports * and…

  • DuplicateLayouts

    Short description📄 DuplicateLayouts is an AutoCAD and Civil 3D AutoLISP utility for duplicating layout tabs from a dialog-driven workflow. 🔁 It lets CAD users select one or more existing paper-space layouts, assign copy counts, create unique layout names automatically, and manage layout duplication without manually repeating the AutoCAD LAYOUT Copy command. Command:🚀 Main command: DuplicateLayouts…

  • LayoutTools

    LayoutTools

    Short description🧰 LayoutTools is an AutoCAD and Civil 3D AutoLISP layout management dialog for zooming layouts, locking and unlocking viewports, and toggling ANNOALLVISIBLE. 📑 It supports filtered layout selection, selected or all-displayed scope, viewport lock status, annotation visibility status, zoom status tracking, clipboard copy, and batch paper-space operations. Command:🚀 Main command: LayoutTools 🔁 Alias command:…

  • LayerCreation

    Short description🧱 LayerCreation is an AutoCAD and Civil 3D AutoLISP tool for creating or updating layers with color, linetype, lineweight, transparency, and default object settings. 🎨 It supports ACI colors, RGB true color, color books, a DCL dialog, and a reliable command-line fallback. Command:🚀 Main command: LayerCreation ⌨️ Command-line fallback: NEWLAYERCLI 🎨 Layer fields: Name,…

  • 3DPolyVertex2Table

    Short description🧩 3DPolyVertex2Table creates an AutoCAD table containing the X Y and Z coordinates of every vertex from a selected 3DPolyline. 🔢 The selected polyline vertices are marked in the drawing with matching numeric labels and small red circles. 📋 After the coordinate table is generated the user places it at the required drawing location.…

  • PLTools

    Short description🧩 PLTools is a large AutoCAD and Civil 3D AutoLISP polyline editing toolbox containing more than thirty callable commands. 🧰 The suite covers vertex insertion reduction deletion and movement segment conversion polyline joining reversing 2D and 3D conversion chain selection segment information centerline style geometry and other advanced polyline operations. 🎛️ PL-MENU and PLTOOLS-MENU…

  • OffsetAndLayer

    Short description🧩 OffsetAndLayer offsets selected planar curve objects inward or outward by a chosen distance and assigns the new offset geometry to a selected drawing layer. 🎛️ A DCL dialog provides Inward or Outward direction offset distance layer name filtering and a layer dropdown. 💾 The last offset value selected layer and direction are stored…

  • MiddleLinePolylines_2

    Short description🧩 MiddleLinePolylines_2 provides the CPL_2 command for generating a simple two vertex centerline between two open curves. 📍 The routine averages the start points of the first and last selected curve and averages their end points. 📐 A new two vertex LWPOLYLINE is created in ModelSpace from those two midpoint positions. Command:Main command: CPL_2…

  • MiddleLinePolylines

    Short description🧩 MiddleLinePolylines provides the CPL command for creating a centerline between two selected open AutoCAD curves. 📐 The current version accepts general open vlax curve objects such as LINE LWPOLYLINE POLYLINE SPLINE and ARC rather than only polylines. 🧠 The algorithm uses temporary curve copies offsets lofted geometry and geometric intersection processing to derive…