26.03.2013 - updated release, completely rewritten, major bugfixing
This Autolisp routine is intended primarily for a Dwg to Gis conversion. See if it fits your needs.
It recreates boundaries around all the hatch patterns in a drawing at once. The recreated boundaries are drawn in new layers and consist only of single closed polylines (interpreted as polygons by Gis applications). Each curved element of the boundary is converted to a segmented polyline and finally all these pieces are combined into one.
The outcome might be not identical to the original hatch outline, since it has to be considered as an approximation. Anyway, this is exactly the same process used by common desktop Gis when importing drawings.
Tested on Autocad 2012.
- creates single closed polyline boundaries (Gis polygons)
- assigns the hatch color to the boundary
- draws in new layers called as the source layer of the hatch, plus a custom suffix
- deletes or keeps all the previous associated boundaries
- handles every kind of known geometry in a boundary (elliptic arcs, circles...)
In Autocad, load it from Tools menu > AutoLISP > Load application
Usage: type BULKRHB in the command-line
Example (click on the images to enlarge)
Hatch on layer "0" (without boundary)
All the hatch outline pieces (HATCHGENERATEBOUNDARY command result)
(BULKRHB performed: 3 closed polylines on layer "0_BOUNDARIES")