Removing lines from a list of curves

Hi guys,

I have a list of curves generated from a surface on Revit and I want to remove 2 of them.

I tried using List.Equals so I can use List.FilterbyBoolmask but the lines that I selected are just not getting recognised as being the “equal”.

How should I go about removing the 2 selected lines from my list of curves?

Try to to change the lancing of “List.Equals” to the “longest” intead of “auto”.

The Set.Difference node is your friend here :slight_smile:

Simply create a primary list of all curves, and a list of hte curves you want to remove from that list.

You can read more about it here: Dynamo Dictionary

3 Likes

I just tried using List.SetDifference but it still somehow doesn’t catch the curve?

I checked through the attributes of the curve (Start Point, End Point) and they should be exactly the same. Is the software somehow reading the 2 curves as different because they’re from different source geometry?

Nope, didn’t help :frowning_face:

Hi …try to insert a listflatten after list create…or use list.join instead of list.create

1 Like

@Haziq_J Sovitek is correct - try a List.Flatten after the List.Create :slight_smile:

1 Like

@solamour @sovitek I’ve tried but still no change. List.SetDifference works on List.FirstItem tho.

You can check out the script I attached


remove 2 curves from line.dyn (38.4 KB)

@Haziq_J …try lacing to longest in Set.difference

It’s essentially a list level problem - and you want the following:

  1. The list1 input into List.SetDifference should be a single, flat list of items
  2. The list2 input into List.SetDifference should be a single, flat list of items you want to remove from list1

Otherwise, as @sovitek mentioned you’ll need to use lacing :slight_smile:

@solamour As you can see from my Watch Node, both lists are already flattened before going into SetDifference. Setting lacing to longest only increases the list level in the output, but did not remove the unwanted lines still.

Is it possible for you to upload your .DYN file here for me to test in that case :slight_smile: ?

Yes of course, please see attached! Thank you so much for your prompt responses so far!

remove 2 curves from line.dyn (38.4 KB)

@Haziq_J I’m investigating why the Set.Difference node is failing, and will loop back with you on this.

In the meantime, you can use this String.FromObject workaround :slight_smile:

2 Likes

@solamour heheh i find out the same :wink:

I think because List.SetDifference compare hash (not the geometry), a workaround, is to check the result of Geometry.Intersect

2 Likes

Brilliant, it works! Thanks @solamour @sovitek !!

2 Likes