Esempio n. 1
0
        public static Brep ToRhino(this DB.Face face, bool untrimmed = false)
        {
            var surface = face.ToRhinoSurface();

            if (surface is null)
            {
                return(null);
            }

            var brep = Brep.CreateFromSurface(surface);

            if (brep is null)
            {
                return(null);
            }

#if REVIT_2018
            if (!face.OrientationMatchesSurfaceOrientation)
            {
                brep.Flip();
            }
#endif
            if (untrimmed)
            {
                return(brep);
            }

            var loops = face.GetEdgesAsCurveLoops().ToRhino().ToArray();

            try { return(brep.TrimFaces(loops)); }
            finally { brep.Dispose(); }
        }