예제 #1
0
        /***************************************************/

        private static BHG.PlanarSurface ToBHoMPlanarSurface(this RHG.BrepFace face)
        {
            RHG.Surface rhSurf = face.UnderlyingSurface();
            if (rhSurf == null)
            {
                return(null);
            }

            BHG.PlanarSurface bhs = rhSurf.FromRhino() as BHG.PlanarSurface;
            List <BHG.ICurve> internalBoundaries = new List <BHG.ICurve>();

            BHG.ICurve externalBoundary = bhs.ExternalBoundary;
            foreach (RHG.BrepLoop loop in face.Loops)
            {
                if (loop.LoopType == RHG.BrepLoopType.Inner)
                {
                    internalBoundaries.Add(new BHG.PolyCurve {
                        Curves = loop.Trims.Select(x => rhSurf.Pushup(x, BHG.Tolerance.Distance).FromRhino()).ToList()
                    });
                }
                else if (loop.LoopType == RHG.BrepLoopType.Outer)
                {
                    externalBoundary = new BHG.PolyCurve {
                        Curves = loop.Trims.Select(x => rhSurf.Pushup(x, BHG.Tolerance.Distance).FromRhino()).ToList()
                    }
                }
                ;
            }

            return(BH.Engine.Geometry.Create.PlanarSurface(externalBoundary, internalBoundaries));
        }