Keep Intersecting Curves


I would like to compare 2 curves but remove the one that overlaps.

Geometry.DoesIntersect has given odd results.

Room boundary has 5 curves (door opening removed as expected) - good
Room bounding at cabinetry has 1 curve which - good.

I filter the two, but the output is not as expected, as the Geometry does intersect is reporting more than one curve?.

My desired output is 6 curves (shown in pink):
(room boundary curves without door opening) - (cabinetry intersect at room boundary)

Is there something that I am missing?

Thank you.

1 Like

Hey @Dynamo_Ann , could you also mark which line in watch 3D node corresponds to which index in the first list? And if the location of cabinetry line is different from what’s shown in Test Room image then could be helpful to mark that as well.

I tried to recreate your problem and it worked for me.

Your original list of curves only has 5 lines, which means the cabinet isn’t splitting those lines yet (the right side wall is one line). I think you have the wrong line selected. It looks like the right side wall is the line you’re using, which would intersect with the two lines it connects to and itself, as it seems to be doing.

Thank you for the replies, I really appreciate it.

@YashRathore You were right. I was not finding the correct intersecting curve at cabinetry to boundary curve. I have now located this. I have also tried to incorporate some nodes from your script provided.

@Nick_Boyts. Thanks. I think that was part of it.

I think it’s nearly there,only, it wont trim the curve (curve-cabinetry)… can you see what I might possibly be doing incorrectly?

The one thing I can find in your script that might not be working is that TrimInteriorByParameter needs to work just on one line that is intersecting with cabinetry. In your case you are using the node for all the lines.

Try filtering out just the right side wall with DoesIntersect node and then apply Trim on just that line.

Let us know if it works out.

Hi @Dynamo_Ann

Could you drop here dummy rvt file? It will help others to provide you clean solution.

1 Like

As @YashRathore mentioned, you’re trimming your full list of lines. You’re also combining that original list with the trimmed lines at the end which means you’re not going to see the gap, as the original untrimmed line is still visible. You’ll have to turn off geometry preview for all the nodes you don’t want to see.

Geometry.DoesIntersect will return true even if the intersection is a point - which happens in the angles.
And it needs to be set to cross product to determine if any of the items in List1 intersects any of the items in List2.

You might want to try to intersect them and check if the intersections is a line. If it is a line than the two are on top of each other.

Thanks everyone. I really appreciate you helping a total newbie.

I have tried again on a dummy project with more rooms.

After turning off previews as suggested, I have found that the node is working as it should, and isn’t giving odd results.

I am now just stuck at the point where I want to remove(trim out) the curves at that intersection. See image:

List 1 - List 2?

Is there a general methodology to doing this?

Hey @Dynamo_Ann,
Could you show the location of the solid geometry and output lines wrt to the initial list of lines?
Or it would be even better if you could share the dummy project file along with the dynamo graph.

Hi @Dynamo_Ann ,

You could try the following workflow:

  1. Explode each line so that you won’t have any corners/ angles in your “Curves”.
  2. Use their direction to group each line with the same direction into groups.
  3. Group each line (inside these groups from #2) by their distance, now only touching lines of the same direction are grouped together.
  4. Now extract each start and endpoint from all your Curves, then using these Points create every possible combination, i.e. 0-0, 0-1, 0-2, 0-3, 1-1, 1,2, etc.
  5. Use these combinations and measure each distance between these points, 1 distance should be the longest.
  6. From the longest distances of each group can we create a new line by their start and endpoints, now we end up (in this case) with 5 Curves, non-overlapping.
  7. At last we can finally join these individual lines together into a PolyCurve.

See below:

The only downside I can think of is that Arcs/ Elipses/ Circles etc. will not keep their original shape since all lines are only manipulated by their start- and endpoints.

2021-11-07 Cutting Overlapping Lines.dyn (91.4 KB)
Remove Duplicate Lines Testfile.rvt (1.5 MB)

PS: please upload a sample file/ lines so we don’t have to recreate your image :slight_smile:

1 Like

Of course! Apologies for the delay, here’s the .dyn file. Struggling to load sample file.(image is from the Revit Residential sample file with casework components loaded in) should be pretty straight forward in most projects.


Custom node is from a LinkedIn tutorial (Revit and Dynamo for Interior Design - William Carney), works off co-ordinates to get the curves all in the same direction. so if it doesn’t work, adjust the co-ordinates to top left of the project.

Script works well as is, but I’d like to refine it to remove cabinetry (so I don’t have to split walls at those locations etc).

. _WallFinishTest.dyn (158.7 KB)

CustomNode_End.dyf (52.6 KB)

p.s thanks @Daan I’ll give your method a test run tomorrow when I get a couple of spare hours.

Thanks again for all the replies :slight_smile:

Hi, @Dynamo_Ann!

Try use Geometry.SplitByTools from Ampersand to split curves with cabinets. After look into Geometry.PruneDuplicates from Data-Shapes. I’ll help later today.cabinets.dyn (45.3 KB)
Geometry_DeleteDuplicates.dyf (8.0 KB)

1 Like

Thank you so much :slight_smile: , I can find the intersection lines at casework, but I just cant figure out how to remove it from the main curves line, ie. list 1 - list 2…? did I miss a step?

@Dynamo_Ann , can you share your RVT and DYN?
There’s some things i can’see in screenshot.