Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Creating custom sort for Curves in C#

$
0
0

Hello everyone! Can one create a custom sort for curves?

Example code:

x.Sort(new CustomCompare());

///

class CustomCompare : IComparer
{
public int CompareRegionRelashionship(Curve x, Curve y)
{
if ( x.GetLength() > y.GetLength())
{
return 1;
}
else if (x.GetLength()<y.GetLength()) // If x is inside y
{
return -1;
}
else
{
return 0;
}
}
}

Error (CS0535): ‘Script_Instance.CustomCompare’ does not implement interface member ‘System.Collections.Generic.IComparer<Rhino.Geometry.Curve>.Compare(Rhino.Geometry.Curve, Rhino.Geometry.Curve)’

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles