Exemplo n.º 1
0
        private void WriteEllipseAsPolyline(Ellipse ellipse)
        {
            //we will draw the ellipse as a polyline, it is not supported in AutoCad12 dxf files
            this.WriteCodePair(0, DxfObjectCode.Polyline);

            this.WriteEntityCommonCodes(ellipse);

            //closed polyline
            this.WriteCodePair(70, 1);

            //dummy point
            this.WriteCodePair(10, 0.0);
            this.WriteCodePair(20, 0.0);
            this.WriteCodePair(30, ellipse.Center.Z);

            this.WriteCodePair(39, ellipse.Thickness);

            this.WriteCodePair(210, ellipse.Normal.X);
            this.WriteCodePair(220, ellipse.Normal.Y);
            this.WriteCodePair(230, ellipse.Normal.Z);

            //Obsolete; formerly an “entities follow flag” (optional; ignore if present)
            //but its needed to load the dxf file in AutoCAD
            this.WriteCodePair(66, "1");

            this.WriteXData(ellipse.XData);

            List<Vector2d> points = ellipse.PolygonalVertexes(ellipse.CurvePoints);
            foreach (Vector2d v in points)
            {
                this.WriteCodePair(0, DxfObjectCode.Vertex);
                this.WriteCodePair(8, ellipse.Layer);
                this.WriteCodePair(70, 0);
                this.WriteCodePair(10, v.X);
                this.WriteCodePair(20, v.Y);
            }
            this.WriteCodePair(0, StringCode.EndSequence);
        }