Hatch only between a close polyline and offset


I am working on a Dynamo script that can offset the existing buildings and hatch the area between the original polylines and the offset area. I got the offset to work but i am not sure how to approach the hatch. If i collect all the polylines then i end up with a hatch of the building and another hatch of the offset. Any ideas?

1 Like

You might need to run it a couple of times but it should work. You don’t actually need the second polyline to create the hatch.


Thank you Paolo for the input. I want to run the script on many bldg footprint all at once. A recreated the dynamo script based on your image but it seems to work well on simple shapes but once the bldgs polyline have many segments it doesn’t work. i get errors in the script. test.dwg (403.2 KB)

Bldgs-Offset&Hatch2.dyn (21.8 KB)

Hi @csanchez,

I see that the closed AutoCAD polylines are not converted to geometry. I ignored this limitation with a little Dynamo gymnastics and it works.

Bldgs-Offset&Hatch2_GO.dyn (47.4 KB)

Thank you Ge0rges for the input. the script works well for a single object pick but what i want to do is to select multiple objects all at once. this script is to reduce the time my cad users use to hatch with an offset multiple building captured form gis data, so we are talking about an averag of 100 building that are in one layer. When i modified the script to select all the objects within the layer i get very weir results.

Bldgs-Offset&Hatch2_GO.dyn (153.1 KB)

@csanchez here you go. This should work for multiple polylines. Pay attention to the note at the end about running the graph several times.

OffsetHatch.dyn (46.1 KB)

1 Like

Make sure that just the polylines are selected. If in the selection list there are other elements the errors will appear.

No sure whats the issue in my end Ge0rges, the layer only has polylines but the offset if randomly done.

One thing to mention is that the polylines are done bu the extraction of shp files from gis. That’s the reason of the number of segments in some places where a straight line would do draft buy an user

Mzjensen, tthak you for your input. i run the graph but no hatch was done instead with i zoom into the graph the lines are offset randomly. the origin of the lines are shp files from gis exported as polylines and therefore multiple segments are in areas where straight lines would be prefer. i am not sure if thats the reason for such a weir result. I was thinking that maybe trying to hatch the building area, offset the building and then trim it would work better. is that possible to be done in dynamo? i don’t see a trim hatch node.

This will only work with closed polylines. You’re going to have a difficult time automating the process if the polylines are not closed to begin with. Whatever method you end up using, I recommend coming up with a way to turn the buildings into individual, closed polylines. For example, if you are using MAPIMPORT with the .SHP files, check the box that says “Import polygons as closed polylines”.


Thank you Mzjensen, i tried importing the shp files with the close polylines and run the graph again but the input seems file and when try to get the geometry i get null for all.

gis-bldgs.dwg (659.7 KB)

It’s likely because you have coincident points in the polylines that prevents the correct extraction of the geometry.

gis-bldgs.dwg (1.6 MB)

For the closed polylines with coincident points, here is a different approach.
The big challenge is the poor quality of some polylines that have multiple vertex colinear that alters the hatch. Ideally, these polylines should be simplified by reducing the number of vertex (e.g. command MAPCLEAN in Civil3D).
Once launched the script waits about 10 minutes to complete the operation (for your project). The script relaunch with modified values will have to work well, but there will be hatches hidden in the model space ( binding ?) .
I advise you to test with 4 or 5 buildings before applying on the big project.

Bldgs-Offset&Hatch3_GO.dyn (653.7 KB)

1 Like

Thank you George. your solution works very well

George, your script worked easily and quickly for me. Big thanks from the City of Kelso. This will be a big help with my city base file.

For a beginner like me, it’s gratifying to know that my little contribution helps you. Thank you so much!