Просмотр исходного кода

新增计曲线注记,修改整数高程点删除逻辑,以及其他修改

qyx 3 недель назад
Родитель
Сommit
9f0dbd1487
21 измененных файлов: 489 добавлений и 248 удалений
  1. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/.suo
  2. 110
    84
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CMCgis_Basicfunction.cs
  3. 0
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ChPLContradiction.cs
  4. 26
    4
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/GCDdelete_Form.Designer.cs
  5. 28
    12
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/GCDdelete_Form.cs
  6. 9
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj
  7. 17
    3
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InsertDOMs_to_one.Designer.cs
  8. 10
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InsertDOMs_to_one.cs
  9. 1
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/JQXLabel_grid.Designer.cs
  10. 272
    141
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/JQXLabel_grid.cs
  11. 12
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/MainClass.cs
  12. 2
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Menus.cs
  13. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.dll
  14. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.pdb
  15. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  16. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.AssemblyReference.cache
  17. 1
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.CoreCompileInputs.cache
  18. 1
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.FileListAbsolute.txt
  19. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.GenerateResource.cache
  20. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.dll
  21. Двоичные данные
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.pdb

Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/.suo Просмотреть файл


+ 110
- 84
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CMCgis_Basicfunction.cs Просмотреть файл

@@ -1803,91 +1803,117 @@ namespace HCTools
1803 1803
                     yy = yy - D6;
1804 1804
                 if(BLC!=5000)
