示例#1
0
        /// <summary>
        /// Returns a Windows Shapes Path from a Rhinocommon Rectangle
        /// </summary>
        /// <param name="input">Rhinocommon Rectangle</param>
        /// <returns>System Windows Shapes Path</returns>
        public static Sh.Path ToPath(this Rg.Rectangle3d input)
        {
            Sh.Path path = new Sh.Path();

            path.Data = input.ToGeometry();

            return(path);
        }
示例#2
0
        public static Sm.Geometry ToGeometry(this Geometry input)
        {
            Sm.Geometry geometry = null;
            switch (input.CurveType)
            {
            case Geometry.CurveTypes.Arc:
                Rg.Arc arc = new Rg.Arc();
                input.Curve.TryGetArc(out arc);
                geometry = arc.ToGeometry();
                break;

            case Geometry.CurveTypes.Circle:
                Rg.Circle circle = new Rg.Circle();
                input.Curve.TryGetCircle(out circle);
                geometry = circle.ToGeometry();
                break;

            case Geometry.CurveTypes.Ellipse:
                Rg.Ellipse ellipse = new Rg.Ellipse();
                input.Curve.TryGetEllipse(out ellipse);
                geometry = ellipse.ToGeometry();
                break;

            case Geometry.CurveTypes.Line:
                Rg.Line line = new Rg.Line(input.Curve.PointAtStart, input.Curve.PointAtEnd);
                geometry = line.ToGeometry();
                break;

            case Geometry.CurveTypes.Polyline:
                Rg.Polyline polyline = new Rg.Polyline();
                input.Curve.TryGetPolyline(out polyline);
                geometry = polyline.ToGeometry();
                break;

            case Geometry.CurveTypes.Rectangle:
                Rg.Polyline pline = new Rg.Polyline();
                input.Curve.TryGetPolyline(out pline);
                Rg.Rectangle3d rectangle = new Rg.Rectangle3d(Rg.Plane.WorldXY, pline[0], pline[2]);
                geometry = rectangle.ToGeometry();
                break;

            default:
                geometry = input.Curve.ToGeometry();
                break;
            }
            return(geometry);
        }