示例#1
0
        static Surface FromExtrudedSurface(IList <DB.Curve> curves, DB.BoundingBoxUV bboxUV, double relativeTolerance)
        {
            var ctol = relativeTolerance * Revit.ShortCurveTolerance;

            var axis = new LineCurve
                       (
                new Line(curves[0].GetEndPoint(0).ToPoint3d(), curves[1].GetEndPoint(0).ToPoint3d()),
                0.0,
                1.0
                       );

            Curve curveU = ToRhino(curves[0]);

            curveU.Translate(axis.PointAt(bboxUV.Min.V) - curveU.PointAtStart);

            Curve curveV = new LineCurve(new Line(axis.PointAt(bboxUV.Min.V), axis.PointAt(bboxUV.Max.V)));

            if (ctol != 0.0)
            {
                curveU = curveU.Extend(CurveEnd.Both, ctol, CurveExtensionStyle.Smooth);
                curveV = curveV.Extend(CurveEnd.Both, ctol, CurveExtensionStyle.Smooth);
            }

            return(SumSurface.Create(curveU, curveV));
        }
示例#2
0
        private Topologic.Face BySurface(Rhino.Geometry.Surface ghSurface)
        {
            SumSurface ghSumSurface = ghSurface as SumSurface;

            if (ghSumSurface != null)
            {
                return(BySumSurface(ghSumSurface));
            }

            RevSurface ghRevSurface = ghSurface as RevSurface;

            if (ghRevSurface != null)
            {
                return(ByRevSurface(ghRevSurface));
            }

            PlaneSurface ghPlaneSurface = ghSurface as PlaneSurface;

            if (ghPlaneSurface != null)
            {
                return(ByPlaneSurface(ghPlaneSurface));
            }

            //ClippingPlaneSurface ghClippingPlaneSurface = ghSurface as ClippingPlaneSurface;
            //if (ghClippingPlaneSurface != null)
            //{
            //    return ByClippingPlaneSurface(ghClippingPlaneSurface);
            //}

            Extrusion ghExtrusion = ghSurface as Extrusion;

            if (ghExtrusion != null)
            {
                return(ByExtrusion(ghExtrusion));
            }

            Rhino.Geometry.NurbsSurface ghNurbsSurface = ghSurface as Rhino.Geometry.NurbsSurface;
            if (ghNurbsSurface != null)
            {
                return(ByNurbsSurface(ghNurbsSurface));
            }

            //BrepFace ghBrepFace = ghSurface as BrepFace;
            //if (ghBrepFace != null)
            //{
            //    return ByBrepFace(ghBrepFace);
            //}

            throw new Exception("This type of surface is not yet supported.");
        }
示例#3
0
        public static global::Topologic.Face ToTopologic(this global::Rhino.Geometry.Surface surface)
        {
            if (surface == null)
            {
                return(null);
            }

            SumSurface sumSurface = surface as SumSurface;

            if (sumSurface != null)
            {
                return(sumSurface.ToTopologic());
            }

            RevSurface revSurface = surface as RevSurface;

            if (revSurface != null)
            {
                return(revSurface.ToTopologic());
            }

            PlaneSurface planeSurface = surface as PlaneSurface;

            if (planeSurface != null)
            {
                return(planeSurface.ToTopologic());
            }

            Extrusion ghExtrusion = surface as Extrusion;

            if (ghExtrusion != null)
            {
                return(ghExtrusion.ToTopologic());
            }

            global::Rhino.Geometry.NurbsSurface ghNurbsSurface = surface as global::Rhino.Geometry.NurbsSurface;
            if (ghNurbsSurface != null)
            {
                return(ghNurbsSurface.ToTopologic());
            }


            return(null);
        }
示例#4
0
 private Topologic.Face BySumSurface(SumSurface ghSumSurface)
 {
     Rhino.Geometry.NurbsSurface ghNurbsSurface = ghSumSurface.ToNurbsSurface();
     return(ByNurbsSurface(ghNurbsSurface));
 }
示例#5
0
 public static global::Topologic.Face ToTopologic(this SumSurface sumSurface)
 {
     Rhino.Geometry.NurbsSurface ghNurbsSurface = sumSurface?.ToNurbsSurface();
     return(ghNurbsSurface?.ToTopologic());
 }