1805 1805
                 {
1806
-                    //if (i == strs.Length - 3)
1807
-                    //{
1808
-                    //    string[] str1 = strs[i].Split(' ');
1809
-                    //    DBText text_fz1 = new DBText();
1810
-                    //    text_fz1.TextString = str1[0];
1811
-                    //    text_fz1.Position = new Point3d(xx, yy, 0);
1812
-                    //    text_fz1.Height = D6;
1813
-                    //    text_fz1.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1814
-                    //    text_fz1.Layer = layername;
1815
-                    //    text_fz1.TextStyleId = HZ;
1816
-                    //    text_fz1.WidthFactor = 0.8;
1817
-                    //    if (BLC == 5000)
1818
-                    //    {
1819
-                    //        text_fz1.TextStyleId = st;
1820
-                    //        text_fz1.WidthFactor = 1.375;
1821
-                    //    }
1822
-
1823
-                    //    text_fz1.SetDatabaseDefaults();
1824
-                    //    blocktablerecord.AppendEntity(text_fz1);
1825
-                    //    traction.AddNewlyCreatedDBObject(text_fz1, true);
1826
-
1827
-                    //    xx = xx + D140 / 2 + D2;
1828
-                    //    DBText text_fz2 = new DBText();
1829
-                    //    text_fz2.TextString = str1[1] + " " + str1[2];
1830
-                    //    text_fz2.Position = new Point3d(xx, yy, 0);
1831
-                    //    text_fz2.Height = D6;
1832
-                    //    text_fz2.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1833
-                    //    text_fz2.Layer = layername;
1834
-                    //    text_fz2.TextStyleId = HZ;
1835
-                    //    text_fz2.WidthFactor = 1;
1836
-                    //    if (BLC == 5000)
1837
-                    //    {
1838
-                    //        text_fz2.TextStyleId = st;
1839
-                    //        text_fz2.WidthFactor = 1.375;
1840
-                    //    }
1841
-                    //    text_fz2.SetDatabaseDefaults();
1842
-                    //    blocktablerecord.AppendEntity(text_fz2);
1843
-                    //    traction.AddNewlyCreatedDBObject(text_fz2, true);
1844
-                    //    yy = yy - D4;
1845
-
1846
-                    //    continue;
1847
-                    //}
1848
-                    //else if (i == strs.Length - 2)
1849
-                    //{
1850
-                    //    string[] str2 = strs[i].Split(' ');
1851
-                    //    DBText text_1 = new DBText();
1852
-                    //    text_1.TextString = str2[0] + " " + str2[1] + " " + str2[2];
1853
-                    //    text_1.Position = new Point3d(xx, yy, 0);
1854
-                    //    text_1.Height = D6;
1855
-                    //    text_1.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1856
-                    //    text_1.Layer = layername;
1857
-                    //    text_1.TextStyleId = HZ;
1858
-                    //    text_1.WidthFactor = 0.8;
1859
-                    //    if (BLC == 5000)
1860
-                    //    {
1861
-                    //        text_1.TextStyleId = st;
1862
-                    //        text_1.WidthFactor = 1.375;
1863
-                    //    }
1864
-
1865
-                    //    text_1.SetDatabaseDefaults();
1866
-                    //    blocktablerecord.AppendEntity(text_1);
1867
-                    //    traction.AddNewlyCreatedDBObject(text_1, true);
1868
-
1869
-                    //    xx = xx + D90;
1870
-                    //    DBText text_2 = new DBText();
1871
-                    //    text_2.TextString = str2[3];
1872
-                    //    text_2.Position = new Point3d(xx, yy, 0);
1873
-                    //    text_2.Height = D6;
1874
-                    //    text_2.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1875
-                    //    text_2.Layer = layername;
1876
-                    //    text_2.TextStyleId = HZ;
1877
-                    //    text_2.WidthFactor = 1;
1878
-                    //    if (BLC == 5000)
1879
-                    //    {
1880
-                    //        text_2.TextStyleId = st;
1881
-                    //        text_2.WidthFactor = 1.375;
1882
-                    //    }
1883
-                    //    text_2.SetDatabaseDefaults();
1884
-                    //    blocktablerecord.AppendEntity(text_2);
1885
-                    //    traction.AddNewlyCreatedDBObject(text_2, true);
1886
-                    //    yy = yy - D4;
1887
-
1888
-                    //    continue;
1889
-                    //}
1806
+                    if (i == strs.Length - 3)
1807
+                    {
1808
+                        var strtochar = strs[i].ToCharArray();
1809
+                        string[] str1 = new string[2];
1810
+                        string split_str = "";
1811
+                        for (int j = 0; j < strtochar.Length; j++)
1812
+                        {
1813
+                            if (strtochar[j] >= 0x4e00 && strtochar[j] <= 0x9fbb)
1814
+                            {
1815
+                                split_str = strtochar[j].ToString();
1816
+                                str1 = strs[i].Split(strtochar[j]);
1817
+                                break;
1818
+                            }
1819
+                        }
1820
+                        //string[] str1 = strs[i].Split(' ');
1821
+                        DBText text_fz1 = new DBText();
1822
+                        text_fz1.TextString = str1[0];
1823
+                        text_fz1.Position = new Point3d(xx, yy, 0);
1824
+                        text_fz1.Height = D6;
1825
+                        text_fz1.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1826
+                        text_fz1.Layer = layername;
1827
+                        text_fz1.TextStyleId = HZ;
1828
+                        text_fz1.WidthFactor = 0.8;
1829
+                        if (BLC == 5000)
1830
+                        {
1831
+                            text_fz1.TextStyleId = st;
1832
+                            text_fz1.WidthFactor = 1.375;
1833
+                        }
1834
+
1835
+                        text_fz1.SetDatabaseDefaults();
1836
+                        blocktablerecord.AppendEntity(text_fz1);
1837
+                        traction.AddNewlyCreatedDBObject(text_fz1, true);
1838
+
1839
+                        xx = xx + D140 / 2 + D2;
1840
+                        DBText text_fz2 = new DBText();
1841
+                        //text_fz2.TextString = str1[1] + " " + str1[2];
1842
+                        text_fz2.TextString = split_str.ToString() + str1[1];
1843
+                        text_fz2.Position = new Point3d(xx, yy, 0);
1844
+                        text_fz2.Height = D6;
1845
+                        text_fz2.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1846
+                        text_fz2.Layer = layername;
1847
+                        text_fz2.TextStyleId = HZ;
1848
+                        text_fz2.WidthFactor = 1;
1849
+                        if (BLC == 5000)
1850
+                        {
1851
+                            text_fz2.TextStyleId = st;
1852
+                            text_fz2.WidthFactor = 1.375;
1853
+                        }
1854
+                        text_fz2.SetDatabaseDefaults();
1855
+                        blocktablerecord.AppendEntity(text_fz2);
1856
+                        traction.AddNewlyCreatedDBObject(text_fz2, true);
1857
+                        yy = yy - D4;
1890 1858
 
1859
+                        continue;
1860
+                    }
1861
+                    else if (i == strs.Length - 2)
1862
+                    {
1863
+                        //string[] str2 = strs[i].Split(' ');
1864
+                        var strtochar = strs[i].ToCharArray();
1865
+                        string[] str2 = new string[2];
1866
+                        string split_str = "";
1867
+                        for (int j = 0; j < strtochar.Length; j++)
1868
+                        {
1869
+                            if (strtochar[j] >= 0x4e00 && strtochar[j] <= 0x9fbb)
1870
+                            {
1871
+                                str2 = strs[i].Split(strtochar[j]);
1872
+                                split_str = strtochar[j].ToString();
1873
+                                break;
1874
+                            }
1875
+                        }
1876
+                        DBText text_1 = new DBText();
1877
+                        //text_1.TextString = str2[0] + " " + str2[1] + " " + str2[2];
1878
+                        text_1.TextString = str2[0];
1879
+                        text_1.Position = new Point3d(xx, yy, 0);
1880
+                        text_1.Height = D6;
1881
+                        text_1.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1882
+                        text_1.Layer = layername;
1883
+                        text_1.TextStyleId = HZ;
1884
+                        text_1.WidthFactor = 0.8;
1885
+                        if (BLC == 5000)
1886
+                        {
1887
+                            text_1.TextStyleId = st;
1888
+                            text_1.WidthFactor = 1.375;
1889
+                        }
1890
+
1891
+                        text_1.SetDatabaseDefaults();
1892
+                        blocktablerecord.AppendEntity(text_1);
1893
+                        traction.AddNewlyCreatedDBObject(text_1, true);
1894
+
1895
+                        xx = xx + D90;
1896
+                        DBText text_2 = new DBText();
1897
+                        //text_2.TextString = str2[3];
1898
+                        text_2.TextString = split_str + str2[1];
1899
+                        text_2.Position = new Point3d(xx, yy, 0);
1900
+                        text_2.Height = D6;
1901
+                        text_2.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
1902
+                        text_2.Layer = layername;
1903
+                        text_2.TextStyleId = HZ;
1904
+                        text_2.WidthFactor = 1;
1905
+                        if (BLC == 5000)
1906
+                        {
1907
+                            text_2.TextStyleId = st;
1908
+                            text_2.WidthFactor = 1.375;
1909
+                        }
1910
+                        text_2.SetDatabaseDefaults();
1911
+                        blocktablerecord.AppendEntity(text_2);
1912
+                        traction.AddNewlyCreatedDBObject(text_2, true);
1913
+                        yy = yy - D4;
1914
+
1915
+                        continue;
1916
+                    }
1891 1917
 
1892 1918
                     DBText text5 = new DBText();
1893 1919
                     text5.TextString = strs[i];

+ 0
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ChPLContradiction.cs Просмотреть файл

@@ -206,7 +206,6 @@ namespace HCTools
206 206
 
207 207
 
208 208
 
209
-
210 209
             //耗时
211 210
             watch.Stop();
212 211
             long times = watch.ElapsedMilliseconds;

+ 26
- 4
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/GCDdelete_Form.Designer.cs Просмотреть файл

@@ -34,12 +34,14 @@ namespace HCTools
34 34
             this.button1 = new System.Windows.Forms.Button();
35 35
             this.label2 = new System.Windows.Forms.Label();
36 36
             this.comboBox_blc = new System.Windows.Forms.ComboBox();
37
+            this.textBox_dgj = new System.Windows.Forms.TextBox();
38
+            this.label3 = new System.Windows.Forms.Label();
37 39
             this.SuspendLayout();
38 40
             // 
39 41
             // label1
40 42
             // 
41 43
             this.label1.AutoSize = true;
42
-            this.label1.Location = new System.Drawing.Point(52, 93);
44
+            this.label1.Location = new System.Drawing.Point(51, 85);
43 45
             this.label1.Name = "label1";
44 46
             this.label1.Size = new System.Drawing.Size(127, 15);
45 47
             this.label1.TabIndex = 0;
@@ -48,14 +50,14 @@ namespace HCTools
48 50
             // comboBox1
49 51
             // 
50 52
             this.comboBox1.FormattingEnabled = true;
51
-            this.comboBox1.Location = new System.Drawing.Point(185, 90);
53
+            this.comboBox1.Location = new System.Drawing.Point(184, 82);
52 54
             this.comboBox1.Name = "comboBox1";
53 55
             this.comboBox1.Size = new System.Drawing.Size(172, 23);
54 56
             this.comboBox1.TabIndex = 1;
55 57
             // 
56 58
             // button1
57 59
             // 
58
-            this.button1.Location = new System.Drawing.Point(176, 135);
60
+            this.button1.Location = new System.Drawing.Point(175, 181);
59 61
             this.button1.Name = "button1";
60 62
             this.button1.Size = new System.Drawing.Size(67, 29);
61 63
             this.button1.TabIndex = 2;
@@ -85,11 +87,29 @@ namespace HCTools
85 87
             this.comboBox_blc.Size = new System.Drawing.Size(172, 23);
86 88
             this.comboBox_blc.TabIndex = 4;
87 89
             // 
90
+            // textBox_dgj
91
+            // 
92
+            this.textBox_dgj.Location = new System.Drawing.Point(185, 128);
93
+            this.textBox_dgj.Name = "textBox_dgj";
94
+            this.textBox_dgj.Size = new System.Drawing.Size(100, 25);
95
+            this.textBox_dgj.TabIndex = 5;
96
+            // 
97
+            // label3
98
+            // 
99
+            this.label3.AutoSize = true;
100
+            this.label3.Location = new System.Drawing.Point(118, 131);
101
+            this.label3.Name = "label3";
102
+            this.label3.Size = new System.Drawing.Size(60, 15);
103
+            this.label3.TabIndex = 6;
104
+            this.label3.Text = "等高距:";
105
+            // 
88 106
             // GCDdelete_Form
89 107
             // 
90 108
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
91 109
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
92
-            this.ClientSize = new System.Drawing.Size(427, 176);
110
+            this.ClientSize = new System.Drawing.Size(427, 237);
111
+            this.Controls.Add(this.label3);
112
+            this.Controls.Add(this.textBox_dgj);
93 113
             this.Controls.Add(this.comboBox_blc);
94 114
             this.Controls.Add(this.label2);
95 115
             this.Controls.Add(this.button1);
@@ -110,5 +130,7 @@ namespace HCTools
110 130
         private System.Windows.Forms.Button button1;
111 131
         private System.Windows.Forms.Label label2;
112 132
         private System.Windows.Forms.ComboBox comboBox_blc;
133
+        private System.Windows.Forms.TextBox textBox_dgj;
134
+        private System.Windows.Forms.Label label3;
113 135
     }
