GAPC LISP: Find Open Polygon / Find Open Polylines (Free AutoLISP Download)
GAPC addresses a common AutoCAD quirk: a polyline can visually look closed (its first and last points coincide) while its internal Closed flag is still set to false, meaning it is technically an open polyline. Exporting such "fake closed" polygons to GIS or Land Records systems can cause import failures or incorrect topology. GAPC checks each selected polyline's actual Closed flag and visually marks exactly where any open polyline's gap begins.
GAPCHECK-bgol (Find Open Polygon / Find Open Polylines)
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
GAPC addresses a common AutoCAD quirk: a polyline can visually look closed (its first and last points coincide) while its internal Closed flag is still set to false, meaning it is technically an open polyline. Exporting such "fake closed" polygons to GIS or Land Records systems can cause import failures or incorrect topology. GAPC checks each selected polyline's actual Closed flag and visually marks exactly where any open polyline's gap begins.
How to Use
- Load
GAPCHECK-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
GAPCat the command line and press Enter. - Select the polylines to check.
- Press Enter to finish the selection.
- Every polyline found to be open (Closed flag not set) is marked with a circle at its start point, on a dedicated layer,
BGOL-GAPC(colour red).
Why Use It
- Targets a specific, easy-to-overlook issue, polygons that appear closed on screen but are not truly closed at the entity level.
- Visual, not just textual, draws a marker exactly where the problem is, rather than just reporting "this entity is open" in text.
- Prevents downstream failures, avoids GIS/Land Records import errors that require genuinely closed polygon topology.
- Fast batch checking, checks many selected polylines in one command run.
Where to Use It
- Pre-export quality assurance for any CAD-to-GIS or CAD-to-Land-Records workflow, where polygon topology must be genuinely closed.
- Land parcel, building footprint, or zoning boundary drawings before handoff to a GIS system.
- Any drafting QA step needing quick, visual identification of improperly closed polygons across a whole drawing or selection.
Notes
- Checks the actual Closed flag (DXF group 70, bit 1) via
entget, not just whether the first and last points visually coincide, this is exactly the distinction that matters for GIS/Land Records import. - Marker circle radius defaults to 1.5 drawing units; edit the
*bgol-gapc-radius*constant near the top of the .lsp file to change marker size. - Works on LWPOLYLINE entities; the selected polylines themselves are never modified, only marked.
- 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
GAPC is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Checks the actual Closed flag (DXF group 70, bit 1) via entget, not just whether the first and last points visually coincide, this is exactly the distinction that matters for GIS/Land Records import.
Targets a specific, easy-to-overlook issue, polygons that appear closed on screen but are not truly closed at the entity level.
Yes. GAPC 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 GAPCHECK-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type GAPC 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.