Ejemplo n.º 1
0
        public static Surface ExtractSurface(Autodesk.Revit.DB.RuledFace face, IEnumerable <PolyCurve> edgeLoops)
        {
            var c0 = face.get_Curve(0).ToProtoType();
            var c1 = face.get_Curve(1).ToProtoType();

            return(Surface.ByLoft(new[] { c0, c1 }));
        }
Ejemplo n.º 2
0
 public static Surface ToRhinoSurface(DB.RuledFace face, double relativeTolerance)
 {
     using (var surface = face.GetSurface() as DB.RuledSurface)
     {
         if (surface.MatchesParametricOrientation())
         {
             return(FromRuledSurface
                    (
                        new DB.Curve[] { surface.GetFirstProfileCurve(), surface.GetSecondProfileCurve() },
                        surface.HasFirstProfilePoint() ? surface.GetFirstProfilePoint() : null,
                        surface.HasSecondProfilePoint() ? surface.GetSecondProfilePoint() : null,
                        face.GetBoundingBox(),
                        relativeTolerance
                    ));
         }
         else
         {
             return(FromRuledSurface
                    (
                        new DB.Curve[] { surface.GetFirstProfileCurve().CreateReversed(), surface.GetSecondProfileCurve().CreateReversed() },
                        surface.HasFirstProfilePoint() ? surface.GetFirstProfilePoint() : null,
                        surface.HasSecondProfilePoint() ? surface.GetSecondProfilePoint() : null,
                        face.GetBoundingBox(),
                        relativeTolerance
                    ));
         }
     }
 }
Ejemplo n.º 3
0
 public static Surface ToRhinoSurface(this DB.RuledFace face) => FromRuledSurface
 (
     new DB.Curve[] { face.get_Curve(0), face.get_Curve(1) },
     face.get_Point(0),
     face.get_Point(1),
     face.GetBoundingBox()
 );
Ejemplo n.º 4
0
        public static Surface ToRhinoSurface(DB.RuledFace face, double relativeTolerance)
        {
            NurbsSurface nurbsSurface = default;

            try
            {
#if REVIT_2021
                using (var surface = DB.ExportUtils.GetNurbsSurfaceDataForSurface(face.GetSurface()))
                    nurbsSurface = ToRhino(surface, face.GetBoundingBox());
#else
                using (var surface = DB.ExportUtils.GetNurbsSurfaceDataForFace(face))
                    nurbsSurface = ToRhino(surface, face.GetBoundingBox());
#endif
            }
            catch (Autodesk.Revit.Exceptions.ApplicationException) { }

            if (nurbsSurface is null)
            {
                return(face.IsExtruded ?
                       FromExtrudedSurface
                       (
                           new DB.Curve[] { face.get_Curve(0), face.get_Curve(1) },
                           face.GetBoundingBox(),
                           relativeTolerance
                       ) :
                       FromRuledSurface
                       (
                           new DB.Curve[] { face.get_Curve(0), face.get_Curve(1) },
                           face.get_Curve(0) is null ? face.get_Point(0) : null,
                           face.get_Curve(1) is null ? face.get_Point(1) : null,
                           face.GetBoundingBox(),
                           relativeTolerance
                       ));
            }
            else
            {
                double ctol = relativeTolerance * Revit.ShortCurveTolerance * 5.0;
                if (ctol != 0.0)
                {
                    // Extend using smooth way avoids creating C2 discontinuities
                    nurbsSurface = nurbsSurface.Extend(IsoStatus.West, ctol, true) as NurbsSurface ?? nurbsSurface;
                    nurbsSurface = nurbsSurface.Extend(IsoStatus.East, ctol, true) as NurbsSurface ?? nurbsSurface;
                    nurbsSurface = nurbsSurface.Extend(IsoStatus.South, ctol, true) as NurbsSurface ?? nurbsSurface;
                    nurbsSurface = nurbsSurface.Extend(IsoStatus.North, ctol, true) as NurbsSurface ?? nurbsSurface;
                }
            }

            return(nurbsSurface);
        }
Ejemplo n.º 5
0
 public static Surface ToRhinoSurface(DB.RuledFace face, double relativeTolerance) => face.IsExtruded ?
 FromExtrudedSurface
 (
     new DB.Curve[] { face.get_Curve(0), face.get_Curve(1) },
     face.GetBoundingBox(),
     relativeTolerance
 ):
 FromRuledSurface
 (
     new DB.Curve[] { face.get_Curve(0), face.get_Curve(1) },
     face.get_Curve(0) is null ? face.get_Point(0) : null,
     face.get_Curve(1) is null ? face.get_Point(1) : null,
     face.GetBoundingBox(),
     relativeTolerance
 );
Ejemplo n.º 6
0
 public static Surface ToRhinoSurface(this DB.RuledFace face, double relativeTolerance) => RawDecoder.ToRhinoSurface(face, relativeTolerance);