CWW LISP: Recreate Polygon Clockwise (Free AutoLISP Download)
CWW rebuilds a closed polygon so its vertices run clockwise, starting from a point you specify. Many survey and GIS systems require boundary polygons wound in a specific direction; a polygon drawn or imported with the opposite winding can fail validation or produce incorrect area-sign results downstream. CWW determines the current winding, reverses it if necessary, and rotates the vertex order to start exactly where you want.
CWWIND-bgol (Recreate Polygon Clockwise)
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 polygon-winding normalization utilities used in survey/GIS 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
CWW rebuilds a closed polygon so its vertices run clockwise, starting from a point you specify. Many survey and GIS systems require boundary polygons wound in a specific direction; a polygon drawn or imported with the opposite winding can fail validation or produce incorrect area-sign results downstream. CWW determines the current winding, reverses it if necessary, and rotates the vertex order to start exactly where you want.
How to Use
- Load
CWWIND-bgol.lspinto your CAD session (drag-and-drop the file onto the drawing window, or use theAPPLOADcommand). - Type
CWWat the command line and press Enter. - Select a closed polyline (the routine requires the Closed property to already be set, it will abort with a message otherwise).
- Specify a starting point; the nearest existing vertex to that point becomes the new starting vertex.
- The routine erases the original polyline and creates a new one, starting from that vertex, with all vertices traversed clockwise, on a dedicated layer,
BGOL-CWW(colour blue).
Why Use It
- Ensures compliance with survey/GIS system requirements that mandate clockwise-wound polygons, avoiding validation failures or sign- convention errors downstream.
- Gives explicit control over both the winding direction and the starting vertex, useful when a specific starting point (e.g., a legal boundary's point of commencement) is required by convention.
- Removes the need to manually determine a polygon's current winding direction and manually reverse/rebuild it by hand.
Where to Use It
- Preparing land parcel boundaries or survey polygons for export to systems that require a specific (clockwise) winding convention.
- Standardizing polygon direction across a drawing or dataset where mixed winding directions would cause inconsistent area sign results or GIS import issues.
- Any survey/cadastral workflow needing to enforce a specific starting point and winding direction on boundary polygons.
Notes
- Winding direction is computed with the shoelace (signed area) formula; the routine automatically reverses the vertex order when needed so the result is always clockwise, regardless of how the original was drawn.
- The original entity is deleted and replaced, if you need to keep the original for comparison, copy it first.
- 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
CWW is a standard AutoLISP routine, so it runs in AutoCAD, BricsCAD, ZWCAD, and most other AutoLISP-compatible CAD platforms without modification.
Winding direction is computed with the shoelace (signed area) formula; the routine automatically reverses the vertex order when needed so the result is always clockwise, regardless of how the original was drawn.
Ensures compliance with survey/GIS system requirements that mandate clockwise-wound polygons, avoiding validation failures or sign- convention errors downstream.
Yes. CWW 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 CWWIND-bgol.lsp onto your open drawing window, or load it through the APPLOAD command, then type CWW 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.