114 136
 }

+ 28
- 12
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/GCDdelete_Form.cs Просмотреть файл

@@ -65,7 +65,12 @@ namespace HCTools
65 65
             }
66 66
             if (comboBox_blc.Text == "")
67 67
             {
68
-                MessageBox.Show("请选择比例尺所在图层!");
68
+                MessageBox.Show("请选择比例尺!");
69
+                return;
70
+            }
71
+            if (textBox_dgj.Text == "")
72
+            {
73
+                MessageBox.Show("请输入等高距!");
69 74
                 return;
70 75
             }
71 76
             string blctext = comboBox_blc.Text;
@@ -74,10 +79,12 @@ namespace HCTools
74 79
             blc = Convert.ToInt32(strblc);
75 80
             lyr = comboBox1.Text;
76 81
             deletegcd();
82
+            this.Close();
77 83
         }
78 84
 
79 85
         private void deletegcd()
80 86
         {
87
+            double dgj = Convert.ToDouble(textBox_dgj.Text);
81 88
             Database db = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
82 89
             Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
83 90
             //获取高程点
@@ -110,20 +117,21 @@ namespace HCTools
110 117
                         //找到实体获取并判断高程
111 118
                         Entity entity = (Entity)tran.GetObject(objid, OpenMode.ForWrite);
112 119
 
113
-                        if (entity is BlockReference)
120
+                        if (entity is DBText)
114 121
                         {
115
-                            BlockReference bref = (BlockReference)entity;
116
-                            double z = Math.Round(bref.Position.Z, 2, MidpointRounding.AwayFromZero);
122
+                            DBText bref = (DBText)entity;
123
+                            //double z = Math.Round(Convert.ToDouble(bref.TextString), 2, MidpointRounding.AwayFromZero);
124
+                            double z = Convert.ToDouble(bref.TextString);
117 125
                             //判断四舍五入后是否为整数
118
-                            if (Math.Truncate(z) == Math.Round(z, MidpointRounding.AwayFromZero))
126
+                            if (z % dgj == 0)
119 127
                             {
120 128
                                 bref.Layer = "整数值高程点";
121
-                                //获取高程点旁的高程标注
129
+                                //获取高程点
122 130
                                 Point3d p1 = new Point3d(bref.Position.X - 4 * blc / 2000, bref.Position.Y - 4 * blc / 2000, 0);
123 131
                                 Point3d p2 = new Point3d(bref.Position.X + 4 * blc / 2000, bref.Position.Y + 4 * blc / 2000, 0);
124 132
                                 TypedValue[] typedvalue1 = new TypedValue[2];
125 133
 
126
-                                typedvalue1.SetValue(new TypedValue((int)DxfCode.Start, "Text"), 0);
134
+                                typedvalue1.SetValue(new TypedValue((int)DxfCode.Start, "INSERT"), 0);
127 135
                                 typedvalue1.SetValue(new TypedValue((int)DxfCode.LayerName, lyr), 1);
128 136
 
129 137
                                 SelectionFilter filter1 = new SelectionFilter(typedvalue1);
@@ -133,16 +141,24 @@ namespace HCTools
133 141
                                 {
134 142
                                     SelectionSet ss = psr1.Value;
135 143
                                     ObjectId[] objids = new ObjectId[ss.Count];
136
-                                    objids = selectionset.GetObjectIds();
144
+                                    objids = ss.GetObjectIds();
137 145
                                     for (int ii = 0; ii < objids.Length; ii++)
138 146
                                     {
139 147
                                         ObjectId objid1 = objids[ii];
140 148
                                         Entity ent = (Entity)tran.GetObject(objid1, OpenMode.ForWrite);
141
-                                        if(ent is DBText)
149
+                                        if (ent is BlockReference)
142 150
                                         {
143
-                                            DBText txt = (DBText)ent;
144
-                                            if(Convert.ToDouble(txt.TextString)== Math.Round(bref.Position.Z, 2, MidpointRounding.AwayFromZero))
145
-                                                txt.Layer = "整数值高程点";
151
+                                            BlockReference pt = (BlockReference)ent;
152
+                                            int ws = 0;
153
+                                            if(bref.TextString.Contains('.'))
154
+                                            {
155
+                                                ws = bref.TextString.Split('.')[1].Length;
156
+                                                if (bref.TextString.Split('.')[1].All(c => c == '0'))
157
+                                                    ws = 0;
158
+                                            }
159
+                                            double ele = Math.Round(pt.Position.Z, ws, MidpointRounding.AwayFromZero);
160
+                                            if (z == ele)
161
+                                                pt.Layer = "整数值高程点";
146 162
                                         }
147 163
                                     }
148 164
                                 }

+ 9
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj Просмотреть файл

@@ -350,6 +350,12 @@
350 350
     </Compile>
351 351
     <Compile Include="MainClass.cs" />
352 352
     <Compile Include="Menus.cs" />
353
+    <Compile Include="MergeDwg.cs">
354
+      <SubType>Form</SubType>
355
+    </Compile>
356
+    <Compile Include="MergeDwg.Designer.cs">
357
+      <DependentUpon>MergeDwg.cs</DependentUpon>
358
+    </Compile>
353 359
     <Compile Include="ModifyTFH.cs">
354 360
       <SubType>Form</SubType>
355 361
     </Compile>
@@ -462,6 +468,9 @@
462 468
     <EmbeddedResource Include="Layerchange_Form.resx">
463 469
       <DependentUpon>Layerchange_Form.cs</DependentUpon>
464 470
     </EmbeddedResource>
471
+    <EmbeddedResource Include="MergeDwg.resx">
472
+      <DependentUpon>MergeDwg.cs</DependentUpon>
473
+    </EmbeddedResource>
465 474
     <EmbeddedResource Include="ModifyTFH.resx">
466 475
       <DependentUpon>ModifyTFH.cs</DependentUpon>
467 476
     </EmbeddedResource>

+ 17
- 3
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InsertDOMs_to_one.Designer.cs Просмотреть файл

@@ -37,6 +37,7 @@ namespace HCTools
37 37
             this.button_dom = new System.Windows.Forms.Button();
38 38
             this.checkedListBox_dom = new System.Windows.Forms.CheckedListBox();
39 39
             this.button1 = new System.Windows.Forms.Button();
40
+            this.checkBox_selectAll = new System.Windows.Forms.CheckBox();
40 41
             this.SuspendLayout();
41 42
             // 
42 43
             // label1
@@ -94,7 +95,7 @@ namespace HCTools
94 95
             // checkedListBox_dom
95 96
             // 
96 97
             this.checkedListBox_dom.FormattingEnabled = true;
97
-            this.checkedListBox_dom.Location = new System.Drawing.Point(33, 145);
98
+            this.checkedListBox_dom.Location = new System.Drawing.Point(33, 164);
98 99
             this.checkedListBox_dom.Name = "checkedListBox_dom";
99 100
             this.checkedListBox_dom.Size = new System.Drawing.Size(424, 224);
100 101
             this.checkedListBox_dom.TabIndex = 6;
@@ -102,7 +103,7 @@ namespace HCTools
102 103
             // 
103 104
             // button1
104 105
             // 
105
-            this.button1.Location = new System.Drawing.Point(192, 385);
106
+            this.button1.Location = new System.Drawing.Point(192, 404);
106 107
             this.button1.Name = "button1";
107 108
             this.button1.Size = new System.Drawing.Size(83, 36);
108 109
             this.button1.TabIndex = 7;
@@ -110,11 +111,23 @@ namespace HCTools
110 111
             this.button1.UseVisualStyleBackColor = true;
111 112
             this.button1.Click += new System.EventHandler(this.button1_Click);
112 113
             // 
114
+            // checkBox_selectAll
115
+            // 
116
+            this.checkBox_selectAll.AutoSize = true;
117
+            this.checkBox_selectAll.Location = new System.Drawing.Point(33, 139);
118
+            this.checkBox_selectAll.Name = "checkBox_selectAll";
119
+            this.checkBox_selectAll.Size = new System.Drawing.Size(59, 19);
120
+            this.checkBox_selectAll.TabIndex = 8;
121
+            this.checkBox_selectAll.Text = "全选";
122
+            this.checkBox_selectAll.UseVisualStyleBackColor = true;
123
+            this.checkBox_selectAll.CheckedChanged += new System.EventHandler(this.checkBox_selectAll_CheckedChanged);
124
+            // 
113 125
             // InsertDOMs_to_one
114 126
             // 
115 127
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
116 128
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
117
-            this.ClientSize = new System.Drawing.Size(482, 447);
129
+            this.ClientSize = new System.Drawing.Size(482, 489);
130
+            this.Controls.Add(this.checkBox_selectAll);
118 131
             this.Controls.Add(this.button1);
119 132
             this.Controls.Add(this.checkedListBox_dom);
120 133
             this.Controls.Add(this.button_dom);
@@ -140,5 +153,6 @@ namespace HCTools
140 153
         private System.Windows.Forms.Button button_dom;
141 154
         private System.Windows.Forms.CheckedListBox checkedListBox_dom;
142 155
         private System.Windows.Forms.Button button1;
156
+        private System.Windows.Forms.CheckBox checkBox_selectAll;
143 157
     }
144 158
 }

+ 10
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InsertDOMs_to_one.cs Просмотреть файл

@@ -96,7 +96,8 @@ namespace HCTools
96 96
                         InsertDOMs(tifpath, tfwpath, doc);
97 97
                     }
