Ejemplo n.º 1
0
        //--------------------------------------------------------------------------------------------------

        MemoryStream _Export(Drawing drawing, DxfVersion version, DxfFlags flags, double precision)
        {
            _Precision = precision;
            _Document  = new DxfDomDocument(version, flags);

            // Export
            drawing.Render(this);

            var stream = _Document.WriteToStream();

            _Document = null;
            return(stream);
        }
Ejemplo n.º 2
0
        //--------------------------------------------------------------------------------------------------

        MemoryStream _Export(Sketch sketch, DxfVersion version, DxfFlags flags, double precision)
        {
            _Sketch    = sketch;
            _Precision = precision;
            _Document  = new DxfDomDocument(version, flags);

            foreach (var segment in _Sketch.Segments.Values)
            {
                switch (segment)
                {
                case SketchSegmentLine line:
                    _AddLineSegment(line);
                    break;

                case SketchSegmentCircle circle:
                    _AddCircleSegment(circle);
                    break;

                case SketchSegmentArc arc:
                    _AddArcSegment(arc);
                    break;

                case SketchSegmentEllipse ellipse:
                    _AddEllipseSegment(ellipse);
                    break;

                case SketchSegmentEllipticalArc ellipArc:
                    _AddEllipticalArcSegment(ellipArc);
                    break;

                case SketchSegmentBezier bezier:
                    _AddBezierSegment(bezier);
                    break;
                }
            }

            var stream = _Document.WriteToStream();

            _Document = null;
            return(stream);
        }