by Andres Gonzalez
Jan 16, 2012
Is there a component like DUPLN from Kangaroo in GH?
Andres
You can write a script to do it... here's a C# version.
private void RunScript(List<Line> L, ref object A) { List<Line> output = new List<Line>(); output.Add(L[0]); for (int i = 1;i < L.Count;i++){ bool include = true; for (int j = 0;j < output.Count;j++){ if( output[j].PointAt(0) == L[i].PointAt(0) && output[j].PointAt(1) == L[i].PointAt(1) || output[j].PointAt(0) == L[i].PointAt(1) && output[j].PointAt(1) == L[i].PointAt(0) ){ include = false; } } if(include){ output.Add(L[i]); } } A = output; }
If you'd prefer to test within a tolerance rather than test for exact equality, you can replace the lines that look like
output[j].PointAt(0) == L[i].PointAt(0)
with
output[j].PointAt(0).DistanceTo(L[i].PointAt(0)) < t
I've attached a version of this script that I tend to use - it also outputs the indices of the items from the original list that remain.
Jan 17, 2012
Cancel
Andrew Heumann
You can write a script to do it... here's a C# version.
private void RunScript(List<Line> L, ref object A)
{
List<Line> output = new List<Line>();
output.Add(L[0]);
for (int i = 1;i < L.Count;i++){
bool include = true;
for (int j = 0;j < output.Count;j++){
if(
output[j].PointAt(0) == L[i].PointAt(0)
&&
output[j].PointAt(1) == L[i].PointAt(1)
||
output[j].PointAt(0) == L[i].PointAt(1)
&&
output[j].PointAt(1) == L[i].PointAt(0)
){
include = false;
}
}
if(include){
output.Add(L[i]);
}
}
A = output;
}
If you'd prefer to test within a tolerance rather than test for exact equality, you can replace the lines that look like
output[j].PointAt(0) == L[i].PointAt(0)
with
output[j].PointAt(0).DistanceTo(L[i].PointAt(0)) < t
I've attached a version of this script that I tend to use - it also outputs the indices of the items from the original list that remain.
Jan 16, 2012
Andres Gonzalez
Jan 17, 2012
Andres Gonzalez
Jan 17, 2012