Extract Geometry of Overlapping Polylines

Hello,

I am working on a graph where the user can select two different sets of polylines and have dynamo extract the overlapping geometry. The graph will then insert a hatch/polyline into C3D for the overlapping geometry. The typical workflow for us where this graph would be applied is determining the impervious areas within a drainage area boundary for stormwater design calculations.

I have attached a sample DWG that includes one set of polylines representing impervious area and another representing drainage area boundaries. The graph I have set up works great if the user wants to individually add the overlapping geometry to C3D (i.e. select one drainage area polyline, select one overlapping impervious area polyline, run the graph, overlapping geometry is added to C3D).

This alone can speed up the workflow of manually working with hatches in C3D. However, this graph has the potential to save huge amounts of time if it can be adjusted to extract all of the overlapping geometries for each drainage area at once.

Image A shows the sample polylines in C3D

Image B shows the selection of one drainage area boundary and one overlapping impervious polyline

Image C shows the result from Image B. A hatch and polyline are added for the overlapping geometry.

Image D shows the selection of one drainage area boundary and multiple overlapping geometries.

Image E shows the result from Image D. The same geometry from Image C is added. Additional overlapping areas are not incorporated.

This gets to where I need assistance. The Geometry.Intersect node is only set up to compare two geometries. I need to set up a loop structure that compares each drainage area polyline to all of the impervious area polylines. The overall end goal would be to have the user select all the impervious area polylines, select all the drainage area boundary polylines, run the graph, and have all overlapping geometries added to C3D. My assumption is that this can be done. I am just stuck on how to proceed. Any help is greatly appreciated. I am very excited about this graph.

JJH_Polyline_Intersections_rev0.dyn (31.4 KB)

TEST.dwg (901.7 KB)

Hi @hestingjj,

I haven’t looked closely at your setup, but here are a few thoughts. There was another similar post awhile ago, not sure if it helps or if you’ve looked at it already.

And then for this…

Have you tried the Geometry.IntersectAll node?

Here is my take.
JJH_Polyline_Intersections_rev1 km.dyn (152.4 KB)

1 Like

Here is a better version. I was running into issues the first time so I did a Overkill command but that set me back I think so I ran the script on your original dataset and almost got it but there were a couple of closed polys that Dynamo didn’t like so you kind of have to manually diagnose each null object that comes up. I fixed those by just setting closed option to “no” in the properties panel.
JJH_Polyline_Intersections_rev2 km.dyn (205.3 KB)
TEST v2.dwg (1.2 MB)

1 Like

This would have been really useful to have back when I worked in private development! Great job Kirk. Trying to figure out how on earth you did this. :joy:

1 Like

Just curious, why do you use function.apply instead of just plugging directly into the .GetGeometry nodes. Is this better practice?

It’s a trick I’ve just started using, in this case I’m using it to suppress the warning about the large coordinate system and it wanting the user to set to extra large geometry scaling. Once I got to the hatch I tried the function.apply but that didn’t work because the hatch node wanted other inputs so you are still left with one of those warnings at the end. :man_shrugging:

1 Like

Oh! Cool trick. Thanks for sharing. Yeah, I noticed when I increased geometry scaling the script didn’t work properly, so I guess there is no way around it in this case. I’ll keep that in my back pocket.

I could also see this script being improved further by outputting the impervious and pervious areas of each drainage basin into an excel or autoCAD table. Perhaps a custom property/object data could be associated with the boundary polylines for naming purposes.

You can still use Function.Apply with nodes that require multiple inputs. In your case it would look like this.

2 Likes

Thanks Kirk. Here is my take. I was able to get the same information with my graph by making a couple of adjustments. Two good options for users.

JJH_Polyline_Intersections_rev1.dyn (50.4 KB)

I was getting a couple of weird things going on initially, but I just tried again and the function.apply seems to be ignoring the list level for the boundary and is making one large hatch instead of individual ones. One way around this I suppose it using list.chop and I then get multiple hatches again.


JJH_Polyline_Intersections_rev3.dyn (218.5 KB) TEST v3.dwg (1.2 MB)
I messed around with the script for practice and also got it to label the areas and generate a table. I wasn’t able to export the table to excel, I think it’s an issue with my navisworks installation oddly enough. To get this to work I had to define a property set that I named “Additional Properties” and a property named “Name” and attach it to the drainage boundary lines. Then I was able to number them in the script.

I noticed that the C3D Toolkit has nodes for creating these property sets but I couldn’t for the life of me get them to work. Idealy you wouldn’t have to manually create the property set in C3D prior to running the script. Not sure if anyone has more experience utilizing those nodes. (Also sorry for the mess, I’m still quite novice at Dynamo).

1 Like

I was trying to implement the same to suppress the warning, this will be really handy when you are sharing scripts with team to run from Dynamo player and player pops up error message after run. so user might not be sure to ignore the message or there is a serious error in script. but seems like we cant get rid of coordinate error completely.

1 Like