コード例 #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));
        }