Grasshopper

algorithmic modeling for Rhino

In the facade of the buildings has many hole on it, In Rhino,you can use the command of "UntrimAllHoles" to repair the surface of the facade, It any one know how to use C# to fill the hole of the facade?

Views: 1455

Replies to This Discussion

There's an Untrim component, but it untrims everything, it doesn't know how to distinguish between the holes and the boundary. Is that a problem?

Thank You,David. As you know, Untrim component is not a good way to repair the surface with hole,It untrims everything.  the command "UntrimHoles"(It is not 'UntrimAllHoles', I'm so sorry) in the rhino can help to repair the hole,when I bake the facade geometry to Rhino. But If I Know using C# code to relaize the command "UntrimHoles",  I can repair the facade with holes. Could give me some suggest about how to realize the command? 

I can  not find an usualfully way to distinguish the holes and the boundary.yestday,I think use the boundary's length to test whether it is an holes or an boundary. but it is an alway right.

The BrepFace class knows which one of it's potentially many loops represents the outer boundary. But I can't find a way to actually use this information to then remove the remaining loops from the face interior.

You may have to ask the Rhino api experts on the discourse forum about how to do this.

You still need some maunal work around but thsi should help.

public static Brep BrepUntrim(Brep brep)
        {
          List<Brep> b = new List<Brep>();
           var f = brep.Faces.ToList();
            f.ForEach(x =>
            {
                var l = x.Loops.ToList();
                l = l.Where(y => y.LoopType != BrepLoopType.Inner).ToList();
                var tb = x.UnderlyingSurface().ToBrep();
                tb = tb.Faces[0].Split(l.ConvertAll(z => z.To3dCurve()), 0.001);
                tb = tb.Faces.ToList().ConvertAll(z => z.DuplicateFace(true)).OrderBy(z => z.GetArea()).Last();
                b.Add(tb);

            });

            var untrim = Brep.JoinBreps(b, 0.001).ToList().OrderBy(x => x.GetArea()).Last();
          return  untrim;
        }

You could filter the Faces from the generated Brep a second time for the inner outer loop criteria. I leave you some home work.

Hi I'm have test it in my Grasshopper using C# component(there has something error in the code), But the result is the same as using Untrim Component. the result is attached at below

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service