CIN LISP: Erase Entities Inside a Polyline Boundary (Free AutoLISP Download)
CIN ("Clear Inside") erases every entity located *inside* a selected closed polyline boundary, for example, clearing survey points or text that fall inside a building footprint before further processing. It is the companion tool (and exact inverse) of KEEPIN-bgol (KIN), which erases everything *outside* a boundary instead.
CLRIN-bgol (Erase Entities Inside a Polyline Boundary)
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 boundary-based selective erase utilities used in CAD 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
CIN ("Clear Inside") erases every entity located *inside* a selected closed polyline boundary, for example, clearing survey points or text that fall inside a building footprint before further processing. It is the companion tool (and exact inverse) of KEEPIN-bgol (KIN), which erases everything *outside* a boundary instead.
How to Use
- Load
CLRIN-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
CINat the command line and press Enter. - At the
Select boundary polygon:prompt, click the closed polyline that defines the area you want cleared. - The routine tests every other entity in the drawing against that boundary and erases anything whose reference point falls inside it. The boundary polyline itself is left untouched.
Why Use It
- Efficiency, automates erasing entities inside a boundary, saving time versus manually selecting and deleting each one individually.
- Accuracy, uses the exact defined polygon boundary (even if irregular/complex) to precisely determine which entities to erase, no guesswork with crossing/window selection.
- Streamlined Workflow, simplifies drawing cleanup tasks that would otherwise require careful manual selection to avoid deleting entities outside the intended boundary.
Where to Use It
- Clearing survey point data (elevation text, coordinate markers) that falls inside building footprints or structures, where such points are not relevant to represent.
- Cleaning up drawing areas inside a defined boundary before inserting new content (e.g., a building plan, a table, or other detail).
- Any drawing cleanup task where entities within a specific (possibly irregular) boundary need to be removed without disturbing content outside it.
Notes
- Entity "location" is approximated using its primary insertion/start point (DXF group 10). Very large or oddly-shaped entities are tested by that single reference point, not their full extents.
- Uses a standard ray-casting point-in-polygon algorithm against the boundary's vertex list, correctly handling irregular (non-rectangular) boundaries.
- See also the companion tool KEEPIN-bgol (
KIN), which performs the opposite operation, erasing entities *outside* a boundary instead. - 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
CIN is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Entity "location" is approximated using its primary insertion/start point (DXF group 10). Very large or oddly-shaped entities are tested by that single reference point, not their full extents.
Efficiency, automates erasing entities inside a boundary, saving time versus manually selecting and deleting each one individually.
Yes. CIN 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 CLRIN-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type CIN 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.