예제 #1
0
 public static Surface ToRhino(DB.RuledSurface surface, DB.BoundingBoxUV bboxUV) => FromRuledSurface
 (
     new DB.Curve[] { surface.GetFirstProfileCurve(), surface.GetSecondProfileCurve() },
     surface.HasFirstProfilePoint() ? surface.GetFirstProfilePoint() : null,
     surface.HasSecondProfilePoint() ? surface.GetSecondProfilePoint() : null,
     bboxUV,
     0.0
 );
예제 #2
0
        public static Surface ToRhino(this DB.RuledSurface surface, DB.BoundingBoxUV bboxUV)
        {
            var ctol = Revit.ShortCurveTolerance;

            var     curves = new List <Curve>();
            Point3d start = Point3d.Unset, end = Point3d.Unset;

            if (surface.HasFirstProfilePoint())
            {
                start = surface.GetFirstProfilePoint().ToRhino();
            }
            else
            {
                curves.Add(surface.GetFirstProfileCurve().ToRhino());
            }

            if (surface.HasSecondProfilePoint())
            {
                end = surface.GetSecondProfilePoint().ToRhino();
            }
            else
            {
                curves.Add(surface.GetSecondProfileCurve().ToRhino());
            }

            // Revit Ruled surface Parametric Orientation is opposite to Rhino
            for (var c = 0; c < curves.Count; ++c)
            {
                curves[c].Reverse();
                curves[c] = curves[c].Extend(CurveEnd.Both, ctol, CurveExtensionStyle.Line);
            }

            var lofts = Brep.CreateFromLoft(curves, start, end, LoftType.Straight, false);

            if (lofts.Length == 1 && lofts[0].Surfaces.Count == 1)
            {
                return(lofts[0].Surfaces[0]);
            }

            return(null);
        }