Haziq_J
September 29, 2021, 1:34pm
1
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
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
Haziq_J
September 29, 2021, 2:15pm
4
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?
sovitek
September 29, 2021, 2:23pm
6
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
1 Like
Haziq_J
September 29, 2021, 2:34pm
8
@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)
sovitek
September 29, 2021, 2:35pm
9
@Haziq_J …try lacing to longest in Set.difference
It’s essentially a list level problem - and you want the following:
The list1
input into List.SetDifference should be a single, flat list of items
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
Haziq_J
September 29, 2021, 2:53pm
11
@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 ?
Haziq_J
September 29, 2021, 3:42pm
13
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
2 Likes
sovitek
September 29, 2021, 4:22pm
15
@solamour heheh i find out the same
I think because List.SetDifference compare hash (not the geometry), a workaround, is to check the result of Geometry.Intersect
2 Likes
Haziq_J
September 29, 2021, 4:59pm
17
Brilliant, it works! Thanks @solamour @sovitek !!
2 Likes