98 98
                 }
99
-
99
+                dynamic acadApp = GrxCAD.ApplicationServices.Application.AcadApplication;
100
+                acadApp.ZoomExtents();
100 101
                 //浩辰2020不能用doc.CloseandSave,它只能close不save
101 102
                 doc.Database.Save();
102 103
                 doc.CloseAndDiscard();
@@ -224,5 +225,13 @@ namespace HCTools
224 225
 
225 226
             }
226 227
         }
228
+
229
+        private void checkBox_selectAll_CheckedChanged(object sender, EventArgs e)
230
+        {
231
+            for (int i = 0; i < this.checkedListBox_dom.Items.Count; i++)
232
+            {
233
+                this.checkedListBox_dom.SetItemChecked(i, true);
234
+            }
235
+        }
227 236
     }
228 237
 }

+ 1
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/JQXLabel_grid.Designer.cs Просмотреть файл

@@ -110,6 +110,7 @@ namespace HCTools
110 110
             this.comboBox_blc.FormattingEnabled = true;
111 111
             this.comboBox_blc.Items.AddRange(new object[] {
112 112
             "1:500",
113
+            "1:1000",
113 114
             "1:2000",
114 115
             "1:5000",
115 116
             "1:10000"});

+ 272
- 141
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/JQXLabel_grid.cs Просмотреть файл

@@ -22,6 +22,7 @@ namespace HCTools
22 22
             InitializeComponent();
23 23
         }
24 24
 
25
+        int nodirection = 0;
25 26
         private void JQXLabel_grid_Load(object sender, EventArgs e)
26 27
         {
27 28
             //自动填充下拉框
@@ -89,7 +90,7 @@ namespace HCTools
89 90
                 return;
90 91
             }
91 92
             jqxLabelbyGrid();
92
-            MessageBox.Show("标注完成。");
93
+            MessageBox.Show("标注完成。\n有"+nodirection.ToString()+ "处无法确定方向,移动到“无法确定方向”图层");
93 94
             this.Close();
94 95
         }
95 96
 
@@ -136,6 +137,10 @@ namespace HCTools
136 137
                 MessageBox.Show("未找到图框!");
137 138
                 return;
