SNJP LISP: Snap Text to Junction Point (Free AutoLISP Download)
SNJP snaps junction-number text (drainage, water, or road-network node labels) to the nearest polyline endpoint, precisely aligning annotation with the network geometry it describes. If two or more labels compete for the same nearest endpoint, SNJP doesn't guess, it flags them instead, recoloring them red on a dedicated layer so you can resolve the conflict manually.
JXNSNAP-bgol (Snap Text to Junction Point)
Command Type: AutoLISP routine (works in AutoCAD, BricsCAD, ZWCAD and most AutoLISP-compatible CAD platforms)
Developed by: BGol Community, bgol.in
Inspired by the general concept of nearest-endpoint text snapping utilities used in CAD network/infrastructure drafting. This is an original, independently written routine, new file name, new command name, new source code, created so the CAD community has a free, editable, open-source alternative.
Overview
SNJP snaps junction-number text (drainage, water, or road-network node labels) to the nearest polyline endpoint, precisely aligning annotation with the network geometry it describes. If two or more labels compete for the same nearest endpoint, SNJP doesn't guess, it flags them instead, recoloring them red on a dedicated layer so you can resolve the conflict manually.
How to Use
- Load
JXNSNAP-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
SNJPat the command line and press Enter. - Select the junction-number text entities you want to snap.
- Select the candidate polylines (the network lines) to snap to.
- Enter a search radius when prompted (defaults to
5.0drawing units). - Each text entity is moved to its nearest polyline endpoint if that endpoint is within range and not contested by another text. Any text whose nearest endpoint is shared with another text is left in place and switched to layer
BGOL-SNJP-FLAG(colour red) for manual review.
Why Use It
- Time-saving, automates aligning many junction-number labels to their correct polyline endpoints, eliminating tedious manual snapping in complex polyline networks.
- Improved accuracy, ensures text is precisely aligned to the actual network geometry, reducing risk of mislabeled or ambiguously-placed junction annotation.
- Conflict detection, proactively flags ambiguous cases (multiple texts near one endpoint) rather than silently guessing, preventing overlapping annotations.
Where to Use It
- Annotating utility or drainage network junctions with numbers that must align exactly to network node locations.
- Cleaning up survey or infrastructure drawings where junction labels have drifted from their true node positions.
- Any network-diagram QA pass verifying and correcting label-to-node alignment.
Notes
- Endpoints considered are each candidate polyline's start and end point; intermediate vertices are not currently checked.
- The search radius limits how far a text can move, text with no endpoint within range is left untouched.
- Flagged (ambiguous) text keeps its original position; only its layer and colour change, so nothing is silently mis-snapped.
- Source code is fully open, feel free to study, modify, and redistribute it under the same open, free-for-all spirit.
Credits
Developed and shared for the CAD community by BGol Community. Website: https://bgol.in/ Free and open-source, use it, modify it, share it, for personal or commercial work alike.
Frequently Asked Questions
SNJP is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Endpoints considered are each candidate polyline's start and end point; intermediate vertices are not currently checked.
Time-saving, automates aligning many junction-number labels to their correct polyline endpoints, eliminating tedious manual snapping in complex polyline networks.
Yes. SNJP is fully open-source and free to use, modify, and redistribute for both personal and commercial work, developed and shared by the BGol Community.
Drag and drop JXNSNAP-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type SNJP at the command line to run it.
๐ค About BGol Community
BGol Community of Advanced Surveying builds and shares free, open-source tools for the survey and CAD drafting community.
๐ Made with โค๏ธ by BGol Community of Advanced Surveying
Free, open-source, and built for the CAD community, for personal or commercial use, always.