GPF LISP: Flag Open Polygons (Free AutoLISP Download)
GPF scans a selection of polylines and detects which ones are open (start point does not coincide with end point). Each open polygon's exact gap is flagged with a connecting line plus a circle marker, making it fast to spot and fix boundaries before running area, hatch, or boundary operations that require closed geometry.
GAPFLAG-bgol (Flag Open Polygons)
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 open-polygon detection utilities used in CAD/survey 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
GPF scans a selection of polylines and detects which ones are open (start point does not coincide with end point). Each open polygon's exact gap is flagged with a connecting line plus a circle marker, making it fast to spot and fix boundaries before running area, hatch, or boundary operations that require closed geometry.
How to Use
- Load
GAPFLAG-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
GPFat the command line and press Enter. - Select the polygons (closed or potentially-open polylines) to check.
- Every open polygon found has its gap marked with a straight line between the two endpoints plus a circle centered on the gap, on a dedicated layer,
BGOL-GPF(colour red). Properly closed polygons are left completely unmarked. - The command line reports how many polylines were checked and how many open gaps were flagged.
Why Use It
- Improved workflow, quickly identifies open polygons before running further operations, saving time versus manually zooming into each shape.
- Enhanced accuracy, avoids errors caused by treating an open polyline as if it were closed (e.g., inaccurate
AREAorBOUNDARYresults). - Streamlined operations, ensures a batch of polygons is properly closed and ready for tasks that require closed geometry.
Where to Use It
- Drawing cleanup: sweep through a batch of polygons and immediately spot which ones need their gaps closed.
- Quality assurance checks before running area calculations, hatching, or boundary-dependent operations that require fully closed polygons.
- Preparing survey or site boundary drawings for further analysis, ensuring no unintended gaps remain in the polygon set.
Notes
- A polygon is flagged only if its DXF
Closedflag is not set and its actual start/end points don't coincide within a small tolerance, this avoids false positives on entities that are closed but whose flag happens to read oddly. - The marker circle's radius scales with the gap size so tiny gaps are still visible and large gaps aren't overwhelmed by an oversized circle.
- 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
GPF is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
A polygon is flagged only if its DXF Closed flag is not set and its actual start/end points don't coincide within a small tolerance, this avoids false positives on entities that are closed but whose flag happens to read oddly.
Improved workflow, quickly identifies open polygons before running further operations, saving time versus manually zooming into each shape.
Yes. GPF 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 GAPFLAG-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type GPF 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.