138 139
             }
140
+            //创建标记字体
141
+            CreateSheetMap cs = new CreateSheetMap();
142
+            cs.createTextStyle();
143
+            ObjectId HZ = cs.gettextstyleID("HZ");
139 144
             //遍历图框顶点列表,按顶点范围搜索等高线
140 145
             for (int i = 0; i < tkpts.Count; i++)
141 146
             {
@@ -163,40 +168,43 @@ namespace HCTools
163 168
                     SelectionSet ss = psr_pl.Value;
164 169
                     ObjectId[] plids = ss.GetObjectIds();
165 170
 
166
-                    List<Polyline> pllist = new List<Polyline>();
167
-                    for (int ii = 0; ii < plids.Length; ii++)
171
+                    List<Polyline> pllist = new List<Polyline>(); using (Transaction tr = db.TransactionManager.StartTransaction())
168 172
                     {
169
-                        using (Transaction tr = db.TransactionManager.StartTransaction())
173
+                        for (int ii = 0; ii < plids.Length; ii++)
170 174
                         {
175
+
171 176
                             Polyline pl = tr.GetObject(plids[ii], OpenMode.ForRead) as Polyline;
172 177
                             pllist.Add(pl);
173
-                            tr.Commit();
174 178
                         }
179
+                        tr.Commit();
175 180
                     }
176 181
 
177 182
                     //绘制图框
178 183
                     Polyline tk1 = new Polyline();
179 184
                     double width = tkpts[i][1].X - tkpts[i][0].X;
180 185
                     double height = tkpts[i][1].Y - tkpts[i][0].Y;
181
-                    tk1.AddVertexAt(0, new Point2d(tkpts[i][0].X, tkpts[i][0].Y), 0, 0, 0);
186
+                    tk1.AddVertexAt(0, new Point2d(tkpts[i][0].X, width), 0, 0, 0);
182 187
                     tk1.AddVertexAt(1, new Point2d(tkpts[i][0].X + width, tkpts[i][0].Y), 0, 0, 0);
183 188
                     tk1.AddVertexAt(2, new Point2d(tkpts[i][1].X, tkpts[i][1].Y), 0, 0, 0);
184 189
                     tk1.AddVertexAt(3, new Point2d(tkpts[i][0].X, tkpts[i][0].Y + height), 0, 0, 0);
185 190
                     tk1.Closed = true;
186 191
 
187
-                    var result = getPll(pllist,tk1);
188
-                    if (result.Count > 1)
189
-                    {
190
-                        Polyline merged = mergePl(result,tk1);
191
-                        makeMark(merged, db, tk1, blc);
192
-                    }
193
-                    else
194
-                        makeMark(result[0], db, tk1, blc);
192
+                    Point3d centralpt = new Point3d(tkpts[i][0].X + width / 2, tkpts[i][0].Y + height / 2, 0);
193
+                    var result = getPll(pllist,tk1, centralpt);
194
+                    //if (result.Count > 1)
195
+                    //{
196
+                        //Polyline merged = mergePl(result,tk1);
197
+                        //makeMark(merged, db, tk1, blc,centralpt);
198
+                        makeMark(result, db, blc,centralpt,HZ);
199
+                    //}
200
+                    //else
201
+                    //makeMark(result[0], db, tk1, blc, centralpt);
202
+                    pllist.Clear();
195 203
                 }
196 204
             }
197 205
         }
198 206
 
199
-        private List<Polyline> getPll(List<Polyline> pllist,Polyline tk)
207
+        private Polyline getPll(List<Polyline> pllist,Polyline tk,Point3d central)
200 208
         {
201 209
             var jqxlist = pllist.Where(pline => pline.Layer == comboBox_jqx.Text).ToList();
202 210
             var plllist_sorted = pllist.OrderBy(pline => pline.Elevation).ToList();
@@ -208,149 +216,270 @@ namespace HCTools
208 216
                 var sortedEle = jqxlist_groupbyele.Keys.OrderBy(e => e).ToList();
209 217
 
210 218
                 //获取图框内的多段线
211
-                var plinside = new List<Polyline>();
212
-                foreach (var item in jqxlist_groupbyele)
213
-                {
214
-                    foreach (var pl in item.Value)
215
-                    {
216
-                        var pls = GetPolylineInsideFrame(pl, tk);
217
-                        foreach (var l in pls)
218
-                        {
219
-                            plinside.Add(l);
220
-                        }
221
-                    }
222
-                }
219
+                //var plinside = new List<Polyline>();
220
+                //foreach (var item in jqxlist_groupbyele)
221
+                //{
222
+                //    foreach (var pl in item.Value)
223
+                //    {
224
+                //        var pls = GetPolylineInsideFrame(pl, tk);
225
+                //        foreach (var l in pls)
226
+                //        {
227
+                //            plinside.Add(l);
228
+                //        }
229
+                //    }
230
+                //}
223 231
                 //选择其中最长的高程组作为用于标记的高程线
224
-                var plinside_groupbyele = plinside.GroupBy(pline => pline.Elevation)
225
-                                    .ToDictionary(group => group.Key, group => group.ToList());
226
-                var result = plinside_groupbyele.OrderByDescending(g => g.Value.Sum(p => p.Length)).FirstOrDefault();
227
-                return result.Value;
232
+                //var plinside_groupbyele = plinside.GroupBy(pline => pline.Elevation)
233
+                //                    .ToDictionary(group => group.Key, group => group.ToList());
234
+                //var result = plinside_groupbyele.OrderByDescending(g => g.Value.Sum(p => p.Length)).FirstOrDefault();
235
+                Polyline labelpll = jqxlist.OrderBy(c => c.GetClosestPointTo(new Point3d(central.X,central.Y,c.Elevation), new Vector3d(0, 0, 1), false)
236
+                                            .DistanceTo(new Point3d(central.X, central.Y, c.Elevation))).First();
237
+                jqxlist.Clear();
238
+                return labelpll;
228 239
             }
229 240
             else
230 241
                 return null;
231 242
         }
232 243
 
