Hi again,
my apologize in advance for the tons of quest that I will publish but I’m learning and I came from python and vb.net =D
I would need to find the largest surface of a brep, to define if the object is planar or not…
I though to pass through a dictionary to assign face index and it’s area, then pass areas to a list sort and retrieve the first or last element… but even if I add value to area to avoid value duplicate I still get an error of duplicated value…
public static int RetriveSurfaceID(Brep brep, string mode)
{
var aree = new Dictionary<double, int>();
var faces = brep.Faces;
foreach (var face in faces)
{
aree.Add(face.Brep.GetArea() + 0.000001, face.FaceIndex);
}
var areelist = aree.Keys.ToList();
areelist.Sort();
switch (mode)
{
case "MAX":
return aree[areelist[areelist.Count - 1]];
case "MIN":
return aree[areelist[0]];
default:
return -1;
}
}

2 posts - 2 participants