Beispiel #1
0
        //--------------------------------------------------------------------------------------------------

        protected void AddCurve(Geom2d_Curve curve2d, bool reverse, double first, double last)
        {
            // Process curve
            switch (curve2d)
            {
            case Geom2d_Line line:
                AddLine(line, first, last, reverse);
                break;

            case Geom2d_Ellipse ellipse:
                AddEllipse(ellipse, first, last, reverse);
                break;

            case Geom2d_Circle circle:
                AddCircle(circle, first, last, reverse);
                break;

            case Geom2d_BSplineCurve bspline:
                AddBSplineCurve(bspline, first, last, reverse);
                break;

            case Geom2d_BezierCurve bezier:
                AddBezierCurve(bezier, first, last, reverse);
                break;

            default:
                // Try to create B-Spline curve
                var bsplineCurve = ShapeConstruct.ConvertCurveToBSpline(curve2d, first, last, 0.001 /*Precision.Confusion()*10*/, curve2d.Continuity(), 10000, 3);
                if (bsplineCurve != null)
                {
                    AddBSplineCurve(bsplineCurve, first, last, reverse);
                    return;
                }
                Messages.Warning("SvgExporter: Unsupported curve class.");
                break;
            }
        }
Beispiel #2
0
        //--------------------------------------------------------------------------------------------------

        public static bool RenderCurve(IDrawingRenderer renderer, Geom2d_Curve curve2d, double first, double last, bool reverse)
        {
            switch (curve2d)
            {
            case Geom2d_Line line:
                return(RenderLine(renderer, line, first, last, reverse));

            case Geom2d_Ellipse ellipse:
                return(RenderEllipse(renderer, ellipse, first, last, reverse));

            case Geom2d_Circle circle:
                return(RenderCircle(renderer, circle, first, last, reverse));

            case Geom2d_BSplineCurve bspline:
                return(RenderBSplineCurve(renderer, bspline, first, last, reverse));

            case Geom2d_BezierCurve bezier:
                return(RenderBezierCurve(renderer, bezier, first, last, reverse));

            default:
                // Try to create B-Spline curve
                var bsplineCurve = ShapeConstruct.ConvertCurveToBSpline(curve2d, first, last, 0.001 /*Precision.Confusion()*10*/, curve2d.Continuity(), 10000, 3);
                if (bsplineCurve != null)
                {
                    return(RenderBSplineCurve(renderer, bsplineCurve, first, last, reverse));
                }
                Messages.Warning("BrepRenderHelper: Unsupported curve class.");
                return(false);
            }
        }
Beispiel #3
0
        //--------------------------------------------------------------------------------------------------

        void _AddCurve(Geom2d_Curve curve2d, double first, double last)
        {
            // Process curve
            switch (curve2d)
            {
            case Geom2d_Line line:
                _AddLine(line, first, last);
                break;

            case Geom2d_Ellipse ellipse:
                _AddEllipse(ellipse, first, last);
                break;

            case Geom2d_Circle circle:
                _AddCircle(circle, first, last);
                break;

            case Geom2d_BSplineCurve bspline:
                _AddBSplineCurve(bspline, first, last);
                break;

            default:
                // Try to create B-Spline curve
                var bsplineCurve = ShapeConstruct.ConvertCurveToBSpline(curve2d, first, last, _Precision * 10.0, curve2d.Continuity(), 10000, 3);
                if (bsplineCurve != null)
                {
                    _AddBSplineCurve(bsplineCurve, first, last);
                    return;
                }

                Messages.Warning($"DxfExporter: Unsupported curve class: {curve2d.GetType().Name}.");
                break;
            }
        }