233
-        private Polyline mergePl(List<Polyline> plllist, Polyline tk)
244
+        #region
245
+        //private Polyline mergePl(List<Polyline> plllist, Polyline tk)
246
+        //{
247
+        //    List<Polyline> interse = new List<Polyline>();
248
+        //    List<Polyline> result = new List<Polyline>(plllist);
249
+        //    for (int i = 0; i < plllist.Count - 1; i++)
250
+        //    {
251
+        //        Point3d start1 = plllist[i].GetPoint3dAt(0);
252
+        //        Point3d end1 = plllist[i].GetPoint3dAt(plllist[i].NumberOfVertices - 1);
253
+        //        for (int j = i + 1; j < plllist.Count; j++)
254
+        //        {
255
+        //            Point3d start2 = plllist[j].GetPoint3dAt(0);
256
+        //            Point3d end2 = plllist[j].GetPoint3dAt(plllist[j].NumberOfVertices - 1);
257
+        //            if (start1 == start2 || start1 == end2 || end1 == start2 || end1 == end2)
258
+        //            {
259
+        //                interse.Add(plllist[i]);
260
+        //                interse.Add(plllist[j]);
261
+        //                if (result.Contains(plllist[i])) result.Remove(plllist[i]);
262
+        //                if (result.Contains(plllist[j])) result.Remove(plllist[j]);
263
+        //            }
264
+        //        }
265
+        //    }
266
+        //    if (interse.Count > 0)
267
+        //    {
268
+        //        // 转换为NTS线串
269
+        //        var lineStrings = new List<Geometry>();
270
+        //        foreach (var pl in interse)
271
+        //        {
272
+        //            var lineString1 = ConvertPolylineToNtsGeometry(pl);
273
+        //            lineStrings.Add(lineString1);
274
+        //        }
275
+        //        // 使用线合并器
276
+        //        var merger = new LineMerger();
277
+        //        merger.Add(lineStrings);
278
+
279
+        //        // 获取合并结果
280
+        //        var mergedCollection = merger.GetMergedLineStrings();
281
+
282
+        //        // 转换回AutoCAD多段线
283
+        //        foreach (var geometry in mergedCollection)
284
+        //        {
285
+        //            if (geometry is LineString mergedLineString)
286
+        //            {
287
+        //                var mergedPolyline = ConvertNtsLineStringToPolyline(mergedLineString);
288
+        //                if (mergedPolyline != null)
289
+        //                {
290
+        //                    mergedPolyline.Elevation = plllist[0].Elevation;
291
+        //                    result.Add(mergedPolyline);
292
+        //                }
293
+        //            }
294
+        //        }
295
+        //    }
296
+        //    var plinside = new List<Polyline>();
297
+        //    foreach (var item in result)
298
+        //    {
299
+        //        var pls = GetPolylineInsideFrame(item, tk);
300
+        //        foreach (var l in pls)
301
+        //        {
302
+        //            plinside.Add(l);
303
+        //        }
304
+        //    }
305
+        //    return plinside.OrderByDescending(g => g.Length).First();
306
+        //}
307
+        #endregion
308
+
309
+        private void makeMark(Polyline pll,Database db, int blc,Point3d central, ObjectId HZ)
234 310
         {
235
-            List<Polyline> interse = new List<Polyline>();
236
-            List<Polyline> result = new List<Polyline>(plllist);
237
-            for (int i = 0; i < plllist.Count - 1; i++)
311
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
312
+            //var pllInside = GetPolylineInsideFrame(pll, tk);
313
+            Polyline labelpll = pll;
314
+            //Point3d label_pos = labelpll.GetPointAtDist(labelpll.Length / 2);
315
+
316
+            Point3d label_pos = labelpll.GetClosestPointTo(central, new Vector3d(0, 0, 1), false);
317
+            if (labelpll.StartPoint.X > labelpll.EndPoint.X)
318
+                labelpll.ReverseCurve();
319
+            //计算放置注记处的方向
320
+            Vector3d tangent = labelpll.GetFirstDerivative(labelpll.GetParameterAtPoint(label_pos));
321
+            double angle = tangent.GetAngleTo(Vector3d.XAxis);
322
+            //调整角度范围(0到2Π)
323
+            if (tangent.Y < 0)
324
+                angle = 2 * Math.PI - angle;
325
+            //法线向量
326
+            Vector3d normal = new Vector3d(-tangent.Y, tangent.X, 0);
327
+            //单位化
328
+            normal = normal.GetNormal();
329
+
330
+            List<Polyline> pllist = new List<Polyline>();
331
+            var angle1 = angle;
332
+            var angle2 = angle + Math.PI;
333
+            int flag = 0;
334
+            //以标注所在位置点为基点做基于该点的法线射线进行搜索
335
+            Point3d startPoint = label_pos;
336
+            Point3d endPoint = label_pos + normal * 200;
337
+            Point3dCollection ptcoll = new Point3dCollection() { startPoint, endPoint };
338
+
339
+            TypedValue[] typedvalue_pl = new TypedValue[2];
340
+            typedvalue_pl.SetValue(new TypedValue((int)DxfCode.LayerName, comboBox_jqx.Text+",8110"), 0);
341
+            typedvalue_pl.SetValue(new TypedValue((int)DxfCode.Start, "LWPOLYLINE"), 1);
342
+            SelectionFilter selectionfilter_pl = new SelectionFilter(typedvalue_pl);
343
+            PromptSelectionResult psr_pl = ed.SelectFence(ptcoll, selectionfilter_pl);
344
+            if (psr_pl.Status == PromptStatus.OK)
238 345
             {
239
-                Point3d start1 = plllist[i].GetPoint3dAt(0);
240
-                Point3d end1 = plllist[i].GetPoint3dAt(plllist[i].NumberOfVertices - 1);
241
-                for (int j = i + 1; j < plllist.Count; j++)
346
+                SelectionSet ss = psr_pl.Value;
347
+                ObjectId[] plids = ss.GetObjectIds();
348
+                using (Transaction tr = db.TransactionManager.StartTransaction())
242 349
                 {
243
-                    Point3d start2 = plllist[j].GetPoint3dAt(0);
244
-                    Point3d end2 = plllist[j].GetPoint3dAt(plllist[j].NumberOfVertices - 1);
245
-                    if (start1 == start2 || start1 == end2 || end1 == start2 || end1 == end2)
350
+                    for (int ii = 0; ii < plids.Length; ii++)
246 351
                     {
247
-                        interse.Add(plllist[i]);
248
-                        interse.Add(plllist[j]);
249
-                        if (result.Contains(plllist[i])) result.Remove(plllist[i]);
250
-                        if (result.Contains(plllist[j])) result.Remove(plllist[j]);
352
+
353
+                        Polyline dgx = tr.GetObject(plids[ii], OpenMode.ForRead) as Polyline;
354
+                        if (dgx.Elevation != pll.Elevation)
355
+                            pllist.Add(dgx);
251 356
                     }
357
+                    tr.Commit();
252 358
                 }
253 359
             }
254
-            if (interse.Count > 0)
360
+            if (pllist.Count == 0 || psr_pl.Status != PromptStatus.OK)
255 361
             {
256
-                // 转换为NTS线串
257
-                var lineStrings = new List<Geometry>();
258
-                foreach (var pl in interse)
362
+                flag = 1;
363
+                endPoint = label_pos - normal * 200;
364
+                ptcoll = new Point3dCollection() { startPoint, endPoint };
365
+                PromptSelectionResult psr_pl1 = ed.SelectFence(ptcoll, selectionfilter_pl);
366
+                if (psr_pl1.Status == PromptStatus.OK)
259 367
                 {
260
-                    var lineString1 = ConvertPolylineToNtsGeometry(pl);
261
-                    lineStrings.Add(lineString1);
262
-                }
263
-                // 使用线合并器
264
-                var merger = new LineMerger();
265
-                merger.Add(lineStrings);
266
-
267
-                // 获取合并结果
268
-                var mergedCollection = merger.GetMergedLineStrings();
269
-
270
-                // 转换回AutoCAD多段线
271
-                foreach (var geometry in mergedCollection)
272
-                {
273
-                    if (geometry is LineString mergedLineString)
368
+                    SelectionSet ss = psr_pl1.Value;
369
+                    ObjectId[] plids = ss.GetObjectIds();
370
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
274 371
                     {
275
-                        var mergedPolyline = ConvertNtsLineStringToPolyline(mergedLineString);
276
-                        if (mergedPolyline != null)
372
+                        for (int ii = 0; ii < plids.Length; ii++)
277 373
                         {
278
-                            mergedPolyline.Elevation = plllist[0].Elevation;
279
-                            result.Add(mergedPolyline);
374
+
375
+                            Polyline dgx = tr.GetObject(plids[ii], OpenMode.ForRead) as Polyline;
376
+                            if (dgx.Elevation != pll.Elevation)
377
+                                pllist.Add(dgx);
280 378
                         }
379
+                        tr.Commit();
281 380
                     }
282 381
                 }
382
+                psr_pl1 = null;
283 383
             }
284
-            var plinside = new List<Polyline>();
285
-            foreach (var item in result)
384
+            if (pllist.Count != 0)
286 385
             {
287
-                var pls = GetPolylineInsideFrame(item, tk);
288
-                foreach (var l in pls)
289
-                {
290
-                    plinside.Add(l);
291
-                }
292
-            }
293
-            return plinside.OrderByDescending(g => g.Length).First();
294
-        }
386
+                Polyline closest = null;
387
+                double minDistance = double.MaxValue;
295 388
 
