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

Trimmed surfaces become untrimmed surfaces through c# or python script

$
0
0

Hello,

I would like to filter out surfaces whose air is less than a given value, for example y =2 m2 (like the green surface in the figure). I tried the scripts in C# and Python, it works but I get untrimmed surfaces instead of trimmed surfaces. With the item operator (for example i=101) I can find the trimmed surfaces but it boring and takes a lot of time each time the geometry changes.

You will find attached the rhino and grasshopper file to clearly see my problem.

with C#
private void RunScript(List x, double y, ref object A)
{
List filteredSurfaces = new List();
foreach (Brep brep in x)
{
{double area = brep.GetArea();
if (area < y)
{
filteredSurfaces.Add(brep.Surfaces[0]);
}
}
}
A = filteredSurfaces;
}

Thank you in advance for your help

filter_surface.3dm (1.0 MB)
filter_surface.gh (19.1 KB)

7 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 4140

Trending Articles