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:

Tags: ๐Ÿท๏ธ ActiveX AutoCAD, ๐Ÿท๏ธ AutoCAD, ๐Ÿท๏ธ AutoCAD arc edit, ๐Ÿท๏ธ AutoCAD clipboard log, ๐Ÿท๏ธ AutoCAD DCL dialog, ๐Ÿท๏ธ AutoCAD debug log, ๐Ÿท๏ธ AutoCAD extend lines, ๐Ÿท๏ธ AutoCAD geometry cleanup, ๐Ÿท๏ธ AutoCAD line cleanup, ๐Ÿท๏ธ Autocad Lisps, ๐Ÿท๏ธ AutoCAD polyline edit, ๐Ÿท๏ธ AutoCAD productivity tool, ๐Ÿท๏ธ AutoCAD spline edit, ๐Ÿท๏ธ AutoCAD trim extend, ๐Ÿท๏ธ AutoCAD trim lines, ๐Ÿท๏ธ AutoCAD undo workflow, ๐Ÿท๏ธ AutoLISP, ๐Ÿท๏ธ AutoTrimExtendLines, ๐Ÿท๏ธ CAD drafting automation, ๐Ÿท๏ธ CAD_menu, ๐Ÿท๏ธ Civil 3D LISP, ๐Ÿท๏ธ extend to edge, ๐Ÿท๏ธ IntersectWith AutoLISP, ๐Ÿท๏ธ LISP DCL tool, ๐Ÿท๏ธ Touch LSP, ๐Ÿท๏ธ trim to boundary, ๐Ÿท๏ธ TTT command, ๐Ÿท๏ธ TTTCLEAR command, ๐Ÿท๏ธ Visual LISP COM