296
-        private void makeMark(Polyline pll,Database db, Polyline tk, int blc)
297
-        {
298
-            var pllInside = GetPolylineInsideFrame(pll, tk);
299
-            Polyline labelpll = pllInside.OrderByDescending(c => c.Length).First();
300
-            Point3d label_pos = labelpll.GetPointAtDist(labelpll.Length / 2);
301
-            if (labelpll.StartPoint.X > labelpll.EndPoint.X)
302
-                labelpll.ReverseCurve();
303
-            //计算放置注记处的方向
304
-            Vector3d tangent = labelpll.GetFirstDerivative(labelpll.GetParameterAtPoint(label_pos));
305
-            double angle = tangent.GetAngleTo(Vector3d.XAxis);
306
-            //调整角度范围(0到2Π)
307
-            if (tangent.Y < 0)
308
-                angle = 2 * Math.PI - angle;
389
+                foreach (Polyline dgx in pllist)
390
+                {
391
+                    // 直接计算距离,不使用中间Point3d对象
392
+                    Point3d closestPoint = dgx.GetClosestPointTo(label_pos, new Vector3d(0, 0, 1), false);
309 393
 
310
-            // 定义不允许的角度范围:90°到270°(向下方向)
311
-            double lowerBound = Math.PI / 2;  // 90°
312
-            double upperBound = 3 * Math.PI / 2;  // 270°
394
+                    // 避免创建新的Point3d对象
395
+                    double distance = Math.Sqrt(
396
+                        Math.Pow(closestPoint.X - label_pos.X, 2) +
397
+                        Math.Pow(closestPoint.Y - label_pos.Y, 2) +
398
+                        Math.Pow(dgx.Elevation - label_pos.Z, 2)
399
+                    );
313 400
 
314
-            // 如果角度在向下范围内,进行调整
315
-            if (angle > lowerBound && angle < upperBound)
316
-            {
317
-                // 翻转180度,使文字朝上
318
-                angle = angle + Math.PI;
401
+                    if (distance < minDistance)
402
+                    {
403
+                        minDistance = distance;
404
+                        closest = dgx;
405
+                    }
406
+                }
407
+                if (closest.Elevation < pll.Elevation && flag == 0 || closest.Elevation > pll.Elevation && flag == 1)
408
+                    angle = angle2;
409
+                closest.Dispose();
410
+                //1:2000字高4,以此为基础计算其他比例尺的字高
411
+                double labelheight = 4;
412
+                if (blc == 500)
413
+                    labelheight = labelheight * ((double)500 / 2000);
414
+                if (blc == 1000)
415
+                    labelheight = labelheight * ((double)1000 / 2000);
416
+                if (blc == 5000)
417
+                    labelheight = labelheight * ((double)5000 / 2000);
418
+                if (blc == 10000)
419
+                    labelheight = labelheight * ((double)10000 / 2000);
420
+
421
+                string ele = pll.Elevation.ToString();
422
+                using (Transaction tr = db.TransactionManager.StartTransaction())
423
+                {
424
+                    BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
425
+                    BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
426
+                    DBText ele_txt = new DBText();
427
+                    ele_txt.Height = labelheight;
428
+                    ele_txt.TextString = ele;
429
+                    ele_txt.TextStyleId = HZ;
430
+                    ele_txt.HorizontalMode = TextHorizontalMode.TextMid;
431
+                    ele_txt.Position = label_pos;
432
+                    ele_txt.AlignmentPoint = label_pos;
433
+                    ele_txt.Rotation = angle;
434
+                    ele_txt.Layer = comboBox_bz.Text;
435
+                    btr.AppendEntity(ele_txt);
436
+                    tr.AddNewlyCreatedDBObject(ele_txt, true);
437
+                    tr.Commit();
438
+                }
319 439
             }
320
-
321
-            //创建标记字体
322
-            CreateSheetMap cs = new CreateSheetMap();
323
-            cs.createTextStyle();
324
-            ObjectId HZ = cs.gettextstyleID("HZ");
325
-            //1:2000字高4,以此为基础计算其他比例尺的字高
326
-            double labelheight = 4;
327
-            if (blc == 500)
328
-                labelheight = labelheight * ((double)500 / 2000);
329
-            if (blc == 1000)
330
-                labelheight = labelheight * ((double)1000 / 2000);
331
-            if (blc == 5000)
332
-                labelheight = labelheight * ((double)5000 / 2000);
333
-            if (blc == 10000)
334
-                labelheight = labelheight * ((double)10000 / 2000);
335
-
336
-            string ele = pll.Elevation.ToString();
337
-            using (Transaction tr = db.TransactionManager.StartTransaction())
440
+            else
338 441
             {
339
-                BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
340
-                BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
341
-                DBText ele_txt = new DBText();
342
-                ele_txt.Height = labelheight;
343
-                ele_txt.TextString = ele;
344
-                ele_txt.TextStyleId = HZ;
345
-                ele_txt.HorizontalMode = TextHorizontalMode.TextMid;
346
-                ele_txt.Position = label_pos;
347
-                ele_txt.AlignmentPoint = label_pos;
348
-                ele_txt.Rotation = angle;
349
-                ele_txt.Layer = comboBox_bz.Text;
350
-                btr.AppendEntity(ele_txt);
351
-                tr.AddNewlyCreatedDBObject(ele_txt, true);
352
-                tr.Commit();
442
+                nodirection = nodirection + 1;
443
+                LayerControl layerscontrol = new LayerControl();
444
+                string layname = "无法判断方向";
445
+                if (layerscontrol.haslayername(layname) == false)
446
+                {
447
+                    colorgb col = new colorgb(255, 0, 0);
448
+                    layerscontrol.creatlayer(layname, col);
449
+                }
450
+                //1:2000字高4,以此为基础计算其他比例尺的字高
451
+                double labelheight = 4;
452
+                if (blc == 500)
453
+                    labelheight = labelheight * ((double)500 / 2000);
454
+                if (blc == 1000)
455
+                    labelheight = labelheight * ((double)1000 / 2000);
456
+                if (blc == 5000)
457
+                    labelheight = labelheight * ((double)5000 / 2000);
458
+                if (blc == 10000)
459
+                    labelheight = labelheight * ((double)10000 / 2000);
460
+
461
+                string ele = pll.Elevation.ToString();
462
+                using (Transaction tr = db.TransactionManager.StartTransaction())
463
+                {
464
+                    BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
465
+                    BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
466
+                    DBText ele_txt = new DBText();
467
+                    ele_txt.Height = labelheight;
468
+                    ele_txt.TextString = ele;
469
+                    ele_txt.TextStyleId = HZ;
470
+                    ele_txt.HorizontalMode = TextHorizontalMode.TextMid;
471
+                    ele_txt.Position = label_pos;
472
+                    ele_txt.AlignmentPoint = label_pos;
473
+                    ele_txt.Rotation = angle;
474
+                    ele_txt.Layer = "无法判断方向";
475
+                    btr.AppendEntity(ele_txt);
476
+                    tr.AddNewlyCreatedDBObject(ele_txt, true);
477
+                    tr.Commit();
478
+                }
479
+
353 480
             }
481
+            pllist.Clear();
482
+            psr_pl = null;
354 483
             #region
355 484
             //Polyline templine = pllist[0].Clone() as Polyline;
356 485
 
@@ -417,18 +546,20 @@ namespace HCTools
417 546
                         insidePolylines.Add(polyline);
418 547
                     }
