Exemplo n.º 1
0
        public DxfPolyLine ReadPolyLine(StreamReader Reader)
        {
            string buffer;

            buffer = Reader.ReadLine();
            bool Xvaluecheck = false;
            bool Yvaluecheck = false;
            bool Zvaluecheck = false;

            double xvalue = 0;
            double yvalue = 0;
            double zvalue = 0;

            byte Polylineflag;

            DxfPolyLine PolyLine = new DxfPolyLine();

            while (buffer != "ENDSEQ")
            {
                switch (buffer)
                {
                case "10": buffer = Reader.ReadLine();
                    xvalue        = double.Parse(buffer);
                    Xvaluecheck   = true;
                    break;

                case "20": buffer = Reader.ReadLine();
                    yvalue        = double.Parse(buffer);
                    Yvaluecheck   = true;
                    break;

                case "30": buffer = Reader.ReadLine();
                    zvalue        = double.Parse(buffer);
                    Zvaluecheck   = true;
                    break;

                case "39": buffer      = Reader.ReadLine();
                    PolyLine.thickness = double.Parse(buffer);
                    break;

                case "70": buffer = Reader.ReadLine();
                    Polylineflag  = byte.Parse(buffer);
                    break;

                case "40": buffer       = Reader.ReadLine();
                    PolyLine.startWidth = ushort.Parse(buffer);
                    break;

                case "41": buffer     = Reader.ReadLine();
                    PolyLine.endWidth = ushort.Parse(buffer);
                    break;

                case "71": buffer             = Reader.ReadLine();
                    PolyLine.meshMvertexcount = ushort.Parse(buffer);
                    break;

                case "72": buffer             = Reader.ReadLine();
                    PolyLine.meshNvertexcount = ushort.Parse(buffer);
                    break;

                case "73": buffer            = Reader.ReadLine();
                    PolyLine.surfaceMdensity = ushort.Parse(buffer);
                    break;

                case "74": buffer            = Reader.ReadLine();
                    PolyLine.surfaceNdensity = ushort.Parse(buffer);
                    break;

                case "210": buffer = Reader.ReadLine();
                    PolyLine.extrusionDirection.xval = double.Parse(buffer);
                    break;

                case "220": buffer = Reader.ReadLine();
                    PolyLine.extrusionDirection.yval = double.Parse(buffer);
                    break;

                case "230": buffer = Reader.ReadLine();
                    PolyLine.extrusionDirection.zval = double.Parse(buffer);
                    break;

                default:
                    break;
                }
                if (Xvaluecheck && Yvaluecheck && Zvaluecheck)
                {
                    DxfPoint temporarypoint = new DxfPoint(xvalue, yvalue, zvalue);
                    PolyLine.controlPoints.Add(temporarypoint);
                    Xvaluecheck = false;
                    Yvaluecheck = false;
                    Zvaluecheck = false;
                }
            }
            return(PolyLine);
        }