Example #1
0
        public void WriteToFileInDxfFormat(StreamWriter sw)
        {
            sw.WriteLine("0");
            sw.WriteLine("DIMENSION");
            //sw.WriteLine("5");
            //sw.WriteLine("88");//
            sw.WriteLine("8");
            sw.WriteLine(this.Parent.Name);//圖層名稱
            sw.WriteLine("2");
            sw.WriteLine("*D0");//包含標註圖片組成圖元的圖塊名稱
            sw.WriteLine("70");
            sw.WriteLine("3");//標註種類
            sw.WriteLine("1");//使用者明確輸入的標註文字
            sw.WriteLine(" ");//抑制文字
            sw.WriteLine("62");
            sw.WriteLine(Part.SystemColor2DXFColorIndex(this.Color));//顏色號碼
            sw.WriteLine("10");
            sw.WriteLine(this.Startpn.X.ToString());//定義點X座標
            sw.WriteLine("20");
            sw.WriteLine(this.Startpn.Y.ToString());//定義點Y座標
            sw.WriteLine("30");
            sw.WriteLine(this.Startpn.Z.ToString());//定義點Z座標
            sw.WriteLine("11");
            sw.WriteLine(this.TextReferP.X.ToString());//標註文字的中點X座標
            sw.WriteLine("21");
            sw.WriteLine(this.TextReferP.Y.ToString());//標註文字的中點Y座標
            sw.WriteLine("31");
            sw.WriteLine(this.TextReferP.Z.ToString());//標註文字的中點Z座標
            sw.WriteLine("15");
            sw.WriteLine(this.Endpn.X.ToString());//直徑標註、半徑標註及角度標註的定義點X座標
            sw.WriteLine("25");
            sw.WriteLine(this.Endpn.Y.ToString());//直徑標註、半徑標註及角度標註的定義點Y座標
            sw.WriteLine("35");
            sw.WriteLine(this.Endpn.Z.ToString());//直徑標註、半徑標註及角度標註的定義點Z座標
            sw.WriteLine("40");
            //sw.WriteLine("10");//Leader length for radius and diameter dimensions
            string a = this.LeaderLength.ToString();
            sw.WriteLine(this.LeaderLength.ToString());//Leader length for radius and diameter dimensions

            Text valueText = new Geometry.Text();
            valueText.Value = this.Value.ToString("N3");
            valueText.RefPoint = this.TextReferP;
            PointD v1 = this.Endpn - this.Startpn;
            valueText.Orietation = (int)RadToDeg(Atan2(v1.Y, v1.X));
            if (valueText.Orietation > 90)
                valueText.Orietation -= 180;
            else if (valueText.Orietation < -90)
                valueText.Orietation += 180;
            valueText.Color = this.Color;
            valueText.Parent = new Layer(this.Parent.Name);
            valueText.TextHieght = this.ArrowSize / 8;
            valueText.WriteToFileInDxfFormat(sw);
        }
Example #2
0
        public void WriteToFileInDxfFormat(StreamWriter sw)
        {
            sw.WriteLine("0");
            sw.WriteLine("DIMENSION");
            //sw.WriteLine("5");
            //sw.WriteLine("88");//
            sw.WriteLine("8");
            sw.WriteLine(this.Parent.Name);//圖層名稱
            sw.WriteLine("2");
            sw.WriteLine("*D0");//包含標註圖片組成圖元的圖塊名稱
            sw.WriteLine("70");
            sw.WriteLine("1");
            sw.WriteLine("1");//使用者明確輸入的標註文字
            sw.WriteLine(" ");//抑制文字
            sw.WriteLine("62");
            sw.WriteLine(Part.SystemColor2DXFColorIndex(this.Color));//顏色號碼
            sw.WriteLine("10");
            sw.WriteLine(this.HieghtReferP.X.ToString());//定義點X座標
            sw.WriteLine("20");
            sw.WriteLine(this.HieghtReferP.Y.ToString());//定義點Y座標
            sw.WriteLine("30");
            sw.WriteLine(this.HieghtReferP.Z.ToString());//定義點Z座標
            sw.WriteLine("11");
            sw.WriteLine(this.TextReferP.X.ToString());//標註文字的中點X座標
            sw.WriteLine("21");
            sw.WriteLine(this.TextReferP.Y.ToString());//標註文字的中點Y座標
            sw.WriteLine("31");
            sw.WriteLine(this.TextReferP.Z.ToString());//標註文字的中點Z座標
            sw.WriteLine("13");
            sw.WriteLine(this.Startpn.X.ToString());//線性標註與角度標註的定義點X座標
            sw.WriteLine("23");
            sw.WriteLine(this.Startpn.Y.ToString());//線性標註與角度標註的定義點Y座標
            sw.WriteLine("33");
            sw.WriteLine(this.Startpn.Z.ToString());//線性標註與角度標註的定義點Z座標
            sw.WriteLine("14");
            sw.WriteLine(this.Endpn.X.ToString());//線性標註與角度標註的定義點X座標
            sw.WriteLine("24");
            sw.WriteLine(this.Endpn.Y.ToString());//線性標註與角度標註的定義點Y座標
            sw.WriteLine("34");
            sw.WriteLine(this.Endpn.Z.ToString());//線性標註與角度標註的定義點Z座標

            Text valueText = new Geometry.Text();
            valueText.Value = this.Value.ToString("################.###");
            valueText.RefPoint = this.TextReferP;
            PointD v1 = this.Endpn - this.Startpn;
            valueText.Orietation = (int)RadToDeg(Atan2(v1.Y, v1.X));
            valueText.Color = this.Color;
            valueText.Parent = new Layer(this.Parent.Name);
            valueText.TextHieght = this.ArrowSize / 8;
            valueText.WriteToFileInDxfFormat(sw);
        }