419 548
                 }
420
-                else if (intersection is GeometryCollection collection)
421
-                {
422
-                    // 几何集合
423
-                    for (int i = 0; i < collection.NumGeometries; i++)
424
-                    {
425
-                        LineString segment = collection.GetGeometryN(i) as LineString;
426
-                        var polyline = ConvertNtsLineStringToPolyline(segment);
427
-                        polyline.Elevation = sourcePolyline.Elevation;
428
-                        insidePolylines.Add(polyline);
429
-                    }
430
-                }
549
+                //else if (intersection is GeometryCollection collection)
550
+                //{
551
+                //    // 几何集合
552
+                //    for (int i = 0; i < collection.NumGeometries; i++)
553
+                //    {
554
+                //        LineString segment = collection.GetGeometryN(i) as LineString;
555
+                //        var polyline = ConvertNtsLineStringToPolyline(segment);
556
+                //        polyline.Elevation = sourcePolyline.Elevation;
557
+                //        insidePolylines.Add(polyline);
558
+                //    }
559
+                //}
431 560
             }
561
+            ntsFrame = null;
562
+            ntsSource = null;
432 563
             return insidePolylines;
433 564
         }
434 565
 

+ 12
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/MainClass.cs Просмотреть файл

@@ -668,5 +668,17 @@ namespace HCTools
668 668
                 form.Show();
669 669
             }
670 670
         }
671
+
672
+        //合并dwg
673
+        [CommandMethod("Mergedwg")]
674
+        public void Merge()
675
+        {
676
+            Verify();
677
+            if (num == 1)
678
+            {
679
+                MergeDwg form = new MergeDwg();
680
+                form.Show();
681
+            }
682
+        }
671 683
     }
672 684
 }

+ 2
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Menus.cs Просмотреть файл

@@ -90,6 +90,8 @@ namespace HCTools
90 90
             pmi = pm.AddMenuItem(pm.Count + 1, "图层属性表", "Attribute ");
91 91
             pmi.HelpString = "图层属性表";
92 92
 
93
+            pmi = pm.AddMenuItem(pm.Count + 1, "合并同名dwg", "Mergedwg ");
94
+            pmi.HelpString = "合并同名dwg";
93 95
 
94 96
             //添加一个分隔条以区分不同类型的命令
95 97
             pm.AddSeparator(pm.Count + 1);

Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.dll Просмотреть файл


Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.pdb Просмотреть файл


Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/DesignTimeResolveAssemblyReferences.cache Просмотреть файл


Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.AssemblyReference.cache Просмотреть файл


+ 1
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.CoreCompileInputs.cache Просмотреть файл

@@ -1 +1 @@
1
-f6ce5b89e9e52977c869c2a1f0489f8609d73c8f
1
+c31aaf052ba2e83d0fb50dea0dcb81eb2a13efb9

+ 1
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.FileListAbsolute.txt Просмотреть файл

@@ -76,7 +76,6 @@ F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\b
76 76
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\bin\Debug\System.Memory.xml
77 77
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\bin\Debug\System.Numerics.Vectors.xml
78 78
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\bin\Debug\System.Runtime.CompilerServices.Unsafe.xml
79
-F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.csproj.AssemblyReference.cache
80 79
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.AttributeForm.resources
81 80
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.Chaginfos.resources
82 81
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.CheckL.resources
@@ -112,3 +111,4 @@ F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\o
112 111
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.dll
113 112
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.pdb
114 113
 F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.PtLinecontradiction.resources
114
+F:\daima\Tools\加密后软件工具\CAD插件工具\源代码\HCTools\HCTools\obj\Debug\HCTools.MergeDwg.resources

Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.GenerateResource.cache Просмотреть файл


Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.dll Просмотреть файл


Двоичные данные
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.pdb Просмотреть файл


Загрузка…
Отмена
Сохранить