internal static Brep ToBrep(DB.Face face) { var surface = Raw.RawDecoder.ToRhinoSurface(face, out var _, 1.0); if (surface is null) { return(null); } var brep = Brep.CreateFromSurface(surface); if (brep is null) { return(null); } if (!face.MatchesSurfaceOrientation()) { brep.Flip(); } var loops = ToCurveMany(face.GetEdgesAsCurveLoops()).ToArray(); try { return(TrimFaces(brep, loops)); } finally { brep.Dispose(); } }
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(); } }
public static List <Polygon3D> ToSAM_Polygon3Ds(this Autodesk.Revit.DB.Face face) { if (face == null) { return(null); } return(ToSAM_Polygon3Ds(face.GetEdgesAsCurveLoops())); }
public Face3D(RVT.Face face, ref List <string> messages) { var tolerance = AppSettings.Instance.StoredSettings.GeometrySettings.Tolerance; var loops = new List <List <Point3D> >(); var curveLoops = face.GetEdgesAsCurveLoops(); foreach (var cLoop in curveLoops) { var loop = new List <Point3D>(); foreach (var curve in cLoop) { if (curve.Length < tolerance) { messages.Add($"Face contains a curve that is shorter than specified tolerance of {tolerance}."); } var pts = GeometryUtils.GetPoints3D(curve); loop.AddRange(pts); } loops.Add(loop); } var j = 0; var maxArea = 0d; var maxIndex = -1; foreach (var polygon in loops) { GetPolygonPlane(polygon.Select(x => new RVT.XYZ(x.X, x.Y, x.Z)).ToList(), out _, out _, out var area); if (Math.Abs(maxArea) < Math.Abs(area)) { maxIndex = j; maxArea = area; } j++; } Boundary = loops[maxIndex]; loops.RemoveAt(maxIndex); Holes = loops; }
public static List <PolycurveLoop3D> ToSAM_PolycurveLoop3Ds(this Autodesk.Revit.DB.Face face) { return(ToSAM(face.GetEdgesAsCurveLoops())); }