qyx 4ヶ月前
コミット
440c96004b
100個のファイルの変更15262行の追加0行の削除
  1. バイナリ
      加密后软件工具/CAD插件工具/HCTools.dll
  2. バイナリ
      加密后软件工具/CAD插件工具/使用说明.docx
  3. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/.vs/Regest/v16/.suo
  4. 25
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest.sln
  5. 6
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/App.config
  6. 129
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Form1.Designer.cs
  7. 38
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Form1.cs
  8. 120
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Form1.resx
  9. 22
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Program.cs
  10. 36
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/AssemblyInfo.cs
  11. 70
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Resources.Designer.cs
  12. 117
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Resources.resx
  13. 29
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Settings.Designer.cs
  14. 7
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Settings.settings
  15. 83
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Regest.csproj
  16. 6
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Regest.csproj.user
  17. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/bin/Debug/Regest.exe
  18. 6
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/bin/Debug/Regest.exe.config
  19. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/bin/Debug/Regest.pdb
  20. 4
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs
  21. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  22. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  23. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.Form1.resources
  24. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.Properties.Resources.resources
  25. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.AssemblyReference.cache
  26. 1
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.CoreCompileInputs.cache
  27. 10
    0
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.FileListAbsolute.txt
  28. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.GenerateResource.cache
  29. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.exe
  30. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.pdb
  31. バイナリ
      加密后软件工具/CAD插件工具/提供注册码用/输出注册码.exe
  32. バイナリ
      加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/.suo
  33. バイナリ
      加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/TestStore/0/000.testlog
  34. バイナリ
      加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/TestStore/0/testlog.manifest
  35. 25
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools.sln
  36. 6
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/App.config
  37. 89
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/AttributeForm.Designer.cs
  38. 138
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/AttributeForm.cs
  39. 123
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/AttributeForm.resx
  40. 263
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Attributeget.cs
  41. 2551
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CMCgis_Basicfunction.cs
  42. 1103
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ChPLContradiction.cs
  43. 171
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.Designer.cs
  44. 350
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.cs
  45. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.resx
  46. 95
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckContourLine.cs
  47. 147
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckL.Designer.cs
  48. 101
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckL.cs
  49. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckL.resx
  50. 422
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckPLOverlay.cs
  51. 154
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Conn.Designer.cs
  52. 113
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Conn.cs
  53. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Conn.resx
  54. 479
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Connect.cs
  55. 173
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ContourLineFix.cs
  56. 856
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutContourLine.cs
  57. 244
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutCountL.Designer.cs
  58. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutCountL.cs
  59. 143
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutCountL.resx
  60. 131
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneral.Designer.cs
  61. 76
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneral.cs
  62. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneral.resx
  63. 193
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneralization.cs
  64. 150
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeleteElept.Designer.cs
  65. 93
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeleteElept.cs
  66. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeleteElept.resx
  67. 149
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeletePts.cs
  68. 153
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnnck.cs
  69. 170
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnno.Designer.cs
  70. 101
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnno.cs
  71. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnno.resx
  72. 97
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinterpl.Designer.cs
  73. 38
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinterpl.cs
  74. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinterpl.resx
  75. 351
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinters.cs
  76. 288
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ElePtCheck.cs
  77. 124
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRd.Designer.cs
  78. 85
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRd.cs
  79. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRd.resx
  80. 71
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRound.cs
  81. 156
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDenck.cs
  82. 170
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDensity.Designer.cs
  83. 100
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDensity.cs
  84. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDensity.resx
  85. 612
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/FeatureOverlap.cs
  86. 275
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj
  87. 10
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj.user
  88. 126
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierak.Designer.cs
  89. 87
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierak.cs
  90. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierak.resx
  91. 91
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierarchy.cs
  92. 227
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InsertDOM.cs
  93. 132
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InstDOM.Designer.cs
  94. 45
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InstDOM.cs
  95. 120
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InstDOM.resx
  96. 579
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Inters.cs
  97. 136
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/LayerChange.cs
  98. 208
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Layerchange_Form.Designer.cs
  99. 143
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Layerchange_Form.cs
  100. 0
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Layerchange_Form.resx

バイナリ
加密后软件工具/CAD插件工具/HCTools.dll ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/使用说明.docx ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/.vs/Regest/v16/.suo ファイルの表示


+ 25
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest.sln ファイルの表示

@@ -0,0 +1,25 @@
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio Version 16
4
+VisualStudioVersion = 16.0.33130.400
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Regest", "Regest\Regest.csproj", "{44A61635-7B77-49F0-9B8D-3929C286D37E}"
7
+EndProject
8
+Global
9
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
+		Debug|Any CPU = Debug|Any CPU
11
+		Release|Any CPU = Release|Any CPU
12
+	EndGlobalSection
13
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
14
+		{44A61635-7B77-49F0-9B8D-3929C286D37E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15
+		{44A61635-7B77-49F0-9B8D-3929C286D37E}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
+		{44A61635-7B77-49F0-9B8D-3929C286D37E}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
+		{44A61635-7B77-49F0-9B8D-3929C286D37E}.Release|Any CPU.Build.0 = Release|Any CPU
18
+	EndGlobalSection
19
+	GlobalSection(SolutionProperties) = preSolution
20
+		HideSolutionNode = FALSE
21
+	EndGlobalSection
22
+	GlobalSection(ExtensibilityGlobals) = postSolution
23
+		SolutionGuid = {41ED4B9B-266D-4E98-A796-4FC1EBD5DF76}
24
+	EndGlobalSection
25
+EndGlobal

+ 6
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/App.config ファイルの表示

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8" ?>
2
+<configuration>
3
+    <startup> 
4
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5
+    </startup>
6
+</configuration>

+ 129
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Form1.Designer.cs ファイルの表示

@@ -0,0 +1,129 @@
1
+
2
+namespace Regest
3
+{
4
+    partial class Form1
5
+    {
6
+        /// <summary>
7
+        /// 必需的设计器变量。
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// 清理所有正在使用的资源。
13
+        /// </summary>
14
+        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows 窗体设计器生成的代码
25
+
26
+        /// <summary>
27
+        /// 设计器支持所需的方法 - 不要修改
28
+        /// 使用代码编辑器修改此方法的内容。
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.button1 = new System.Windows.Forms.Button();
33
+            this.textBox1 = new System.Windows.Forms.TextBox();
34
+            this.label1 = new System.Windows.Forms.Label();
35
+            this.label2 = new System.Windows.Forms.Label();
36
+            this.textBox2 = new System.Windows.Forms.TextBox();
37
+            this.label3 = new System.Windows.Forms.Label();
38
+            this.workdays = new System.Windows.Forms.TextBox();
39
+            this.SuspendLayout();
40
+            // 
41
+            // button1
42
+            // 
43
+            this.button1.Location = new System.Drawing.Point(204, 101);
44
+            this.button1.Name = "button1";
45
+            this.button1.Size = new System.Drawing.Size(91, 29);
46
+            this.button1.TabIndex = 5;
47
+            this.button1.Text = "生 成";
48
+            this.button1.UseVisualStyleBackColor = true;
49
+            this.button1.Click += new System.EventHandler(this.button1_Click);
50
+            // 
51
+            // textBox1
52
+            // 
53
+            this.textBox1.Location = new System.Drawing.Point(118, 156);
54
+            this.textBox1.Name = "textBox1";
55
+            this.textBox1.Size = new System.Drawing.Size(279, 25);
56
+            this.textBox1.TabIndex = 7;
57
+            // 
58
+            // label1
59
+            // 
60
+            this.label1.AutoSize = true;
61
+            this.label1.Location = new System.Drawing.Point(51, 160);
62
+            this.label1.Name = "label1";
63
+            this.label1.Size = new System.Drawing.Size(67, 15);
64
+            this.label1.TabIndex = 3;
65
+            this.label1.Text = "注册码:";
66
+            // 
67
+            // label2
68
+            // 
69
+            this.label2.AutoSize = true;
70
+            this.label2.Location = new System.Drawing.Point(51, 26);
71
+            this.label2.Name = "label2";
72
+            this.label2.Size = new System.Drawing.Size(67, 15);
73
+            this.label2.TabIndex = 6;
74
+            this.label2.Text = "机器码:";
75
+            // 
76
+            // textBox2
77
+            // 
78
+            this.textBox2.Location = new System.Drawing.Point(118, 23);
79
+            this.textBox2.Name = "textBox2";
80
+            this.textBox2.Size = new System.Drawing.Size(279, 25);
81
+            this.textBox2.TabIndex = 4;
82
+            // 
83
+            // label3
84
+            // 
85
+            this.label3.AutoSize = true;
86
+            this.label3.Location = new System.Drawing.Point(36, 73);
87
+            this.label3.Name = "label3";
88
+            this.label3.Size = new System.Drawing.Size(82, 15);
89
+            this.label3.TabIndex = 8;
90
+            this.label3.Text = "有效天数:";
91
+            // 
92
+            // workdays
93
+            // 
94
+            this.workdays.Location = new System.Drawing.Point(118, 70);
95
+            this.workdays.Name = "workdays";
96
+            this.workdays.Size = new System.Drawing.Size(100, 25);
97
+            this.workdays.TabIndex = 9;
98
+            // 
99
+            // Form1
100
+            // 
101
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
102
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
103
+            this.ClientSize = new System.Drawing.Size(472, 202);
104
+            this.Controls.Add(this.workdays);
105
+            this.Controls.Add(this.label3);
106
+            this.Controls.Add(this.textBox2);
107
+            this.Controls.Add(this.label2);
108
+            this.Controls.Add(this.button1);
109
+            this.Controls.Add(this.textBox1);
110
+            this.Controls.Add(this.label1);
111
+            this.Name = "Form1";
112
+            this.Text = "注册码生成";
113
+            this.ResumeLayout(false);
114
+            this.PerformLayout();
115
+
116
+        }
117
+
118
+        #endregion
119
+
120
+        private System.Windows.Forms.Button button1;
121
+        private System.Windows.Forms.TextBox textBox1;
122
+        private System.Windows.Forms.Label label1;
123
+        private System.Windows.Forms.Label label2;
124
+        private System.Windows.Forms.TextBox textBox2;
125
+        private System.Windows.Forms.Label label3;
126
+        private System.Windows.Forms.TextBox workdays;
127
+    }
128
+}
129
+

+ 38
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Form1.cs ファイルの表示

@@ -0,0 +1,38 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.IO;
7
+using System.Linq;
8
+using System.Security.Cryptography;
9
+using System.Text;
10
+using System.Threading.Tasks;
11
+using System.Windows.Forms;
12
+
13
+namespace Regest
14
+{
15
+    public partial class Form1 : Form
16
+    {
17
+        public Form1()
18
+        {
19
+            InitializeComponent();
20
+        }
21
+
22
+        private void button1_Click(object sender, EventArgs e)
23
+        {
24
+            string jqm = textBox2.Text;
25
+            jqm = jqm +"," + workdays.Text;
26
+            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
27
+            byte[] inputByteArray = Encoding.Default.GetBytes(jqm);
28
+            des.Key = ASCIIEncoding.ASCII.GetBytes("vnf4s3ru");// 密钥
29
+            des.IV = ASCIIEncoding.ASCII.GetBytes("vnf4s3ru");// 初始化向量
30
+            MemoryStream ms = new MemoryStream();
31
+            CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(), CryptoStreamMode.Write);
32
+            cs.Write(inputByteArray, 0, inputByteArray.Length);
33
+            cs.FlushFinalBlock();
34
+            var retB = Convert.ToBase64String(ms.ToArray());
35
+            textBox1.Text = retB;
36
+        }
37
+    }
38
+}

+ 120
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Form1.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 22
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Program.cs ファイルの表示

@@ -0,0 +1,22 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Threading.Tasks;
5
+using System.Windows.Forms;
6
+
7
+namespace Regest
8
+{
9
+    static class Program
10
+    {
11
+        /// <summary>
12
+        /// 应用程序的主入口点。
13
+        /// </summary>
14
+        [STAThread]
15
+        static void Main()
16
+        {
17
+            Application.EnableVisualStyles();
18
+            Application.SetCompatibleTextRenderingDefault(false);
19
+            Application.Run(new Form1());
20
+        }
21
+    }
22
+}

+ 36
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/AssemblyInfo.cs ファイルの表示

@@ -0,0 +1,36 @@
1
+using System.Reflection;
2
+using System.Runtime.CompilerServices;
3
+using System.Runtime.InteropServices;
4
+
5
+// 有关程序集的一般信息由以下
6
+// 控制。更改这些特性值可修改
7
+// 与程序集关联的信息。
8
+[assembly: AssemblyTitle("Regest")]
9
+[assembly: AssemblyDescription("")]
10
+[assembly: AssemblyConfiguration("")]
11
+[assembly: AssemblyCompany("")]
12
+[assembly: AssemblyProduct("Regest")]
13
+[assembly: AssemblyCopyright("Copyright ©  2024")]
14
+[assembly: AssemblyTrademark("")]
15
+[assembly: AssemblyCulture("")]
16
+
17
+// 将 ComVisible 设置为 false 会使此程序集中的类型
18
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
19
+//请将此类型的 ComVisible 特性设置为 true。
20
+[assembly: ComVisible(false)]
21
+
22
+// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
23
+[assembly: Guid("44a61635-7b77-49f0-9b8d-3929c286d37e")]
24
+
25
+// 程序集的版本信息由下列四个值组成: 
26
+//
27
+//      主版本
28
+//      次版本
29
+//      生成号
30
+//      修订号
31
+//
32
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
33
+//通过使用 "*",如下所示:
34
+// [assembly: AssemblyVersion("1.0.*")]
35
+[assembly: AssemblyVersion("1.0.0.0")]
36
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 70
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Resources.Designer.cs ファイルの表示

@@ -0,0 +1,70 @@
1
+//------------------------------------------------------------------------------
2
+// <auto-generated>
3
+//     此代码由工具生成。
4
+//     运行时版本: 4.0.30319.42000
5
+//
6
+//     对此文件的更改可能导致不正确的行为,如果
7
+//     重新生成代码,则所做更改将丢失。
8
+// </auto-generated>
9
+//------------------------------------------------------------------------------
10
+
11
+
12
+namespace Regest.Properties
13
+{
14
+    /// <summary>
15
+    ///   强类型资源类,用于查找本地化字符串等。
16
+    /// </summary>
17
+    // 此类是由 StronglyTypedResourceBuilder
18
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
19
+    // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
20
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
21
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
22
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
23
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
24
+    internal class Resources
25
+    {
26
+
27
+        private static global::System.Resources.ResourceManager resourceMan;
28
+
29
+        private static global::System.Globalization.CultureInfo resourceCulture;
30
+
31
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32
+        internal Resources()
33
+        {
34
+        }
35
+
36
+        /// <summary>
37
+        ///   返回此类使用的缓存 ResourceManager 实例。
38
+        /// </summary>
39
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
40
+        internal static global::System.Resources.ResourceManager ResourceManager
41
+        {
42
+            get
43
+            {
44
+                if ((resourceMan == null))
45
+                {
46
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Regest.Properties.Resources", typeof(Resources).Assembly);
47
+                    resourceMan = temp;
48
+                }
49
+                return resourceMan;
50
+            }
51
+        }
52
+
53
+        /// <summary>
54
+        ///   重写当前线程的 CurrentUICulture 属性,对
55
+        ///   使用此强类型资源类的所有资源查找执行重写。
56
+        /// </summary>
57
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
58
+        internal static global::System.Globalization.CultureInfo Culture
59
+        {
60
+            get
61
+            {
62
+                return resourceCulture;
63
+            }
64
+            set
65
+            {
66
+                resourceCulture = value;
67
+            }
68
+        }
69
+    }
70
+}

+ 117
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Resources.resx ファイルの表示

@@ -0,0 +1,117 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:element name="root" msdata:IsDataSet="true">
64
+      <xsd:complexType>
65
+        <xsd:choice maxOccurs="unbounded">
66
+          <xsd:element name="metadata">
67
+            <xsd:complexType>
68
+              <xsd:sequence>
69
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
70
+              </xsd:sequence>
71
+              <xsd:attribute name="name" type="xsd:string" />
72
+              <xsd:attribute name="type" type="xsd:string" />
73
+              <xsd:attribute name="mimetype" type="xsd:string" />
74
+            </xsd:complexType>
75
+          </xsd:element>
76
+          <xsd:element name="assembly">
77
+            <xsd:complexType>
78
+              <xsd:attribute name="alias" type="xsd:string" />
79
+              <xsd:attribute name="name" type="xsd:string" />
80
+            </xsd:complexType>
81
+          </xsd:element>
82
+          <xsd:element name="data">
83
+            <xsd:complexType>
84
+              <xsd:sequence>
85
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
86
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
87
+              </xsd:sequence>
88
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
89
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
90
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
91
+            </xsd:complexType>
92
+          </xsd:element>
93
+          <xsd:element name="resheader">
94
+            <xsd:complexType>
95
+              <xsd:sequence>
96
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
97
+              </xsd:sequence>
98
+              <xsd:attribute name="name" type="xsd:string" use="required" />
99
+            </xsd:complexType>
100
+          </xsd:element>
101
+        </xsd:choice>
102
+      </xsd:complexType>
103
+    </xsd:element>
104
+  </xsd:schema>
105
+  <resheader name="resmimetype">
106
+    <value>text/microsoft-resx</value>
107
+  </resheader>
108
+  <resheader name="version">
109
+    <value>2.0</value>
110
+  </resheader>
111
+  <resheader name="reader">
112
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
113
+  </resheader>
114
+  <resheader name="writer">
115
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+</root>

+ 29
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Settings.Designer.cs ファイルの表示

@@ -0,0 +1,29 @@
1
+//------------------------------------------------------------------------------
2
+// <auto-generated>
3
+//     This code was generated by a tool.
4
+//     Runtime Version:4.0.30319.42000
5
+//
6
+//     Changes to this file may cause incorrect behavior and will be lost if
7
+//     the code is regenerated.
8
+// </auto-generated>
9
+//------------------------------------------------------------------------------
10
+
11
+
12
+namespace Regest.Properties
13
+{
14
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
16
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
17
+    {
18
+
19
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
20
+
21
+        public static Settings Default
22
+        {
23
+            get
24
+            {
25
+                return defaultInstance;
26
+            }
27
+        }
28
+    }
29
+}

+ 7
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Properties/Settings.settings ファイルの表示

@@ -0,0 +1,7 @@
1
+<?xml version='1.0' encoding='utf-8'?>
2
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
3
+  <Profiles>
4
+    <Profile Name="(Default)" />
5
+  </Profiles>
6
+  <Settings />
7
+</SettingsFile>

+ 83
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Regest.csproj ファイルの表示

@@ -0,0 +1,83 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{44A61635-7B77-49F0-9B8D-3929C286D37E}</ProjectGuid>
8
+    <OutputType>WinExe</OutputType>
9
+    <RootNamespace>Regest</RootNamespace>
10
+    <AssemblyName>Regest</AssemblyName>
11
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12
+    <FileAlignment>512</FileAlignment>
13
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <PlatformTarget>AnyCPU</PlatformTarget>
18
+    <DebugSymbols>true</DebugSymbols>
19
+    <DebugType>full</DebugType>
20
+    <Optimize>false</Optimize>
21
+    <OutputPath>bin\Debug\</OutputPath>
22
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
23
+    <ErrorReport>prompt</ErrorReport>
24
+    <WarningLevel>4</WarningLevel>
25
+  </PropertyGroup>
26
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27
+    <PlatformTarget>AnyCPU</PlatformTarget>
28
+    <DebugType>pdbonly</DebugType>
29
+    <Optimize>true</Optimize>
30
+    <OutputPath>bin\Release\</OutputPath>
31
+    <DefineConstants>TRACE</DefineConstants>
32
+    <ErrorReport>prompt</ErrorReport>
33
+    <WarningLevel>4</WarningLevel>
34
+  </PropertyGroup>
35
+  <ItemGroup>
36
+    <Reference Include="System" />
37
+    <Reference Include="System.Core" />
38
+    <Reference Include="System.Xml.Linq" />
39
+    <Reference Include="System.Data.DataSetExtensions" />
40
+    <Reference Include="Microsoft.CSharp" />
41
+    <Reference Include="System.Data" />
42
+    <Reference Include="System.Deployment" />
43
+    <Reference Include="System.Drawing" />
44
+    <Reference Include="System.Net.Http" />
45
+    <Reference Include="System.Windows.Forms" />
46
+    <Reference Include="System.Xml" />
47
+  </ItemGroup>
48
+  <ItemGroup>
49
+    <Compile Include="Form1.cs">
50
+      <SubType>Form</SubType>
51
+    </Compile>
52
+    <Compile Include="Form1.Designer.cs">
53
+      <DependentUpon>Form1.cs</DependentUpon>
54
+    </Compile>
55
+    <Compile Include="Program.cs" />
56
+    <Compile Include="Properties\AssemblyInfo.cs" />
57
+    <EmbeddedResource Include="Form1.resx">
58
+      <DependentUpon>Form1.cs</DependentUpon>
59
+    </EmbeddedResource>
60
+    <EmbeddedResource Include="Properties\Resources.resx">
61
+      <Generator>ResXFileCodeGenerator</Generator>
62
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
63
+      <SubType>Designer</SubType>
64
+    </EmbeddedResource>
65
+    <Compile Include="Properties\Resources.Designer.cs">
66
+      <AutoGen>True</AutoGen>
67
+      <DependentUpon>Resources.resx</DependentUpon>
68
+    </Compile>
69
+    <None Include="Properties\Settings.settings">
70
+      <Generator>SettingsSingleFileGenerator</Generator>
71
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
72
+    </None>
73
+    <Compile Include="Properties\Settings.Designer.cs">
74
+      <AutoGen>True</AutoGen>
75
+      <DependentUpon>Settings.settings</DependentUpon>
76
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
77
+    </Compile>
78
+  </ItemGroup>
79
+  <ItemGroup>
80
+    <None Include="App.config" />
81
+  </ItemGroup>
82
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
83
+</Project>

+ 6
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/Regest.csproj.user ファイルの表示

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <PropertyGroup>
4
+    <ProjectView>ProjectFiles</ProjectView>
5
+  </PropertyGroup>
6
+</Project>

バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/bin/Debug/Regest.exe ファイルの表示


+ 6
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/bin/Debug/Regest.exe.config ファイルの表示

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8" ?>
2
+<configuration>
3
+    <startup> 
4
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5
+    </startup>
6
+</configuration>

バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/bin/Debug/Regest.pdb ファイルの表示


+ 4
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs ファイルの表示

@@ -0,0 +1,4 @@
1
+// <autogenerated />
2
+using System;
3
+using System.Reflection;
4
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]

バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/DesignTimeResolveAssemblyReferences.cache ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.Form1.resources ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.Properties.Resources.resources ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.AssemblyReference.cache ファイルの表示


+ 1
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.CoreCompileInputs.cache ファイルの表示

@@ -0,0 +1 @@
1
+e91224c8c3c20a37d9f3cbe81946241a8755950c

+ 10
- 0
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.FileListAbsolute.txt ファイルの表示

@@ -0,0 +1,10 @@
1
+F:\2024\04\浩辰\Regest\Regest\bin\Debug\Regest.exe.config
2
+F:\2024\04\浩辰\Regest\Regest\bin\Debug\Regest.exe
3
+F:\2024\04\浩辰\Regest\Regest\bin\Debug\Regest.pdb
4
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.csproj.AssemblyReference.cache
5
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.Form1.resources
6
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.Properties.Resources.resources
7
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.csproj.GenerateResource.cache
8
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.csproj.CoreCompileInputs.cache
9
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.exe
10
+F:\2024\04\浩辰\Regest\Regest\obj\Debug\Regest.pdb

バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.csproj.GenerateResource.cache ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.exe ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/Regest/Regest/obj/Debug/Regest.pdb ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/提供注册码用/输出注册码.exe ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/.suo ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/TestStore/0/000.testlog ファイルの表示


バイナリ
加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/TestStore/0/testlog.manifest ファイルの表示


+ 25
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools.sln ファイルの表示

@@ -0,0 +1,25 @@
1
+
2
+Microsoft Visual Studio Solution File, Format Version 12.00
3
+# Visual Studio Version 16
4
+VisualStudioVersion = 16.0.33130.400
5
+MinimumVisualStudioVersion = 10.0.40219.1
6
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HCTools", "HCTools\HCTools.csproj", "{ABB97F2C-1CCA-4782-B144-A796879EBE66}"
7
+EndProject
8
+Global
9
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
10
+		Debug|Any CPU = Debug|Any CPU
11
+		Release|Any CPU = Release|Any CPU
12
+	EndGlobalSection
13
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
14
+		{ABB97F2C-1CCA-4782-B144-A796879EBE66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15
+		{ABB97F2C-1CCA-4782-B144-A796879EBE66}.Debug|Any CPU.Build.0 = Debug|Any CPU
16
+		{ABB97F2C-1CCA-4782-B144-A796879EBE66}.Release|Any CPU.ActiveCfg = Release|Any CPU
17
+		{ABB97F2C-1CCA-4782-B144-A796879EBE66}.Release|Any CPU.Build.0 = Release|Any CPU
18
+	EndGlobalSection
19
+	GlobalSection(SolutionProperties) = preSolution
20
+		HideSolutionNode = FALSE
21
+	EndGlobalSection
22
+	GlobalSection(ExtensibilityGlobals) = postSolution
23
+		SolutionGuid = {26C276F7-933E-4026-8DCF-62A02D00430D}
24
+	EndGlobalSection
25
+EndGlobal

+ 6
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/App.config ファイルの表示

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="utf-8" ?>
2
+<configuration>
3
+    <startup> 
4
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
5
+    </startup>
6
+</configuration>

+ 89
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/AttributeForm.Designer.cs ファイルの表示

@@ -0,0 +1,89 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class AttributeForm
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.components = new System.ComponentModel.Container();
33
+            this.dataGridView_Info = new System.Windows.Forms.DataGridView();
34
+            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
35
+            this.缩放至ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
36
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Info)).BeginInit();
37
+            this.contextMenuStrip1.SuspendLayout();
38
+            this.SuspendLayout();
39
+            // 
40
+            // dataGridView_Info
41
+            // 
42
+            this.dataGridView_Info.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
43
+            this.dataGridView_Info.ContextMenuStrip = this.contextMenuStrip1;
44
+            this.dataGridView_Info.Dock = System.Windows.Forms.DockStyle.Fill;
45
+            this.dataGridView_Info.Location = new System.Drawing.Point(0, 0);
46
+            this.dataGridView_Info.Name = "dataGridView_Info";
47
+            this.dataGridView_Info.RowHeadersWidth = 51;
48
+            this.dataGridView_Info.RowTemplate.Height = 27;
49
+            this.dataGridView_Info.Size = new System.Drawing.Size(1010, 499);
50
+            this.dataGridView_Info.TabIndex = 0;
51
+            this.dataGridView_Info.SortCompare += new System.Windows.Forms.DataGridViewSortCompareEventHandler(this.dataGridView_Info_SortCompare);
52
+            // 
53
+            // contextMenuStrip1
54
+            // 
55
+            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
56
+            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
57
+            this.缩放至ToolStripMenuItem});
58
+            this.contextMenuStrip1.Name = "contextMenuStrip1";
59
+            this.contextMenuStrip1.Size = new System.Drawing.Size(124, 28);
60
+            // 
61
+            // 缩放至ToolStripMenuItem
62
+            // 
63
+            this.缩放至ToolStripMenuItem.Name = "缩放至ToolStripMenuItem";
64
+            this.缩放至ToolStripMenuItem.Size = new System.Drawing.Size(123, 24);
65
+            this.缩放至ToolStripMenuItem.Text = "缩放至";
66
+            this.缩放至ToolStripMenuItem.Click += new System.EventHandler(this.缩放至ToolStripMenuItem_Click);
67
+            // 
68
+            // AttributeForm
69
+            // 
70
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
71
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
72
+            this.ClientSize = new System.Drawing.Size(1010, 499);
73
+            this.Controls.Add(this.dataGridView_Info);
74
+            this.Name = "AttributeForm";
75
+            this.Text = "属性表";
76
+            this.Load += new System.EventHandler(this.AttributeForm_Load);
77
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Info)).EndInit();
78
+            this.contextMenuStrip1.ResumeLayout(false);
79
+            this.ResumeLayout(false);
80
+
81
+        }
82
+
83
+        #endregion
84
+
85
+        private System.Windows.Forms.DataGridView dataGridView_Info;
86
+        private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
87
+        private System.Windows.Forms.ToolStripMenuItem 缩放至ToolStripMenuItem;
88
+    }
89
+}

+ 138
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/AttributeForm.cs ファイルの表示

@@ -0,0 +1,138 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.Geometry;
4
+using System;
5
+using System.Collections.Generic;
6
+using System.ComponentModel;
7
+using System.Data;
8
+using System.Drawing;
9
+using System.Linq;
10
+using System.Text;
11
+using System.Threading.Tasks;
12
+using System.Windows.Forms;
13
+
14
+namespace HCTools
15
+{
16
+    public partial class AttributeForm : Form
17
+    {
18
+        private List<List<string>> info_all = new List<List<string>>();//obj信息
19
+        private List<ObjectId> objid_all = new List<ObjectId>();
20
+        public AttributeForm()
21
+        {
22
+            InitializeComponent();
23
+        }
24
+
25
+        public void GetInfo(List<List<string>> info_all, List<ObjectId> objid_all)
26
+        {
27
+            this.info_all = info_all;
28
+            this.objid_all = objid_all;
29
+        }
30
+
31
+        private void AttributeForm_Load(object sender, EventArgs e)
32
+        {
33
+            this.dataGridView_Info.ColumnCount = 9;
34
+
35
+            this.dataGridView_Info.Columns[0].HeaderText = "ID";
36
+            this.dataGridView_Info.Columns[1].HeaderText = "名称";
37
+            this.dataGridView_Info.Columns[2].HeaderText = "图层";
38
+            this.dataGridView_Info.Columns[3].HeaderText = "类型";
39
+            this.dataGridView_Info.Columns[4].HeaderText = "X";
40
+            this.dataGridView_Info.Columns[5].HeaderText = "Y";
41
+            this.dataGridView_Info.Columns[6].HeaderText = "Z";
42
+            this.dataGridView_Info.Columns[7].HeaderText = "长度(m)";
43
+            this.dataGridView_Info.Columns[8].HeaderText = "面积(m²)";
44
+
45
+            this.dataGridView_Info.AllowUserToAddRows = false;
46
+            this.dataGridView_Info.AllowUserToResizeRows = false;
47
+            this.dataGridView_Info.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
48
+            this.dataGridView_Info.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
49
+            //this.dataGridView_Info.RowHeadersVisible = false;
50
+            this.dataGridView_Info.ReadOnly = true;
51
+
52
+            for (int i = 0;i<info_all.Count;i++)
53
+            {
54
+                dataGridView_Info.Rows.Add();
55
+            }
56
+            for (int i = 0; i < this.dataGridView_Info.Rows.Count; i++)
57
+            {
58
+                this.dataGridView_Info[0, i].Value = info_all[i][0];
59
+                this.dataGridView_Info[1, i].Value = info_all[i][1];
60
+                this.dataGridView_Info[2, i].Value = info_all[i][2];
61
+                this.dataGridView_Info[3, i].Value = info_all[i][3];
62
+                this.dataGridView_Info[4, i].Value = info_all[i][4];
63
+                this.dataGridView_Info[5, i].Value = info_all[i][5];
64
+                this.dataGridView_Info[6, i].Value = info_all[i][6];
65
+                this.dataGridView_Info[7, i].Value = info_all[i][7];
66
+                this.dataGridView_Info[8, i].Value = info_all[i][8];
67
+            }
68
+        }
69
+
70
+        private void dataGridView_Info_SortCompare(object sender, DataGridViewSortCompareEventArgs e)
71
+        {
72
+            int column = e.Column.Index;
73
+            int row1 = e.RowIndex1;
74
+            int row2 = e.RowIndex2;
75
+            if (column == 0|| column == 4 || column == 5 || column == 6)
76
+            {
77
+                double value1 = Convert.ToDouble(e.CellValue1.ToString().Replace("_", ""));
78
+                double value2 = Convert.ToDouble(e.CellValue2.ToString().Replace("_", ""));
79
+                if (value1 > value2)
80
+                    e.SortResult = 1;
81
+                else if (value2 == value1)
82
+                    e.SortResult = 0;
83
+                else e.SortResult = -1;
84
+                e.Handled = true;
85
+            }
86
+        }
87
+
88
+        private void 缩放至ToolStripMenuItem_Click(object sender, EventArgs e)
89
+        {
90
+            DataGridViewRow row = this.dataGridView_Info.CurrentRow;
91
+            ObjectId id = objid_all[Convert.ToInt32(row.Cells[0].Value) - 1];
92
+            Entity current_entity = BasicFunction.GetDBObject(id);
93
+            current_entity.Highlight();//高亮显示实体 
94
+
95
+            //缩放至实体
96
+            ZoomToExtent(current_entity.GeometricExtents);
97
+        }
98
+
99
+        /// <summary>
100
+        /// 缩放至指定范围
101
+        /// </summary>
102
+        /// <param name="extent"></param>
103
+        public static void ZoomToExtent(Extents3d extent)
104
+        {
105
+            try
106
+            {
107
+                Point3d pMin = extent.MinPoint;
108
+                Point3d pMax = extent.MaxPoint;
109
+                //获取当前文档及数据库
110
+                Document acDoc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
111
+                Database acCurDb = acDoc.Database;
112
+
113
+                // 启动事务
114
+                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
115
+                {
116
+                    using (ViewTableRecord acView = acDoc.Editor.GetCurrentView())
117
+                    {
118
+                        //设置视图的高
119
+                        acView.Height = Math.Abs(pMin.Y - pMax.Y);
120
+                        //设置视图的宽
121
+                        acView.Width = Math.Abs(pMin.X - pMax.X);
122
+                        // 设置视图中心
123
+                        acView.CenterPoint = new Point2d((pMin.X + pMax.X) / 2, (pMin.Y + pMax.Y) / 2);
124
+                        // 更新当前视图
125
+                        acDoc.Editor.SetCurrentView(acView);
126
+                    }
127
+                    // 提交更改
128
+                    acTrans.Commit();
129
+                }
130
+            }
131
+            catch (Exception)
132
+            {
133
+
134
+                throw;
135
+            }
136
+        }
137
+    }
138
+}

+ 123
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/AttributeForm.resx ファイルの表示

@@ -0,0 +1,123 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+  <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121
+    <value>17, 17</value>
122
+  </metadata>
123
+</root>

+ 263
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Attributeget.cs ファイルの表示

@@ -0,0 +1,263 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using System;
5
+using System.Collections.Generic;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+
10
+namespace HCTools
11
+{
12
+    class Attributeget
13
+    {
14
+        private static List<ObjectId> objid_all = new List<ObjectId>();
15
+        public void attribt()
16
+        {
17
+            //存放所有图层名
18
+            List<string> alllayername = new List<string>();
19
+            List<List<string>> info_all = new List<List<string>>();
20
+
21
+            Database db = HostApplicationServices.WorkingDatabase;
22
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
23
+
24
+            using (Transaction trans = db.TransactionManager.StartTransaction())
25
+            {
26
+                LayerTable layertable = trans.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
27
+                foreach (ObjectId objid in layertable)
28
+                {
29
+                    LayerTableRecord layertablerecord = trans.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
30
+                    alllayername.Add(layertablerecord.Name);
31
+                }
32
+                alllayername.Sort();
33
+                trans.Commit();
34
+            }
35
+
36
+            int num = 0;
37
+            for (int i = 0; i < alllayername.Count; i++)
38
+            {
39
+                List<List<string>> info = Getlyobjinfo(alllayername[i], num);
40
+                num = num + info.Count;
41
+                for (int j = 0; j < info.Count; j++)
42
+                {
43
+                    string id = info[j][0];
44
+                    string name = info[j][1];
45
+                    string type = info[j][2];
46
+                    string X = info[j][3];
47
+                    string Y = info[j][4];
48
+                    string Z = info[j][5];
49
+                    string lenth = info[j][6];
50
+                    string area = info[j][7];
51
+                    List<string> temp = new List<string>();
52
+                    temp.Add(id);
53
+                    temp.Add(name);
54
+                    temp.Add(alllayername[i]);
55
+                    temp.Add(type);
56
+                    temp.Add(X);
57
+                    temp.Add(Y);
58
+                    temp.Add(Z);
59
+                    temp.Add(lenth);
60
+                    temp.Add(area);
61
+                    info_all.Add(temp);
62
+                }
63
+            }
64
+
65
+            AttributeForm Frm = new AttributeForm();
66
+            Frm.GetInfo(info_all,objid_all);
67
+            Frm.Show();
68
+        }
69
+
70
+        private static List<List<string>> Getlyobjinfo(string layername, int num)
71
+        {
72
+            List<List<string>> info = new List<List<string>>();//图层中obj信息
73
+
74
+            Database database = HostApplicationServices.WorkingDatabase;
75
+            using (Transaction traction = database.TransactionManager.StartTransaction())
76
+            {
77
+                // 获得当前文档的编辑器  
78
+                Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
79
+                // 创建一个 TypedValue 数组,用于定义过滤条件
80
+                TypedValue[] typedvalue = new TypedValue[1];
81
+                typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, layername), 0);
82
+                // 赋值过滤条件给 SelectionFilter 对象
83
+                SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
84
+                // 要求在图形区域中手动选择对象
85
+                PromptSelectionResult psr = editor.SelectAll(selectionfilter);
86
+
87
+                if (psr.Status == PromptStatus.OK)
88
+                {
89
+                    SelectionSet selectionset = psr.Value;
90
+                    ObjectId[] obj = new ObjectId[selectionset.Count];
91
+                    obj = selectionset.GetObjectIds();
92
+
93
+                    for (int i = 0; i < obj.Length; i++)
94
+                    {
95
+                        //获取实体
96
+                        ObjectId objid = obj[i];
97
+                        Entity entity = (Entity)traction.GetObject(objid, OpenMode.ForRead);
98
+                        objid_all.Add(objid);
99
+
100
+                        if (entity is Polyline)
101
+                        {
102
+                            num++;
103
+                            Polyline pll = (Polyline)entity;
104
+                            string name = "无";
105
+                            string type = "多段线";
106
+                            double X = pll.StartPoint.X;
107
+                            double Y = pll.StartPoint.Y;
108
+                            double Z = pll.Elevation;
109
+                            double length = pll.Length;
110
+                            string area;
111
+                            if(pll.Closed)
112
+                            {
113
+                                area = pll.Area.ToString("0.000");
114
+                            }
115
+                            else
116
+                            {
117
+                                area = "无";
118
+                            }
119
+                            List<string> temp = new List<string>();
120
+                            temp.Add(num.ToString());
121
+                            temp.Add(name);
122
+                            temp.Add(type);
123
+                            temp.Add(X.ToString("0.000"));
124
+                            temp.Add(Y.ToString("0.000"));
125
+                            temp.Add(Z.ToString("0.000"));
126
+                            temp.Add(length.ToString("0.000"));
127
+                            temp.Add(area);
128
+                            info.Add(temp);
129
+                        }
130
+                        if (entity is Polyline2d)
131
+                        {
132
+                            num++;
133
+                            Polyline2d pll = (Polyline2d)entity;
134
+                            string name = "无";
135
+                            string type = "二维多段线";
136
+                            double X = pll.StartPoint.X;
137
+                            double Y = pll.StartPoint.Y;
138
+                            double Z = pll.Elevation;
139
+                            double length = pll.Length;
140
+                            string area;
141
+                            if (pll.Closed)
142
+                            {
143
+                                area = pll.Area.ToString("0.000");
144
+                            }
145
+                            else
146
+                            {
147
+                                area = "无";
148
+                            }
149
+                            List<string> temp = new List<string>();
150
+                            temp.Add(num.ToString());
151
+                            temp.Add(name);
152
+                            temp.Add(type);
153
+                            temp.Add(X.ToString("0.000"));
154
+                            temp.Add(Y.ToString("0.000"));
155
+                            temp.Add(Z.ToString("0.000"));
156
+                            temp.Add(length.ToString("0.000"));
157
+                            temp.Add(area);
158
+                            info.Add(temp);
159
+                        }
160
+                        else if (entity is Line)
161
+                        {
162
+                            num++;
163
+                            Line line = (Line)entity;
164
+                            string name = "无";
165
+                            string type = "直线";
166
+                            double X = line.StartPoint.X;
167
+                            double Y = line.StartPoint.Y;
168
+                            double Z = line.StartPoint.Z;
169
+                            double length = line.Length;
170
+                            string area;
171
+                            if (line.Closed)
172
+                            {
173
+                                area = line.Area.ToString("0.000");
174
+                            }
175
+                            else
176
+                            {
177
+                                area = "无";
178
+                            }
179
+                            List<string> temp = new List<string>();
180
+                            temp.Add(num.ToString());
181
+                            temp.Add(name);
182
+                            temp.Add(type);
183
+                            temp.Add(X.ToString("0.000"));
184
+                            temp.Add(Y.ToString("0.000"));
185
+                            temp.Add(Z.ToString("0.000"));
186
+                            temp.Add(length.ToString("0.000"));
187
+                            temp.Add(area);
188
+                            info.Add(temp);
189
+                        }
190
+                        else if (entity is DBText)
191
+                        {
192
+                            num++;
193
+                            DBText txt = (DBText)entity;
194
+                            string name = txt.TextString;
195
+                            string type = "文字";
196
+                            double X = txt.Position.X;
197
+                            double Y = txt.Position.Y;
198
+                            double Z = txt.Position.Z;
199
+                            string length = "无";
200
+                            string area = "无";
201
+                            List<string> temp = new List<string>();
202
+                            temp.Add(num.ToString());
203
+                            temp.Add(name);
204
+                            temp.Add(type);
205
+                            temp.Add(X.ToString("0.000"));
206
+                            temp.Add(Y.ToString("0.000"));
207
+                            temp.Add(Z.ToString("0.000"));
208
+                            temp.Add(length);
209
+                            temp.Add(area);
210
+                            info.Add(temp);
211
+                        }
212
+                        else if (entity is BlockReference)
213
+                        {
214
+                            num++;
215
+                            BlockReference blk = (BlockReference)entity;
216
+                            string name = blk.Name;
217
+                            string type = "块参照";
218
+                            double X = blk.Position.X;
219
+                            double Y = blk.Position.Y;
220
+                            double Z = blk.Position.Z;
221
+                            string length = "无";
222
+                            string area = "无";
223
+                            List<string> temp = new List<string>();
224
+                            temp.Add(num.ToString());
225
+                            temp.Add(name);
226
+                            temp.Add(type);
227
+                            temp.Add(X.ToString("0.000"));
228
+                            temp.Add(Y.ToString("0.000"));
229
+                            temp.Add(Z.ToString("0.000"));
230
+                            temp.Add(length);
231
+                            temp.Add(area);
232
+                            info.Add(temp);
233
+                        }
234
+                        else if(entity is Hatch)
235
+                        {
236
+                            num++;
237
+                            Hatch hc = (Hatch)entity;
238
+                            string name = hc.PatternName;
239
+                            string type = "图案填充";
240
+                            double X = hc.Origin.X;
241
+                            double Y = hc.Origin.Y;
242
+                            double Z = 0;
243
+                            string length = "无";
244
+                            string area = hc.Area.ToString();
245
+                            List<string> temp = new List<string>();
246
+                            temp.Add(num.ToString());
247
+                            temp.Add(name);
248
+                            temp.Add(type);
249
+                            temp.Add(X.ToString("0.000"));
250
+                            temp.Add(Y.ToString("0.000"));
251
+                            temp.Add(Z.ToString("0.000"));
252
+                            temp.Add(length);
253
+                            temp.Add(area);
254
+                            info.Add(temp);
255
+                        }
256
+                    }
257
+                }
258
+                traction.Commit();
259
+            }
260
+            return info;
261
+        }
262
+    }
263
+}

+ 2551
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CMCgis_Basicfunction.cs
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 1103
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ChPLContradiction.cs
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 171
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.Designer.cs ファイルの表示

@@ -0,0 +1,171 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class Chaginfos
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.btn_BrowseSave = new System.Windows.Forms.Button();
33
+            this.btn_BrowseNdupdate = new System.Windows.Forms.Button();
34
+            this.label_Save = new System.Windows.Forms.Label();
35
+            this.label_Update = new System.Windows.Forms.Label();
36
+            this.txtbox_SaveLocation = new System.Windows.Forms.TextBox();
37
+            this.txtbox_nDupdateLocation = new System.Windows.Forms.TextBox();
38
+            this.dataGridView_Update = new System.Windows.Forms.DataGridView();
39
+            this.btn_Update = new System.Windows.Forms.Button();
40
+            this.label1 = new System.Windows.Forms.Label();
41
+            this.comboBox_layer = new System.Windows.Forms.ComboBox();
42
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Update)).BeginInit();
43
+            this.SuspendLayout();
44
+            // 
45
+            // btn_BrowseSave
46
+            // 
47
+            this.btn_BrowseSave.Location = new System.Drawing.Point(494, 90);
48
+            this.btn_BrowseSave.Name = "btn_BrowseSave";
49
+            this.btn_BrowseSave.Size = new System.Drawing.Size(47, 30);
50
+            this.btn_BrowseSave.TabIndex = 18;
51
+            this.btn_BrowseSave.Text = "浏览";
52
+            this.btn_BrowseSave.UseVisualStyleBackColor = true;
53
+            this.btn_BrowseSave.Click += new System.EventHandler(this.btn_BrowseSave_Click);
54
+            // 
55
+            // btn_BrowseNdupdate
56
+            // 
57
+            this.btn_BrowseNdupdate.Location = new System.Drawing.Point(494, 38);
58
+            this.btn_BrowseNdupdate.Name = "btn_BrowseNdupdate";
59
+            this.btn_BrowseNdupdate.Size = new System.Drawing.Size(47, 29);
60
+            this.btn_BrowseNdupdate.TabIndex = 17;
61
+            this.btn_BrowseNdupdate.Text = "浏览";
62
+            this.btn_BrowseNdupdate.UseVisualStyleBackColor = true;
63
+            this.btn_BrowseNdupdate.Click += new System.EventHandler(this.btn_BrowseNdupdate_Click);
64
+            // 
65
+            // label_Save
66
+            // 
67
+            this.label_Save.AutoSize = true;
68
+            this.label_Save.Location = new System.Drawing.Point(74, 98);
69
+            this.label_Save.Name = "label_Save";
70
+            this.label_Save.Size = new System.Drawing.Size(82, 15);
71
+            this.label_Save.TabIndex = 16;
72
+            this.label_Save.Text = "保存路径:";
73
+            // 
74
+            // label_Update
75
+            // 
76
+            this.label_Update.Location = new System.Drawing.Point(74, 29);
77
+            this.label_Update.Name = "label_Update";
78
+            this.label_Update.Size = new System.Drawing.Size(77, 55);
79
+            this.label_Update.TabIndex = 15;
80
+            this.label_Update.Text = "需修改的文件所在路径:";
81
+            // 
82
+            // txtbox_SaveLocation
83
+            // 
84
+            this.txtbox_SaveLocation.Location = new System.Drawing.Point(157, 95);
85
+            this.txtbox_SaveLocation.Name = "txtbox_SaveLocation";
86
+            this.txtbox_SaveLocation.Size = new System.Drawing.Size(319, 25);
87
+            this.txtbox_SaveLocation.TabIndex = 14;
88
+            // 
89
+            // txtbox_nDupdateLocation
90
+            // 
91
+            this.txtbox_nDupdateLocation.Location = new System.Drawing.Point(157, 41);
92
+            this.txtbox_nDupdateLocation.Name = "txtbox_nDupdateLocation";
93
+            this.txtbox_nDupdateLocation.Size = new System.Drawing.Size(319, 25);
94
+            this.txtbox_nDupdateLocation.TabIndex = 13;
95
+            // 
96
+            // dataGridView_Update
97
+            // 
98
+            this.dataGridView_Update.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
99
+            this.dataGridView_Update.Location = new System.Drawing.Point(77, 197);
100
+            this.dataGridView_Update.Margin = new System.Windows.Forms.Padding(4);
101
+            this.dataGridView_Update.Name = "dataGridView_Update";
102
+            this.dataGridView_Update.RowHeadersWidth = 51;
103
+            this.dataGridView_Update.RowTemplate.Height = 23;
104
+            this.dataGridView_Update.Size = new System.Drawing.Size(473, 195);
105
+            this.dataGridView_Update.TabIndex = 12;
106
+            // 
107
+            // btn_Update
108
+            // 
109
+            this.btn_Update.Location = new System.Drawing.Point(252, 411);
110
+            this.btn_Update.Name = "btn_Update";
111
+            this.btn_Update.Size = new System.Drawing.Size(89, 31);
112
+            this.btn_Update.TabIndex = 19;
113
+            this.btn_Update.Text = "确定更新";
114
+            this.btn_Update.UseVisualStyleBackColor = true;
115
+            this.btn_Update.Click += new System.EventHandler(this.btn_Update_Click);
116
+            // 
117
+            // label1
118
+            // 
119
+            this.label1.Location = new System.Drawing.Point(74, 138);
120
+            this.label1.Name = "label1";
121
+            this.label1.Size = new System.Drawing.Size(77, 55);
122
+            this.label1.TabIndex = 20;
123
+            this.label1.Text = "待修改信息所在图层:";
124
+            // 
125
+            // comboBox_layer
126
+            // 
127
+            this.comboBox_layer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
128
+            this.comboBox_layer.FormattingEnabled = true;
129
+            this.comboBox_layer.Location = new System.Drawing.Point(157, 151);
130
+            this.comboBox_layer.Name = "comboBox_layer";
131
+            this.comboBox_layer.Size = new System.Drawing.Size(184, 23);
132
+            this.comboBox_layer.TabIndex = 21;
133
+            // 
134
+            // Chaginfos
135
+            // 
136
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
137
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
138
+            this.ClientSize = new System.Drawing.Size(624, 466);
139
+            this.Controls.Add(this.comboBox_layer);
140
+            this.Controls.Add(this.label1);
141
+            this.Controls.Add(this.btn_Update);
142
+            this.Controls.Add(this.btn_BrowseSave);
143
+            this.Controls.Add(this.btn_BrowseNdupdate);
144
+            this.Controls.Add(this.label_Save);
145
+            this.Controls.Add(this.label_Update);
146
+            this.Controls.Add(this.txtbox_SaveLocation);
147
+            this.Controls.Add(this.txtbox_nDupdateLocation);
148
+            this.Controls.Add(this.dataGridView_Update);
149
+            this.Name = "Chaginfos";
150
+            this.Text = "批量修改图框信息";
151
+            this.Load += new System.EventHandler(this.Chaginfos_Load);
152
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView_Update)).EndInit();
153
+            this.ResumeLayout(false);
154
+            this.PerformLayout();
155
+
156
+        }
157
+
158
+        #endregion
159
+
160
+        private System.Windows.Forms.Button btn_BrowseSave;
161
+        private System.Windows.Forms.Button btn_BrowseNdupdate;
162
+        private System.Windows.Forms.Label label_Save;
163
+        private System.Windows.Forms.Label label_Update;
164
+        private System.Windows.Forms.TextBox txtbox_SaveLocation;
165
+        private System.Windows.Forms.TextBox txtbox_nDupdateLocation;
166
+        private System.Windows.Forms.DataGridView dataGridView_Update;
167
+        private System.Windows.Forms.Button btn_Update;
168
+        private System.Windows.Forms.Label label1;
169
+        private System.Windows.Forms.ComboBox comboBox_layer;
170
+    }
171
+}

+ 350
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.cs ファイルの表示

@@ -0,0 +1,350 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+
11
+using GrxCAD.EditorInput;
12
+using GrxCAD.DatabaseServices;
13
+using GrxCAD.Geometry;
14
+using System.IO;
15
+
16
+namespace HCTools
17
+{
18
+    public partial class Chaginfos : Form
19
+    {
20
+        public Chaginfos()
21
+        {
22
+            InitializeComponent();
23
+        }
24
+
25
+        public struct record
26
+        {
27
+            public string original;
28
+            public string now;
29
+            public double distance;
30
+
31
+            public record(string original, string now, double distance)
32
+            {
33
+                this.original = original;
34
+                this.now = now;
35
+                this.distance = distance;
36
+            }
37
+        }
38
+
39
+        private void Chaginfos_Load(object sender, EventArgs e)
40
+        {
41
+            dataGridView_Update.ColumnCount = 3;
42
+            dataGridView_Update.Columns[0].HeaderText = "原始内容";
43
+            dataGridView_Update.Columns[1].HeaderText = "修改内容";
44
+            dataGridView_Update.Columns[2].HeaderText = "平移距离";
45
+
46
+            dataGridView_Update.RowHeadersVisible = false;
47
+            dataGridView_Update.AllowUserToResizeRows = false;
48
+
49
+            dataGridView_Update.Columns[0].Width = 181;
50
+            dataGridView_Update.Columns[1].Width = 181;
51
+            dataGridView_Update.Columns[2].Width = 100;
52
+
53
+            dataGridView_Update.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
54
+            dataGridView_Update.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
55
+            dataGridView_Update.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
56
+
57
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
58
+            using (Transaction traction = database.TransactionManager.StartTransaction())
59
+            {
60
+                //存放所有图层名
61
+                List<string> alllayername = new List<string>();
62
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
63
+                foreach (ObjectId objid in layertable)
64
+                {
65
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
66
+                    alllayername.Add(layertablerecord.Name);
67
+                }
68
+                alllayername.Sort();
69
+
70
+                for (int i = 0; i < alllayername.Count; i++)
71
+                {
72
+                    this.comboBox_layer.Items.Add(alllayername[i]);
73
+                }
74
+            }
75
+        }
76
+
77
+
78
+        List<record> list = new List<record>();
79
+        private void btn_Update_Click(object sender, EventArgs e)
80
+        {
81
+            list.Clear();
82
+            int j = 0;
83
+
84
+            if (path_Open == "" || path_Save == "")
85
+            {
86
+                MessageBox.Show("需修改的文件所在路径或保存路径为空!", "提示");
87
+                return;
88
+            }
89
+
90
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
91
+            dataGridView_Update.ReadOnly = true;
92
+            for (int i = 0; i < dataGridView_Update.Rows.Count; i++)
93
+            {
94
+                string original = "";
95
+                string now = "";
96
+                string str = "";
97
+                double distance = 0;
98
+
99
+                object obj0 = dataGridView_Update[0, i].Value;
100
+                if (obj0 != null)
101
+                {
102
+                    original = obj0.ToString();
103
+                }
104
+                object obj1 = dataGridView_Update[1, i].Value;
105
+
106
+                if (obj1 != null)
107
+                {
108
+                    now = obj1.ToString();
109
+                }
110
+                object obj2 = dataGridView_Update[2, i].Value;
111
+
112
+                if (obj2 != null)
113
+                {
114
+                    str = obj2.ToString();
115
+                }
116
+
117
+                if (string.IsNullOrEmpty(str) == false)
118
+                {
119
+                    distance = Convert.ToDouble(str.ToString());
120
+                }
121
+
122
+                list.Add(new record(original, now, distance));
123
+            }
124
+            dataGridView_Update.ReadOnly = false;
125
+
126
+            //记录删除记录
127
+            List<string> delete = new List<string>();
128
+
129
+            string[] file = Directory.GetFiles(path_Open);
130
+            for (int i = 0; i < file.Length; i++)
131
+            {
132
+                string paths = file[i];
133
+                string name = System.IO.Path.GetFileName(paths);
134
+
135
+                if (name.Contains(".dwg") == false)
136
+                {
137
+                    continue;
138
+                }
139
+
140
+                Database data = new Database(false, true);
141
+                data.ReadDwgFile(paths, FileShare.Read, true, null);
142
+                data.CloseInput(true);
143
+
144
+
145
+                //记录附注起始坐标
146
+                //Point3d position = new Point3d();
147
+
148
+
149
+                delete.Clear();
150
+
151
+                using (Transaction trans = data.TransactionManager.StartTransaction())
152
+                {
153
+                    BlockTable bt = (BlockTable)trans.GetObject(data.BlockTableId, OpenMode.ForWrite);
154
+                    BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
155
+
156
+
157
+                    LayerTable lt = trans.GetObject(data.LayerTableId, OpenMode.ForRead) as LayerTable;
158
+                    LayerTableRecord ltr = trans.GetObject(lt[comboBox_layer.SelectedItem.ToString()], OpenMode.ForRead) as LayerTableRecord;
159
+                    ObjectId LayerID = ltr.ObjectId;
160
+
161
+                    foreach (ObjectId id in btr)
162
+                    {
163
+                        Entity ent = trans.GetObject(id, OpenMode.ForWrite) as Entity;
164
+                        if (ent != null)
165
+                        {
166
+                            if (ent.GetType().ToString() == "GrxCAD.DatabaseServices.DBText" && ent.LayerId == LayerID)
167
+                            {
168
+
169
+                                DBText T = ent as DBText;
170
+                                string str = T.TextString.Trim();
171
+
172
+                                //if (str.Contains("投影方式") && T.LayerId == LayerID)
173
+                                //{
174
+                                //    position = T.Position;
175
+                                //}
176
+
177
+                                //if (str.Contains("测图员") || str.Contains("数化员") || str.Contains("检查员") || str.Contains("复查员"))
178
+                                //{
179
+                                //    if (T.LayerId == LayerID)
180
+                                //    {
181
+                                //        delete.Add(str + "\t");
182
+                                //        T.Erase(true);
183
+                                //        //continue;
184
+                                //    }
185
+
186
+                                //}
187
+
188
+                                for (int k = 0; k < list.Count; k++)
189
+                                {
190
+                                    if (str == list[k].original.Trim())
191
+                                    {
192
+
193
+                                        if (string.IsNullOrEmpty(list[k].now) == true)
194
+                                        {
195
+                                            if (T.LayerId == LayerID)
196
+                                            {
197
+                                                j++;
198
+                                                delete.Add(str + "\t");
199
+                                                T.Erase(true);
200
+                                                continue;
201
+                                            }
202
+                                        }
203
+                                        else
204
+                                        {
205
+                                            j++;
206
+                                            T.TextString = list[k].now;
207
+                                            T.Position = new Point3d(T.Position.X + list[k].distance, T.Position.Y, 0);
208
+                                        }
209
+                                    }
210
+                                }
211
+
212
+                            }
213
+
214
+                        }
215
+
216
+                    }
217
+
218
+
219
+                    //if (position != null)
220
+                    //{
221
+
222
+                    //    TextStyleTable tst = trans.GetObject(data.TextStyleTableId, OpenMode.ForRead) as TextStyleTable;
223
+                    //    TextStyleTableRecord tstr = trans.GetObject(tst["HZ"], OpenMode.ForRead) as TextStyleTableRecord;
224
+                    //    ObjectId TStyleID = tstr.ObjectId;
225
+
226
+
227
+
228
+                    //    ObjectId HZ = TStyleID;
229
+                    //    double xx = position.X;
230
+                    //    double yy = position.Y;
231
+
232
+                    //    string[] contents = new string[7];
233
+                    //    contents[0] = "SPHEROID:WGS-84 ";
234
+                    //    contents[1] = "PROJECTION:Gauss-Kruger projection;";
235
+                    //    contents[2] = "Center meridian is 104°16′; Projection elevation is 310m.";
236
+                    //    //
237
+                    //    //
238
+                    //    //
239
+                    //    contents[3] = "VERTICAL DATUM : From Mean Sea Level HONDAU(Vietnam), Contour intervals: 1 meter";
240
+                    //    contents[4] = "GB/T 20257.1-2007 Cartographic symbols for national fundamental scale maps ";
241
+                    //    //contents[4] = "GB/T 20257.2-2006 Cartographic symbols for national fundamental scale maps ";
242
+                    //    contents[5] = "Part 1: Specifications for cartographic symbols 1:500 1:1000&1:2000 topographic maps";
243
+                    //    //contents[5] = "Part 2: Specifications for cartographic symbols 1:5000&1:10000 topographic maps";
244
+                    //    contents[6] = "December 2012";
245
+
246
+                    //    for (int k = 0; k < contents.Length; k++)
247
+                    //    {
248
+                    //        DBText text1 = new DBText();
249
+                    //        text1.TextString = contents[k];
250
+                    //        text1.Position = new Point3d(xx, yy, 0);
251
+                    //        //text1.Height = 15;
252
+                    //        text1.Height = 3;
253
+                    //        text1.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 4);
254
+                    //        text1.LayerId = LayerID;
255
+                    //        text1.TextStyleId = HZ;
256
+                    //        text1.WidthFactor = 0.8;
257
+
258
+                    //        text1.SetDatabaseDefaults(data);
259
+                    //        btr.AppendEntity(text1);
260
+                    //        trans.AddNewlyCreatedDBObject(text1, true);
261
+
262
+
263
+
264
+                    //        //yy = yy - 30;
265
+                    //        yy = yy - 5;
266
+                    //    }
267
+
268
+                    //}
269
+                    //else
270
+                    //{
271
+
272
+                    //}
273
+
274
+
275
+                    trans.Commit();
276
+                }
277
+
278
+
279
+                //2010版本格式
280
+                data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1024);
281
+                //2004版本格式
282
+                //data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1800);
283
+                //2000版本格式
284
+                //data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1015);
285
+
286
+
287
+                data.Dispose();
288
+
289
+                //
290
+                delete.Sort();
291
+                string deleterecord = "";
292
+                foreach (var item in delete)
293
+                {
294
+                    deleterecord += item;
295
+                }
296
+
297
+                deleterecord = name + "\t" + deleterecord;
298
+                deleterecord += "\r\n";
299
+
300
+                System.IO.StreamWriter writer = new StreamWriter("F:\\recore.txt", true);
301
+                writer.Write(deleterecord);
302
+                writer.Dispose();
303
+            }
304
+            if (j > 0)
305
+                ed.WriteMessage("修改成功!");
306
+            else
307
+                ed.WriteMessage("未找到原始内容,修改失败!");
308
+            this.Close();
309
+        }
310
+
311
+
312
+        private string path_Open = "";
313
+        private void btn_BrowseNdupdate_Click(object sender, EventArgs e)
314
+        {
315
+            path_Open = "";
316
+
317
+            FolderBrowserDialog FBD = new FolderBrowserDialog();
318
+            FBD.Description = "选择需修改数据数据目录";
319
+            FBD.ShowNewFolderButton = false;
320
+            DialogResult result = FBD.ShowDialog();
321
+
322
+            if (result == DialogResult.OK)
323
+            {
324
+                path_Open = FBD.SelectedPath;
325
+            }
326
+
327
+            txtbox_nDupdateLocation.Text = path_Open;
328
+        }
329
+
330
+
331
+        string path_Save = "";
332
+        private void btn_BrowseSave_Click(object sender, EventArgs e)
333
+        {
334
+            path_Save = "";
335
+
336
+            FolderBrowserDialog FBD = new FolderBrowserDialog();
337
+            FBD.Description = "选择保存数据目录";
338
+            FBD.ShowNewFolderButton = false;
339
+            DialogResult result = FBD.ShowDialog();
340
+
341
+            if (result == DialogResult.OK)
342
+            {
343
+                path_Save = FBD.SelectedPath;
344
+            }
345
+
346
+            txtbox_SaveLocation.Text = path_Save;
347
+        }
348
+
349
+    }
350
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 95
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckContourLine.cs ファイルの表示

@@ -0,0 +1,95 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using GrxCAD.ApplicationServices;
8
+using GrxCAD.DatabaseServices;
9
+using GrxCAD.EditorInput;
10
+using GrxCAD.Geometry;
11
+
12
+namespace HCTools
13
+{
14
+    class CheckContourLine
15
+    {
16
+        public static int gap;
17
+        public static string jqx;
18
+        public static string sqx;
19
+
20
+        public void Valuecheck()
21
+        {
22
+            Document doc = Application.DocumentManager.MdiActiveDocument;
23
+            string LayerName = jqx + "," +sqx;
24
+            ObjectId[] ids = BasicFunction.getHeight(LayerName);//存放获取的等高线id
25
+
26
+
27
+            //如果没有等高线则返回
28
+            if (ids == null)
29
+                return;
30
+
31
+            //检查是否有错误曲线图层,没有则创建
32
+            LayerControl layerscontrol = new LayerControl();
33
+            string layname = "等高线有误";
34
+            if (!layerscontrol.haslayername(layname))
35
+            {
36
+                colorgb col = new colorgb(255, 0, 225);
37
+                layerscontrol.creatlayer(layname, col);
38
+                layerscontrol.movelayertofront(layname);
39
+            }
40
+            else
41
+                layerscontrol.movelayertofront(layname);
42
+
43
+            int j = 0;
44
+            int num = 0;
45
+            for (int i = 0; i < ids.Length; i++)
46
+            {
47
+                Polyline pll = BasicFunction.GetDBObject(ids[i]) as Polyline;
48
+                if (pll.Elevation <= 0)
49
+                {
50
+                    ChangeLayer(pll.Id, layname);
51
+                    j++;
52
+                }
53
+                else
54
+                {
55
+                    if (int.TryParse(Math.Round(pll.Elevation, 3, MidpointRounding.AwayFromZero).ToString(), out num))
56
+                    {
57
+                        if (Math.Round(pll.Elevation,3, MidpointRounding.AwayFromZero) % gap == 0)
58
+                        {
59
+                            continue;
60
+                        }
61
+                        else
62
+                        {
63
+                            ChangeLayer(pll.Id, layname);
64
+                            j++;
65
+                        }
66
+                    }
67
+                    else
68
+                    {
69
+                        ChangeLayer(pll.Id, layname);
70
+                        j++;
71
+                    }
72
+                }
73
+            }
74
+            Editor ed = doc.Editor; ed.WriteMessage("共有" + j + "处错误");
75
+        }
76
+
77
+
78
+        private void ChangeLayer(ObjectId c1Id, string lyname)
79
+        {
80
+            Database db = HostApplicationServices.WorkingDatabase;
81
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
82
+            using (Transaction trans = db.TransactionManager.StartTransaction())
83
+            {
84
+                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
85
+                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
86
+                Entity ent1 = (Entity)c1Id.GetObject(OpenMode.ForWrite);
87
+                ent1.Layer = lyname;
88
+                trans.Commit();
89
+            }
90
+            doclock.Dispose();
91
+        }
92
+    }
93
+}
94
+
95
+

+ 147
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckL.Designer.cs ファイルの表示

@@ -0,0 +1,147 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class CheckL
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.textBox_Gap = new System.Windows.Forms.TextBox();
33
+            this.label_Gap = new System.Windows.Forms.Label();
34
+            this.btn_Cancel = new System.Windows.Forms.Button();
35
+            this.btn_OK = new System.Windows.Forms.Button();
36
+            this.label1 = new System.Windows.Forms.Label();
37
+            this.label2 = new System.Windows.Forms.Label();
38
+            this.comboBox_sqx = new System.Windows.Forms.ComboBox();
39
+            this.comboBox_jqx = new System.Windows.Forms.ComboBox();
40
+            this.SuspendLayout();
41
+            // 
42
+            // textBox_Gap
43
+            // 
44
+            this.textBox_Gap.Location = new System.Drawing.Point(167, 127);
45
+            this.textBox_Gap.Name = "textBox_Gap";
46
+            this.textBox_Gap.Size = new System.Drawing.Size(169, 25);
47
+            this.textBox_Gap.TabIndex = 3;
48
+            // 
49
+            // label_Gap
50
+            // 
51
+            this.label_Gap.AutoSize = true;
52
+            this.label_Gap.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
53
+            this.label_Gap.Location = new System.Drawing.Point(94, 130);
54
+            this.label_Gap.Name = "label_Gap";
55
+            this.label_Gap.Size = new System.Drawing.Size(67, 15);
56
+            this.label_Gap.TabIndex = 2;
57
+            this.label_Gap.Text = "等高距:";
58
+            // 
59
+            // btn_Cancel
60
+            // 
61
+            this.btn_Cancel.Location = new System.Drawing.Point(255, 171);
62
+            this.btn_Cancel.Margin = new System.Windows.Forms.Padding(4);
63
+            this.btn_Cancel.Name = "btn_Cancel";
64
+            this.btn_Cancel.Size = new System.Drawing.Size(100, 29);
65
+            this.btn_Cancel.TabIndex = 34;
66
+            this.btn_Cancel.Text = "取 消";
67
+            this.btn_Cancel.UseVisualStyleBackColor = true;
68
+            this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
69
+            // 
70
+            // btn_OK
71
+            // 
72
+            this.btn_OK.Location = new System.Drawing.Point(77, 171);
73
+            this.btn_OK.Margin = new System.Windows.Forms.Padding(4);
74
+            this.btn_OK.Name = "btn_OK";
75
+            this.btn_OK.Size = new System.Drawing.Size(100, 29);
76
+            this.btn_OK.TabIndex = 33;
77
+            this.btn_OK.Text = "确 定";
78
+            this.btn_OK.UseVisualStyleBackColor = true;
79
+            this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
80
+            // 
81
+            // label1
82
+            // 
83
+            this.label1.AutoSize = true;
84
+            this.label1.Location = new System.Drawing.Point(64, 25);
85
+            this.label1.Name = "label1";
86
+            this.label1.Size = new System.Drawing.Size(97, 15);
87
+            this.label1.TabIndex = 35;
88
+            this.label1.Text = "首曲线图层:";
89
+            // 
90
+            // label2
91
+            // 
92
+            this.label2.AutoSize = true;
93
+            this.label2.Location = new System.Drawing.Point(64, 74);
94
+            this.label2.Name = "label2";
95
+            this.label2.Size = new System.Drawing.Size(97, 15);
96
+            this.label2.TabIndex = 36;
97
+            this.label2.Text = "计曲线图层:";
98
+            // 
99
+            // comboBox_sqx
100
+            // 
101
+            this.comboBox_sqx.FormattingEnabled = true;
102
+            this.comboBox_sqx.Location = new System.Drawing.Point(167, 22);
103
+            this.comboBox_sqx.Name = "comboBox_sqx";
104
+            this.comboBox_sqx.Size = new System.Drawing.Size(169, 23);
105
+            this.comboBox_sqx.TabIndex = 37;
106
+            // 
107
+            // comboBox_jqx
108
+            // 
109
+            this.comboBox_jqx.FormattingEnabled = true;
110
+            this.comboBox_jqx.Location = new System.Drawing.Point(167, 71);
111
+            this.comboBox_jqx.Name = "comboBox_jqx";
112
+            this.comboBox_jqx.Size = new System.Drawing.Size(169, 23);
113
+            this.comboBox_jqx.TabIndex = 38;
114
+            // 
115
+            // CheckL
116
+            // 
117
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
118
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
119
+            this.ClientSize = new System.Drawing.Size(434, 213);
120
+            this.Controls.Add(this.comboBox_jqx);
121
+            this.Controls.Add(this.comboBox_sqx);
122
+            this.Controls.Add(this.label2);
123
+            this.Controls.Add(this.label1);
124
+            this.Controls.Add(this.btn_Cancel);
125
+            this.Controls.Add(this.btn_OK);
126
+            this.Controls.Add(this.textBox_Gap);
127
+            this.Controls.Add(this.label_Gap);
128
+            this.Name = "CheckL";
129
+            this.Text = "等高线检查";
130
+            this.Load += new System.EventHandler(this.CheckL_Load);
131
+            this.ResumeLayout(false);
132
+            this.PerformLayout();
133
+
134
+        }
135
+
136
+        #endregion
137
+
138
+        private System.Windows.Forms.TextBox textBox_Gap;
139
+        private System.Windows.Forms.Label label_Gap;
140
+        private System.Windows.Forms.Button btn_Cancel;
141
+        private System.Windows.Forms.Button btn_OK;
142
+        private System.Windows.Forms.Label label1;
143
+        private System.Windows.Forms.Label label2;
144
+        private System.Windows.Forms.ComboBox comboBox_sqx;
145
+        private System.Windows.Forms.ComboBox comboBox_jqx;
146
+    }
147
+}

+ 101
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckL.cs ファイルの表示

@@ -0,0 +1,101 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class CheckL : Form
15
+    {
16
+        public CheckL()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void btn_OK_Click(object sender, EventArgs e)
22
+        {
23
+            int num = 0;
24
+            if (comboBox_jqx.Text == "")
25
+            {
26
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择计曲线所在图层");
27
+                return;
28
+            }
29
+            if (comboBox_sqx.Text == "")
30
+            {
31
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择首曲线所在图层");
32
+                return;
33
+            }
34
+            if (textBox_Gap.Text == "")
35
+            {
36
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入等高距");
37
+                return;
38
+            }
39
+
40
+            if (int.TryParse(textBox_Gap.Text.ToString(), out num) == false)
41
+            {
42
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("等高距必须为整数");
43
+                return;
44
+            }
45
+
46
+            CheckContourLine.gap = Convert.ToInt32(textBox_Gap.Text);
47
+            CheckContourLine.jqx = comboBox_jqx.Text;
48
+            CheckContourLine.sqx = comboBox_sqx.Text;
49
+
50
+            this.Close();
51
+            CheckContourLine ccline = new CheckContourLine();
52
+            ccline.Valuecheck();
53
+            this.Close();
54
+        }
55
+
56
+        private void CheckL_Load(object sender, EventArgs e)
57
+        {
58
+            this.comboBox_jqx.DropDownStyle = ComboBoxStyle.DropDownList;
59
+            this.comboBox_sqx.DropDownStyle = ComboBoxStyle.DropDownList;
60
+
61
+            //自动填充下拉框
62
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
63
+            using (Transaction traction = database.TransactionManager.StartTransaction())
64
+            {
65
+                //存放所有图层名
66
+                List<string> alllayername = new List<string>();
67
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
68
+                foreach (ObjectId objid in layertable)
69
+                {
70
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
71
+                    alllayername.Add(layertablerecord.Name);
72
+                }
73
+
74
+                alllayername.Sort();
75
+
76
+                for (int i = 0; i < alllayername.Count; i++)
77
+                {
78
+                    this.comboBox_jqx.Items.Add(alllayername[i]);
79
+                    this.comboBox_sqx.Items.Add(alllayername[i]);
80
+                }
81
+
82
+                if (alllayername.Contains("8110"))
83
+                {
84
+                    int index = alllayername.IndexOf("8110");
85
+                    this.comboBox_sqx.SelectedIndex = index;
86
+                }
87
+                if (alllayername.Contains("8120"))
88
+                {
89
+                    int index = alllayername.IndexOf("8120");
90
+                    this.comboBox_jqx.SelectedIndex = index;
91
+                }
92
+                traction.Commit();
93
+            }
94
+        }
95
+
96
+        private void btn_Cancel_Click(object sender, EventArgs e)
97
+        {
98
+            this.Close();
99
+        }
100
+    }
101
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckL.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 422
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CheckPLOverlay.cs ファイルの表示

@@ -0,0 +1,422 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Diagnostics;
6
+
7
+using GrxCAD.Geometry;
8
+using GrxCAD.DatabaseServices;
9
+using GrxCAD.ApplicationServices;
10
+using GrxCAD.EditorInput;
11
+
12
+
13
+
14
+namespace HCTools
15
+{
16
+
17
+    public struct CPoint
18
+    {
19
+        public double x;
20
+        public double y;
21
+        public double z;
22
+        public object objID;
23
+    }
24
+
25
+
26
+    /// <summary>
27
+    /// 判断点和线是否重叠
28
+    /// </summary>
29
+    class CheckPLOverlay
30
+    {
31
+        public static int blc;//比例尺
32
+        public static string sqx;//首曲线
33
+        public static string jqx;//计曲线
34
+        public const int looptimes = 15;//循环查找次数
35
+        public static string EleLayerName;//高程点图层名
36
+
37
+        public int windowwidth;//当前可视范围
38
+        public int windowheight;
39
+
40
+
41
+        public double radius;//半径
42
+
43
+        public double length;//搜索半径
44
+        //存放所有高程点数组
45
+        public List<CPoint> pointarrlist = new List<CPoint>();
46
+
47
+        //存放有问题的高程点数组
48
+        public List<CPoint> errorpointarrlist = new List<CPoint>();
49
+
50
+
51
+
52
+
53
+
54
+
55
+        /// <summary>
56
+        /// 检测点线矛盾,并画圆标记出错误点
57
+        /// </summary>
58
+
59
+        public void contourch()
60
+        {
61
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
62
+
63
+            //清空各数组
64
+            pointarrlist.Clear();
65
+            errorpointarrlist.Clear();
66
+
67
+            double flagradius = 4.0 * blc / 1000;//画圆标记半径
68
+            windowwidth = 30 * 4 * blc / 1000;//确定可视范围
69
+            windowheight = 30 * 4 * blc / 1000;
70
+
71
+            if (blc == 500)
72
+            {
73
+                radius = 0.125;
74
+            }
75
+            else if (blc == 1000)
76
+            {
77
+                radius = 0.25;
78
+            }
79
+            else if (blc == 2000)
80
+            {
81
+                radius = 0.5;
82
+            }
83
+            else if (blc == 5000)
84
+            {
85
+                radius = 1.25;
86
+            }
87
+
88
+
89
+            //外切圆半径
90
+            length = radius * Math.Pow(2, 0.5);
91
+
92
+            selectcontourpoint(EleLayerName);//选出高程点
93
+            if (pointarrlist.Count == 0)
94
+            {
95
+                return;
96
+            }
97
+
98
+            //开始计时
99
+            Stopwatch watch = new Stopwatch();
100
+            watch.Start();
101
+
102
+            LayerControl layerscontrol = new LayerControl();
103
+            string layname = "点线重叠标记符号";
104
+            if (!layerscontrol.haslayername(layname))
105
+            {
106
+                colorgb col = new colorgb(255, 0, 255);
107
+                layerscontrol.creatlayer(layname, col);
108
+                layerscontrol.movelayertofront(layname);
109
+            }
110
+            else
111
+                layerscontrol.movelayertofront(layname);
112
+
113
+            layname = "点线重叠高程点";
114
+            if (layerscontrol.haslayername(layname) == false)
115
+            {
116
+                colorgb col = new colorgb(255, 0, 255);
117
+                layerscontrol.creatlayer(layname, col);
118
+            }
119
+
120
+
121
+
122
+            for (int i = 0; i < pointarrlist.Count; i++)
123
+            {
124
+                CPoint p = pointarrlist[i];
125
+                bool flag = check(p.x, p.y, p.z);
126
+                if (flag == false)
127
+                {
128
+                    errorpointarrlist.Add(p);
129
+                }
130
+            }
131
+
132
+
133
+
134
+
135
+            Database database = HostApplicationServices.WorkingDatabase;
136
+            using (Transaction traction = database.TransactionManager.StartTransaction())
137
+            {
138
+
139
+                DocumentLock documentlock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
140
+                BlockTable blocktable = traction.GetObject(database.BlockTableId,
141
+                                         OpenMode.ForWrite) as BlockTable;
142
+
143
+
144
+                string decimals = "";
145
+                if (blc == 2000 || blc == 5000)
146
+                {
147
+                    decimals = "F1";
148
+                }
149
+                else
150
+                {
151
+                    decimals = "F2";
152
+                }
153
+
154
+                for (int i = 0; i < errorpointarrlist.Count; i++)
155
+                {
156
+                    CPoint p = errorpointarrlist[i];
157
+
158
+                    BasicFunction functions = new BasicFunction();
159
+                    functions.makeflag(p.x, p.y, 0, flagradius, "点线重叠标记符号");
160
+
161
+
162
+                    ObjectId id = (ObjectId)p.objID;
163
+                    Entity entity = (Entity)traction.GetObject(id, OpenMode.ForWrite);
164
+                    entity.Layer = "点线重叠高程点";
165
+
166
+                    double z = p.z;
167
+                    string ele = z.ToString(decimals);
168
+
169
+
170
+                    Point3d p1 = new Point3d(p.x, p.y - 2.5, 0);
171
+                    Point3d p2 = new Point3d(p.x + 10, p.y + 2.5, 0);
172
+                    TypedValue[] typedvalue = new TypedValue[2];
173
+
174
+                    typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "Text"), 0);
175
+                    typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, EleLayerName), 1);
176
+
177
+                    SelectionFilter filter = new SelectionFilter(typedvalue);
178
+                    PromptSelectionResult psr = editor.SelectCrossingWindow(p1, p2, filter);
179
+                    if (psr.Status == PromptStatus.OK)
180
+                    {
181
+                        SelectionSet set = psr.Value;
182
+                        ObjectId[] objs = new ObjectId[set.Count];
183
+                        objs = set.GetObjectIds();
184
+                        for (int ii = 0; ii < objs.Length; ii++)
185
+                        {
186
+                            Entity Text = (Entity)traction.GetObject(objs[ii], OpenMode.ForWrite);
187
+
188
+                            DBText T = (DBText)Text;
189
+                            if (T.TextString == ele)
190
+                            {
191
+                                T.Layer = "点线重叠高程点";
192
+                                T.Color = GrxCAD.Colors.Color.FromRgb(255, 0, 255);
193
+                            }
194
+                        }
195
+                    }
196
+
197
+
198
+                }
199
+
200
+                traction.Commit();
201
+                documentlock.Dispose();
202
+                traction.Dispose();
203
+            }
204
+
205
+
206
+
207
+
208
+            //耗时
209
+            watch.Stop();
210
+            long times = watch.ElapsedMilliseconds;
211
+            //editor.Regen();
212
+            //editor.UpdateScreen();
213
+
214
+            editor.WriteMessage("\n" + "耗时:" + times.ToString() + "毫秒");
215
+            editor.WriteMessage("\n" + "检测到压线高程点" + errorpointarrlist.Count.ToString());
216
+            editor.WriteMessage("\n");
217
+
218
+        }
219
+
220
+
221
+
222
+
223
+        /// <summary>
224
+        /// 选出所有高程点,并取出其x,y,z坐标
225
+        /// </summary>
226
+        /// <param name="layername">高程点图层名</param>
227
+        private void selectcontourpoint(string layername)
228
+        {
229
+            Document document = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
230
+            Database database = HostApplicationServices.WorkingDatabase;
231
+            using (Transaction traction = database.TransactionManager.StartTransaction())
232
+            {
233
+                // 获得当前文档的编辑器  
234
+                Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
235
+                // 创建一个 TypedValue 数组,用于定义过滤条件
236
+                TypedValue[] typedvalue = new TypedValue[1];
237
+                typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, layername), 0);
238
+                // 赋值过滤条件给 SelectionFilter 对象
239
+                SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
240
+
241
+                // 要求在图形区域中手动选择对象
242
+                PromptSelectionResult psr = editor.GetSelection(selectionfilter);
243
+
244
+                //自动选择图像区域全部对象
245
+                //PromptSelectionResult psr = editor.SelectAll(selectionfilter);
246
+
247
+
248
+                if (psr.Status == PromptStatus.OK)
249
+                {
250
+                    SelectionSet selectionset = psr.Value;
251
+
252
+                    ObjectId[] obj = new ObjectId[selectionset.Count];
253
+                    obj = selectionset.GetObjectIds();
254
+
255
+
256
+                    for (int i = 0; i < obj.Length; i++)
257
+                    {
258
+                        ObjectId objid = obj[i];
259
+
260
+                        //找到实体,取出高程点的x,y,z
261
+                        Entity entity = (Entity)traction.GetObject(objid, OpenMode.ForRead);
262
+
263
+                        if (entity is BlockReference)
264
+                        {
265
+                            BlockReference blockreference = (BlockReference)entity;
266
+                            CPoint cp = new CPoint();
267
+
268
+                            cp.x = blockreference.Position.X;
269
+                            cp.y = blockreference.Position.Y;
270
+                            cp.z = blockreference.Position.Z;
271
+                            cp.objID = objid;
272
+
273
+                            pointarrlist.Add(cp);
274
+                        }
275
+
276
+                    }
277
+                    editor.WriteMessage("\n" + "选中高程点数量:" + pointarrlist.Count.ToString());
278
+
279
+                }
280
+
281
+
282
+
283
+                traction.Commit();
284
+                traction.Dispose();
285
+            }
286
+        }
287
+
288
+
289
+        /// <summary>
290
+        /// 检查是否压线 
291
+        /// </summary>
292
+        /// <param name="x">高程点x坐标</param>
293
+        /// <param name="y">高程点y坐标</param>
294
+        /// <param name="z">高程点z坐标</param>
295
+        private bool check(double x, double y, double z)
296
+        {
297
+
298
+            Database database = HostApplicationServices.WorkingDatabase;
299
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
300
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
301
+            using (Transaction acTrans = database.TransactionManager.StartTransaction())
302
+            {
303
+                ViewTableRecord currview = editor.GetCurrentView();
304
+                currview.CenterPoint = new Point2d(x, y);
305
+                currview.ViewDirection = new Vector3d(0, 0, 1);
306
+                currview.Width = windowwidth;
307
+                currview.Height = windowheight;
308
+                editor.SetCurrentView(currview);
309
+                acTrans.Commit();
310
+            }
311
+
312
+            Transaction traction = database.TransactionManager.StartTransaction();
313
+            List<double> elevation = new List<double>();
314
+            try
315
+            {
316
+
317
+                BlockTable blocktable = traction.GetObject(database.BlockTableId,
318
+                                             OpenMode.ForWrite) as BlockTable;
319
+
320
+
321
+                BlockTableRecord blocktablerecord = traction.GetObject(blocktable[BlockTableRecord.ModelSpace],
322
+                                                OpenMode.ForWrite) as BlockTableRecord;
323
+
324
+
325
+                //ViewTableRecord currview = editor.GetCurrentView();
326
+                //currview.CenterPoint = new Point2d(x, y);
327
+                //currview.ViewDirection = new Vector3d(0, 0, 1);
328
+                //currview.Width = windowwidth;
329
+                //currview.Height = windowheight;
330
+                //editor.SetCurrentView(currview);
331
+
332
+
333
+                string filttext = sqx + "," + jqx;
334
+                TypedValue[] filterlist = new TypedValue[1]
335
+                    {
336
+                        new TypedValue((int)DxfCode.LayerName,filttext)
337
+                    };
338
+                //filterelist.SetValue(new TypedValue((int)DxfCode.LayerName, "8110,8120"),0);
339
+                // 赋值过滤条件给 SelectionFilter 对象
340
+                SelectionFilter filter = new SelectionFilter(filterlist);
341
+
342
+                Point3d p1 = new Point3d(x - length, y - length, 0);
343
+                Point3d p2 = new Point3d(x + length, y + length, 0);
344
+
345
+
346
+                PromptSelectionResult pselectresult;
347
+                pselectresult = editor.SelectCrossingWindow(p1, p2, filter);
348
+
349
+                if (pselectresult.Status == PromptStatus.OK)
350
+                {
351
+                    SelectionSet selectionset = pselectresult.Value;
352
+                    ObjectId[] obj = new ObjectId[selectionset.Count];
353
+                    obj = selectionset.GetObjectIds();
354
+                    for (int i = 0; i < obj.Length; i++)
355
+                    {
356
+                        ObjectId objid = obj[i];
357
+                        Entity entity = (Entity)traction.GetObject(objid, OpenMode.ForRead);
358
+
359
+                        if (entity is Polyline)
360
+                        {
361
+                            Polyline pline = (Polyline)entity;
362
+                            Point3d p = pline.GetClosestPointTo(new Point3d(x, y, z), new Vector3d(0, 0, 1), false);
363
+                            double distance = System.Math.Sqrt((p.X - x) * (p.X - x) + (p.Y - y) * (p.Y - y));
364
+                            if (distance < radius)
365
+                            {
366
+                                if ((distance == 0 || pline.Elevation != z) == true)
367
+                                {
368
+
369
+                                    return false;
370
+                                    //cpoint cp = new cpoint();
371
+                                    //cp.x = x;
372
+                                    //cp.y = y;
373
+                                    //cp.z = z;
374
+                                    //errorpointarrlist.Add(cp);
375
+                                }
376
+                            }
377
+                        }
378
+                        else if (entity is Polyline2d)
379
+                        {
380
+                            Polyline2d pline2d = (Polyline2d)entity;
381
+                            Point3d p = pline2d.GetClosestPointTo(new Point3d(x, y, z), new Vector3d(0, 0, 1), false);
382
+                            double distance = System.Math.Sqrt((p.X - x) * (p.X - x) + (p.Y - y) * (p.Y - y));
383
+                            if (distance < radius)
384
+                            {
385
+                                if ((distance == 0 && pline2d.Elevation == z) == false)
386
+                                {
387
+                                    return false;
388
+                                    //cpoint cp = new cpoint();
389
+                                    //cp.x = x;
390
+                                    //cp.y = y;
391
+                                    //cp.z = z;
392
+                                    //errorpointarrlist.Add(cp);
393
+                                }
394
+                            }
395
+                        }
396
+
397
+                    }
398
+
399
+                }
400
+
401
+
402
+            }
403
+            catch (GrxCAD.Runtime.Exception ex)
404
+            {
405
+                string str = ex.ToString();
406
+                Application.ShowAlertDialog(str);
407
+            }
408
+            finally
409
+            {
410
+                doclock.Dispose();
411
+                traction.Dispose();
412
+            }
413
+
414
+            return true;
415
+
416
+        }
417
+
418
+
419
+
420
+
421
+    }
422
+}

+ 154
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Conn.Designer.cs ファイルの表示

@@ -0,0 +1,154 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class Conn
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.comboBox_blc = new System.Windows.Forms.ComboBox();
33
+            this.label_Blc = new System.Windows.Forms.Label();
34
+            this.btn_Cancel = new System.Windows.Forms.Button();
35
+            this.btn_OK = new System.Windows.Forms.Button();
36
+            this.comboBox_jqx = new System.Windows.Forms.ComboBox();
37
+            this.label2 = new System.Windows.Forms.Label();
38
+            this.comboBox_sqx = new System.Windows.Forms.ComboBox();
39
+            this.label1 = new System.Windows.Forms.Label();
40
+            this.SuspendLayout();
41
+            // 
42
+            // comboBox_blc
43
+            // 
44
+            this.comboBox_blc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
45
+            this.comboBox_blc.FormattingEnabled = true;
46
+            this.comboBox_blc.Items.AddRange(new object[] {
47
+            "1:500",
48
+            "1:1000",
49
+            "1:2000",
50
+            "1:5000"});
51
+            this.comboBox_blc.Location = new System.Drawing.Point(186, 28);
52
+            this.comboBox_blc.Margin = new System.Windows.Forms.Padding(4);
53
+            this.comboBox_blc.Name = "comboBox_blc";
54
+            this.comboBox_blc.Size = new System.Drawing.Size(160, 23);
55
+            this.comboBox_blc.TabIndex = 53;
56
+            // 
57
+            // label_Blc
58
+            // 
59
+            this.label_Blc.AutoSize = true;
60
+            this.label_Blc.Location = new System.Drawing.Point(83, 31);
61
+            this.label_Blc.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
62
+            this.label_Blc.Name = "label_Blc";
63
+            this.label_Blc.Size = new System.Drawing.Size(97, 15);
64
+            this.label_Blc.TabIndex = 52;
65
+            this.label_Blc.Text = "比例尺选择:";
66
+            // 
67
+            // btn_Cancel
68
+            // 
69
+            this.btn_Cancel.Location = new System.Drawing.Point(246, 167);
70
+            this.btn_Cancel.Margin = new System.Windows.Forms.Padding(4);
71
+            this.btn_Cancel.Name = "btn_Cancel";
72
+            this.btn_Cancel.Size = new System.Drawing.Size(100, 29);
73
+            this.btn_Cancel.TabIndex = 55;
74
+            this.btn_Cancel.Text = "取 消";
75
+            this.btn_Cancel.UseVisualStyleBackColor = true;
76
+            // 
77
+            // btn_OK
78
+            // 
79
+            this.btn_OK.Location = new System.Drawing.Point(83, 167);
80
+            this.btn_OK.Margin = new System.Windows.Forms.Padding(4);
81
+            this.btn_OK.Name = "btn_OK";
82
+            this.btn_OK.Size = new System.Drawing.Size(100, 29);
83
+            this.btn_OK.TabIndex = 54;
84
+            this.btn_OK.Text = "确 定";
85
+            this.btn_OK.UseVisualStyleBackColor = true;
86
+            this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
87
+            // 
88
+            // comboBox_jqx
89
+            // 
90
+            this.comboBox_jqx.FormattingEnabled = true;
91
+            this.comboBox_jqx.Location = new System.Drawing.Point(186, 77);
92
+            this.comboBox_jqx.Name = "comboBox_jqx";
93
+            this.comboBox_jqx.Size = new System.Drawing.Size(160, 23);
94
+            this.comboBox_jqx.TabIndex = 59;
95
+            // 
96
+            // label2
97
+            // 
98
+            this.label2.AutoSize = true;
99
+            this.label2.Location = new System.Drawing.Point(83, 80);
100
+            this.label2.Name = "label2";
101
+            this.label2.Size = new System.Drawing.Size(97, 15);
102
+            this.label2.TabIndex = 58;
103
+            this.label2.Text = "计曲线图层:";
104
+            // 
105
+            // comboBox_sqx
106
+            // 
107
+            this.comboBox_sqx.FormattingEnabled = true;
108
+            this.comboBox_sqx.Location = new System.Drawing.Point(186, 123);
109
+            this.comboBox_sqx.Name = "comboBox_sqx";
110
+            this.comboBox_sqx.Size = new System.Drawing.Size(160, 23);
111
+            this.comboBox_sqx.TabIndex = 61;
112
+            // 
113
+            // label1
114
+            // 
115
+            this.label1.AutoSize = true;
116
+            this.label1.Location = new System.Drawing.Point(83, 126);
117
+            this.label1.Name = "label1";
118
+            this.label1.Size = new System.Drawing.Size(97, 15);
119
+            this.label1.TabIndex = 60;
120
+            this.label1.Text = "首曲线图层:";
121
+            // 
122
+            // Conn
123
+            // 
124
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
125
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
126
+            this.ClientSize = new System.Drawing.Size(432, 223);
127
+            this.Controls.Add(this.comboBox_sqx);
128
+            this.Controls.Add(this.label1);
129
+            this.Controls.Add(this.comboBox_jqx);
130
+            this.Controls.Add(this.label2);
131
+            this.Controls.Add(this.btn_Cancel);
132
+            this.Controls.Add(this.btn_OK);
133
+            this.Controls.Add(this.comboBox_blc);
134
+            this.Controls.Add(this.label_Blc);
135
+            this.Name = "Conn";
136
+            this.Text = "线相交检查";
137
+            this.Load += new System.EventHandler(this.Conn_Load);
138
+            this.ResumeLayout(false);
139
+            this.PerformLayout();
140
+
141
+        }
142
+
143
+        #endregion
144
+
145
+        private System.Windows.Forms.ComboBox comboBox_blc;
146
+        private System.Windows.Forms.Label label_Blc;
147
+        private System.Windows.Forms.Button btn_Cancel;
148
+        private System.Windows.Forms.Button btn_OK;
149
+        private System.Windows.Forms.ComboBox comboBox_jqx;
150
+        private System.Windows.Forms.Label label2;
151
+        private System.Windows.Forms.ComboBox comboBox_sqx;
152
+        private System.Windows.Forms.Label label1;
153
+    }
154
+}

+ 113
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Conn.cs ファイルの表示

@@ -0,0 +1,113 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class Conn : Form
15
+    {
16
+        public Conn()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void Conn_Load(object sender, EventArgs e)
22
+        {
23
+            if (MainClass.Flag == "SelfIntersect")
24
+            {
25
+                this.Text = "线自相交";
26
+            }
27
+            if (MainClass.Flag == "EachIntersect")
28
+            {
29
+                this.Text = "线相交";
30
+            }
31
+
32
+            this.comboBox_jqx.DropDownStyle = ComboBoxStyle.DropDownList;
33
+            this.comboBox_sqx.DropDownStyle = ComboBoxStyle.DropDownList;
34
+
35
+            //自动填充下拉框
36
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
37
+            using (Transaction traction = database.TransactionManager.StartTransaction())
38
+            {
39
+                //存放所有图层名
40
+                List<string> alllayername = new List<string>();
41
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
42
+                foreach (ObjectId objid in layertable)
43
+                {
44
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
45
+                    alllayername.Add(layertablerecord.Name);
46
+                }
47
+
48
+                alllayername.Sort();
49
+
50
+                for (int i = 0; i < alllayername.Count; i++)
51
+                {
52
+                    this.comboBox_jqx.Items.Add(alllayername[i]);
53
+                    this.comboBox_sqx.Items.Add(alllayername[i]);
54
+                }
55
+
56
+                if (alllayername.Contains("8110"))
57
+                {
58
+                    int index = alllayername.IndexOf("8110");
59
+                    this.comboBox_sqx.SelectedIndex = index;
60
+                }
61
+                if (alllayername.Contains("8120"))
62
+                {
63
+                    int index = alllayername.IndexOf("8120");
64
+                    this.comboBox_jqx.SelectedIndex = index;
65
+                }
66
+                traction.Commit();
67
+            }
68
+        }
69
+
70
+        private void btn_OK_Click(object sender, EventArgs e)
71
+        {
72
+            if (MainClass.Flag == "SelfIntersect")
73
+            {
74
+                if (comboBox_blc.Text == "")
75
+                {
76
+                    GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
77
+                    return;
78
+                }
79
+
80
+                //比例尺
81
+                string blctext = comboBox_blc.Text;
82
+                int blcindex = blctext.LastIndexOf(':');
83
+                string strblc = blctext.Substring(blcindex + 1);
84
+                Inters.blc = Convert.ToInt32(strblc);
85
+                Inters.jqx = comboBox_jqx.Text;
86
+                Inters.sqx = comboBox_sqx.Text;
87
+
88
+                this.Close();
89
+                Inters selfints = new Inters();
90
+                selfints.SelfInts();
91
+            }
92
+
93
+            if (MainClass.Flag == "EachIntersect")
94
+            {
95
+                if (comboBox_blc.Text == "")
96
+                {
97
+                    GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
98
+                    return;
99
+                }
100
+
101
+                //比例尺
102
+                string blctext = comboBox_blc.Text;
103
+                int blcindex = blctext.LastIndexOf(':');
104
+                string strblc = blctext.Substring(blcindex + 1);
105
+                Inters.blc = Convert.ToInt32(strblc);
106
+
107
+                this.Close();
108
+                Inters eachints = new Inters();
109
+                eachints.Ints();
110
+            }
111
+        }
112
+    }
113
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Conn.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 479
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Connect.cs ファイルの表示

@@ -0,0 +1,479 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using GrxCAD.DatabaseServices;
8
+using GrxCAD.Geometry;
9
+using GrxCAD.ApplicationServices;
10
+using GrxCAD.EditorInput;
11
+using System.Windows.Forms;
12
+
13
+namespace HCTools
14
+{
15
+    class Connect
16
+    {
17
+        Point3dCollection joinpoint = new Point3dCollection();//连接点
18
+
19
+        #region 连接
20
+        /// <summary>
21
+        /// 连接线
22
+        /// </summary>
23
+        public void joinplline()
24
+        {
25
+            ObjectId[] line = BasicFunction.getPll();//获取待连接线
26
+            if (line == null)
27
+                return;
28
+
29
+            //遍历比较待连接线,连接高程相同的两等高线
30
+            Database db = HostApplicationServices.WorkingDatabase;
31
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
32
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
33
+
34
+            using (Transaction trans = db.TransactionManager.StartTransaction())
35
+            {
36
+                if (line.Length == 1)
37
+                {
38
+                    ed.WriteMessage("请选择另一条连接线");
39
+                    return;
40
+                }
41
+
42
+                try
43
+                {
44
+                    Entity entity1 = line[0].GetObject(OpenMode.ForWrite)as Entity;
45
+                    Entity entity2 = line[1].GetObject(OpenMode.ForWrite) as Entity;
46
+                    if (entity1 is Polyline2d && entity2 is Polyline)
47
+                    {
48
+                        Polyline2d pll1 = (Polyline2d)entity1;
49
+                        Polyline pll2 = (Polyline)trans.GetObject(entity2.Id, OpenMode.ForWrite);
50
+                        pll2.Elevation = pll1.Elevation;
51
+                        Calculate(pll1.StartPoint, pll1.EndPoint, pll2.StartPoint, pll2.EndPoint);
52
+                        Polyline pline = new Polyline();
53
+                        pline.AddVertexAt(0, new Point2d(joinpoint[0].X, joinpoint[0].Y), 0, 0, 0);
54
+                        pline.AddVertexAt(1, new Point2d(joinpoint[1].X, joinpoint[1].Y), 0, 0, 0);//创建连接线
55
+
56
+                        if (pll2.Elevation == pll1.Elevation)
57
+                        {
58
+                            //pll1.JoinEntity(pline);//浩辰的JoinEntity函数会报enotemplementedyet,不知道原因。
59
+                            Polyline pll_temp = PllConn(pll2, pline);
60
+                            //pll1.JoinEntity(pll2);
61
+                            Polyline pll_final = Pllpll2d(pll_temp, pll1, trans);
62
+                            pll1.Erase();
63
+                            pll2.Erase();
64
+                            BlockTable bt = (BlockTable)(trans.GetObject(db.BlockTableId, OpenMode.ForRead));
65
+                            BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
66
+                            btr.AppendEntity(pll_final);
67
+                            trans.AddNewlyCreatedDBObject(pll_final, true);
68
+                        }
69
+                        else
70
+                            MessageBox.Show("两线高程不一致!", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
71
+                    }
72
+                    else if (entity1 is Polyline && entity2 is Polyline2d)
73
+                    {
74
+                        Polyline pll1 = (Polyline)entity1;
75
+                        Polyline2d pll2 = (Polyline2d)entity2;
76
+                        Calculate(pll1.StartPoint, pll1.EndPoint, pll2.StartPoint, pll2.EndPoint);
77
+                        Polyline pline = new Polyline();
78
+                        pline.AddVertexAt(0, new Point2d(joinpoint[0].X, joinpoint[0].Y), 0, 0, 0);
79
+                        pline.AddVertexAt(1, new Point2d(joinpoint[1].X, joinpoint[1].Y), 0, 0, 0);//创建连接线
80
+
81
+                        if (pll2.Elevation == pll1.Elevation)
82
+                        {
83
+                            //pll1.JoinEntity(pline);//浩辰的JoinEntity函数会报enotemplementedyet,不知道原因。
84
+                            Polyline pll_temp = PllConn(pll1,pline);
85
+                            //pll1.JoinEntity(pll2);
86
+                            Polyline pll_final = Pllpll2d(pll_temp, pll2, trans);
87
+                            pll1.Erase();
88
+                            pll2.Erase();
89
+                            BlockTable bt = (BlockTable)(trans.GetObject(db.BlockTableId, OpenMode.ForRead));
90
+                            BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
91
+                            btr.AppendEntity(pll_final);
92
+                            trans.AddNewlyCreatedDBObject(pll_final, true);
93
+                        }
94
+                        else
95
+                            MessageBox.Show("两线高程不一致!", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
96
+                    }
97
+                    else if (entity1 is Polyline2d && entity2 is Polyline2d)
98
+                    {
99
+                        Polyline2d pll1 = (Polyline2d)entity1;
100
+                        Polyline2d pll2 = (Polyline2d)entity2;
101
+                        Calculate(pll1.StartPoint, pll1.EndPoint, pll2.StartPoint, pll2.EndPoint);
102
+                        Point3dCollection pos = new Point3dCollection{joinpoint[0], joinpoint[1]};
103
+                        DoubleCollection doubles = new DoubleCollection{0,0,0,0};
104
+                        Polyline2d pline = new Polyline2d(Poly2dType.SimplePoly, pos, 0, false, 0, 0, doubles);
105
+                        BlockTable bt = (BlockTable)(trans.GetObject(db.BlockTableId, OpenMode.ForRead));
106
+                        BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
107
+                        btr.AppendEntity(pline);
108
+                        trans.AddNewlyCreatedDBObject(pline, true);
109
+                        //pline.AddVertexAt(0, new Point2d(joinpoint[0].X, joinpoint[0].Y), 0, 0, 0);
110
+                        //pline.AddVertexAt(1, new Point2d(joinpoint[1].X, joinpoint[1].Y), 0, 0, 0);//创建连接线
111
+
112
+                        if (pll2.Elevation == pll1.Elevation)
113
+                        {
114
+                            Polyline2d pll_temp = Pll2dConn(pll1, pline,trans);
115
+                            btr.AppendEntity(pll_temp);
116
+                            trans.AddNewlyCreatedDBObject(pll_temp, true);
117
+                            //pll1.JoinEntity(pline);
118
+                            //pll1.JoinEntity(pll2);
119
+                            Polyline2d pll_final = Pll2dConn(pll_temp, pll2,trans);
120
+                            pll1.Erase();
121
+                            pline.Erase();
122
+                            pll2.Erase();
123
+                            pll_temp.Erase();
124
+                            btr.AppendEntity(pll_final);
125
+                            trans.AddNewlyCreatedDBObject(pll_final, true);
126
+                        }
127
+                        else
128
+                            MessageBox.Show("两线高程不一致!", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
129
+                    }
130
+                    else
131
+                    {
132
+                        Polyline pll1 = (Polyline)entity1;
133
+                        Polyline pll2 = (Polyline)entity2;
134
+                        Calculate(pll1.StartPoint, pll1.EndPoint, pll2.StartPoint, pll2.EndPoint);
135
+                        Polyline pline = new Polyline();
136
+                        pline.AddVertexAt(0, new Point2d(joinpoint[0].X, joinpoint[0].Y), 0, 0, 0);
137
+                        pline.AddVertexAt(1, new Point2d(joinpoint[1].X, joinpoint[1].Y), 0, 0, 0);//创建连接线
138
+
139
+                        if (pll2.Elevation == pll1.Elevation)
140
+                        {
141
+                            //pll1.JoinEntity(pline);//浩辰的JoinEntity函数会报enotemplementedyet,不知道原因。
142
+                            Polyline pll_temp = PllConn(pll1, pline);
143
+                            //pll1.JoinEntity(pll2);
144
+                            Polyline pll_final = PllConn(pll_temp, pll2);
145
+                            pll1.Erase();
146
+                            pll2.Erase();
147
+                            BlockTable bt = (BlockTable)(trans.GetObject(db.BlockTableId, OpenMode.ForRead));
148
+                            BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
149
+                            btr.AppendEntity(pll_final);
150
+                            trans.AddNewlyCreatedDBObject(pll_final, true);
151
+                        }
152
+                        else
153
+                            MessageBox.Show("两线高程不一致!", "提示", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
154
+                    }
155
+                    trans.Commit();
156
+                }
157
+
158
+
159
+                catch (GrxCAD.Runtime.Exception ex)
160
+                {
161
+                    string str = ex.ToString();
162
+                    GrxCAD.ApplicationServices.Application.ShowAlertDialog(str);
163
+                }
164
+            }
165
+        }
166
+
167
+
168
+        /// <summary>
169
+        /// 计算获得连接点
170
+        /// </summary>
171
+        private Point3dCollection Calculate(Point3d startpt1, Point3d endpt1, Point3d startpt2, Point3d endpt2)
172
+        {
173
+            Double[] distance=new Double[4];
174
+            joinpoint.Clear();
175
+            int i = 0;
176
+
177
+            //两线段四个端点之间的距离
178
+            distance[0] = Math.Sqrt(Math.Pow((startpt1.X - startpt2.X), 2) + Math.Pow((startpt1.Y - startpt2.Y), 2));
179
+            distance[1] = Math.Sqrt(Math.Pow((startpt1.X - endpt2.X), 2) + Math.Pow((startpt1.Y - endpt2.Y), 2));
180
+            distance[2] = Math.Sqrt(Math.Pow((endpt1.X - startpt2.X), 2) + Math.Pow((endpt1.Y - startpt2.Y), 2));
181
+            distance[3] = Math.Sqrt(Math.Pow((endpt1.X - endpt2.X), 2) + Math.Pow((endpt1.Y - endpt2.Y), 2));
182
+
183
+            //比较获取最小的距离,得到连接点
184
+            for (i = 0; i < distance.Length; i++)
185
+            {
186
+                if (distance[i] == distance.Min())
187
+                    break;
188
+            }
189
+            switch (i.ToString())
190
+            {
191
+                case "0":
192
+                    joinpoint.Add(startpt1);
193
+                    joinpoint.Add(startpt2);
194
+                    break;
195
+
196
+                case "1":
197
+                    joinpoint.Add(startpt1);
198
+                    joinpoint.Add(endpt2);
199
+                    break;
200
+
201
+                case "2":
202
+                    joinpoint.Add(endpt1);
203
+                    joinpoint.Add(startpt2);
204
+                    break;
205
+
206
+                case "3":
207
+                    joinpoint.Add(endpt1);
208
+                    joinpoint.Add(endpt2);
209
+                    break;
210
+            }
211
+            return joinpoint;
212
+        }
213
+
214
+        /// <summary>
215
+        /// 连接两条线(两条都是Polyline)
216
+        /// </summary>
217
+        private Polyline PllConn(Polyline pll1, Polyline pll2)
218
+        {
219
+            List<Point2d> pllpt = new List<Point2d>();
220
+            List<Point2d> pll1pt = new List<Point2d>();
221
+            for (int i = 0; i < pll1.NumberOfVertices; i++)
222
+            {
223
+                pllpt.Add(pll1.GetPoint2dAt(i));
224
+            }
225
+            for (int i = 0; i < pll2.NumberOfVertices; i++)
226
+            {
227
+                pll1pt.Add(pll2.GetPoint2dAt(i));
228
+            }
229
+            //if (pllpt[pllpt.Count - 1] != pll1pt[pll1pt.Count - 1])
230
+            //    pllpt.Reverse();
231
+            //else if (pllpt[0] != pll1pt[0])
232
+            //    pll1pt.Reverse();
233
+            if (pllpt[pllpt.Count - 1] == pll1pt[pll1pt.Count - 1])
234
+                pll1pt.Reverse();
235
+            else if (pllpt[0] == pll1pt[pll1pt.Count - 1])
236
+            {
237
+                pllpt.Reverse();
238
+                pll1pt.Reverse();
239
+            }
240
+            else if (pllpt[0] == pll1pt[0])
241
+                pllpt.Reverse();
242
+                for (int i = 0; i < pll1pt.Count; i++)
243
+            {
244
+                if (pllpt.Contains(pll1pt[i]))
245
+                    continue;
246
+                else
247
+                    pllpt.Add(pll1pt[i]);
248
+            }
249
+            Polyline pline = new Polyline();
250
+            for (int i = 0; i < pllpt.Count; i++)
251
+            {
252
+                pline.AddVertexAt(i, new Point2d(pllpt[i].X, pllpt[i].Y), 0, 0, 0);
253
+            }
254
+            pline.Elevation = pll1.Elevation;
255
+            pline.LinetypeId = pll1.LinetypeId;
256
+            pline.Color = pll1.Color;
257
+            pline.Layer = pll1.Layer;
258
+            return pline;
259
+        }
260
+
261
+
262
+        /// <summary>
263
+        /// 连接两条线(两条都是Polyline2d)
264
+        /// </summary>
265
+        private Polyline2d Pll2dConn(Polyline2d pll1, Polyline2d pll2, Transaction tr)
266
+        {
267
+            List<Point3d> pllpt = new List<Point3d>();
268
+            List<Point3d> pll1pt = new List<Point3d>();
269
+            List<double> bulgeList = new List<double>();//存凸度
270
+            List<double> bulgeList1 = new List<double>();
271
+            Point3dCollection ptcoll = new Point3dCollection();
272
+            DoubleCollection dbcoll = new DoubleCollection();
273
+            foreach(ObjectId id in pll1)
274
+            {
275
+                Vertex2d vx = (Vertex2d)tr.GetObject(id, OpenMode.ForRead);
276
+                if (vx.VertexType != Vertex2dType.SplineControlVertex)
277
+                { 
278
+                    pllpt.Add(vx.Position);
279
+                    bulgeList.Add(vx.Bulge);
280
+                }
281
+            }
282
+            foreach (ObjectId id in pll2)
283
+            {
284
+                Vertex2d vx = (Vertex2d)tr.GetObject(id, OpenMode.ForRead);
285
+                if (vx.VertexType != Vertex2dType.SplineControlVertex)
286
+                {
287
+                    pll1pt.Add(vx.Position);
288
+                    bulgeList1.Add(vx.Bulge);
289
+                }
290
+            }
291
+            //if (pllpt[pllpt.Count - 1] != pll1pt[pll1pt.Count - 1])
292
+            //{
293
+            //    pllpt.Reverse();
294
+            //    bulgeList.Reverse();
295
+            //}
296
+            //else if (pllpt[0] != pll1pt[0])
297
+            //{ 
298
+            //    pll1pt.Reverse();
299
+            //    bulgeList1.Reverse();
300
+            //}
301
+            if (pllpt[pllpt.Count - 1] == pll1pt[pll1pt.Count - 1])
302
+            { 
303
+                pll1pt.Reverse();
304
+                bulgeList1.Reverse();
305
+            }
306
+            else if (pllpt[0] == pll1pt[pll1pt.Count - 1])
307
+            {
308
+                pllpt.Reverse();
309
+                pll1pt.Reverse();
310
+                bulgeList.Reverse();
311
+                bulgeList1.Reverse();
312
+            }
313
+            else if (pllpt[0] == pll1pt[0])
314
+            { 
315
+                pllpt.Reverse();
316
+                bulgeList1.Reverse();
317
+            }
318
+            for (int i = 0; i < pll1pt.Count; i++)
319
+            {
320
+                if (pllpt.Contains(pll1pt[i]))
321
+                    continue;
322
+                else
323
+                { 
324
+                    pllpt.Add(pll1pt[i]);
325
+                    bulgeList.Add(bulgeList1[i]);
326
+                }
327
+            }
328
+            for (int i = 0; i < pllpt.Count; i++)
329
+            {
330
+                ptcoll.Add(pllpt[i]);
331
+            }
332
+            for (int i = 0; i < bulgeList.Count; i++)
333
+            {
334
+                dbcoll.Add(bulgeList[i]);
335
+            }
336
+            Polyline2d pline = new Polyline2d(pll1.PolyType, ptcoll, 0, false, 0, 0, dbcoll);
337
+            pline.Elevation = pll1.Elevation;
338
+            pline.LinetypeId = pll1.LinetypeId;
339
+            pline.Color = pll1.Color;
340
+            pline.Layer = pll1.Layer;
341
+            return pline;
342
+        }
343
+
344
+
345
+        /// <summary>
346
+        /// 连接两条线(一条是Polyline,一条是Polyline2d,连接后的线为Polyline)
347
+        /// </summary>
348
+        private Polyline Pllpll2d(Polyline pll1, Polyline2d pll2, Transaction tr)
349
+        {
350
+            List<Point3d> pllpt = new List<Point3d>();
351
+            List<Point3d> pll1pt = new List<Point3d>();
352
+            for (int i = 0; i < pll1.NumberOfVertices; i++)
353
+            {
354
+                pllpt.Add(pll1.GetPoint3dAt(i));
355
+            }
356
+            foreach (ObjectId id in pll2)
357
+            {
358
+                Vertex2d vx = (Vertex2d)tr.GetObject(id, OpenMode.ForRead);
359
+                if (vx.VertexType != Vertex2dType.SplineControlVertex)
360
+                {
361
+                    pll1pt.Add(vx.Position);
362
+                }
363
+            }
364
+            //if (pllpt[pllpt.Count - 1] != pll1pt[pll1pt.Count - 1])
365
+            //    pllpt.Reverse();
366
+            //else if (pllpt[0] != pll1pt[0])
367
+            //    pll1pt.Reverse();
368
+            if (pllpt[pllpt.Count - 1] == pll1pt[pll1pt.Count - 1])
369
+                pll1pt.Reverse();
370
+            else if (pllpt[0] == pll1pt[pll1pt.Count - 1])
371
+            {
372
+                pllpt.Reverse();
373
+                pll1pt.Reverse();
374
+            }
375
+            else if (pllpt[0] == pll1pt[0])
376
+                pllpt.Reverse();
377
+            for (int i = 0; i < pll1pt.Count; i++)
378
+            {
379
+                if (pllpt.Contains(pll1pt[i]))
380
+                    continue;
381
+                else
382
+                    pllpt.Add(pll1pt[i]);
383
+            }
384
+            Polyline pline = new Polyline();
385
+            for (int i = 0; i < pllpt.Count; i++)
386
+            {
387
+                pline.AddVertexAt(i, new Point2d(pllpt[i].X, pllpt[i].Y), 0, 0, 0);
388
+            }
389
+            pline.Elevation = pll1.Elevation;
390
+            pline.LinetypeId = pll1.LinetypeId;
391
+            pline.Color = pll1.Color;
392
+            pline.Layer = pll1.Layer;
393
+            return pline;
394
+        }
395
+
396
+        #endregion
397
+
398
+
399
+        //public void conn()
400
+        //{
401
+        //    ObjectIdCollection ids = getEntity();
402
+        //    BlockReference br = null;
403
+        //    Polyline pll = null;
404
+        //    DBObjectCollection objcoll = new DBObjectCollection();
405
+        //    string Brname = "";
406
+        //    Point3d Brposition = new Point3d();
407
+
408
+        //    Database db = HostApplicationServices.WorkingDatabase;
409
+        //    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
410
+        //    Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
411
+        //    using (Transaction trans = db.TransactionManager.StartTransaction())
412
+        //    {
413
+        //        foreach(ObjectId id in ids)
414
+        //        {
415
+        //            if (trans.GetObject(id, OpenMode.ForRead) is BlockReference)
416
+        //            {
417
+        //                br = trans.GetObject(id, OpenMode.ForRead)as BlockReference;
418
+        //                Brname = br.Name;
419
+        //                Brposition = br.Position;
420
+        //            }
421
+        //            if (trans.GetObject(id, OpenMode.ForRead) is Polyline)
422
+        //            {
423
+        //                pll = trans.GetObject(id, OpenMode.ForRead) as Polyline;
424
+        //            }
425
+        //        }
426
+        //        br.Explode(objcoll);
427
+        //        trans.Commit();
428
+        //    }
429
+
430
+        //    foreach (Entity ent in objcoll)
431
+        //    {
432
+        //        using (Transaction trans = db.TransactionManager.StartTransaction())
433
+        //        {
434
+        //            BlockTable blocktable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
435
+        //            BlockTableRecord blocktablerecord = trans.GetObject(blocktable[BlockTableRecord.ModelSpace],
436
+        //                OpenMode.ForWrite) as BlockTableRecord;
437
+        //            blocktablerecord.AppendEntity(ent);
438
+        //            trans.AddNewlyCreatedDBObject(ent, true);
439
+        //            trans.Commit();
440
+        //        }
441
+        //    }
442
+
443
+
444
+        //    doclock.Dispose();
445
+        //}
446
+
447
+
448
+        //private static ObjectIdCollection getEntity()
449
+        //{
450
+        //    ObjectIdCollection ids = new ObjectIdCollection();
451
+
452
+        //    Document doc = Application.DocumentManager.MdiActiveDocument;
453
+        //    Database db = doc.Database;
454
+        //    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
455
+
456
+        //    TypedValue[] value = new TypedValue[]
457
+        //    {
458
+        //        new TypedValue((int)DxfCode.Start,"Insert,POLYLINE"),
459
+        //    };//设置筛选条件
460
+        //    SelectionFilter filter = new SelectionFilter(value);
461
+        //    //选择区域中全部对象
462
+        //    //PromptSelectionResult psr = ed.SelectAll(filter);
463
+        //    // 要求在图形区域中手动选择对象
464
+        //    PromptSelectionResult psr = ed.GetSelection(filter);
465
+
466
+
467
+        //    if (psr.Status == PromptStatus.OK)
468
+        //    {
469
+        //        using (Transaction trans = db.TransactionManager.StartTransaction())
470
+        //        {
471
+        //            SelectionSet ss = psr.Value;
472
+        //            ids = new ObjectIdCollection(ss.GetObjectIds());
473
+        //            trans.Commit();
474
+        //        }
475
+        //    }
476
+        //    return ids;
477
+        //}
478
+    }
479
+}

+ 173
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ContourLineFix.cs ファイルの表示

@@ -0,0 +1,173 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using GrxCAD.GraphicsInterface;
6
+using System;
7
+using System.Collections.Generic;
8
+using System.Linq;
9
+using System.Text;
10
+using System.Threading.Tasks;
11
+
12
+namespace HCTools
13
+{
14
+    class ContourLineFix
15
+    {
16
+        public void Clfix()
17
+        {
18
+            Database db = HostApplicationServices.WorkingDatabase;
19
+            Document doc = Application.DocumentManager.MdiActiveDocument;
20
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
21
+
22
+            ObjectId jigid = new ObjectId();
23
+            PromptPointResult pPtRes;
24
+            PromptPointOptions pPtOpts = new PromptPointOptions("");
25
+
26
+            pPtOpts.Message = "选择起点\n ";
27
+            pPtRes = doc.Editor.GetPoint(pPtOpts);
28
+            Point3d ptStart = pPtRes.Value;
29
+
30
+            if (pPtRes.Status == PromptStatus.OK)
31
+            {
32
+                LineJig lJig = new LineJig(ptStart);
33
+                PromptResult PR = doc.Editor.Drag(lJig);
34
+                if (PR.Status == PromptStatus.OK)
35
+                {
36
+                    jigid = BasicFunction.AddObj(doc, lJig.line_1);
37
+                    GrxCAD.DatabaseServices.Line jigl = (GrxCAD.DatabaseServices.Line)BasicFunction.GetDBObject(jigid);
38
+                    List<ObjectId> plllist = Pllsort(jigl);
39
+                    GrxCAD.DatabaseServices.Polyline pll_s = (GrxCAD.DatabaseServices.Polyline)BasicFunction.GetDBObject(plllist[0]);
40
+                    GrxCAD.DatabaseServices.Polyline pll_w = (GrxCAD.DatabaseServices.Polyline)BasicFunction.GetDBObject(plllist[plllist.Count - 1]);
41
+                    double dgj = (pll_s.Elevation - pll_w.Elevation)/(plllist.Count - 1);
42
+                    double ele = pll_s.Elevation;
43
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
44
+                    {
45
+                        for (int i = 1; i < plllist.Count - 1; i++)
46
+                        {
47
+                            GrxCAD.DatabaseServices.Polyline pll = (GrxCAD.DatabaseServices.Polyline)tr.GetObject(plllist[i], OpenMode.ForWrite, true);
48
+                            pll.Elevation = ele - dgj;
49
+                            ele = ele - dgj;
50
+                        }
51
+                        GrxCAD.DatabaseServices.Line jl = (GrxCAD.DatabaseServices.Line)tr.GetObject(jigid, OpenMode.ForWrite, true);
52
+                        jl.Erase();
53
+                        tr.Commit();
54
+                    }
55
+                    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
56
+                    ed.WriteMessage("修改完成\n");
57
+                }
58
+
59
+            }
60
+            doclock.Dispose();
61
+        }
62
+
63
+
64
+        private static List<ObjectId> Pllsort(Line jigl)
65
+        {
66
+            List<ObjectId> sortedid = new List<ObjectId>();
67
+            Point3dCollection ptcoll = new Point3dCollection();
68
+            var plane = new Plane(Point3d.Origin, Vector3d.ZAxis);
69
+            ptcoll.Add(jigl.StartPoint);
70
+            ptcoll.Add(jigl.EndPoint);
71
+
72
+            Database db = HostApplicationServices.WorkingDatabase;
73
+            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
74
+            TypedValue[] value = new TypedValue[]
75
+                {
76
+                new TypedValue((int)DxfCode.Start,"LWPOLYLINE"),
77
+                };//设置筛选条件
78
+            SelectionFilter filter = new SelectionFilter(value);
79
+            // 要求在图形区域中手动选择对象
80
+            PromptSelectionResult psr = ed.SelectFence(ptcoll, filter);
81
+
82
+            if (psr.Status == PromptStatus.OK)
83
+            {
84
+                SelectionSet ss = psr.Value;
85
+                ObjectIdCollection idcoll = new ObjectIdCollection(ss.GetObjectIds());
86
+
87
+                using (Transaction trans = db.TransactionManager.StartTransaction())
88
+                {
89
+                    for (int i = 1; i < idcoll.Count; i++)
90
+                    {
91
+                        GrxCAD.DatabaseServices.Polyline pll = (GrxCAD.DatabaseServices.Polyline)BasicFunction.GetDBObject(idcoll[i]);
92
+                        Point3dCollection itsresult1 = new Point3dCollection();
93
+                        pll.IntersectWith(jigl, Intersect.OnBothOperands, plane, itsresult1, IntPtr.Zero, IntPtr.Zero);
94
+                        double x1 = itsresult1[0].X;
95
+                        double y1 = itsresult1[0].Y;
96
+                        double x2 = jigl.StartPoint.X;
97
+                        double y2 = jigl.StartPoint.Y;
98
+                        double tempdist = Math.Abs(Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2)));
99
+                        ObjectId temp = idcoll[i];
100
+                        for (int j = i - 1; j >=0; j--)
101
+                        {
102
+                            GrxCAD.DatabaseServices.Polyline pll2 = (GrxCAD.DatabaseServices.Polyline)BasicFunction.GetDBObject(idcoll[j]);
103
+                        Point3dCollection itsresult2 = new Point3dCollection();
104
+                            pll2.IntersectWith(jigl, Intersect.OnBothOperands, plane, itsresult2, IntPtr.Zero, IntPtr.Zero);
105
+                            double x3 = itsresult2[0].X;
106
+                            double y3 = itsresult2[0].Y;
107
+                            double tempdist2 = Math.Abs(Math.Sqrt(Math.Pow(x3 - x2, 2) + Math.Pow(y3 - y2, 2)));
108
+                            if (tempdist < tempdist2)
109
+                            {
110
+                                idcoll[j + 1] = idcoll[j];
111
+                                idcoll[j] = temp;
112
+                            }
113
+                            else
114
+                                break;
115
+                        }
116
+                    }
117
+                    foreach (ObjectId id in idcoll)
118
+                    {
119
+                        sortedid.Add(id);
120
+                    }
121
+                    trans.Commit();
122
+                }
123
+            }
124
+            return sortedid;
125
+        }
126
+    }
127
+
128
+    public class LineJig : DrawJig
129
+    {
130
+        public Line line_1;
131
+        public Point3d BasePnt;
132
+        public Point3d AcquirePnt;
133
+
134
+        public LineJig(Point3d _basePnt)
135
+        {
136
+            line_1 = new Line();
137
+
138
+            BasePnt = _basePnt;
139
+        }
140
+
141
+        protected override SamplerStatus Sampler(JigPrompts prompts)
142
+        {
143
+            JigPromptPointOptions JPPO = new JigPromptPointOptions();
144
+            JPPO.Message = "选择终点\n";
145
+            JPPO.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted | UserInputControls.AnyBlankTerminatesInput);
146
+
147
+            PromptPointResult PR = prompts.AcquirePoint(JPPO);
148
+
149
+            if (PR.Status != PromptStatus.OK)
150
+                return SamplerStatus.Cancel;
151
+
152
+            if (PR.Value == AcquirePnt)
153
+                return SamplerStatus.NoChange;
154
+
155
+            AcquirePnt = PR.Value;
156
+            return SamplerStatus.OK;
157
+        }
158
+
159
+        protected override bool WorldDraw(WorldDraw draw)
160
+        {
161
+            Point3d point_1 = new Point3d(BasePnt.X, BasePnt.Y, 0);
162
+            Point3d point_2 = new Point3d(AcquirePnt.X, AcquirePnt.Y, 0);
163
+            line_1.StartPoint = point_1;
164
+            line_1.EndPoint = point_2;
165
+            line_1.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 7);
166
+
167
+            draw.Geometry.Draw(line_1);
168
+            return true;
169
+        }
170
+    }
171
+}
172
+
173
+

+ 856
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutContourLine.cs ファイルの表示

@@ -0,0 +1,856 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    class CutContourLine
15
+    {
16
+        public static string sqxlayer;
17
+        public static string jqxlayer;
18
+        public static int mapscale;
19
+        public static double scalelen;
20
+        public static double lenIgnore;
21
+        public static double eledvalue;
22
+        public void ccls()
23
+        {
24
+            DocumentLock documentlock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
25
+            Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
26
+            Database db = doc.Database;
27
+            //类全局变量
28
+            //存储地图图层
29
+            //System.Collections.ArrayList layerlist = new System.Collections.ArrayList();
30
+            LayerTable layertable = null;
31
+            bool openflag = true;
32
+            List<Entity> plentitycollection = new List<Entity>();
33
+            List<Entity> plentitycollection1 = new List<Entity>();
34
+            //保存裁剪掉的等高线
35
+            List<Entity> cdentity = new List<Entity>();
36
+
37
+
38
+            #region//第一个事务 获取计曲线
39
+            using (Transaction tran = doc.TransactionManager.StartTransaction())
40
+            {
41
+                
42
+                //layertable = tran.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
43
+                ////获取图层
44
+                //foreach (ObjectId id in layertable)
45
+                //{
46
+                //    DocumentLock docLock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
47
+                //    LayerTableRecord lyrtbrec = tran.GetObject(id, OpenMode.ForWrite) as LayerTableRecord;
48
+                //    docLock.Dispose();
49
+                //    layerlist.Add(lyrtbrec.Name);
50
+                    
51
+                //}
52
+
53
+                //CLSelectForm clsf = new CLSelectForm(layerlist);
54
+                //if (clsf.ShowDialog() == DialogResult.OK)
55
+                //{
56
+                //    openflag = true;
57
+                //    mapscale = clsf.mapscale;
58
+                //    sqxlayer = clsf.SQX;
59
+                //    jqxlayer = clsf.JQX;
60
+                //    scalelen = clsf.ScaleLength;
61
+                //    lenIgnore = clsf.LenIgnore;
62
+                //    eledvalue = clsf.EleDValue;
63
+                //}
64
+
65
+
66
+                if (openflag == true)
67
+                {
68
+                    ///带1的为首曲线过滤,没有的是计曲线过滤
69
+                    TypedValue[] tv = new TypedValue[1];
70
+                    TypedValue[] tv1 = new TypedValue[1];
71
+                    tv.SetValue(new TypedValue((int)DxfCode.LayerName, jqxlayer), 0);
72
+                    tv1.SetValue(new TypedValue((int)DxfCode.LayerName, sqxlayer), 0);
73
+                    SelectionFilter sf = new SelectionFilter(tv);
74
+                    SelectionFilter sf1 = new SelectionFilter(tv1);
75
+                    //doc.Editor.WriteMessage("请选择计曲线!");
76
+
77
+                    //PromptSelectionResult psr = doc.Editor.GetSelection(sf);
78
+                    PromptSelectionResult psr = doc.Editor.SelectAll(sf);
79
+                    PromptSelectionResult psr1 = doc.Editor.SelectAll(sf1);
80
+
81
+                    if (psr.Status == PromptStatus.OK && psr1.Status == PromptStatus.OK)
82
+                    {
83
+                        //// 以只读方式打开块表记录   Open the Block table record for read
84
+                        BlockTable acbt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
85
+                        //// 以写方式打开模型空间块表记录   Open the Block table record Model space for write
86
+                        BlockTableRecord acblr = tran.GetObject(acbt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
87
+                        SelectionSet ss = psr.Value;
88
+                        //// 以只读方式打开块表记录   Open the Block table record for read
89
+                        SelectionSet ss1 = psr1.Value;
90
+
91
+
92
+                        foreach (ObjectId idpl in ss.GetObjectIds())
93
+                        {
94
+                            Entity enpl = tran.GetObject(idpl, OpenMode.ForWrite, true) as Entity;
95
+                            if (enpl is Polyline)
96
+                            {
97
+                                Polyline pl = enpl as Polyline;
98
+                                if (pl.Elevation != 0)
99
+                                {
100
+                                    plentitycollection.Add(enpl);
101
+                                }
102
+                            }
103
+                            else if (enpl is Polyline2d)
104
+                            {
105
+                                Polyline2d pl2d = enpl as Polyline2d;
106
+                                if (pl2d.Elevation != 0)
107
+                                {
108
+                                    plentitycollection.Add(enpl);
109
+                                }
110
+                            }
111
+                        }
112
+                        foreach (ObjectId idp2 in ss1.GetObjectIds())
113
+                        {
114
+                            Entity enp2 = tran.GetObject(idp2, OpenMode.ForWrite, true) as Entity;
115
+                            if (enp2 is Polyline)
116
+                            {
117
+                                Polyline pl = enp2 as Polyline;
118
+                                if (pl.Elevation != 0)
119
+                                {
120
+                                    plentitycollection1.Add(enp2);
121
+                                }
122
+                            }
123
+                            else if (enp2 is Polyline2d)
124
+                            {
125
+                                Polyline2d pl2d = enp2 as Polyline2d;
126
+                                if (pl2d.Elevation != 0)
127
+                                {
128
+                                    plentitycollection1.Add(enp2);
129
+                                }
130
+                            }
131
+                        }
132
+                    }
133
+                    else
134
+                        doc.Editor.WriteMessage("没有选择到任何实体\r\n");
135
+                    //////////////////////////////这个气死我了 
136
+
137
+                    doc.Editor.WriteMessage("程序开始运行\r\n.........\r\n......\r\n...\r\n");
138
+                    tran.Commit();
139
+                    tran.Dispose();
140
+                }
141
+                else
142
+                {
143
+                    MessageBox.Show("请选择相应的每一个参数!", "警告");
144
+                    return;
145
+
146
+                }
147
+            }//end using
148
+            #endregion
149
+
150
+            #region//检查、裁剪等高线
151
+            if (plentitycollection.Count > 0)
152
+            {
153
+                //根据高程将计曲线排序
154
+                plentitycollection.Sort(CompareDGXByElevation);
155
+                //删除重叠,重复的等高线
156
+                //int count = RemoveOverlapPolyline(ref plentitycollection);
157
+
158
+                ////////////////////方便调试 仅此而已
159
+                //List<Polyline2d> test = new List<Polyline2d>();
160
+                //foreach (Entity en in plentitycollection)
161
+                //{
162
+                //    Polyline2d pl = en as Polyline2d;
163
+                //    if (pl != null)
164
+                //        test.Add(pl);
165
+                //}
166
+
167
+                //List<Polyline> test00 = new List<Polyline>();
168
+                //foreach (Entity en in plentitycollection)
169
+                //{
170
+                //    Polyline pl = en as Polyline;
171
+                //    if (pl != null)
172
+                //        test00.Add(pl);
173
+                //}
174
+                ///////////////////
175
+
176
+
177
+
178
+                //以每条计曲线为循环变量
179
+                for (int i = 0; i < plentitycollection.Count - 1; i++)
180
+                {
181
+                    Point3dCollection pt3dcoll = new Point3dCollection();
182
+
183
+                    Entity en1 = plentitycollection[i];
184
+                    double ele1 = 0;
185
+                    Point2d pten1start = new Point2d();//
186
+                    Point2d pten1end = new Point2d();//
187
+
188
+                    if (en1 is Polyline)
189
+                    {
190
+                        Polyline pl = en1 as Polyline;
191
+                        pten1start = new Point2d(pl.StartPoint.X, pl.StartPoint.Y);
192
+                        pten1end = new Point2d(pl.EndPoint.X, pl.EndPoint.Y);
193
+
194
+                        ele1 = Convert.ToDouble(pl.Elevation.ToString("f1"));
195
+                        pl.GetStretchPoints(pt3dcoll);
196
+                    }
197
+                    else if (en1 is Polyline2d)
198
+                    {
199
+                        Polyline2d pl2d = en1 as Polyline2d;
200
+                        pten1start = new Point2d(pl2d.StartPoint.X, pl2d.StartPoint.Y);
201
+                        pten1end = new Point2d(pl2d.EndPoint.X, pl2d.EndPoint.Y);
202
+
203
+                        ele1 = Convert.ToDouble(pl2d.Elevation.ToString("f1"));
204
+                        pl2d.GetStretchPoints(pt3dcoll);
205
+                    }
206
+
207
+                    int j = 1;
208
+                    Entity en2 = null;
209
+                    double ele2 = 0, ele = 0;
210
+                    Point2d pten2start = new Point2d();
211
+                    Point2d pten2end = new Point2d();
212
+
213
+                    double startlength = 9999999, endlength = 9999999;
214
+
215
+                    //寻找一条等高线(计曲线)相邻的等高线
216
+                    while (ele <= ele1 + eledvalue)
217
+                    {
218
+                        Entity entemp = plentitycollection[j];
219
+                        if (entemp is Polyline)
220
+                        {
221
+                            Polyline pl = entemp as Polyline;
222
+                            ele = Convert.ToDouble(pl.Elevation.ToString("f1"));
223
+
224
+                            if (ele == ele1 + eledvalue)
225
+                            {
226
+                                pten2start = new Point2d(pl.StartPoint.X, pl.StartPoint.Y);
227
+                                pten2end = new Point2d(pl.EndPoint.X, pl.EndPoint.Y);
228
+
229
+                                double start = pten1start.GetDistanceTo(pten2start);
230
+                                double end = pten1end.GetDistanceTo(pten2end);
231
+
232
+                                //这段代码主要解决相邻有多条等高线时选择距离最近的
233
+                                if (startlength > start && endlength > end)
234
+                                {
235
+                                    startlength = start;
236
+                                    endlength = end;
237
+
238
+                                    en2 = entemp;
239
+                                    ele2 = ele;
240
+                                }
241
+                                else if (startlength > start)
242
+                                {
243
+                                    startlength = start;
244
+                                    endlength = end;
245
+
246
+                                    en2 = entemp;
247
+                                    ele2 = ele;
248
+                                }
249
+                                else if (endlength > end)
250
+                                {
251
+                                    startlength = start;
252
+                                    endlength = end;
253
+
254
+                                    en2 = entemp;
255
+                                    ele2 = ele;
256
+                                }
257
+                            }
258
+                        }
259
+                        else if (entemp is Polyline2d)
260
+                        {
261
+                            Polyline2d pl2d = entemp as Polyline2d;
262
+                            ele = Convert.ToDouble(pl2d.Elevation.ToString("f1"));
263
+
264
+                            if (ele == ele1 + eledvalue)
265
+                            {
266
+                                pten2start = new Point2d(pl2d.StartPoint.X, pl2d.StartPoint.Y);
267
+                                pten2end = new Point2d(pl2d.EndPoint.X, pl2d.EndPoint.Y);
268
+
269
+                                double start = pten1start.GetDistanceTo(pten2start);
270
+                                double end = pten1end.GetDistanceTo(pten2end);
271
+
272
+                                if (startlength > start && endlength > end)
273
+                                {
274
+                                    startlength = start;
275
+                                    endlength = end;
276
+
277
+                                    en2 = entemp;
278
+                                    ele2 = ele;
279
+                                }
280
+                                else if (startlength > start)
281
+                                {
282
+                                    startlength = start;
283
+                                    endlength = end;
284
+
285
+                                    en2 = entemp;
286
+                                    ele2 = ele;
287
+                                }
288
+                                else if (endlength > end)
289
+                                {
290
+                                    startlength = start;
291
+                                    endlength = end;
292
+
293
+                                    en2 = entemp;
294
+                                    ele2 = ele;
295
+                                }
296
+                            }
297
+                        }
298
+                        j++;
299
+                        if (j > plentitycollection.Count - 1)
300
+                            break;
301
+                    }
302
+
303
+                    //满足裁剪条件的节点
304
+                    Point3dCollection cjcoll = new Point3dCollection();
305
+                    bool flag = false;
306
+
307
+                    if (en2 != null)
308
+                    {
309
+                        //以计曲线节点为循环
310
+                        for (int ii = 0; ii < pt3dcoll.Count; ii++)
311
+                        {
312
+                            Point3d pt3d = pt3dcoll[ii];
313
+
314
+                            Point3d temppt3d = new Point3d();
315
+                            temppt3d = GetClosestPoint(pt3d, en2);
316
+
317
+                            //临时计算两个3d点之间的平面距离
318
+                            Point2d pt2d1 = new Point2d(pt3d.X, pt3d.Y);
319
+                            Point2d pt2d2 = new Point2d(temppt3d.X, temppt3d.Y);
320
+
321
+                            double length = pt2d1.GetDistanceTo(pt2d2);
322
+                            if (length < scalelen)
323
+                            {
324
+                                //flag为false标志继续添加满足条件节点
325
+                                //flag为true标志结束添加节点,进行后续计算
326
+                                
327
+                                if (ii == pt3dcoll.Count - 1)//最后一组节点
328
+                                {
329
+                                    flag = true;
330
+                                }
331
+                                else 
332
+                                {
333
+                                    cjcoll.Add(pt3d);
334
+                                    cjcoll.Add(temppt3d);
335
+                                }
336
+                            }
337
+                            else
338
+                            {
339
+                                flag = true;
340
+                            }
341
+                            if (flag == true)
342
+                            {
343
+                                if (cjcoll.Count > 0)
344
+                                {
345
+                                    if (cjcoll.Count > 3)
346
+                                    {
347
+                                        //矩形框四个角点
348
+                                        //选取2个为裁剪的两个节点
349
+                                        //为计曲线上的点
350
+                                        Point3d pt1cjnode = new Point3d();
351
+                                        Point3d pt2node = new Point3d();
352
+                                        Point3d pt3cjnode = new Point3d();
353
+                                        Point3d pt4node = new Point3d();
354
+
355
+                                        pt1cjnode = cjcoll[0];
356
+                                        pt2node = cjcoll[1];
357
+                                        pt3cjnode = cjcoll[cjcoll.Count - 2];
358
+                                        pt4node = cjcoll[cjcoll.Count - 1];
359
+
360
+                                        Point3dCollection rectcj = new Point3dCollection();
361
+                                        rectcj.Add(pt1cjnode);
362
+                                        rectcj.Add(pt2node);
363
+                                        rectcj.Add(pt3cjnode);
364
+                                        rectcj.Add(pt4node);
365
+
366
+                                        #region
367
+                                        Point2d pt2djudge1 = new Point2d(pt1cjnode.X, pt1cjnode.Y);
368
+                                        Point2d pt2djudge2 = new Point2d(pt3cjnode.X, pt3cjnode.Y);
369
+
370
+                                        if (pt2djudge1.GetDistanceTo(pt2djudge2) > lenIgnore)
371
+                                        {
372
+                                            #region//画裁剪线
373
+                                            ////using (Transaction tran = doc.TransactionManager.StartTransaction())
374
+                                            ////{
375
+
376
+                                            ////    //// 以只读方式打开块表记录   Open the Block table record for read
377
+                                            ////    BlockTable acbt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
378
+                                            ////    //// 以写方式打开模型空间块表记录   Open the Block table record Model space for write
379
+                                            ////    BlockTableRecord acblr = tran.GetObject(acbt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
380
+
381
+                                            ////    //设置激活图层
382
+                                            ////    layertable = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
383
+                                            ////    if (!layertable.Has("CJX"))
384
+                                            ////    {
385
+                                            ////        LayerTableRecord ltr = new LayerTableRecord();
386
+                                            ////        ltr.Name = "CJX";
387
+                                            ////        ObjectId layerid = layertable.Add(ltr);
388
+                                            ////        tran.AddNewlyCreatedDBObject(ltr, true);
389
+                                            ////        db.Clayer = layerid;
390
+                                            ////    }
391
+                                            ////    else
392
+                                            ////    {
393
+                                            ////        //设置首曲线为当期激活图层
394
+                                            ////        foreach (ObjectId id in layertable)
395
+                                            ////        {
396
+                                            ////            LayerTableRecord lyrtbrec = tran.GetObject(id, OpenMode.ForWrite) as LayerTableRecord;
397
+                                            ////            if (lyrtbrec.Name == "CJX")
398
+                                            ////                db.Clayer = id;
399
+                                            ////        }
400
+                                            ////    }
401
+
402
+                                            ////    Polyline3d cjxpl = new Polyline3d(Poly3dType.SimplePoly, cjcoll, false);
403
+
404
+                                            ////    cjxpl.Color = GrxCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
405
+                                            ////    acblr.AppendEntity(cjxpl);
406
+                                            ////    cjxpl.Layer = "CJX";
407
+                                            ////    tran.AddNewlyCreatedDBObject(cjxpl, true);
408
+
409
+                                            ////    //doc.Editor.WriteMessage("");
410
+
411
+                                            ////    tran.Commit();
412
+                                            ////    tran.Dispose();
413
+                                            ////}
414
+                                            #endregion
415
+
416
+                                            double Xmin = 9999999999, Xmax = 0, Ymin = 9999999999, Ymax = 0;
417
+                                            //获取该点集的最大值最小值
418
+                                            foreach (Point3d pt3dcorner in cjcoll)
419
+                                            {
420
+                                                if (Xmin >= pt3dcorner.X)
421
+                                                    Xmin = pt3dcorner.X;
422
+                                                if (Xmax < pt3dcorner.X)
423
+                                                    Xmax = pt3dcorner.X;
424
+                                                if (Ymin >= pt3dcorner.Y)
425
+                                                    Ymin = pt3dcorner.Y;
426
+                                                if (Ymax < pt3dcorner.Y)
427
+                                                    Ymax = pt3dcorner.Y;
428
+                                            }
429
+                                            if (Xmin > Xmax)
430
+                                            {
431
+                                                double tempt = 0;
432
+                                                tempt = Xmin;
433
+                                                Xmin = Xmax;
434
+                                                Xmax = tempt;
435
+                                            }
436
+
437
+                                            if (Ymin > Ymax)
438
+                                            {
439
+                                                double tempt = 0;
440
+                                                tempt = Ymin;
441
+                                                Ymin = Ymax;
442
+                                                Ymax = tempt;
443
+                                            }
444
+                                            #region//设置视图
445
+                                            //设置当前视图
446
+                                            ViewTableRecord viewtr = new ViewTableRecord();
447
+                                            viewtr.CenterPoint = new Point2d(Xmin + (Xmax - Xmin) / 2, Ymin + (Ymax - Ymin) / 2);
448
+                                            viewtr.ViewDirection = new Vector3d(0, 0, 1);
449
+                                            viewtr.Height = Ymax - Ymin + 100;
450
+                                            viewtr.Width = Xmax - Xmin + 100;
451
+                                            doc.Editor.SetCurrentView(viewtr);
452
+                                            #endregion
453
+
454
+                                            //对选择到的首曲线进行处理
455
+                                            string stttr = "";
456
+                                            TypedValue[] tvtemp = new TypedValue[1];
457
+                                            tvtemp.SetValue(new TypedValue((int)DxfCode.LayerName, sqxlayer), 0);
458
+                                            SelectionFilter sftemp = new SelectionFilter(tvtemp);
459
+                                            PromptSelectionResult psrtempt = doc.Editor.SelectCrossingWindow(new Point3d(Xmin, Ymin, 0), new Point3d(Xmax, Ymax, 0), sftemp);
460
+                                            if (psrtempt.Status == PromptStatus.OK)
461
+                                            {
462
+                                                SelectionSet sstempt = psrtempt.Value;
463
+                                                #region
464
+                                                using (Transaction tran = doc.TransactionManager.StartTransaction())
465
+                                                {
466
+                                                    //// 以只读方式打开块表记录   Open the Block table record for read
467
+                                                    BlockTable acbt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
468
+                                                    //// 以写方式打开模型空间块表记录   Open the Block table record Model space for write
469
+                                                    BlockTableRecord acblr = tran.GetObject(acbt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
470
+
471
+                                                    //设置激活图层
472
+                                                    layertable = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
473
+
474
+                                                    //设置首曲线为当期激活图层
475
+                                                    foreach (ObjectId id in layertable)
476
+                                                    {
477
+                                                        LayerTableRecord lyrtbrec = tran.GetObject(id, OpenMode.ForWrite) as LayerTableRecord;
478
+                                                        if (lyrtbrec.Name == sqxlayer)
479
+                                                            db.Clayer = id;
480
+                                                    }
481
+                                                    foreach (ObjectId oidtempt in sstempt.GetObjectIds())
482
+                                                    {
483
+                                                        Entity entempt = tran.GetObject(oidtempt, OpenMode.ForWrite) as Entity;
484
+
485
+                                                        //if (ele1 > ele2)
486
+                                                        //{
487
+                                                        //    double tempt = 0;
488
+                                                        //    tempt = ele1;
489
+                                                        //    ele1 = ele2;
490
+                                                        //    ele2 = tempt;
491
+                                                        //}
492
+
493
+                                                        if (entempt is Polyline)
494
+                                                        {
495
+                                                            Polyline pltempt = entempt as Polyline;
496
+                                                            if (Convert.ToDouble(pltempt.Elevation.ToString("f1")) > ele1 && Convert.ToDouble(pltempt.Elevation.ToString("f1")) < ele2)
497
+                                                            {
498
+                                                                //裁剪节点集
499
+                                                                Point3dCollection pt3dcolltempt = new Point3dCollection();
500
+                                                                //裁剪节点集
501
+                                                                Point3dCollection pt3dcolltempt2 = new Point3dCollection();
502
+
503
+
504
+                                                                //裁剪节点
505
+                                                                Point3d pt3dtt1 = pltempt.GetClosestPointTo(pt1cjnode, false);
506
+                                                                Point3d pt3dtt2 = pltempt.GetClosestPointTo(pt3cjnode, false);
507
+
508
+                                                                //将线端点以外的点添加进裁剪接节点
509
+                                                                if (pt3dtt1 != new Point3d())
510
+                                                                {
511
+                                                                    if (pt3dtt1 != pltempt.StartPoint && pt3dtt1 != pltempt.EndPoint)
512
+                                                                        pt3dcolltempt.Add(pt3dtt1);
513
+                                                                }
514
+                                                                if (pt3dtt2 != new Point3d())
515
+                                                                {
516
+                                                                    if (pt3dtt2 != pltempt.StartPoint && pt3dtt2 != pltempt.EndPoint)
517
+                                                                        pt3dcolltempt.Add(pt3dtt2);
518
+                                                                }
519
+                                                                stttr += pltempt.StartPoint.X + "," + pltempt.StartPoint.Y + "," + pltempt.StartPoint.Z + "!" + pltempt.EndPoint.X + ","
520
+                                                                    + pltempt.EndPoint.Y + "," + pltempt.EndPoint.Z + "\r\n";
521
+                                                                stttr += pt3dtt1.X + "@" + pt3dtt1.Y + "@" + pt3dtt1.Z + "!" + pt3dtt2.X + "@" + pt3dtt2.Y + "@" + pt3dtt2.Z + "\r\n";
522
+                                                                if (pt3dcolltempt.Count > 0)
523
+                                                                {
524
+                                                                    for (int ch = 0; ch < pt3dcolltempt.Count; ch++)
525
+                                                                    {
526
+                                                                        pt3dcolltempt2.Add(pt3dcolltempt[pt3dcolltempt.Count - 1 - ch]);
527
+                                                                    }
528
+
529
+
530
+                                                                    DBObjectCollection dbojcoll = null;
531
+                                                                    DBObjectCollection dbojcoll2 = null;
532
+                                                                    try
533
+                                                                    {
534
+                                                                        dbojcoll = pltempt.GetSplitCurves(pt3dcolltempt);
535
+                                                                    }
536
+                                                                    catch { }
537
+                                                                    try
538
+                                                                    {
539
+                                                                        dbojcoll2 = pltempt.GetSplitCurves(pt3dcolltempt2);
540
+                                                                    }
541
+                                                                    catch { }
542
+
543
+                                                                    if (dbojcoll2.Count > dbojcoll.Count)
544
+                                                                        dbojcoll = dbojcoll2;
545
+                                                                    //if (dbojcoll.Count >0)
546
+                                                                    if (dbojcoll.Count < 1)
547
+                                                                        continue;
548
+                                                                    //{
549
+                                                                    if (pltempt.Closed)//如果该线闭合
550
+                                                                    {
551
+                                                                        foreach (DBObject enen in dbojcoll)
552
+                                                                        {
553
+                                                                            Polyline plcjh = enen as Polyline;
554
+                                                                            Point3dCollection ptcolltempt3d = new Point3dCollection();
555
+                                                                            plcjh.GetStretchPoints(ptcolltempt3d);
556
+                                                                            Point3d ptptpt = ptcolltempt3d[(int)(ptcolltempt3d.Count / 2)];
557
+                                                                            //Point3d ptptpt = ptcolltempt3d[1];
558
+                                                                            Point2d ptinen1 = new Point2d();
559
+                                                                            Point2d ptinen2 = new Point2d();
560
+                                                                            //double llen = 9999;
561
+                                                                            if (en1 is Polyline)
562
+                                                                            {
563
+                                                                                Polyline plen1 = en1 as Polyline;
564
+                                                                                Point3d mypt = plen1.GetClosestPointTo(ptptpt, false);
565
+                                                                                ptinen1 = new Point2d(mypt.X, mypt.Y);
566
+
567
+                                                                                //llen = plen1.GetClosestPointTo(ptptpt, false).DistanceTo(ptptpt);
568
+                                                                            }
569
+                                                                            else if (en1 is Polyline2d)
570
+                                                                            {
571
+                                                                                Polyline2d pl2den1 = en1 as Polyline2d;
572
+
573
+                                                                                Point3d mypt = pl2den1.GetClosestPointTo(ptptpt, false);
574
+                                                                                ptinen1 = new Point2d(mypt.X, mypt.Y);
575
+                                                                                //llen = pl2den1.GetClosestPointTo(ptptpt, false).DistanceTo(ptptpt);
576
+                                                                            }
577
+                                                                            if (en2 is Polyline)
578
+                                                                            {
579
+                                                                                Polyline plen2 = en2 as Polyline;
580
+                                                                                Point3d mypt = plen2.GetClosestPointTo(ptptpt, false);
581
+                                                                                ptinen2 = new Point2d(mypt.X, mypt.Y);
582
+                                                                            }
583
+                                                                            else if (en2 is Polyline2d)
584
+                                                                            {
585
+                                                                                Polyline2d pl2den2 = en2 as Polyline2d;
586
+
587
+                                                                                Point3d mypt = pl2den2.GetClosestPointTo(ptptpt, false);
588
+                                                                                ptinen2 = new Point2d(mypt.X, mypt.Y);
589
+                                                                            }
590
+                                                                            double llen = 9999;
591
+                                                                            if ((ptinen1 != new Point2d()) && (ptinen2 != new Point2d()))
592
+                                                                            {
593
+                                                                                llen = ptinen1.GetDistanceTo(ptinen2);
594
+                                                                            }
595
+                                                                            if (llen < scalelen)
596
+                                                                            {
597
+                                                                                cdentity.Add(plcjh);
598
+                                                                            }
599
+                                                                            else
600
+                                                                            {
601
+                                                                                acblr.AppendEntity(plcjh);
602
+                                                                                plcjh.Layer = sqxlayer;
603
+                                                                                tran.AddNewlyCreatedDBObject(plcjh, true);
604
+                                                                            }
605
+                                                                        }
606
+                                                                    }
607
+                                                                    else
608
+                                                                    {
609
+                                                                        foreach (DBObject enen in dbojcoll)
610
+                                                                        {
611
+
612
+                                                                            Polyline plcjh = enen as Polyline;
613
+                                                                            Point2d startpoint = new Point2d(plcjh.StartPoint.X, plcjh.StartPoint.Y);
614
+                                                                            Point2d endpoint = new Point2d(plcjh.EndPoint.X, plcjh.EndPoint.Y);
615
+
616
+                                                                            double linelength = startpoint.GetDistanceTo(endpoint);
617
+
618
+                                                                            if (linelength > 1.5 * mapscale)
619
+                                                                            {
620
+                                                                                //if ((plcjh.GetClosestPointTo(pt3dtt1, false) == pt3dtt1) && (plcjh.GetClosestPointTo(pt3dtt2, false) == pt3dtt2))
621
+                                                                                if ((pt3dtt1 == plcjh.StartPoint || pt3dtt1 == plcjh.EndPoint) && (pt3dtt2 == plcjh.StartPoint || pt3dtt2 == plcjh.EndPoint))
622
+                                                                                {
623
+                                                                                    cdentity.Add(plcjh);
624
+                                                                                }
625
+                                                                                else
626
+                                                                                {
627
+                                                                                    acblr.AppendEntity(plcjh);
628
+                                                                                    plcjh.Layer = sqxlayer;
629
+                                                                                    tran.AddNewlyCreatedDBObject(plcjh, true);
630
+                                                                                }
631
+                                                                            }
632
+                                                                            else
633
+                                                                                cdentity.Add(plcjh);
634
+                                                                        }
635
+                                                                    }
636
+                                                                    //}
637
+                                                                    entempt.Erase(true);
638
+                                                                    //tran.Commit();
639
+                                                                }
640
+
641
+                                                            }
642
+                                                        }
643
+                                                        else if (entempt is Polyline2d)
644
+                                                        {
645
+                                                            ////裁剪二维多段线代码
646
+                                                            
647
+                                                            Polyline2d pl2dtempt = entempt as Polyline2d;
648
+                                                            if (Convert.ToDouble(pl2dtempt.Elevation.ToString("f1")) > ele1 && Convert.ToDouble(pl2dtempt.Elevation.ToString("f1")) < ele2)
649
+                                                            {
650
+                                                                Point3dCollection pt3dcolltempt = new Point3dCollection();
651
+                                                                Point3d pt3dtt1 = pl2dtempt.GetClosestPointTo(pt1cjnode, false);
652
+                                                                Point3d pt3dtt2 = pl2dtempt.GetClosestPointTo(pt3cjnode, false);
653
+
654
+                                                                //将线端点以外的点添加进裁剪接节点
655
+                                                                if (pt3dtt1 != new Point3d())
656
+                                                                {
657
+                                                                    if (pt3dtt1 != pl2dtempt.StartPoint && pt3dtt1 != pl2dtempt.EndPoint)
658
+                                                                        pt3dcolltempt.Add(pt3dtt1);
659
+                                                                }
660
+                                                                if (pt3dtt2 != new Point3d())
661
+                                                                {
662
+                                                                    if (pt3dtt2 != pl2dtempt.StartPoint && pt3dtt2 != pl2dtempt.EndPoint)
663
+                                                                        pt3dcolltempt.Add(pt3dtt2);
664
+                                                                }
665
+                                                                if (pt3dcolltempt.Count > 0)
666
+                                                                {
667
+                                                                    Polyline pltempt = new Polyline();                                                                   
668
+                                                                    Point3dCollection pt3dpl2dcoll = new Point3dCollection();
669
+                                                                    pl2dtempt.GetStretchPoints(pt3dpl2dcoll);
670
+                                                                    //foreach (Point3d pt in pt3dpl2dcoll)
671
+                                                                    //{
672
+                                                                    //    pltempt.AddVertexAt(0,pt,0,0,0);
673
+                                                                    //}
674
+
675
+                                                                    DBObjectCollection dbojcoll = pl2dtempt.GetSplitCurves(pt3dcolltempt);
676
+                                                                    if (dbojcoll.Count>0)
677
+                                                                    {
678
+                                                                    foreach (DBObject enen in dbojcoll)
679
+                                                                    {
680
+                                                                        Polyline2d pl2dcjh = enen as Polyline2d;
681
+
682
+                                                                        Point2d startpoint = new Point2d(pl2dcjh.StartPoint.X, pl2dcjh.StartPoint.Y);
683
+                                                                        Point2d endpoint = new Point2d(pl2dcjh.EndPoint.X, pl2dcjh.EndPoint.Y);
684
+
685
+                                                                        double linelength = startpoint.GetDistanceTo(endpoint);
686
+
687
+                                                                        if (linelength > 1.5 * mapscale)
688
+                                                                        {
689
+
690
+                                                                            if ((pl2dcjh.GetClosestPointTo(pt3dtt1, false) == pt3dtt1) && (pl2dcjh.GetClosestPointTo(pt3dtt2, false) == pt3dtt2))
691
+                                                                            if ((pt3dtt1 == pl2dcjh.StartPoint || pt3dtt1 == pl2dcjh.EndPoint) && (pt3dtt2 == pl2dcjh.StartPoint || pt3dtt2 == pl2dcjh.EndPoint))
692
+                                                                            {
693
+                                                                                cdentity.Add(pl2dcjh);
694
+                                                                            }
695
+                                                                            else
696
+                                                                            {
697
+                                                                                acblr.AppendEntity(pl2dcjh);
698
+                                                                                pl2dcjh.Layer = sqxlayer;
699
+                                                                                tran.AddNewlyCreatedDBObject(pl2dcjh, true);
700
+                                                                            }
701
+                                                                        }
702
+                                                                        else
703
+                                                                            cdentity.Add(pl2dcjh);
704
+                                                                    }
705
+
706
+                                                                    } 
707
+                                                                    entempt.Erase(true);
708
+                                                                    tran.Commit();
709
+                                                                }
710
+                                                            }
711
+
712
+                                                  
713
+                                                        }
714
+
715
+                                                        #region//画裁剪线
716
+                                                        //Polyline3d cjxpl = new Polyline3d(Poly3dType.SimplePoly, rectcj, false);
717
+                                                        //if (!layertable.Has("CJX"))
718
+                                                        //{
719
+                                                        //    LayerTableRecord ltr = new LayerTableRecord();
720
+                                                        //    ltr.Name = "CJX";
721
+                                                        //    ObjectId layerid = layertable.Add(ltr);
722
+                                                        //    tran.AddNewlyCreatedDBObject(ltr, true);
723
+                                                        //    //db.Clayer = layerid;
724
+                                                        //}
725
+
726
+                                                        //cjxpl.Color = GrxCAD.Colors.Color.FromColor(System.Drawing.Color.Blue);
727
+                                                        //acblr.AppendEntity(cjxpl);
728
+                                                        //cjxpl.Layer = "CJX";
729
+                                                        //tran.AddNewlyCreatedDBObject(cjxpl, true);
730
+                                                        ////doc.Editor.WriteMessage("");
731
+                                                        #endregion
732
+
733
+                                                    }
734
+
735
+                                                    tran.Commit();
736
+                                                    tran.Dispose();
737
+                                                }
738
+                                                #endregion
739
+                                            }
740
+
741
+                                        }
742
+
743
+                                    }
744
+                                    cjcoll.Clear();
745
+                                    cjcoll = new Point3dCollection();
746
+                                }
747
+
748
+                                flag = false;
749
+                                continue;
750
+                            }//end if
751
+                            else
752
+                            {
753
+                                continue;
754
+                            }
755
+                        }
756
+                    }
757
+                }
758
+            }
759
+            else
760
+                return;      
761
+       #endregion
762
+       #region
763
+            ///画裁剪掉的线
764
+            if (cdentity.Count > 0)
765
+            {
766
+                using (Transaction tran = doc.TransactionManager.StartTransaction())
767
+                {
768
+
769
+                    //// 以只读方式打开块表记录   Open the Block table record for read
770
+                    BlockTable acbt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
771
+                    //// 以写方式打开模型空间块表记录   Open the Block table record Model space for write
772
+                    BlockTableRecord acblr = tran.GetObject(acbt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
773
+
774
+                    //设置激活图层
775
+                    layertable = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
776
+                    if (!layertable.Has("CJSQX"))
777
+                    {
778
+                        LayerTableRecord ltr = new LayerTableRecord();
779
+                        ltr.Name = "CJSQX";
780
+                        ObjectId layerid = layertable.Add(ltr);
781
+                        tran.AddNewlyCreatedDBObject(ltr, true);
782
+                        db.Clayer = layerid;
783
+                    }
784
+                    else
785
+                    {
786
+                        foreach (ObjectId id in layertable)
787
+                        {
788
+                            LayerTableRecord lyrtbrec = tran.GetObject(id, OpenMode.ForWrite) as LayerTableRecord;
789
+                            if (lyrtbrec.Name == "CJSQX")
790
+                                db.Clayer = id;
791
+                        }
792
+                    }
793
+
794
+                    foreach (Entity enenen in cdentity)
795
+                    {
796
+                        enenen.Color = GrxCAD.Colors.Color.FromColor(System.Drawing.Color.Red);
797
+                        acblr.AppendEntity(enenen);
798
+                        enenen.Layer = "CJSQX";
799
+                        tran.AddNewlyCreatedDBObject(enenen, true);
800
+                    }
801
+
802
+                    doc.Editor.WriteMessage("已完成裁剪\r\n裁剪掉的等高线都放在CJSQX图层中\r\n");
803
+
804
+                    tran.Commit();
805
+                    tran.Dispose();
806
+                }
807
+            }
808
+            #endregion
809
+            documentlock.Dispose();
810
+            doc.Editor.WriteMessage("程序运行结束");          
811
+        }
812
+        public static int CompareDGXByElevation(Entity en1, Entity en2)
813
+        {
814
+            double ele1 = 0, ele2 = 0;
815
+            //because just Polyline and Polyline2d two class in plentitycollection
816
+            if (en1 is Polyline)
817
+            {
818
+                Polyline pl = en1 as Polyline;
819
+                ele1 = Convert.ToDouble(pl.Elevation.ToString("f1"));
820
+            }
821
+            else
822
+            {
823
+                Polyline2d pl2d = en1 as Polyline2d;
824
+                ele1 = Convert.ToDouble(pl2d.Elevation.ToString("f1"));
825
+            }
826
+
827
+            if (en2 is Polyline)
828
+            {
829
+                Polyline pl = en2 as Polyline;
830
+                ele2 = Convert.ToDouble(pl.Elevation.ToString("f1"));
831
+            }
832
+            else
833
+            {
834
+                Polyline2d pl2d = en2 as Polyline2d;
835
+                ele2 = Convert.ToDouble(pl2d.Elevation.ToString("f1"));
836
+            }
837
+
838
+            return (int)(ele1 - ele2);
839
+
840
+        }
841
+        public static Point3d GetClosestPoint(Point3d pt, Entity enpl)
842
+        {
843
+            if (enpl is Polyline)
844
+            {
845
+                Polyline pl = enpl as Polyline;
846
+                return pl.GetClosestPointTo(pt, true);
847
+            }
848
+            else
849
+            {
850
+                Polyline2d pl2d = enpl as Polyline2d;
851
+                return pl2d.GetClosestPointTo(pt, true);
852
+            }
853
+        }
854
+       #endregion
855
+    }
856
+}

+ 244
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutCountL.Designer.cs ファイルの表示

@@ -0,0 +1,244 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class CutCountL
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CutCountL));
33
+            this.label17 = new System.Windows.Forms.Label();
34
+            this.richTextBox2 = new System.Windows.Forms.RichTextBox();
35
+            this.dgxCJ_gcc_te = new System.Windows.Forms.TextBox();
36
+            this.dgxCJ_gcc_la = new System.Windows.Forms.Label();
37
+            this.dgxCJ_hlcd_te = new System.Windows.Forms.TextBox();
38
+            this.dgxCJ_hlcd_la = new System.Windows.Forms.Label();
39
+            this.dgxCJ_cjjl_te = new System.Windows.Forms.TextBox();
40
+            this.dgxCJ_cjjl_la = new System.Windows.Forms.Label();
41
+            this.dgxCJ_jqx_co = new System.Windows.Forms.ComboBox();
42
+            this.dgxCJ_jqx_la = new System.Windows.Forms.Label();
43
+            this.dgxCJ_sqx_co = new System.Windows.Forms.ComboBox();
44
+            this.dgxCJ_sqx_la = new System.Windows.Forms.Label();
45
+            this.dgxCJ_blc_co = new System.Windows.Forms.ComboBox();
46
+            this.dgxCJ_blc_la = new System.Windows.Forms.Label();
47
+            this.Cancel = new System.Windows.Forms.Button();
48
+            this.OK = new System.Windows.Forms.Button();
49
+            this.SuspendLayout();
50
+            // 
51
+            // label17
52
+            // 
53
+            this.label17.AutoSize = true;
54
+            this.label17.Location = new System.Drawing.Point(319, 20);
55
+            this.label17.Name = "label17";
56
+            this.label17.Size = new System.Drawing.Size(52, 15);
57
+            this.label17.TabIndex = 27;
58
+            this.label17.Text = "说明:";
59
+            // 
60
+            // richTextBox2
61
+            // 
62
+            this.richTextBox2.Location = new System.Drawing.Point(322, 44);
63
+            this.richTextBox2.Name = "richTextBox2";
64
+            this.richTextBox2.Size = new System.Drawing.Size(430, 319);
65
+            this.richTextBox2.TabIndex = 26;
66
+            this.richTextBox2.Text = resources.GetString("richTextBox2.Text");
67
+            // 
68
+            // dgxCJ_gcc_te
69
+            // 
70
+            this.dgxCJ_gcc_te.Location = new System.Drawing.Point(174, 313);
71
+            this.dgxCJ_gcc_te.Name = "dgxCJ_gcc_te";
72
+            this.dgxCJ_gcc_te.Size = new System.Drawing.Size(121, 25);
73
+            this.dgxCJ_gcc_te.TabIndex = 25;
74
+            // 
75
+            // dgxCJ_gcc_la
76
+            // 
77
+            this.dgxCJ_gcc_la.AutoSize = true;
78
+            this.dgxCJ_gcc_la.Location = new System.Drawing.Point(48, 285);
79
+            this.dgxCJ_gcc_la.Name = "dgxCJ_gcc_la";
80
+            this.dgxCJ_gcc_la.Size = new System.Drawing.Size(142, 15);
81
+            this.dgxCJ_gcc_la.TabIndex = 24;
82
+            this.dgxCJ_gcc_la.Text = "两计曲线间高程差:";
83
+            // 
84
+            // dgxCJ_hlcd_te
85
+            // 
86
+            this.dgxCJ_hlcd_te.Location = new System.Drawing.Point(174, 244);
87
+            this.dgxCJ_hlcd_te.Name = "dgxCJ_hlcd_te";
88
+            this.dgxCJ_hlcd_te.Size = new System.Drawing.Size(121, 25);
89
+            this.dgxCJ_hlcd_te.TabIndex = 23;
90
+            // 
91
+            // dgxCJ_hlcd_la
92
+            // 
93
+            this.dgxCJ_hlcd_la.AutoSize = true;
94
+            this.dgxCJ_hlcd_la.Location = new System.Drawing.Point(48, 217);
95
+            this.dgxCJ_hlcd_la.Name = "dgxCJ_hlcd_la";
96
+            this.dgxCJ_hlcd_la.Size = new System.Drawing.Size(180, 15);
97
+            this.dgxCJ_hlcd_la.TabIndex = 22;
98
+            this.dgxCJ_hlcd_la.Text = "可忽略的裁剪长度(m):";
99
+            // 
100
+            // dgxCJ_cjjl_te
101
+            // 
102
+            this.dgxCJ_cjjl_te.Location = new System.Drawing.Point(174, 176);
103
+            this.dgxCJ_cjjl_te.Name = "dgxCJ_cjjl_te";
104
+            this.dgxCJ_cjjl_te.Size = new System.Drawing.Size(121, 25);
105
+            this.dgxCJ_cjjl_te.TabIndex = 21;
106
+            // 
107
+            // dgxCJ_cjjl_la
108
+            // 
109
+            this.dgxCJ_cjjl_la.AutoSize = true;
110
+            this.dgxCJ_cjjl_la.Location = new System.Drawing.Point(48, 179);
111
+            this.dgxCJ_cjjl_la.Name = "dgxCJ_cjjl_la";
112
+            this.dgxCJ_cjjl_la.Size = new System.Drawing.Size(120, 15);
113
+            this.dgxCJ_cjjl_la.TabIndex = 20;
114
+            this.dgxCJ_cjjl_la.Text = "裁剪距离(m):";
115
+            // 
116
+            // dgxCJ_jqx_co
117
+            // 
118
+            this.dgxCJ_jqx_co.FormattingEnabled = true;
119
+            this.dgxCJ_jqx_co.Location = new System.Drawing.Point(174, 136);
120
+            this.dgxCJ_jqx_co.Name = "dgxCJ_jqx_co";
121
+            this.dgxCJ_jqx_co.Size = new System.Drawing.Size(121, 23);
122
+            this.dgxCJ_jqx_co.TabIndex = 19;
123
+            // 
124
+            // dgxCJ_jqx_la
125
+            // 
126
+            this.dgxCJ_jqx_la.AutoSize = true;
127
+            this.dgxCJ_jqx_la.Location = new System.Drawing.Point(48, 139);
128
+            this.dgxCJ_jqx_la.Name = "dgxCJ_jqx_la";
129
+            this.dgxCJ_jqx_la.Size = new System.Drawing.Size(97, 15);
130
+            this.dgxCJ_jqx_la.TabIndex = 18;
131
+            this.dgxCJ_jqx_la.Text = "计曲线图层:";
132
+            // 
133
+            // dgxCJ_sqx_co
134
+            // 
135
+            this.dgxCJ_sqx_co.FormattingEnabled = true;
136
+            this.dgxCJ_sqx_co.Location = new System.Drawing.Point(174, 93);
137
+            this.dgxCJ_sqx_co.Name = "dgxCJ_sqx_co";
138
+            this.dgxCJ_sqx_co.Size = new System.Drawing.Size(121, 23);
139
+            this.dgxCJ_sqx_co.TabIndex = 17;
140
+            // 
141
+            // dgxCJ_sqx_la
142
+            // 
143
+            this.dgxCJ_sqx_la.AutoSize = true;
144
+            this.dgxCJ_sqx_la.Location = new System.Drawing.Point(48, 97);
145
+            this.dgxCJ_sqx_la.Name = "dgxCJ_sqx_la";
146
+            this.dgxCJ_sqx_la.Size = new System.Drawing.Size(97, 15);
147
+            this.dgxCJ_sqx_la.TabIndex = 16;
148
+            this.dgxCJ_sqx_la.Text = "首曲线图层:";
149
+            // 
150
+            // dgxCJ_blc_co
151
+            // 
152
+            this.dgxCJ_blc_co.FormattingEnabled = true;
153
+            this.dgxCJ_blc_co.Items.AddRange(new object[] {
154
+            "1:200",
155
+            "1:500",
156
+            "1:1000",
157
+            "1:2000",
158
+            "1:5000",
159
+            "1:10000"});
160
+            this.dgxCJ_blc_co.Location = new System.Drawing.Point(174, 51);
161
+            this.dgxCJ_blc_co.Name = "dgxCJ_blc_co";
162
+            this.dgxCJ_blc_co.Size = new System.Drawing.Size(121, 23);
163
+            this.dgxCJ_blc_co.TabIndex = 15;
164
+            // 
165
+            // dgxCJ_blc_la
166
+            // 
167
+            this.dgxCJ_blc_la.AutoSize = true;
168
+            this.dgxCJ_blc_la.Location = new System.Drawing.Point(48, 54);
169
+            this.dgxCJ_blc_la.Name = "dgxCJ_blc_la";
170
+            this.dgxCJ_blc_la.Size = new System.Drawing.Size(90, 15);
171
+            this.dgxCJ_blc_la.TabIndex = 14;
172
+            this.dgxCJ_blc_la.Text = "地图比例尺:";
173
+            // 
174
+            // Cancel
175
+            // 
176
+            this.Cancel.Location = new System.Drawing.Point(506, 391);
177
+            this.Cancel.Margin = new System.Windows.Forms.Padding(4);
178
+            this.Cancel.Name = "Cancel";
179
+            this.Cancel.Size = new System.Drawing.Size(100, 29);
180
+            this.Cancel.TabIndex = 34;
181
+            this.Cancel.Text = "取 消";
182
+            this.Cancel.UseVisualStyleBackColor = true;
183
+            this.Cancel.Click += new System.EventHandler(this.Cancel_Click);
184
+            // 
185
+            // OK
186
+            // 
187
+            this.OK.Location = new System.Drawing.Point(196, 391);
188
+            this.OK.Margin = new System.Windows.Forms.Padding(4);
189
+            this.OK.Name = "OK";
190
+            this.OK.Size = new System.Drawing.Size(100, 29);
191
+            this.OK.TabIndex = 33;
192
+            this.OK.Text = "确 定";
193
+            this.OK.UseVisualStyleBackColor = true;
194
+            this.OK.Click += new System.EventHandler(this.OK_Click);
195
+            // 
196
+            // CutCountL
197
+            // 
198
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
199
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
200
+            this.ClientSize = new System.Drawing.Size(800, 442);
201
+            this.Controls.Add(this.Cancel);
202
+            this.Controls.Add(this.OK);
203
+            this.Controls.Add(this.label17);
204
+            this.Controls.Add(this.richTextBox2);
205
+            this.Controls.Add(this.dgxCJ_gcc_te);
206
+            this.Controls.Add(this.dgxCJ_gcc_la);
207
+            this.Controls.Add(this.dgxCJ_hlcd_te);
208
+            this.Controls.Add(this.dgxCJ_hlcd_la);
209
+            this.Controls.Add(this.dgxCJ_cjjl_te);
210
+            this.Controls.Add(this.dgxCJ_cjjl_la);
211
+            this.Controls.Add(this.dgxCJ_jqx_co);
212
+            this.Controls.Add(this.dgxCJ_jqx_la);
213
+            this.Controls.Add(this.dgxCJ_sqx_co);
214
+            this.Controls.Add(this.dgxCJ_sqx_la);
215
+            this.Controls.Add(this.dgxCJ_blc_co);
216
+            this.Controls.Add(this.dgxCJ_blc_la);
217
+            this.Name = "CutCountL";
218
+            this.Text = "等高线裁剪";
219
+            this.Load += new System.EventHandler(this.CutCountL_Load);
220
+            this.ResumeLayout(false);
221
+            this.PerformLayout();
222
+
223
+        }
224
+
225
+        #endregion
226
+
227
+        private System.Windows.Forms.Label label17;
228
+        private System.Windows.Forms.RichTextBox richTextBox2;
229
+        private System.Windows.Forms.TextBox dgxCJ_gcc_te;
230
+        private System.Windows.Forms.Label dgxCJ_gcc_la;
231
+        private System.Windows.Forms.TextBox dgxCJ_hlcd_te;
232
+        private System.Windows.Forms.Label dgxCJ_hlcd_la;
233
+        private System.Windows.Forms.TextBox dgxCJ_cjjl_te;
234
+        private System.Windows.Forms.Label dgxCJ_cjjl_la;
235
+        private System.Windows.Forms.ComboBox dgxCJ_jqx_co;
236
+        private System.Windows.Forms.Label dgxCJ_jqx_la;
237
+        private System.Windows.Forms.ComboBox dgxCJ_sqx_co;
238
+        private System.Windows.Forms.Label dgxCJ_sqx_la;
239
+        private System.Windows.Forms.ComboBox dgxCJ_blc_co;
240
+        private System.Windows.Forms.Label dgxCJ_blc_la;
241
+        private System.Windows.Forms.Button Cancel;
242
+        private System.Windows.Forms.Button OK;
243
+    }
244
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutCountL.cs ファイルの表示

@@ -0,0 +1,120 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class CutCountL : Form
15
+    {
16
+        public CutCountL()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void CutCountL_Load(object sender, EventArgs e)
22
+        {
23
+            this.dgxCJ_blc_co.DropDownStyle = ComboBoxStyle.DropDownList;
24
+            this.dgxCJ_jqx_co.DropDownStyle = ComboBoxStyle.DropDownList;
25
+            this.dgxCJ_sqx_co.DropDownStyle = ComboBoxStyle.DropDownList;
26
+
27
+            //自动填充下拉框
28
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
29
+            using (Transaction traction = database.TransactionManager.StartTransaction())
30
+            {
31
+                //存放所有图层名
32
+                List<string> alllayername = new List<string>();
33
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
34
+                foreach (ObjectId objid in layertable)
35
+                {
36
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
37
+                    alllayername.Add(layertablerecord.Name);
38
+                }
39
+
40
+                alllayername.Sort();
41
+
42
+                for (int i = 0; i < alllayername.Count; i++)
43
+                {
44
+                    this.dgxCJ_jqx_co.Items.Add(alllayername[i]);
45
+                    this.dgxCJ_sqx_co.Items.Add(alllayername[i]);
46
+                }
47
+
48
+                if (alllayername.Contains("8300"))
49
+                {
50
+                    int index = alllayername.IndexOf("8300");
51
+                }
52
+                if (alllayername.Contains("8110"))
53
+                {
54
+                    int index = alllayername.IndexOf("8110");
55
+                    this.dgxCJ_sqx_co.SelectedIndex = index;
56
+                }
57
+                if (alllayername.Contains("8120"))
58
+                {
59
+                    int index = alllayername.IndexOf("8120");
60
+                    this.dgxCJ_jqx_co.SelectedIndex = index;
61
+                }
62
+                traction.Commit();
63
+            }
64
+
65
+        }
66
+
67
+        private void OK_Click(object sender, EventArgs e)
68
+        {
69
+            if (dgxCJ_blc_co.Text == "")
70
+            {
71
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择比例尺");
72
+                return;
73
+            }
74
+            if (dgxCJ_sqx_co.Text == "")
75
+            {
76
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择首曲线图层");
77
+                return;
78
+            }
79
+            if (dgxCJ_jqx_co.Text == "")
80
+            {
81
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择计曲线图层");
82
+                return;
83
+            }
84
+            if (dgxCJ_gcc_te.Text == "")
85
+            {
86
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入计曲线高程差");
87
+                return;
88
+            }
89
+            if (dgxCJ_hlcd_te.Text == "")
90
+            {
91
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入可忽略的裁剪长度");
92
+                return;
93
+            }
94
+            if (dgxCJ_cjjl_te.Text == "")
95
+            {
96
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入裁剪距离");
97
+                return;
98
+            }
99
+            CutContourLine.sqxlayer = dgxCJ_sqx_co.Text;
100
+            CutContourLine.jqxlayer = dgxCJ_jqx_co.Text;
101
+            CutContourLine.eledvalue = double.Parse(dgxCJ_gcc_te.Text);
102
+            CutContourLine.lenIgnore = double.Parse(dgxCJ_hlcd_te.Text);
103
+            CutContourLine.scalelen = double.Parse(dgxCJ_cjjl_te.Text);
104
+            //比例尺
105
+            string blctext = dgxCJ_blc_co.Text;
106
+            int blcindex = blctext.LastIndexOf(':');
107
+            string strblc = blctext.Substring(blcindex + 1);
108
+            CutContourLine.mapscale = Convert.ToInt32(strblc);
109
+
110
+            this.Close();
111
+            CutContourLine chfeature = new CutContourLine();
112
+            chfeature.ccls();
113
+        }
114
+
115
+        private void Cancel_Click(object sender, EventArgs e)
116
+        {
117
+            this.Close();
118
+        }
119
+    }
120
+}

+ 143
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CutCountL.resx ファイルの表示

@@ -0,0 +1,143 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+  <data name="richTextBox2.Text" xml:space="preserve">
121
+    <value>根据规范要求,地形图中计曲线间距小于2mm,首曲线可以不表示。
122
+
123
+各种比例尺地形图不用表示首曲线的计曲线间距为:
124
+1:500  	1m
125
+1:1000 	2m
126
+1:2000 	4m
127
+1:5000 	10m
128
+1:10000	15m
129
+该裁减距离只是参考,按成图需求,可自行设置不用表示首曲线的计曲线间距。
130
+
131
+可忽略裁剪长度是另一个是否表示首曲线的参数,当满足规范间距不用表示的首曲线长度太短,小于规范长度时,不予处理。
132
+其中1:1000的可忽略裁剪长度为1m,其他比例尺的地形图以1:1000为基准变化,也可以按出图需求,自行设定。
133
+
134
+根据规范要求,不同比例尺地形图计曲线间高程差为固定值。
135
+各种比例尺计曲线间高程差为:
136
+1:500  	2.5m
137
+1:1000 	5m
138
+1:2000 	10m
139
+1:5000 	50m
140
+1:10000	100m
141
+该参数只是参考,具体计曲线间高程差,根据其地形图来确定。</value>
142
+  </data>
143
+</root>

+ 131
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneral.Designer.cs ファイルの表示

@@ -0,0 +1,131 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class DGXGeneral
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.checkedListBox_dgxtc = new System.Windows.Forms.CheckedListBox();
33
+            this.label1 = new System.Windows.Forms.Label();
34
+            this.label2 = new System.Windows.Forms.Label();
35
+            this.comboBox_dgj = new System.Windows.Forms.ComboBox();
36
+            this.butn_ok = new System.Windows.Forms.Button();
37
+            this.butn_cancel = new System.Windows.Forms.Button();
38
+            this.SuspendLayout();
39
+            // 
40
+            // checkedListBox_dgxtc
41
+            // 
42
+            this.checkedListBox_dgxtc.FormattingEnabled = true;
43
+            this.checkedListBox_dgxtc.Location = new System.Drawing.Point(44, 102);
44
+            this.checkedListBox_dgxtc.Name = "checkedListBox_dgxtc";
45
+            this.checkedListBox_dgxtc.Size = new System.Drawing.Size(235, 264);
46
+            this.checkedListBox_dgxtc.TabIndex = 0;
47
+            // 
48
+            // label1
49
+            // 
50
+            this.label1.AutoSize = true;
51
+            this.label1.Location = new System.Drawing.Point(25, 35);
52
+            this.label1.Name = "label1";
53
+            this.label1.Size = new System.Drawing.Size(112, 15);
54
+            this.label1.TabIndex = 1;
55
+            this.label1.Text = "转换后等高距:";
56
+            // 
57
+            // label2
58
+            // 
59
+            this.label2.AutoSize = true;
60
+            this.label2.Location = new System.Drawing.Point(25, 75);
61
+            this.label2.Name = "label2";
62
+            this.label2.Size = new System.Drawing.Size(127, 15);
63
+            this.label2.TabIndex = 2;
64
+            this.label2.Text = "选择等高线图层:";
65
+            // 
66
+            // comboBox_dgj
67
+            // 
68
+            this.comboBox_dgj.FormattingEnabled = true;
69
+            this.comboBox_dgj.Items.AddRange(new object[] {
70
+            "0.5",
71
+            "1",
72
+            "2",
73
+            "2.5",
74
+            "5",
75
+            "10",
76
+            "20",
77
+            "40",
78
+            "50"});
79
+            this.comboBox_dgj.Location = new System.Drawing.Point(134, 32);
80
+            this.comboBox_dgj.Name = "comboBox_dgj";
81
+            this.comboBox_dgj.Size = new System.Drawing.Size(155, 23);
82
+            this.comboBox_dgj.TabIndex = 3;
83
+            // 
84
+            // butn_ok
85
+            // 
86
+            this.butn_ok.Location = new System.Drawing.Point(28, 389);
87
+            this.butn_ok.Name = "butn_ok";
88
+            this.butn_ok.Size = new System.Drawing.Size(75, 23);
89
+            this.butn_ok.TabIndex = 4;
90
+            this.butn_ok.Text = "确 定";
91
+            this.butn_ok.UseVisualStyleBackColor = true;
92
+            this.butn_ok.Click += new System.EventHandler(this.butn_ok_Click);
93
+            // 
94
+            // butn_cancel
95
+            // 
96
+            this.butn_cancel.Location = new System.Drawing.Point(214, 389);
97
+            this.butn_cancel.Name = "butn_cancel";
98
+            this.butn_cancel.Size = new System.Drawing.Size(75, 23);
99
+            this.butn_cancel.TabIndex = 5;
100
+            this.butn_cancel.Text = "取 消";
101
+            this.butn_cancel.UseVisualStyleBackColor = true;
102
+            // 
103
+            // DGXGeneral
104
+            // 
105
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
106
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
107
+            this.ClientSize = new System.Drawing.Size(338, 424);
108
+            this.Controls.Add(this.butn_cancel);
109
+            this.Controls.Add(this.butn_ok);
110
+            this.Controls.Add(this.comboBox_dgj);
111
+            this.Controls.Add(this.label2);
112
+            this.Controls.Add(this.label1);
113
+            this.Controls.Add(this.checkedListBox_dgxtc);
114
+            this.Name = "DGXGeneral";
115
+            this.Text = "等高线缩编";
116
+            this.Load += new System.EventHandler(this.DGXGeneral_Load);
117
+            this.ResumeLayout(false);
118
+            this.PerformLayout();
119
+
120
+        }
121
+
122
+        #endregion
123
+
124
+        private System.Windows.Forms.CheckedListBox checkedListBox_dgxtc;
125
+        private System.Windows.Forms.Label label1;
126
+        private System.Windows.Forms.Label label2;
127
+        private System.Windows.Forms.ComboBox comboBox_dgj;
128
+        private System.Windows.Forms.Button butn_ok;
129
+        private System.Windows.Forms.Button butn_cancel;
130
+    }
131
+}

+ 76
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneral.cs ファイルの表示

@@ -0,0 +1,76 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections;
4
+using System.Collections.Generic;
5
+using System.ComponentModel;
6
+using System.Data;
7
+using System.Drawing;
8
+using System.Linq;
9
+using System.Text;
10
+using System.Threading.Tasks;
11
+using System.Windows.Forms;
12
+
13
+namespace HCTools
14
+{
15
+    public partial class DGXGeneral : Form
16
+    {
17
+        public DGXGeneral()
18
+        {
19
+            InitializeComponent();
20
+        }
21
+
22
+        private void DGXGeneral_Load(object sender, EventArgs e)
23
+        {
24
+            this.comboBox_dgj.DropDownStyle = ComboBoxStyle.DropDownList;
25
+
26
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
27
+            using (Transaction traction = database.TransactionManager.StartTransaction())
28
+            {
29
+                //存放所有图层名
30
+                List<string> alllayername = new List<string>();
31
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
32
+                foreach (ObjectId objid in layertable)
33
+                {
34
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
35
+                    alllayername.Add(layertablerecord.Name);
36
+                }
37
+
38
+                alllayername.Sort();
39
+
40
+                for (int i = 0; i < alllayername.Count; i++)
41
+                {
42
+                    this.checkedListBox_dgxtc.Items.Add(alllayername[i]);
43
+                }
44
+                traction.Commit();
45
+            }
46
+        }
47
+
48
+        private void butn_ok_Click(object sender, EventArgs e)
49
+        {
50
+            ArrayList eplayerlist = new ArrayList();
51
+            if (checkedListBox_dgxtc.CheckedItems.Count > 0)
52
+            {
53
+                int count = checkedListBox_dgxtc.CheckedItems.Count;
54
+                for (int i = 0; i < count; i++)
55
+                {
56
+                    eplayerlist.Add(checkedListBox_dgxtc.CheckedItems[i].ToString());
57
+                }
58
+            }
59
+            else
60
+            {
61
+                MessageBox.Show("请选择处理等高线图层!", "警告");
62
+                return;
63
+            }
64
+            if (comboBox_dgj.Text == "")
65
+            {
66
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择等高距");
67
+                return;
68
+            }
69
+
70
+            DGXGeneralization.dgxlayerlist = eplayerlist;
71
+            DGXGeneralization.dgj = double.Parse(comboBox_dgj.Text);
72
+            DGXGeneralization.dgxGeneralization();
73
+            this.Close();
74
+        }
75
+    }
76
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneral.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 193
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DGXGeneralization.cs ファイルの表示

@@ -0,0 +1,193 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using System;
5
+using System.Collections;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    class DGXGeneralization
15
+    {
16
+        public static ArrayList dgxlayerlist;
17
+        public static double dgj;
18
+        public static bool openflag = true;
19
+        public static void dgxGeneralization()
20
+        {
21
+            Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
22
+            Database db = doc.Database;
23
+            DocumentLock docLock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
24
+            //try
25
+            //{
26
+                //LayerTable lt = null;
27
+                //ArrayList layerlist = new ArrayList();
28
+
29
+                ////获取图层事务
30
+                //using (Transaction tran = doc.TransactionManager.StartTransaction())
31
+                //{
32
+                //    lt = tran.GetObject(db.LayerTableId, OpenMode.ForRead) as LayerTable;
33
+                //    foreach (ObjectId layerid in lt)
34
+                //    {
35
+                //        LayerTableRecord ltrec = tran.GetObject(layerid, OpenMode.ForWrite) as LayerTableRecord;
36
+                //        layerlist.Add(ltrec.Name);
37
+                //    }
38
+                //    doc.Editor.WriteMessage("程序开始运行\r\n......\r\n");
39
+                //    tran.Commit();
40
+                //    tran.Dispose();
41
+
42
+                //}
43
+                
44
+
45
+
46
+                //DGXSBForm sf = new DGXSBForm(layerlist);
47
+                //if (sf.ShowDialog() == DialogResult.OK)
48
+                //{
49
+                //    dgxlayerlist = sf.DGXlayerlist;
50
+                //    dgj = sf.DGJ;
51
+                //    openflag = true;
52
+                //}
53
+                if (openflag)
54
+                {
55
+                    string dgx1 = string.Empty, dgx2 = string.Empty;
56
+                    if (dgxlayerlist.Count > 0)
57
+                    {
58
+                        if (dgxlayerlist.Count == 1)
59
+                        {
60
+                            dgx1 = dgxlayerlist[0].ToString();
61
+                        }
62
+                        if (dgxlayerlist.Count == 2)
63
+                        {
64
+                            dgx1 = dgxlayerlist[0].ToString();
65
+                            dgx2 = dgxlayerlist[1].ToString();
66
+                        }
67
+                    }
68
+
69
+                    using (Transaction tran = doc.TransactionManager.StartTransaction())
70
+                    {
71
+                        
72
+                        //// 以只读方式打开块表记录   Open the Block table record for read
73
+                        BlockTable acbt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
74
+                        //// 以写方式打开模型空间块表记录   Open the Block table record Model space for write
75
+                        BlockTableRecord acblr = tran.GetObject(acbt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
76
+
77
+                        //设置激活图层
78
+                        LayerTable layertable = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
79
+                        if (!layertable.Has("Delete"))
80
+                        {
81
+                            LayerTableRecord ltr = new LayerTableRecord();
82
+                            ltr.Name = "Delete";
83
+                            ObjectId layerid = layertable.Add(ltr);
84
+                            tran.AddNewlyCreatedDBObject(ltr, true);
85
+                            //db.Clayer = layerid;
86
+                        }
87
+                        if (!layertable.Has("8120"))
88
+                        {
89
+                            LayerTableRecord ltr = new LayerTableRecord();
90
+                            ltr.Name = "8120";
91
+                            ObjectId layerid = layertable.Add(ltr);
92
+                            tran.AddNewlyCreatedDBObject(ltr, true);
93
+                            //db.Clayer = layerid;
94
+                        }
95
+                        if (!layertable.Has("8110"))
96
+                        {
97
+                            LayerTableRecord ltr = new LayerTableRecord();
98
+                            ltr.Name = "8110";
99
+                            ObjectId layerid = layertable.Add(ltr);
100
+                            tran.AddNewlyCreatedDBObject(ltr, true);
101
+                            //db.Clayer = layerid;
102
+                        }
103
+                        tran.Commit();
104
+                        tran.Dispose();
105
+                        
106
+                    }
107
+                    PromptSelectionResult psr = doc.Editor.SelectAll();
108
+                    //doc.Editor.WriteMessage("请选择等高线!");
109
+                    //PromptSelectionResult psr = doc.Editor.GetSelection();
110
+                    if (psr.Status == PromptStatus.OK)
111
+                    {
112
+                        
113
+                        SelectionSet ss = psr.Value;
114
+                        foreach (ObjectId oid in ss.GetObjectIds())
115
+                        {
116
+                            using (Transaction tran = doc.TransactionManager.StartTransaction())
117
+                            {
118
+                                BlockTable acbt = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
119
+                                BlockTableRecord acbtr = tran.GetObject(acbt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
120
+
121
+                                Entity en = tran.GetObject(oid, OpenMode.ForWrite) as Entity;
122
+
123
+                                if ((en.Layer == dgx1) || (en.Layer == dgx2))
124
+                                {
125
+                                    Polyline pl = new Polyline();
126
+                                    Polyline2d pl2d = new Polyline2d();
127
+                                    double elevation = 99999999;
128
+                                    if (en is Polyline)
129
+                                    {
130
+                                        pl = en as Polyline;
131
+                                        elevation = pl.Elevation;
132
+                                    }
133
+                                    else if (en is Polyline2d)
134
+                                    {
135
+                                        pl2d = en as Polyline2d;
136
+                                        elevation = pl2d.Elevation;
137
+                                    }
138
+                                    if (elevation != 99999999)
139
+                                    {
140
+                                        elevation = Convert.ToDouble(elevation.ToString("f1"));
141
+                                        if (dgj != 0)
142
+                                        {
143
+                                            double remainder = elevation % dgj;
144
+                                            if (remainder != 0.0)
145
+                                            {
146
+                                                en.Layer = "Delete";
147
+                                                en.Color = GrxCAD.Colors.Color.FromColor(System.Drawing.Color.Red);
148
+                                            }
149
+                                            else
150
+                                            {
151
+                                                double remainder2 = elevation % (dgj * 5);
152
+                                                if (remainder2 == 0.0)
153
+                                                {
154
+                                                    en.Layer = "8120";
155
+                                                    en.Color = GrxCAD.Colors.Color.FromColor(System.Drawing.Color.Yellow);
156
+                                                }
157
+                                                else
158
+                                                {
159
+                                                    en.Layer = "8110";
160
+                                                    en.Color = GrxCAD.Colors.Color.FromColor(System.Drawing.Color.White);
161
+                                                }
162
+                                            }
163
+                                        }
164
+
165
+                                    }
166
+
167
+                                }
168
+                                else
169
+                                    continue;
170
+                                //                            
171
+                                tran.Commit();
172
+                                tran.Dispose();
173
+                            }
174
+                        }
175
+                        doc.Editor.WriteMessage("程序运行结束,谢谢使用");
176
+                        
177
+                    }
178
+
179
+
180
+                }
181
+                else
182
+                {
183
+                    doc.Editor.WriteMessage("请选择相关参数\r\n");
184
+                }
185
+            //}
186
+            //catch (GrxCAD.Runtime.Exception ex)
187
+            //{
188
+            //    doc.Editor.WriteMessage(ex.ToString());
189
+            //}
190
+                docLock.Dispose();
191
+        }
192
+    }
193
+}

+ 150
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeleteElept.Designer.cs ファイルの表示

@@ -0,0 +1,150 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class DeleteElept
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.comboBox_gcd = new System.Windows.Forms.ComboBox();
34
+            this.label2 = new System.Windows.Forms.Label();
35
+            this.checkedListBox_ly = new System.Windows.Forms.CheckedListBox();
36
+            this.button_ok = new System.Windows.Forms.Button();
37
+            this.button_cancel = new System.Windows.Forms.Button();
38
+            this.label3 = new System.Windows.Forms.Label();
39
+            this.comboBox_blc = new System.Windows.Forms.ComboBox();
40
+            this.SuspendLayout();
41
+            // 
42
+            // label1
43
+            // 
44
+            this.label1.AutoSize = true;
45
+            this.label1.Location = new System.Drawing.Point(54, 28);
46
+            this.label1.Name = "label1";
47
+            this.label1.Size = new System.Drawing.Size(127, 15);
48
+            this.label1.TabIndex = 0;
49
+            this.label1.Text = "高程点所在图层:";
50
+            // 
51
+            // comboBox_gcd
52
+            // 
53
+            this.comboBox_gcd.FormattingEnabled = true;
54
+            this.comboBox_gcd.Location = new System.Drawing.Point(180, 25);
55
+            this.comboBox_gcd.Name = "comboBox_gcd";
56
+            this.comboBox_gcd.Size = new System.Drawing.Size(222, 23);
57
+            this.comboBox_gcd.TabIndex = 1;
58
+            // 
59
+            // label2
60
+            // 
61
+            this.label2.AutoSize = true;
62
+            this.label2.Location = new System.Drawing.Point(16, 111);
63
+            this.label2.Name = "label2";
64
+            this.label2.Size = new System.Drawing.Size(202, 15);
65
+            this.label2.TabIndex = 2;
66
+            this.label2.Text = "需要删除内部高程点的图层:";
67
+            // 
68
+            // checkedListBox_ly
69
+            // 
70
+            this.checkedListBox_ly.FormattingEnabled = true;
71
+            this.checkedListBox_ly.Location = new System.Drawing.Point(91, 140);
72
+            this.checkedListBox_ly.Name = "checkedListBox_ly";
73
+            this.checkedListBox_ly.Size = new System.Drawing.Size(379, 184);
74
+            this.checkedListBox_ly.TabIndex = 3;
75
+            // 
76
+            // button_ok
77
+            // 
78
+            this.button_ok.Location = new System.Drawing.Point(133, 345);
79
+            this.button_ok.Name = "button_ok";
80
+            this.button_ok.Size = new System.Drawing.Size(75, 31);
81
+            this.button_ok.TabIndex = 4;
82
+            this.button_ok.Text = "确 定";
83
+            this.button_ok.UseVisualStyleBackColor = true;
84
+            this.button_ok.Click += new System.EventHandler(this.button_ok_Click);
85
+            // 
86
+            // button_cancel
87
+            // 
88
+            this.button_cancel.Location = new System.Drawing.Point(355, 345);
89
+            this.button_cancel.Name = "button_cancel";
90
+            this.button_cancel.Size = new System.Drawing.Size(75, 31);
91
+            this.button_cancel.TabIndex = 5;
92
+            this.button_cancel.Text = "取 消";
93
+            this.button_cancel.UseVisualStyleBackColor = true;
94
+            this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
95
+            // 
96
+            // label3
97
+            // 
98
+            this.label3.AutoSize = true;
99
+            this.label3.Location = new System.Drawing.Point(114, 66);
100
+            this.label3.Name = "label3";
101
+            this.label3.Size = new System.Drawing.Size(67, 15);
102
+            this.label3.TabIndex = 6;
103
+            this.label3.Text = "比例尺:";
104
+            // 
105
+            // comboBox_blc
106
+            // 
107
+            this.comboBox_blc.FormattingEnabled = true;
108
+            this.comboBox_blc.Items.AddRange(new object[] {
109
+            "1:500",
110
+            "1:1000",
111
+            "1:2000",
112
+            "1:5000"});
113
+            this.comboBox_blc.Location = new System.Drawing.Point(180, 63);
114
+            this.comboBox_blc.Name = "comboBox_blc";
115
+            this.comboBox_blc.Size = new System.Drawing.Size(222, 23);
116
+            this.comboBox_blc.TabIndex = 7;
117
+            // 
118
+            // DeleteElept
119
+            // 
120
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
121
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
122
+            this.ClientSize = new System.Drawing.Size(535, 388);
123
+            this.Controls.Add(this.comboBox_blc);
124
+            this.Controls.Add(this.label3);
125
+            this.Controls.Add(this.button_cancel);
126
+            this.Controls.Add(this.button_ok);
127
+            this.Controls.Add(this.checkedListBox_ly);
128
+            this.Controls.Add(this.label2);
129
+            this.Controls.Add(this.comboBox_gcd);
130
+            this.Controls.Add(this.label1);
131
+            this.Name = "DeleteElept";
132
+            this.Text = "删除内部高程点";
133
+            this.Load += new System.EventHandler(this.DeleteElept_Load);
134
+            this.ResumeLayout(false);
135
+            this.PerformLayout();
136
+
137
+        }
138
+
139
+        #endregion
140
+
141
+        private System.Windows.Forms.Label label1;
142
+        private System.Windows.Forms.ComboBox comboBox_gcd;
143
+        private System.Windows.Forms.Label label2;
144
+        private System.Windows.Forms.CheckedListBox checkedListBox_ly;
145
+        private System.Windows.Forms.Button button_ok;
146
+        private System.Windows.Forms.Button button_cancel;
147
+        private System.Windows.Forms.Label label3;
148
+        private System.Windows.Forms.ComboBox comboBox_blc;
149
+    }
150
+}

+ 93
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeleteElept.cs ファイルの表示

@@ -0,0 +1,93 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class DeleteElept : Form
15
+    {
16
+        public DeleteElept()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void DeleteElept_Load(object sender, EventArgs e)
22
+        {
23
+            this.comboBox_gcd.DropDownStyle = ComboBoxStyle.DropDownList;
24
+            this.comboBox_blc.DropDownStyle = ComboBoxStyle.DropDownList;
25
+
26
+            //自动填充下拉框
27
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
28
+            using (Transaction traction = database.TransactionManager.StartTransaction())
29
+            {
30
+                //存放所有图层名
31
+                List<string> alllayername = new List<string>();
32
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
33
+                foreach (ObjectId objid in layertable)
34
+                {
35
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
36
+                    alllayername.Add(layertablerecord.Name);
37
+                }
38
+
39
+                alllayername.Sort();
40
+
41
+                for (int i = 0; i < alllayername.Count; i++)
42
+                {
43
+                    this.comboBox_gcd.Items.Add(alllayername[i]);
44
+                    this.checkedListBox_ly.Items.Add(alllayername[i]);
45
+                }
46
+
47
+                if (alllayername.Contains("8300"))
48
+                {
49
+                    int index = alllayername.IndexOf("8300");
50
+                    this.comboBox_gcd.SelectedIndex = index;
51
+                }
52
+                traction.Commit();
53
+            }
54
+        }
55
+
56
+        private void button_ok_Click(object sender, EventArgs e)
57
+        {
58
+            if (comboBox_gcd.Text == "")
59
+            { 
60
+                MessageBox.Show("请选择高程点所在图层!");
61
+                return;
62
+            }
63
+            if (comboBox_blc.Text == "")
64
+            { 
65
+                MessageBox.Show("请选择比例尺!");
66
+                return;
67
+            }
68
+            if (checkedListBox_ly.CheckedItems.Count == 0)
69
+            {
70
+                MessageBox.Show("请至少选择一个图层!");
71
+                return;
72
+            }
73
+            DeletePts.gcdly = comboBox_gcd.Text;
74
+            string blctext = comboBox_blc.Text;
75
+            int blcindex = blctext.LastIndexOf(':');
76
+            string strblc = blctext.Substring(blcindex + 1);
77
+            DeletePts.blc = Convert.ToInt32(strblc);
78
+
79
+            for (int i = 0; i < checkedListBox_ly.CheckedItems.Count; i++)
80
+            {
81
+                DeletePts.delely.Add(checkedListBox_ly.CheckedItems[i].ToString());
82
+            }
83
+            DeletePts delept = new DeletePts();
84
+            delept.delept();
85
+            this.Close();
86
+        }
87
+
88
+        private void button_cancel_Click(object sender, EventArgs e)
89
+        {
90
+            this.Close();
91
+        }
92
+    }
93
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeleteElept.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 149
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DeletePts.cs ファイルの表示

@@ -0,0 +1,149 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+
11
+namespace HCTools
12
+{
13
+    class DeletePts
14
+    {
15
+        public static string gcdly;//高程点所在图层
16
+        public static List<string> delely = new List<string>();//需要删除的图层
17
+        public static int blc;//比例尺
18
+        public double radius;//半径
19
+
20
+        public void delept()
21
+        {
22
+            List<ObjectId> deleids = new List<ObjectId>();
23
+            if (blc == 500)
24
+            {
25
+                radius = 1.5;
26
+            }
27
+            else if (blc == 1000)
28
+            {
29
+                radius = 2.5;
30
+            }
31
+            else if (blc == 2000)
32
+            {
33
+                radius = 4;
34
+            }
35
+            else if (blc == 5000)
36
+            {
37
+                radius = 10.5;
38
+            }
39
+            //创建新图层
40
+            LayerControl layerscontrol = new LayerControl();
41
+            string layname = "已删除";
42
+            if (!layerscontrol.haslayername(layname))
43
+            {
44
+                colorgb col = new colorgb(255, 0, 255);
45
+                layerscontrol.creatlayer(layname, col);
46
+                layerscontrol.movelayertofront(layname);
47
+            }
48
+            else
49
+                layerscontrol.movelayertofront(layname);
50
+
51
+
52
+            for (int i = 0; i < delely.Count; i++)
53
+            {
54
+                List<ObjectId> temp = Idget(delely[i]);
55
+                for (int j = 0; j < temp.Count; j++)
56
+                {
57
+                    deleids.Add(temp[j]);
58
+                }
59
+            }
60
+            Database db = HostApplicationServices.WorkingDatabase;
61
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
62
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
63
+
64
+            TypedValue[] typedvalue = new TypedValue[]
65
+            {
66
+                new TypedValue((int)DxfCode.LayerName, gcdly),
67
+                new TypedValue((int)DxfCode.Start, "Insert")
68
+            };
69
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
70
+
71
+            for (int i = 0; i < deleids.Count; i++)
72
+            {
73
+                using (Transaction trans = db.TransactionManager.StartTransaction())
74
+                {
75
+                    Entity ent = (Entity)trans.GetObject(deleids[i], OpenMode.ForWrite);
76
+                    if (ent is Polyline)
77
+                    {
78
+                        Polyline pll = (Polyline)trans.GetObject(deleids[i], OpenMode.ForWrite);
79
+                        Point3dCollection ptcoll = new Point3dCollection();
80
+                        for (int j = 0; j < pll.NumberOfVertices; j++)
81
+                        {
82
+                            ptcoll.Add(pll.GetPoint3dAt(j));
83
+                        }
84
+                        PromptSelectionResult psr = editor.SelectCrossingPolygon(ptcoll, selectionfilter);
85
+
86
+                        if (psr.Status == PromptStatus.OK)
87
+                        {
88
+                            SelectionSet selectionset = psr.Value;
89
+                            ObjectId[] ids = selectionset.GetObjectIds();
90
+                            for (int j = 0; j < ids.Count(); j++)
91
+                            {
92
+                                BlockReference br = (BlockReference)trans.GetObject(ids[j], OpenMode.ForWrite);
93
+                                br.Layer = "已删除";
94
+                                Point3d p1 = new Point3d(br.Position.X - radius, br.Position.Y - radius, 0);
95
+                                Point3d p2 = new Point3d(br.Position.X + radius, br.Position.Y + radius, 0);
96
+
97
+                                TypedValue[] tpvl = new TypedValue[]
98
+                                {
99
+                                    new TypedValue((int)DxfCode.Start, "Text"),
100
+                                    new TypedValue((int)DxfCode.LayerName, gcdly)
101
+                                };
102
+
103
+                                SelectionFilter filter = new SelectionFilter(tpvl);
104
+                                PromptSelectionResult prosr = editor.SelectCrossingWindow(p1, p2, filter);
105
+
106
+                                if (prosr.Status == PromptStatus.OK)
107
+                                {
108
+                                    SelectionSet seleset = prosr.Value;
109
+                                    ObjectId[] selid = seleset.GetObjectIds();
110
+                                    for (int ii = 0; ii < selid.Count(); ii++)
111
+                                    {
112
+                                        DBText text = trans.GetObject(selid[ii], OpenMode.ForWrite) as DBText;
113
+                                        text.Layer = "已删除";
114
+                                    }
115
+                                }
116
+                            }
117
+                        }
118
+                        trans.Commit();
119
+                    }
120
+                }
121
+            }
122
+            editor.WriteMessage("删除完成\n");
123
+            doclock.Dispose();
124
+        }
125
+
126
+        private static List<ObjectId> Idget(string ly)
127
+        {
128
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
129
+            TypedValue[] typedvalue = new TypedValue[1];
130
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, ly), 0);
131
+
132
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
133
+            PromptSelectionResult psr = editor.SelectAll(selectionfilter);
134
+            SelectionSet selectionset = psr.Value;
135
+            ObjectId[] obj = new ObjectId[selectionset.Count];
136
+            List<ObjectId> ids = new List<ObjectId>();
137
+
138
+            if (psr.Status == PromptStatus.OK)
139
+            {
140
+                obj = selectionset.GetObjectIds();
141
+                for (int i = 0; i < obj.Length; i++)
142
+                {
143
+                    ids.Add(obj[i]);
144
+                }
145
+            }
146
+            return ids;
147
+        }
148
+    }
149
+}

+ 153
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnnck.cs ファイルの表示

@@ -0,0 +1,153 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+
11
+namespace HCTools
12
+{
13
+    class DgxAnnck
14
+    {
15
+        public static string ptlayer;
16
+        public static string tklayer;
17
+        public static double density;
18
+        public static int flag;
19
+
20
+        public void check()
21
+        {
22
+            ObjectId[] ids = TKget();
23
+
24
+            Database db = HostApplicationServices.WorkingDatabase;
25
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
26
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
27
+
28
+            TypedValue[] typedvalue = new TypedValue[1];
29
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, ptlayer), 0);
30
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
31
+
32
+            for (int i = 0; i < ids.Length; i++)
33
+            {
34
+                Entity current_entity = BasicFunction.GetDBObject(ids[i]);
35
+                ZoomToExtent(current_entity.GeometricExtents);
36
+                using (Transaction trans = db.TransactionManager.StartTransaction())
37
+                {
38
+                    Polyline pll = (Polyline)trans.GetObject(ids[i], OpenMode.ForWrite);
39
+                    Point3dCollection ptcoll = new Point3dCollection();
40
+                    for (int j = 0; j < pll.NumberOfVertices; j++)
41
+                    {
42
+                        ptcoll.Add(pll.GetPoint3dAt(j));
43
+                    }
44
+                    PromptSelectionResult psr = editor.SelectCrossingPolygon(ptcoll, selectionfilter);
45
+
46
+                    if (psr.Status == PromptStatus.OK)
47
+                    {
48
+                        SelectionSet selectionset = psr.Value;
49
+                        int ptnums = selectionset.Count;
50
+                        double den = ptnums / pll.Area;
51
+                        if (den < density && flag == 1)
52
+                        {
53
+                            LayerControl layerscontrol = new LayerControl();
54
+                            string layname = "小于密度";
55
+                            if (!layerscontrol.haslayername(layname))
56
+                            {
57
+                                colorgb col = new colorgb(0, 0, 255);
58
+                                layerscontrol.creatlayer(layname, col);
59
+                                pll.Layer = "小于密度";
60
+                            }
61
+                            else
62
+                                pll.Layer = "小于密度";
63
+                        }
64
+                        else if (den > density && flag == 2)
65
+                        {
66
+                            LayerControl layerscontrol = new LayerControl();
67
+                            string layname = "大于密度";
68
+                            if (!layerscontrol.haslayername(layname))
69
+                            {
70
+                                colorgb col = new colorgb(255, 0, 0);
71
+                                layerscontrol.creatlayer(layname, col);
72
+                                pll.Layer = "大于密度";
73
+                            }
74
+                            else
75
+                                pll.Layer = "大于密度";
76
+                        }
77
+                        else if (flag == 3)
78
+                        {
79
+                            if (den < density || den > density)
80
+                            {
81
+                                LayerControl layerscontrol = new LayerControl();
82
+                                string layname = "不等于密度";
83
+                                if (!layerscontrol.haslayername(layname))
84
+                                {
85
+                                    colorgb col = new colorgb(255, 255, 0);
86
+                                    layerscontrol.creatlayer(layname, col);
87
+                                    pll.Layer = "不等于密度";
88
+                                }
89
+                                else
90
+                                    pll.Layer = "不等于密度";
91
+                            }
92
+                        }
93
+                    }
94
+                    trans.Commit();
95
+                }
96
+            }
97
+            doclock.Dispose();
98
+        }
99
+
100
+        private static ObjectId[] TKget()
101
+        {
102
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
103
+            TypedValue[] typedvalue = new TypedValue[1];
104
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, tklayer), 0);
105
+
106
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
107
+            PromptSelectionResult psr = editor.SelectAll(selectionfilter);
108
+            SelectionSet selectionset = psr.Value;
109
+            ObjectId[] obj = new ObjectId[selectionset.Count];
110
+
111
+            if (psr.Status == PromptStatus.OK)
112
+            {
113
+                obj = selectionset.GetObjectIds();
114
+            }
115
+            return obj;
116
+        }
117
+
118
+        public static void ZoomToExtent(Extents3d extent)
119
+        {
120
+            try
121
+            {
122
+                Point3d pMin = extent.MinPoint;
123
+                Point3d pMax = extent.MaxPoint;
124
+                //获取当前文档及数据库
125
+                Document acDoc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
126
+                Database acCurDb = acDoc.Database;
127
+
128
+                // 启动事务
129
+                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
130
+                {
131
+                    using (ViewTableRecord acView = acDoc.Editor.GetCurrentView())
132
+                    {
133
+                        //设置视图的高
134
+                        acView.Height = Math.Abs(pMin.Y - pMax.Y);
135
+                        //设置视图的宽
136
+                        acView.Width = Math.Abs(pMin.X - pMax.X);
137
+                        // 设置视图中心
138
+                        acView.CenterPoint = new Point2d((pMin.X + pMax.X) / 2, (pMin.Y + pMax.Y) / 2);
139
+                        // 更新当前视图
140
+                        acDoc.Editor.SetCurrentView(acView);
141
+                    }
142
+                    // 提交更改
143
+                    acTrans.Commit();
144
+                }
145
+            }
146
+            catch (Exception)
147
+            {
148
+
149
+                throw;
150
+            }
151
+        }
152
+    }
153
+}

+ 170
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnno.Designer.cs ファイルの表示

@@ -0,0 +1,170 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class DgxAnno
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.checkBox_below = new System.Windows.Forms.CheckBox();
33
+            this.checkBox_upon = new System.Windows.Forms.CheckBox();
34
+            this.textBox_density = new System.Windows.Forms.TextBox();
35
+            this.label3 = new System.Windows.Forms.Label();
36
+            this.button_cancel = new System.Windows.Forms.Button();
37
+            this.button_ok = new System.Windows.Forms.Button();
38
+            this.comboBox_gw = new System.Windows.Forms.ComboBox();
39
+            this.comboBox_ptLayer = new System.Windows.Forms.ComboBox();
40
+            this.label2 = new System.Windows.Forms.Label();
41
+            this.label1 = new System.Windows.Forms.Label();
42
+            this.SuspendLayout();
43
+            // 
44
+            // checkBox_below
45
+            // 
46
+            this.checkBox_below.AutoSize = true;
47
+            this.checkBox_below.Location = new System.Drawing.Point(236, 135);
48
+            this.checkBox_below.Name = "checkBox_below";
49
+            this.checkBox_below.Size = new System.Drawing.Size(89, 19);
50
+            this.checkBox_below.TabIndex = 21;
51
+            this.checkBox_below.Text = "小于密度";
52
+            this.checkBox_below.UseVisualStyleBackColor = true;
53
+            // 
54
+            // checkBox_upon
55
+            // 
56
+            this.checkBox_upon.AutoSize = true;
57
+            this.checkBox_upon.Location = new System.Drawing.Point(346, 135);
58
+            this.checkBox_upon.Name = "checkBox_upon";
59
+            this.checkBox_upon.Size = new System.Drawing.Size(89, 19);
60
+            this.checkBox_upon.TabIndex = 20;
61
+            this.checkBox_upon.Text = "大于密度";
62
+            this.checkBox_upon.UseVisualStyleBackColor = true;
63
+            // 
64
+            // textBox_density
65
+            // 
66
+            this.textBox_density.Location = new System.Drawing.Point(104, 133);
67
+            this.textBox_density.Name = "textBox_density";
68
+            this.textBox_density.Size = new System.Drawing.Size(100, 25);
69
+            this.textBox_density.TabIndex = 19;
70
+            // 
71
+            // label3
72
+            // 
73
+            this.label3.AutoSize = true;
74
+            this.label3.Location = new System.Drawing.Point(46, 139);
75
+            this.label3.Name = "label3";
76
+            this.label3.Size = new System.Drawing.Size(52, 15);
77
+            this.label3.TabIndex = 18;
78
+            this.label3.Text = "密度:";
79
+            // 
80
+            // button_cancel
81
+            // 
82
+            this.button_cancel.Location = new System.Drawing.Point(290, 178);
83
+            this.button_cancel.Name = "button_cancel";
84
+            this.button_cancel.Size = new System.Drawing.Size(75, 29);
85
+            this.button_cancel.TabIndex = 17;
86
+            this.button_cancel.Text = "取 消";
87
+            this.button_cancel.UseVisualStyleBackColor = true;
88
+            this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
89
+            // 
90
+            // button_ok
91
+            // 
92
+            this.button_ok.Location = new System.Drawing.Point(100, 178);
93
+            this.button_ok.Name = "button_ok";
94
+            this.button_ok.Size = new System.Drawing.Size(75, 29);
95
+            this.button_ok.TabIndex = 16;
96
+            this.button_ok.Text = "确 定";
97
+            this.button_ok.UseVisualStyleBackColor = true;
98
+            this.button_ok.Click += new System.EventHandler(this.button_ok_Click);
99
+            // 
100
+            // comboBox_gw
101
+            // 
102
+            this.comboBox_gw.FormattingEnabled = true;
103
+            this.comboBox_gw.Location = new System.Drawing.Point(185, 83);
104
+            this.comboBox_gw.Name = "comboBox_gw";
105
+            this.comboBox_gw.Size = new System.Drawing.Size(197, 23);
106
+            this.comboBox_gw.TabIndex = 15;
107
+            // 
108
+            // comboBox_ptLayer
109
+            // 
110
+            this.comboBox_ptLayer.FormattingEnabled = true;
111
+            this.comboBox_ptLayer.Location = new System.Drawing.Point(185, 34);
112
+            this.comboBox_ptLayer.Name = "comboBox_ptLayer";
113
+            this.comboBox_ptLayer.Size = new System.Drawing.Size(197, 23);
114
+            this.comboBox_ptLayer.TabIndex = 14;
115
+            // 
116
+            // label2
117
+            // 
118
+            this.label2.AutoSize = true;
119
+            this.label2.Location = new System.Drawing.Point(67, 86);
120
+            this.label2.Name = "label2";
121
+            this.label2.Size = new System.Drawing.Size(112, 15);
122
+            this.label2.TabIndex = 13;
123
+            this.label2.Text = "格网所在图层:";
124
+            // 
125
+            // label1
126
+            // 
127
+            this.label1.AutoSize = true;
128
+            this.label1.Location = new System.Drawing.Point(22, 37);
129
+            this.label1.Name = "label1";
130
+            this.label1.Size = new System.Drawing.Size(157, 15);
131
+            this.label1.TabIndex = 12;
132
+            this.label1.Text = "等高线注记所在图层:";
133
+            // 
134
+            // DgxAnno
135
+            // 
136
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
137
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
138
+            this.ClientSize = new System.Drawing.Size(478, 232);
139
+            this.Controls.Add(this.checkBox_below);
140
+            this.Controls.Add(this.checkBox_upon);
141
+            this.Controls.Add(this.textBox_density);
142
+            this.Controls.Add(this.label3);
143
+            this.Controls.Add(this.button_cancel);
144
+            this.Controls.Add(this.button_ok);
145
+            this.Controls.Add(this.comboBox_gw);
146
+            this.Controls.Add(this.comboBox_ptLayer);
147
+            this.Controls.Add(this.label2);
148
+            this.Controls.Add(this.label1);
149
+            this.Name = "DgxAnno";
150
+            this.Text = "等高线高程注记密度检查";
151
+            this.Load += new System.EventHandler(this.DgxAnno_Load);
152
+            this.ResumeLayout(false);
153
+            this.PerformLayout();
154
+
155
+        }
156
+
157
+        #endregion
158
+
159
+        private System.Windows.Forms.CheckBox checkBox_below;
160
+        private System.Windows.Forms.CheckBox checkBox_upon;
161
+        private System.Windows.Forms.TextBox textBox_density;
162
+        private System.Windows.Forms.Label label3;
163
+        private System.Windows.Forms.Button button_cancel;
164
+        private System.Windows.Forms.Button button_ok;
165
+        private System.Windows.Forms.ComboBox comboBox_gw;
166
+        private System.Windows.Forms.ComboBox comboBox_ptLayer;
167
+        private System.Windows.Forms.Label label2;
168
+        private System.Windows.Forms.Label label1;
169
+    }
170
+}

+ 101
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnno.cs ファイルの表示

@@ -0,0 +1,101 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class DgxAnno : Form
15
+    {
16
+        public DgxAnno()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void DgxAnno_Load(object sender, EventArgs e)
22
+        {
23
+            this.comboBox_ptLayer.DropDownStyle = ComboBoxStyle.DropDownList;
24
+            this.comboBox_gw.DropDownStyle = ComboBoxStyle.DropDownList;
25
+
26
+            this.MaximizeBox = false;
27
+            this.StartPosition = FormStartPosition.CenterScreen;
28
+
29
+            //自动填充下拉框
30
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
31
+            using (Transaction traction = database.TransactionManager.StartTransaction())
32
+            {
33
+                //存放所有图层名
34
+                List<string> alllayername = new List<string>();
35
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
36
+                foreach (ObjectId objid in layertable)
37
+                {
38
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
39
+                    alllayername.Add(layertablerecord.Name);
40
+                }
41
+
42
+                alllayername.Sort();
43
+
44
+                for (int i = 0; i < alllayername.Count; i++)
45
+                {
46
+                    this.comboBox_ptLayer.Items.Add(alllayername[i]);
47
+                    this.comboBox_gw.Items.Add(alllayername[i]);
48
+                }
49
+
50
+                if (alllayername.Contains("8121"))
51
+                {
52
+                    int index = alllayername.IndexOf("8121");
53
+                    this.comboBox_ptLayer.SelectedIndex = index;
54
+                }
55
+                traction.Commit();
56
+            }
57
+        }
58
+
59
+        private void button_ok_Click(object sender, EventArgs e)
60
+        {
61
+            if (comboBox_ptLayer.Text == "")
62
+            {
63
+                MessageBox.Show("请选择等高线注记所在图层!");
64
+                return;
65
+            }
66
+            if (comboBox_gw.Text == "")
67
+            {
68
+                MessageBox.Show("请选择格网所在图层!");
69
+                return;
70
+            }
71
+            if (textBox_density.Text == "")
72
+            {
73
+                MessageBox.Show("请输入密度!");
74
+                return;
75
+            }
76
+            DgxAnnck.ptlayer = comboBox_ptLayer.Text;
77
+            DgxAnnck.tklayer = comboBox_gw.Text;
78
+            DgxAnnck.density = Convert.ToDouble(textBox_density.Text);
79
+            if (checkBox_below.Checked && !checkBox_upon.Checked)
80
+                DgxAnnck.flag = 1;
81
+            else if (!checkBox_below.Checked && checkBox_upon.Checked)
82
+                DgxAnnck.flag = 2;
83
+            else if (checkBox_below.Checked && checkBox_upon.Checked)
84
+                DgxAnnck.flag = 3;
85
+            else if (!checkBox_below.Checked && !checkBox_upon.Checked)
86
+            {
87
+                MessageBox.Show("请选择“大于密度”/“小于密度”!");
88
+                return;
89
+            }
90
+
91
+            DgxAnnck dgx = new DgxAnnck();
92
+            dgx.check();
93
+            this.Close();
94
+        }
95
+
96
+        private void button_cancel_Click(object sender, EventArgs e)
97
+        {
98
+            this.Close();
99
+        }
100
+    }
101
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/DgxAnno.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 97
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinterpl.Designer.cs ファイルの表示

@@ -0,0 +1,97 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class Dgxinterpl
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.textBox_dgj = new System.Windows.Forms.TextBox();
34
+            this.button_ok = new System.Windows.Forms.Button();
35
+            this.button_cancel = new System.Windows.Forms.Button();
36
+            this.SuspendLayout();
37
+            // 
38
+            // label1
39
+            // 
40
+            this.label1.AutoSize = true;
41
+            this.label1.Location = new System.Drawing.Point(55, 44);
42
+            this.label1.Name = "label1";
43
+            this.label1.Size = new System.Drawing.Size(67, 15);
44
+            this.label1.TabIndex = 0;
45
+            this.label1.Text = "等高距:";
46
+            // 
47
+            // textBox_dgj
48
+            // 
49
+            this.textBox_dgj.Location = new System.Drawing.Point(139, 41);
50
+            this.textBox_dgj.Name = "textBox_dgj";
51
+            this.textBox_dgj.Size = new System.Drawing.Size(157, 25);
52
+            this.textBox_dgj.TabIndex = 1;
53
+            // 
54
+            // button_ok
55
+            // 
56
+            this.button_ok.Location = new System.Drawing.Point(47, 84);
57
+            this.button_ok.Name = "button_ok";
58
+            this.button_ok.Size = new System.Drawing.Size(75, 34);
59
+            this.button_ok.TabIndex = 2;
60
+            this.button_ok.Text = "确 定";
61
+            this.button_ok.UseVisualStyleBackColor = true;
62
+            this.button_ok.Click += new System.EventHandler(this.button_ok_Click);
63
+            // 
64
+            // button_cancel
65
+            // 
66
+            this.button_cancel.Location = new System.Drawing.Point(256, 84);
67
+            this.button_cancel.Name = "button_cancel";
68
+            this.button_cancel.Size = new System.Drawing.Size(75, 34);
69
+            this.button_cancel.TabIndex = 3;
70
+            this.button_cancel.Text = "取 消";
71
+            this.button_cancel.UseVisualStyleBackColor = true;
72
+            this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
73
+            // 
74
+            // Dgxinterpl
75
+            // 
76
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
77
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
78
+            this.ClientSize = new System.Drawing.Size(375, 145);
79
+            this.Controls.Add(this.button_cancel);
80
+            this.Controls.Add(this.button_ok);
81
+            this.Controls.Add(this.textBox_dgj);
82
+            this.Controls.Add(this.label1);
83
+            this.Name = "Dgxinterpl";
84
+            this.Text = "Dgxinterpl";
85
+            this.ResumeLayout(false);
86
+            this.PerformLayout();
87
+
88
+        }
89
+
90
+        #endregion
91
+
92
+        private System.Windows.Forms.Label label1;
93
+        private System.Windows.Forms.TextBox textBox_dgj;
94
+        private System.Windows.Forms.Button button_ok;
95
+        private System.Windows.Forms.Button button_cancel;
96
+    }
97
+}

+ 38
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinterpl.cs ファイルの表示

@@ -0,0 +1,38 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+
11
+namespace HCTools
12
+{
13
+    public partial class Dgxinterpl : Form
14
+    {
15
+        public Dgxinterpl()
16
+        {
17
+            InitializeComponent();
18
+        }
19
+
20
+        private void button_ok_Click(object sender, EventArgs e)
21
+        {
22
+            if (textBox_dgj.Text == "")
23
+            {
24
+                MessageBox.Show("请输入等高距!");
25
+                return;
26
+            }
27
+            Dgxinters.dgj = Convert.ToInt32(textBox_dgj.Text);
28
+            Dgxinters dgxinter = new Dgxinters();
29
+            this.Close();
30
+            dgxinter.Interdgx();
31
+        }
32
+
33
+        private void button_cancel_Click(object sender, EventArgs e)
34
+        {
35
+            this.Close();
36
+        }
37
+    }
38
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinterpl.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 351
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Dgxinters.cs ファイルの表示

@@ -0,0 +1,351 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+
11
+namespace HCTools
12
+{
13
+    class Dgxinters
14
+    {
15
+        public struct Dgx_ct
16
+        {
17
+            public Polyline pll;
18
+            public double elevation;
19
+        }
20
+
21
+        public struct Angles
22
+        {
23
+            public double angle;
24
+            public int xh;
25
+        }
26
+
27
+        public static int dgj;
28
+        public void Interdgx()
29
+        {
30
+            Line jigl1 = Fzx();
31
+            Line jigl2 = Fzx();
32
+            List<Point3d> ptonline = new List<Point3d>();//两辅助拉线之间的线段上的点
33
+
34
+            Point3dCollection ptcoll = new Point3dCollection();
35
+            var plane = new Plane(Point3d.Origin, Vector3d.ZAxis);
36
+            ptcoll.Add(jigl1.StartPoint);
37
+            ptcoll.Add(jigl1.EndPoint);
38
+
39
+            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
40
+            TypedValue[] value = new TypedValue[]
41
+                {
42
+                new TypedValue((int)DxfCode.Start,"LWPOLYLINE"),
43
+                };//设置筛选条件
44
+            SelectionFilter filter = new SelectionFilter(value);
45
+            // 要求在图形区域中手动选择对象
46
+            PromptSelectionResult psr = ed.SelectFence(ptcoll, filter);
47
+
48
+            if (psr.Status == PromptStatus.OK)
49
+            {
50
+                SelectionSet ss = psr.Value;
51
+                ObjectIdCollection idcoll = new ObjectIdCollection(ss.GetObjectIds());
52
+                List<Dgx_ct> dgx_ct = new List<Dgx_ct>();
53
+                for (int i = 0; i < idcoll.Count; i++)
54
+                {
55
+                    Dgx_ct temp = getpll(idcoll[i]);
56
+                    dgx_ct.Add(temp);
57
+                }
58
+                dgx_ct.OrderByDescending(x => x.elevation);
59
+
60
+                for (int i = 0; i < dgx_ct.Count - 1; i++)
61
+                {
62
+                    Point3dCollection itsresult1 = new Point3dCollection();
63
+                    Point3dCollection itsresult2 = new Point3dCollection();
64
+                    dgx_ct[i].pll.IntersectWith(jigl1, Intersect.OnBothOperands, plane, itsresult1, IntPtr.Zero, IntPtr.Zero);
65
+                    dgx_ct[i].pll.IntersectWith(jigl2, Intersect.OnBothOperands, plane, itsresult2, IntPtr.Zero, IntPtr.Zero);
66
+                    Point3d start = itsresult1[0];
67
+                    Point3d end = itsresult2[0];
68
+                    List<Point3d> pts1 = GetPtsBetweenpts(dgx_ct[i].pll, start, end);
69
+
70
+                    itsresult1 = new Point3dCollection();
71
+                    itsresult2 = new Point3dCollection();
72
+                    dgx_ct[i + 1].pll.IntersectWith(jigl1, Intersect.OnBothOperands, plane, itsresult1, IntPtr.Zero, IntPtr.Zero);
73
+                    dgx_ct[i + 1].pll.IntersectWith(jigl2, Intersect.OnBothOperands, plane, itsresult2, IntPtr.Zero, IntPtr.Zero);
74
+                    Point3d start1 = itsresult1[0];
75
+                    Point3d end1 = itsresult2[0];
76
+                    List<Point3d> pts2 = GetPtsBetweenpts(dgx_ct[i + 1].pll, start1, end1);
77
+                    List<Point3d> linearinterpt = new List<Point3d>();
78
+
79
+                    double gcc = dgx_ct[i + 1].pll.Elevation - dgx_ct[i].pll.Elevation;
80
+                    for (int ii = 0; ii < gcc / dgj; ii++)
81
+                    {
82
+                        double targetgc = dgx_ct[i].pll.Elevation + dgj * (ii + 1);
83
+                        Interpolationpts(pts1, pts2, targetgc);
84
+                    }
85
+                }
86
+                ed.WriteMessage("\n等高线内插完成");
87
+            }
88
+        }
89
+
90
+
91
+        private static Line Fzx()
92
+        {
93
+            Document doc = Application.DocumentManager.MdiActiveDocument;
94
+            Line jigl = new Line();
95
+
96
+            ObjectId jigid = new ObjectId();
97
+            PromptPointResult pPtRes;
98
+            PromptPointOptions pPtOpts = new PromptPointOptions("");
99
+            pPtOpts.Message = "选择起点\n ";
100
+            pPtRes = doc.Editor.GetPoint(pPtOpts);
101
+            Point3d ptStart = pPtRes.Value;
102
+
103
+            if (pPtRes.Status == PromptStatus.OK)
104
+            {
105
+                LineJig lJig = new LineJig(ptStart);
106
+                PromptResult PR = doc.Editor.Drag(lJig);
107
+                if (PR.Status == PromptStatus.OK)
108
+                {
109
+                    jigid = BasicFunction.AddObj(doc, lJig.line_1);
110
+                    jigl = (Line)BasicFunction.GetDBObject(jigid);
111
+                }
112
+            }
113
+            return jigl;
114
+        }
115
+
116
+        private static Dgx_ct getpll(ObjectId id)
117
+        {
118
+            Dgx_ct dgx_ct = new Dgx_ct();
119
+            Polyline temp = (Polyline)BasicFunction.GetDBObject(id);
120
+            dgx_ct.pll = temp;
121
+            dgx_ct.elevation = Convert.ToDouble(temp.Elevation.ToString("0.00"));
122
+            return dgx_ct;
123
+        }
124
+
125
+        private static List<Point3d> GetPtsBetweenpts(Polyline pll, Point3d start, Point3d end)
126
+        {
127
+            List<Point3d> allvertex = new List<Point3d>();
128
+            List<Point3d> vertexbt = new List<Point3d>();
129
+            vertexbt.Add(start);
130
+            for (int i = 0; i < pll.NumberOfVertices; i++)
131
+            {
132
+                allvertex.Add(pll.GetPoint3dAt(i));
133
+            }
134
+            double dist1 = double.MaxValue;
135
+            int start_index = 0;
136
+            double dist2 = double.MaxValue;
137
+            int end_index = 0;
138
+            bool sort = false;
139
+            for (int i = 0; i < allvertex.Count; i++)
140
+            {
141
+                if (start.DistanceTo(allvertex[i]) < dist1)
142
+                {
143
+                    dist1 = start.DistanceTo(allvertex[i]);
144
+                    start_index = i;
145
+                }
146
+                if (end.DistanceTo(allvertex[i]) < dist2)
147
+                {
148
+                    dist2 = end.DistanceTo(allvertex[i]);
149
+                    end_index = i;
150
+                }
151
+            }
152
+            if (start_index > end_index)
153
+            {
154
+                int temp = start_index;
155
+                start_index = end_index;
156
+                end_index = temp;
157
+                sort = true;
158
+            }
159
+            for (int i = start_index; i < end_index + 1; i++)
160
+            {
161
+                if (!vertexbt.Contains(allvertex[i]))
162
+                {
163
+                    vertexbt.Add(allvertex[i]);
164
+                    if (i == end_index && !vertexbt.Contains(end))
165
+                        vertexbt.Add(end);
166
+                }
167
+            }
168
+            if (sort)
169
+                vertexbt.Reverse();
170
+            return vertexbt;
171
+        }
172
+
173
+        private static double CalculateAngles(Point3d pt1, Point3d pt2, Point3d pt3)
174
+        {
175
+            //计算角度
176
+            Vector3d vectorAB = pt1.GetVectorTo(pt2);
177
+            Vector3d vectorBC = pt2.GetVectorTo(pt3);
178
+
179
+            double dotProduct = vectorAB.DotProduct(vectorBC);
180
+
181
+            // 计算两个向量的长度  
182
+            double lengthAB = vectorAB.Length;
183
+            double lengthBC = vectorBC.Length;
184
+
185
+            double angleDegrees = new double();
186
+            // 防止除以零的错误  
187
+            if (lengthAB > 0 && lengthBC > 0)
188
+            {
189
+                // 计算两个向量之间夹角的余弦值  
190
+                double cosAngle = dotProduct / (lengthAB * lengthBC);
191
+
192
+                // 使用反余弦函数计算夹角(以弧度为单位)  
193
+                double angleRadians = Math.Acos(cosAngle);
194
+
195
+                // 将弧度转换为度  
196
+                angleDegrees = angleRadians * (180.0 / Math.PI);
197
+            }
198
+            return angleDegrees;
199
+        }
200
+
201
+        private static bool LineIntersect(double x1, double y1, double x2, double y2,
202
+                                          double x3, double y3, double x4, double y4)
203
+        {
204
+            double d1x = x2 - x1;
205
+            double d1y = y2 - y1;
206
+            double d2x = x4 - x3;
207
+            double d2y = y4 - y3;
208
+
209
+            // 计算点1和点2相对于线段CD的叉积  
210
+            double cp1 = d2x * (y1 - y3) - (x1 - x3) * d2y;
211
+            double cp2 = d2x * (y2 - y3) - (x2 - x3) * d2y;
212
+
213
+            // 如果点1和点2相对于线段CD的叉积符号相反,则它们跨立在CD的两侧  
214
+            if (cp1 * cp2 < 0)
215
+            {
216
+                // 计算点3和点4相对于线段AB的叉积  
217
+                double cp3 = d1x * (y3 - y1) - (x3 - x1) * d1y;
218
+                double cp4 = d1x * (y4 - y1) - (x4 - x1) * d1y;
219
+
220
+                // 如果点3和点4相对于线段AB的叉积符号也相反,则它们跨立在AB的两侧  
221
+                if (cp3 * cp4 < 0)
222
+                {
223
+                    // 根据跨立实验,如果以上条件都满足,则线段一定相交  
224
+                    return true;
225
+                }
226
+            }
227
+            // 线段不相交  
228
+            return false;
229
+        }
230
+
231
+        private static Point3d Interpolation(Point3d p1, Point3d p2, double targetZ)
232
+        {
233
+            double t = (targetZ - p1.Z) / dgj;
234
+            double x = p1.X + t * (p2.X - p1.X);
235
+            double y = p1.Y + t * (p2.Y - p1.Y);
236
+            return new Point3d(x, y, targetZ);
237
+        }
238
+
239
+        public static void Interpolationpts(List<Point3d> pts1, List<Point3d> pts2, double targetgc)
240
+        {
241
+            Point3d pt1 = pts1[0];
242
+            Point3d pt2 = pts2[0];
243
+            List<Point3d> itspt = new List<Point3d>();
244
+            int index1 = 0;
245
+            int index2 = 0;
246
+            List<Point3d> interplpts = new List<Point3d>();
247
+            for (int i = 0; i < pts1.Count; i++)
248
+            {
249
+                List<Angles> angle1 = new List<Angles>();//等高线1上的点
250
+                List<Angles> angle2 = new List<Angles>();//等高线2上的点
251
+                List<int> errindex1 = new List<int>();
252
+                List<int> errindex2 = new List<int>();
253
+                bool flag = false;
254
+
255
+                for (int j = i; j < pts1.Count - 1; j++)
256
+                {
257
+                    if (errindex1.Contains(j))
258
+                        continue;
259
+                    else
260
+                    {
261
+                        double angle = CalculateAngles(pt1, pts1[j + 1], pt2);
262
+                        Angles temp = new Angles();
263
+                        temp.angle = angle;
264
+                        temp.xh = j;
265
+                        angle1.Add(temp);
266
+                    }
267
+                }
268
+                for (int j = i; j < pts2.Count - 1; j++)
269
+                {
270
+                    if (errindex2.Contains(j))
271
+                        continue;
272
+                    else
273
+                    {
274
+                        double angle = CalculateAngles(pt1, pts2[j + 1], pt2);
275
+                        Angles temp = new Angles();
276
+                        temp.angle = angle;
277
+                        temp.xh = j;
278
+                        angle2.Add(temp);
279
+                    }
280
+                }
281
+                angle1.OrderByDescending(x => x.angle);
282
+                angle2.OrderByDescending(x => x.angle);
283
+                while (flag)
284
+                {
285
+                    double px = pts1[angle1[0].xh].X;
286
+                    double py = pts1[angle1[0].xh].Y;
287
+                    double qx = pts1[angle2[0].xh].X;
288
+                    double qy = pts1[angle2[0].xh].Y;
289
+                    double dx1 = pt1.X - px;
290
+                    double dy1 = pt1.Y - py;
291
+                    double dx2 = pt2.X - qx;
292
+                    double dy2 = pt2.Y - qy;
293
+                    bool interck1 = LineIntersect(pt1.X, pt1.Y, pts1[index1].X, pts1[index1].Y, pt2.X, pt2.Y, px, py);
294
+                    bool interck2 = LineIntersect(pt1.X, pt1.Y, px, py, pt2.X, pt2.Y, pts2[index2].X, pts2[index2].Y);
295
+                    bool interck3 = LineIntersect(pt1.X, pt1.Y, qx, qy, pt2.X, pt2.Y, pts2[index2].X, pts2[index2].Y);
296
+                    bool interck4 = LineIntersect(pt1.X, pt1.Y, pts1[index1].X, pts1[index1].Y, pt2.X, pt2.Y, qx, qy);
297
+                    if (interck1 & interck2)
298
+                    {
299
+                        if (interck3 & interck4)
300
+                        {
301
+                            if (angle1[0].angle > angle2[0].angle)
302
+                            {
303
+                                for (int ii = index1 + 1; ii < angle1[0].xh; ii++)
304
+                                {
305
+                                    Point3d pt = Interpolation(pt2, pts1[ii], targetgc);
306
+                                    itspt.Add(pt);
307
+                                    if(ii)
308
+                                    pt1 = pts1[ii];
309
+                                }
310
+                                flag = true;
311
+                            }
312
+                            else
313
+                            {
314
+                                
315
+                            }
316
+                        }
317
+                        else
318
+                        {
319
+                            angle2.RemoveAt(0);
320
+                            continue;
321
+                        }
322
+                    }
323
+                    else
324
+                    {
325
+                        angle1.RemoveAt(0);
326
+                        continue;
327
+                    }
328
+                }
329
+            }
330
+
331
+            Database db = HostApplicationServices.WorkingDatabase;
332
+            Document doc = Application.DocumentManager.MdiActiveDocument;
333
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
334
+            using (Transaction trans = db.TransactionManager.StartTransaction())
335
+            {
336
+                BlockTable blocktable = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
337
+                BlockTableRecord blctablerecord = trans.GetObject(blocktable[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
338
+
339
+                Polyline pll = new Polyline();
340
+                for (int i = 0; i < itspt.Count; i++)
341
+                {
342
+                    pll.AddVertexAt(i, new Point2d(itspt[i].X, itspt[i].Y), 0, 0, 0);
343
+                }
344
+                blctablerecord.AppendEntity(pll);
345
+                trans.AddNewlyCreatedDBObject(pll, true);
346
+                trans.Commit();
347
+            }
348
+            doclock.Dispose();
349
+        }
350
+    }
351
+}

+ 288
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/ElePtCheck.cs ファイルの表示

@@ -0,0 +1,288 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using GrxCAD.ApplicationServices;
8
+using GrxCAD.DatabaseServices;
9
+using GrxCAD.EditorInput;
10
+using System.Collections;
11
+using GrxCAD.Geometry;
12
+
13
+namespace HCTools
14
+{
15
+    public struct points
16
+    {
17
+        public Point3d pt;
18
+        public ObjectId objID;
19
+    }
20
+
21
+    class ElePtCheck
22
+    {
23
+        public static int blc;//比例尺
24
+        public static string EleLayerName;//高程点图层名
25
+
26
+        public double radius;//半径
27
+        //public double length;//搜索半径
28
+
29
+        int j = 0;//记录错误点个数
30
+
31
+        //存放所有高程点数组
32
+        public List<points> pointarrlist = new List<points>();
33
+        //存放有问题的高程点数组
34
+        public List<points> errorpointarrlist = new List<points>();
35
+
36
+
37
+
38
+        /// <summary>
39
+        /// 检查错误的高程点并画圆标记
40
+        /// </summary>
41
+        public void pointcheck()
42
+        {
43
+            double flagradius = 4.0 * blc / 1000;//画圆标记半径
44
+
45
+            if (blc == 500)
46
+            {
47
+                radius = 1.5;
48
+            }
49
+            else if (blc == 1000)
50
+            {
51
+                radius = 2.5;
52
+            }
53
+            else if (blc == 2000)
54
+            {
55
+                radius = 4;
56
+            }
57
+            else if (blc == 5000)
58
+            {
59
+                radius = 10.5;
60
+            }
61
+            //外切圆半径
62
+            //length = radius * Math.Pow(2, 0.5);
63
+
64
+
65
+            //检查高程点与注记是否一致或为零
66
+            check();
67
+
68
+            //创建存放错误点的图层
69
+            LayerControl layerscontrol = new LayerControl();
70
+            string layname = "错误高程点";
71
+            if (!layerscontrol.haslayername(layname))
72
+            {
73
+                colorgb col = new colorgb(255, 0, 255);
74
+                layerscontrol.creatlayer(layname, col);
75
+                layerscontrol.movelayertofront(layname);
76
+            }
77
+            else
78
+                layerscontrol.movelayertofront(layname);
79
+
80
+            //创建错误点标记的图层
81
+            LayerControl layerscontrol1 = new LayerControl();
82
+            string layname1 = "错误高程点标记";
83
+            if (!layerscontrol1.haslayername(layname1))
84
+            {
85
+                colorgb col = new colorgb(0, 225, 255);
86
+                layerscontrol1.creatlayer(layname1, col);
87
+                layerscontrol1.movelayertofront(layname1);
88
+            }
89
+            else
90
+                layerscontrol1.movelayertofront(layname1);
91
+
92
+            Database database = HostApplicationServices.WorkingDatabase;
93
+            Document doc = Application.DocumentManager.MdiActiveDocument;
94
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
95
+            using (Transaction traction = database.TransactionManager.StartTransaction())
96
+            {
97
+                DocumentLock documentlock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
98
+                BlockTable blocktable = traction.GetObject(database.BlockTableId,OpenMode.ForWrite) as BlockTable;
99
+                
100
+                for (int i = 0; i < errorpointarrlist.Count; i++)
101
+                {
102
+                    BasicFunction functions = new BasicFunction();
103
+                    BlockReference blr= traction.GetObject(errorpointarrlist[i].objID,OpenMode.ForWrite)as BlockReference;
104
+                    blr.Layer = "错误高程点";
105
+                    functions.makeflag(errorpointarrlist[i].pt.X, errorpointarrlist[i].pt.Y, 0, flagradius, "错误高程点标记");
106
+
107
+                    Point3d p1 = new Point3d(errorpointarrlist[i].pt.X - radius, errorpointarrlist[i].pt.Y - radius, 0);
108
+                    Point3d p2 = new Point3d(errorpointarrlist[i].pt.X + radius, errorpointarrlist[i].pt.Y + radius, 0);
109
+                    TypedValue[] typedvalue = new TypedValue[2];
110
+
111
+                    typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "Text"), 0);
112
+                    typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, EleLayerName), 1);
113
+
114
+                    SelectionFilter filter = new SelectionFilter(typedvalue);
115
+                    PromptSelectionResult psr = editor.SelectCrossingWindow(p1, p2, filter);
116
+
117
+                    if (psr.Status == PromptStatus.OK)
118
+                    {
119
+                        SelectionSet set = psr.Value;
120
+                        ObjectId[] objs = new ObjectId[set.Count];
121
+                        objs = set.GetObjectIds();
122
+                        for (int ii = 0; ii < objs.Length; ii++)
123
+                        {
124
+                            DBText Text = (DBText)traction.GetObject(objs[ii], OpenMode.ForWrite);
125
+                            Text.Layer = "错误高程点";
126
+                        }
127
+                    }
128
+                }
129
+
130
+                traction.Commit();
131
+                documentlock.Dispose();
132
+                traction.Dispose();
133
+            }
134
+
135
+            editor.WriteMessage("\n共有" + j + "处错误");
136
+        }
137
+
138
+        /// <summary>
139
+        /// 检查高程点与注记是否一致或为零
140
+        /// </summary>
141
+        private void check()
142
+        {
143
+            string LayerName = EleLayerName;
144
+            getptInLayer(LayerName);
145
+
146
+            if (pointarrlist == null)
147
+                return;
148
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
149
+            for (int i = 0; i < pointarrlist.Count; i++)
150
+            {
151
+                Point3d pt = pointarrlist[i].pt;
152
+                string getword = GetTxt(pt, LayerName);
153
+                if (pt.Z == 0)
154
+                {
155
+                    errorpointarrlist.Add(pointarrlist[i]);
156
+                    j++;
157
+                }
158
+                else if (!getword.Contains('.') || getword.Contains(".0"))
159
+                {
160
+                    errorpointarrlist.Add(pointarrlist[i]);
161
+                    j++;
162
+                }
163
+                else
164
+                {
165
+                    if (pt.Z.ToString("f1") == getword && pt.Z % (blc / 1000) != 0)
166
+                    {
167
+                        continue;
168
+                    }
169
+                    else
170
+                    {
171
+                        errorpointarrlist.Add(pointarrlist[i]);
172
+                        j++;
173
+                    }
174
+                }
175
+            }
176
+        }
177
+
178
+
179
+        /// <summary>
180
+        /// 获取图层上高程点坐标
181
+        /// </summary>
182
+        private void getptInLayer(string LayerName)
183
+        {
184
+            Document document = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
185
+            Database db = HostApplicationServices.WorkingDatabase;
186
+            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
187
+            
188
+            TypedValue[] value = new TypedValue[]
189
+            {
190
+                new TypedValue((int)DxfCode.LayerName,LayerName),
191
+                new TypedValue((int)DxfCode.Start,"Insert")
192
+            };//设置筛选条件
193
+            SelectionFilter filter = new SelectionFilter(value);
194
+
195
+            //选择区域中全部对象
196
+            //PromptSelectionResult psr = ed.SelectAll(filter);
197
+            // 要求在图形区域中手动选择对象
198
+            PromptSelectionResult psr = ed.GetSelection(filter);
199
+
200
+
201
+            if (psr.Status == PromptStatus.OK)
202
+            {
203
+                using (Transaction transaction = db.TransactionManager.StartTransaction())
204
+                {
205
+                    SelectionSet ss = psr.Value;
206
+                    ObjectId[] ids = ss.GetObjectIds();
207
+
208
+                    points ptlist = new points();
209
+                    foreach (ObjectId etId in ids)
210
+                    {
211
+                        BlockReference blr = transaction.GetObject(etId, OpenMode.ForRead) as BlockReference;
212
+                        ptlist.pt = blr.Position;
213
+                        ptlist.objID = blr.Id;
214
+                        pointarrlist.Add(ptlist);
215
+                    }
216
+
217
+                    transaction.Commit();
218
+                }
219
+            }
220
+        }
221
+
222
+        /// <summary>
223
+        /// 筛选坐标点附近文字信息
224
+        /// </summary>
225
+        private static String GetTxt(Point3d pt, string LayerName)
226
+        {
227
+            ObjectId[] objss = null;//文本对象的ID数组
228
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
229
+
230
+            TypedValue[] val = new TypedValue[] 
231
+            { new TypedValue(0, "TEXT"),
232
+              new TypedValue((int)DxfCode.LayerName,LayerName)
233
+            };//需要筛选的类型值
234
+            SelectionFilter fil = new SelectionFilter(val);//选择过滤器
235
+            PromptSelectionResult pro = ed.SelectCrossingWindow(new Point3d(pt.X - 4.0 * blc / 2000, pt.Y - 4.0 * blc / 2000, 0),
236
+                new Point3d(pt.X + 4.0 * blc / 2000, pt.Y + 4.0 * blc / 2000, 0), fil);
237
+            //PromptSelectionResult pro = ed.SelectAll(fil);//获取结果
238
+            SelectionSet ss = pro.Value;//赋值给选择集
239
+            String txt = null;
240
+
241
+            if (ss != null)
242
+            {
243
+                objss = ss.GetObjectIds();//将选择集内对象ID赋值给ID数组
244
+                if (objss.Length > 1)
245
+                {
246
+                    for (int i = 0; i < objss.Length; i++)
247
+                    {
248
+                        DBText buftext = GetDBObject(objss[i]) as DBText;
249
+                        if (pt.Z.ToString("f1") == buftext.TextString)
250
+                            txt = buftext.TextString;
251
+                    }
252
+                }
253
+                else
254
+                {
255
+                    DBText buftext = GetDBObject(objss[0]) as DBText;
256
+                    txt = buftext.TextString;
257
+                }
258
+            }
259
+            //for (int i = 0; i < objss.Length; i++)
260
+            //{
261
+            //    DBText buftext = GetDBObject(objss[i]) as DBText;//遍历数组ID将对象赋值给单行文本
262
+            //    Point3d po = buftext.Position;//获取单行文本的坐标点
263
+            //    if (Math.Sqrt((po.X - x) * (po.X - x) + (po.Y - y) * (po.Y - y)) < 10)
264
+            //    {
265
+            //        txt = buftext.TextString;//筛选出的单行文本对象
266
+            //    }
267
+            //    else
268
+            //        continue;
269
+            //}
270
+            return txt;
271
+        }
272
+
273
+        private static Entity GetDBObject(ObjectId i)
274
+        {
275
+            Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
276
+            Database db = doc.Database;
277
+            Entity ent = null;
278
+            using (Transaction tr = db.TransactionManager.StartTransaction())
279
+            {
280
+                ent = (Entity)tr.GetObject(i, OpenMode.ForRead, true);
281
+                tr.Commit();
282
+            }
283
+            return ent;
284
+        }
285
+
286
+        }
287
+    }
288
+

+ 124
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRd.Designer.cs ファイルの表示

@@ -0,0 +1,124 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class EleRd
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.comboBox_sqx = new System.Windows.Forms.ComboBox();
33
+            this.label1 = new System.Windows.Forms.Label();
34
+            this.comboBox_jqx = new System.Windows.Forms.ComboBox();
35
+            this.label2 = new System.Windows.Forms.Label();
36
+            this.btn_Cancel = new System.Windows.Forms.Button();
37
+            this.btn_OK = new System.Windows.Forms.Button();
38
+            this.SuspendLayout();
39
+            // 
40
+            // comboBox_sqx
41
+            // 
42
+            this.comboBox_sqx.FormattingEnabled = true;
43
+            this.comboBox_sqx.Location = new System.Drawing.Point(155, 80);
44
+            this.comboBox_sqx.Name = "comboBox_sqx";
45
+            this.comboBox_sqx.Size = new System.Drawing.Size(160, 23);
46
+            this.comboBox_sqx.TabIndex = 67;
47
+            // 
48
+            // label1
49
+            // 
50
+            this.label1.AutoSize = true;
51
+            this.label1.Location = new System.Drawing.Point(52, 83);
52
+            this.label1.Name = "label1";
53
+            this.label1.Size = new System.Drawing.Size(97, 15);
54
+            this.label1.TabIndex = 66;
55
+            this.label1.Text = "首曲线图层:";
56
+            // 
57
+            // comboBox_jqx
58
+            // 
59
+            this.comboBox_jqx.FormattingEnabled = true;
60
+            this.comboBox_jqx.Location = new System.Drawing.Point(155, 34);
61
+            this.comboBox_jqx.Name = "comboBox_jqx";
62
+            this.comboBox_jqx.Size = new System.Drawing.Size(160, 23);
63
+            this.comboBox_jqx.TabIndex = 65;
64
+            // 
65
+            // label2
66
+            // 
67
+            this.label2.AutoSize = true;
68
+            this.label2.Location = new System.Drawing.Point(52, 37);
69
+            this.label2.Name = "label2";
70
+            this.label2.Size = new System.Drawing.Size(97, 15);
71
+            this.label2.TabIndex = 64;
72
+            this.label2.Text = "计曲线图层:";
73
+            // 
74
+            // btn_Cancel
75
+            // 
76
+            this.btn_Cancel.Location = new System.Drawing.Point(215, 124);
77
+            this.btn_Cancel.Margin = new System.Windows.Forms.Padding(4);
78
+            this.btn_Cancel.Name = "btn_Cancel";
79
+            this.btn_Cancel.Size = new System.Drawing.Size(100, 29);
80
+            this.btn_Cancel.TabIndex = 63;
81
+            this.btn_Cancel.Text = "取 消";
82
+            this.btn_Cancel.UseVisualStyleBackColor = true;
83
+            this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
84
+            // 
85
+            // btn_OK
86
+            // 
87
+            this.btn_OK.Location = new System.Drawing.Point(52, 124);
88
+            this.btn_OK.Margin = new System.Windows.Forms.Padding(4);
89
+            this.btn_OK.Name = "btn_OK";
90
+            this.btn_OK.Size = new System.Drawing.Size(100, 29);
91
+            this.btn_OK.TabIndex = 62;
92
+            this.btn_OK.Text = "确 定";
93
+            this.btn_OK.UseVisualStyleBackColor = true;
94
+            this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
95
+            // 
96
+            // EleRd
97
+            // 
98
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
99
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
100
+            this.ClientSize = new System.Drawing.Size(380, 184);
101
+            this.Controls.Add(this.comboBox_sqx);
102
+            this.Controls.Add(this.label1);
103
+            this.Controls.Add(this.comboBox_jqx);
104
+            this.Controls.Add(this.label2);
105
+            this.Controls.Add(this.btn_Cancel);
106
+            this.Controls.Add(this.btn_OK);
107
+            this.Name = "EleRd";
108
+            this.Text = "等高线高程取整";
109
+            this.Load += new System.EventHandler(this.EleRd_Load);
110
+            this.ResumeLayout(false);
111
+            this.PerformLayout();
112
+
113
+        }
114
+
115
+        #endregion
116
+
117
+        private System.Windows.Forms.ComboBox comboBox_sqx;
118
+        private System.Windows.Forms.Label label1;
119
+        private System.Windows.Forms.ComboBox comboBox_jqx;
120
+        private System.Windows.Forms.Label label2;
121
+        private System.Windows.Forms.Button btn_Cancel;
122
+        private System.Windows.Forms.Button btn_OK;
123
+    }
124
+}

+ 85
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRd.cs ファイルの表示

@@ -0,0 +1,85 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class EleRd : Form
15
+    {
16
+        public EleRd()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void EleRd_Load(object sender, EventArgs e)
22
+        {
23
+            this.comboBox_jqx.DropDownStyle = ComboBoxStyle.DropDownList;
24
+            this.comboBox_sqx.DropDownStyle = ComboBoxStyle.DropDownList;
25
+
26
+            //自动填充下拉框
27
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
28
+            using (Transaction traction = database.TransactionManager.StartTransaction())
29
+            {
30
+                //存放所有图层名
31
+                List<string> alllayername = new List<string>();
32
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
33
+                foreach (ObjectId objid in layertable)
34
+                {
35
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
36
+                    alllayername.Add(layertablerecord.Name);
37
+                }
38
+
39
+                alllayername.Sort();
40
+
41
+                for (int i = 0; i < alllayername.Count; i++)
42
+                {
43
+                    this.comboBox_jqx.Items.Add(alllayername[i]);
44
+                    this.comboBox_sqx.Items.Add(alllayername[i]);
45
+                }
46
+
47
+                if (alllayername.Contains("8110"))
48
+                {
49
+                    int index = alllayername.IndexOf("8110");
50
+                    this.comboBox_sqx.SelectedIndex = index;
51
+                }
52
+                if (alllayername.Contains("8120"))
53
+                {
54
+                    int index = alllayername.IndexOf("8120");
55
+                    this.comboBox_jqx.SelectedIndex = index;
56
+                }
57
+                traction.Commit();
58
+            }
59
+        }
60
+
61
+        private void btn_OK_Click(object sender, EventArgs e)
62
+        {
63
+            if (comboBox_sqx.Text == "")
64
+            {
65
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择首曲线");
66
+                return;
67
+            }
68
+            if (comboBox_sqx.Text == "")
69
+            {
70
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择计曲线");
71
+                return;
72
+            }
73
+            EleRound.jqx = comboBox_jqx.Text;
74
+            EleRound.sqx = comboBox_sqx.Text;
75
+            this.Close();
76
+            EleRound elerd = new EleRound();
77
+            elerd.eleround();
78
+        }
79
+
80
+        private void btn_Cancel_Click(object sender, EventArgs e)
81
+        {
82
+            this.Close();
83
+        }
84
+    }
85
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRd.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 71
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleRound.cs ファイルの表示

@@ -0,0 +1,71 @@
1
+using GrxCAD.DatabaseServices;
2
+using GrxCAD.Geometry;
3
+using GrxCAD.ApplicationServices;
4
+using GrxCAD.EditorInput;
5
+using System.Windows.Forms;
6
+
7
+using System;
8
+using System.Collections.Generic;
9
+using System.Linq;
10
+using System.Text;
11
+using System.Threading.Tasks;
12
+
13
+namespace HCTools
14
+{
15
+    class EleRound
16
+    {
17
+        public static string jqx;
18
+        public static string sqx;
19
+        public void eleround()
20
+        {
21
+            Database db = HostApplicationServices.WorkingDatabase;
22
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
23
+
24
+            string lyrname = jqx + "," + sqx;
25
+            //选择要取整等高线
26
+            TypedValue[] value = new TypedValue[]
27
+            {
28
+                new TypedValue((int)DxfCode.LayerName,lyrname),
29
+                new TypedValue((int)DxfCode.Start,"LWPOLYLINE")
30
+            };//设置筛选条件
31
+            SelectionFilter filter = new SelectionFilter(value);//选择区域中全部对象
32
+            //PromptSelectionResult psr = ed.SelectAll(filter);// 要求在图形区域中手动选择对象
33
+            PromptSelectionResult psr = ed.GetSelection(filter);
34
+
35
+            if (psr.Status == PromptStatus.OK)
36
+            {
37
+                int elelines = 0;
38
+                SelectionSet ss = psr.Value;
39
+                if (ss == null)
40
+                    return;
41
+                ObjectIdCollection idcoll1 = new ObjectIdCollection(ss.GetObjectIds());
42
+                for (int i = 0; i < idcoll1.Count; i++)
43
+                {
44
+                    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
45
+                    using (Transaction trans = db.TransactionManager.StartTransaction())
46
+                    {
47
+                        BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
48
+                        BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
49
+                        Polyline pll = (Polyline)idcoll1[i].GetObject(OpenMode.ForWrite);
50
+                        if ((Math.Round(pll.Elevation, 4, MidpointRounding.AwayFromZero) != Math.Truncate((Math.Round(pll.Elevation, 4, MidpointRounding.AwayFromZero)))))
51
+                        {
52
+                            LayerControl layerscontrol = new LayerControl();
53
+                            string layname = "已修改";
54
+                            if (layerscontrol.haslayername(layname) == false)
55
+                            {
56
+                                colorgb col = new colorgb(255, 0, 0);
57
+                                layerscontrol.creatlayer(layname, col);
58
+                            }
59
+                            pll.Elevation = Math.Round(pll.Elevation, 0, MidpointRounding.AwayFromZero);
60
+                            pll.Layer = "已修改";
61
+                            elelines++;
62
+                        }
63
+                        trans.Commit();
64
+                    }
65
+                    doclock.Dispose();
66
+                }
67
+                ed.WriteMessage("\n" + "已修改" + elelines.ToString() + "条高程非整数等高线");
68
+            }
69
+        }
70
+    }
71
+}

+ 156
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDenck.cs ファイルの表示

@@ -0,0 +1,156 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+
11
+namespace HCTools
12
+{
13
+    class EleptDenck
14
+    {
15
+        public static string ptlayer;
16
+        public static string tklayer;
17
+        public static double density;
18
+        public static int flag;
19
+        public void Ptdensity()
20
+        {
21
+            ObjectId[] ids = TKget();
22
+
23
+            Database db = HostApplicationServices.WorkingDatabase;
24
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
25
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
26
+
27
+            TypedValue[] typedvalue = new TypedValue[2];
28
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, ptlayer), 0);
29
+            typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "Insert"), 1);
30
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
31
+
32
+            for (int i = 0; i < ids.Length; i++)
33
+            {
34
+                Entity current_entity = BasicFunction.GetDBObject(ids[i]);
35
+                ZoomToExtent(current_entity.GeometricExtents);
36
+                using (Transaction trans = db.TransactionManager.StartTransaction())
37
+                {
38
+                    Polyline pll = (Polyline)trans.GetObject(ids[i], OpenMode.ForWrite);
39
+                    Point3dCollection ptcoll = new Point3dCollection();
40
+                    for (int j = 0; j < pll.NumberOfVertices; j++)
41
+                    {
42
+                        ptcoll.Add(pll.GetPoint3dAt(j));
43
+                    }
44
+                    PromptSelectionResult psr = editor.SelectCrossingPolygon(ptcoll,selectionfilter);
45
+
46
+                    if (psr.Status == PromptStatus.OK)
47
+                    {
48
+                        SelectionSet selectionset = psr.Value;
49
+                        int ptnums = selectionset.Count;
50
+                        double den = ptnums / pll.Area;
51
+                        if (den < density && flag == 1)
52
+                        {
53
+                            LayerControl layerscontrol = new LayerControl();
54
+                            string layname = "小于密度";
55
+                            if (!layerscontrol.haslayername(layname))
56
+                            {
57
+                                colorgb col = new colorgb(255, 0, 0);
58
+                                layerscontrol.creatlayer(layname, col);
59
+                                pll.Layer = "小于密度";
60
+                            }
61
+                            else
62
+                                pll.Layer = "小于密度";
63
+                            //pll.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 1);
64
+                        }
65
+                        else if (den > density && flag == 2)
66
+                        {
67
+                            LayerControl layerscontrol = new LayerControl();
68
+                            string layname = "大于密度";
69
+                            if (!layerscontrol.haslayername(layname))
70
+                            {
71
+                                colorgb col = new colorgb(255, 0, 0);
72
+                                layerscontrol.creatlayer(layname, col);
73
+                                pll.Layer = "大于密度";
74
+                            }
75
+                            else
76
+                                pll.Layer = "大于密度";
77
+                            //pll.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 1);
78
+                        }
79
+                        else if (flag == 3)
80
+                        {
81
+                            if (den < density || den > density)
82
+                            {
83
+                                LayerControl layerscontrol = new LayerControl();
84
+                                string layname = "不等于密度";
85
+                                if (!layerscontrol.haslayername(layname))
86
+                                {
87
+                                    colorgb col = new colorgb(255, 0, 0);
88
+                                    layerscontrol.creatlayer(layname, col);
89
+                                    pll.Layer = "不等于密度";
90
+                                }
91
+                                else
92
+                                    pll.Layer = "不等于密度";
93
+                                //pll.Color = GrxCAD.Colors.Color.FromColorIndex(GrxCAD.Colors.ColorMethod.ByColor, 1);
94
+                            }
95
+                        }
96
+                    }
97
+                    trans.Commit();
98
+                }
99
+            }
100
+            doclock.Dispose();
101
+        }
102
+
103
+        private static ObjectId[] TKget()
104
+        {
105
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; 
106
+            TypedValue[] typedvalue = new TypedValue[1];
107
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, tklayer), 0);
108
+           
109
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
110
+            PromptSelectionResult psr = editor.SelectAll(selectionfilter);
111
+            SelectionSet selectionset = psr.Value;
112
+            ObjectId[] obj = new ObjectId[selectionset.Count];
113
+
114
+            if (psr.Status == PromptStatus.OK)
115
+            {
116
+                obj = selectionset.GetObjectIds();
117
+            }
118
+            return obj;
119
+        }
120
+
121
+        public static void ZoomToExtent(Extents3d extent)
122
+        {
123
+            try
124
+            {
125
+                Point3d pMin = extent.MinPoint;
126
+                Point3d pMax = extent.MaxPoint;
127
+                //获取当前文档及数据库
128
+                Document acDoc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
129
+                Database acCurDb = acDoc.Database;
130
+
131
+                // 启动事务
132
+                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
133
+                {
134
+                    using (ViewTableRecord acView = acDoc.Editor.GetCurrentView())
135
+                    {
136
+                        //设置视图的高
137
+                        acView.Height = Math.Abs(pMin.Y - pMax.Y);
138
+                        //设置视图的宽
139
+                        acView.Width = Math.Abs(pMin.X - pMax.X);
140
+                        // 设置视图中心
141
+                        acView.CenterPoint = new Point2d((pMin.X + pMax.X) / 2, (pMin.Y + pMax.Y) / 2);
142
+                        // 更新当前视图
143
+                        acDoc.Editor.SetCurrentView(acView);
144
+                    }
145
+                    // 提交更改
146
+                    acTrans.Commit();
147
+                }
148
+            }
149
+            catch (Exception)
150
+            {
151
+
152
+                throw;
153
+            }
154
+        }
155
+    }
156
+}

+ 170
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDensity.Designer.cs ファイルの表示

@@ -0,0 +1,170 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class EleptDensity
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.label2 = new System.Windows.Forms.Label();
34
+            this.comboBox_ptLayer = new System.Windows.Forms.ComboBox();
35
+            this.comboBox_gw = new System.Windows.Forms.ComboBox();
36
+            this.button_ok = new System.Windows.Forms.Button();
37
+            this.button_cancel = new System.Windows.Forms.Button();
38
+            this.label3 = new System.Windows.Forms.Label();
39
+            this.textBox_density = new System.Windows.Forms.TextBox();
40
+            this.checkBox_upon = new System.Windows.Forms.CheckBox();
41
+            this.checkBox_below = new System.Windows.Forms.CheckBox();
42
+            this.SuspendLayout();
43
+            // 
44
+            // label1
45
+            // 
46
+            this.label1.AutoSize = true;
47
+            this.label1.Location = new System.Drawing.Point(51, 26);
48
+            this.label1.Name = "label1";
49
+            this.label1.Size = new System.Drawing.Size(127, 15);
50
+            this.label1.TabIndex = 0;
51
+            this.label1.Text = "高程点所在图层:";
52
+            // 
53
+            // label2
54
+            // 
55
+            this.label2.AutoSize = true;
56
+            this.label2.Location = new System.Drawing.Point(66, 75);
57
+            this.label2.Name = "label2";
58
+            this.label2.Size = new System.Drawing.Size(112, 15);
59
+            this.label2.TabIndex = 1;
60
+            this.label2.Text = "格网所在图层:";
61
+            // 
62
+            // comboBox_ptLayer
63
+            // 
64
+            this.comboBox_ptLayer.FormattingEnabled = true;
65
+            this.comboBox_ptLayer.Location = new System.Drawing.Point(184, 23);
66
+            this.comboBox_ptLayer.Name = "comboBox_ptLayer";
67
+            this.comboBox_ptLayer.Size = new System.Drawing.Size(197, 23);
68
+            this.comboBox_ptLayer.TabIndex = 2;
69
+            // 
70
+            // comboBox_gw
71
+            // 
72
+            this.comboBox_gw.FormattingEnabled = true;
73
+            this.comboBox_gw.Location = new System.Drawing.Point(184, 72);
74
+            this.comboBox_gw.Name = "comboBox_gw";
75
+            this.comboBox_gw.Size = new System.Drawing.Size(197, 23);
76
+            this.comboBox_gw.TabIndex = 3;
77
+            // 
78
+            // button_ok
79
+            // 
80
+            this.button_ok.Location = new System.Drawing.Point(99, 167);
81
+            this.button_ok.Name = "button_ok";
82
+            this.button_ok.Size = new System.Drawing.Size(75, 29);
83
+            this.button_ok.TabIndex = 6;
84
+            this.button_ok.Text = "确 定";
85
+            this.button_ok.UseVisualStyleBackColor = true;
86
+            this.button_ok.Click += new System.EventHandler(this.button_ok_Click);
87
+            // 
88
+            // button_cancel
89
+            // 
90
+            this.button_cancel.Location = new System.Drawing.Point(289, 167);
91
+            this.button_cancel.Name = "button_cancel";
92
+            this.button_cancel.Size = new System.Drawing.Size(75, 29);
93
+            this.button_cancel.TabIndex = 7;
94
+            this.button_cancel.Text = "取 消";
95
+            this.button_cancel.UseVisualStyleBackColor = true;
96
+            this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
97
+            // 
98
+            // label3
99
+            // 
100
+            this.label3.AutoSize = true;
101
+            this.label3.Location = new System.Drawing.Point(45, 128);
102
+            this.label3.Name = "label3";
103
+            this.label3.Size = new System.Drawing.Size(52, 15);
104
+            this.label3.TabIndex = 8;
105
+            this.label3.Text = "密度:";
106
+            // 
107
+            // textBox_density
108
+            // 
109
+            this.textBox_density.Location = new System.Drawing.Point(103, 122);
110
+            this.textBox_density.Name = "textBox_density";
111
+            this.textBox_density.Size = new System.Drawing.Size(100, 25);
112
+            this.textBox_density.TabIndex = 9;
113
+            // 
114
+            // checkBox_upon
115
+            // 
116
+            this.checkBox_upon.AutoSize = true;
117
+            this.checkBox_upon.Location = new System.Drawing.Point(345, 124);
118
+            this.checkBox_upon.Name = "checkBox_upon";
119
+            this.checkBox_upon.Size = new System.Drawing.Size(89, 19);
120
+            this.checkBox_upon.TabIndex = 10;
121
+            this.checkBox_upon.Text = "大于密度";
122
+            this.checkBox_upon.UseVisualStyleBackColor = true;
123
+            // 
124
+            // checkBox_below
125
+            // 
126
+            this.checkBox_below.AutoSize = true;
127
+            this.checkBox_below.Location = new System.Drawing.Point(235, 124);
128
+            this.checkBox_below.Name = "checkBox_below";
129
+            this.checkBox_below.Size = new System.Drawing.Size(89, 19);
130
+            this.checkBox_below.TabIndex = 11;
131
+            this.checkBox_below.Text = "小于密度";
132
+            this.checkBox_below.UseVisualStyleBackColor = true;
133
+            // 
134
+            // EleptDensity
135
+            // 
136
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
137
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
138
+            this.ClientSize = new System.Drawing.Size(468, 219);
139
+            this.Controls.Add(this.checkBox_below);
140
+            this.Controls.Add(this.checkBox_upon);
141
+            this.Controls.Add(this.textBox_density);
142
+            this.Controls.Add(this.label3);
143
+            this.Controls.Add(this.button_cancel);
144
+            this.Controls.Add(this.button_ok);
145
+            this.Controls.Add(this.comboBox_gw);
146
+            this.Controls.Add(this.comboBox_ptLayer);
147
+            this.Controls.Add(this.label2);
148
+            this.Controls.Add(this.label1);
149
+            this.Name = "EleptDensity";
150
+            this.Text = "高程点密度检查";
151
+            this.Load += new System.EventHandler(this.EleptDensity_Load);
152
+            this.ResumeLayout(false);
153
+            this.PerformLayout();
154
+
155
+        }
156
+
157
+        #endregion
158
+
159
+        private System.Windows.Forms.Label label1;
160
+        private System.Windows.Forms.Label label2;
161
+        private System.Windows.Forms.ComboBox comboBox_ptLayer;
162
+        private System.Windows.Forms.ComboBox comboBox_gw;
163
+        private System.Windows.Forms.Button button_ok;
164
+        private System.Windows.Forms.Button button_cancel;
165
+        private System.Windows.Forms.Label label3;
166
+        private System.Windows.Forms.TextBox textBox_density;
167
+        private System.Windows.Forms.CheckBox checkBox_upon;
168
+        private System.Windows.Forms.CheckBox checkBox_below;
169
+    }
170
+}

+ 100
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDensity.cs ファイルの表示

@@ -0,0 +1,100 @@
1
+using GrxCAD.DatabaseServices;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace HCTools
13
+{
14
+    public partial class EleptDensity : Form
15
+    {
16
+        public EleptDensity()
17
+        {
18
+            InitializeComponent();
19
+        }
20
+
21
+        private void EleptDensity_Load(object sender, EventArgs e)
22
+        {
23
+            this.comboBox_ptLayer.DropDownStyle = ComboBoxStyle.DropDownList;
24
+            this.comboBox_gw.DropDownStyle = ComboBoxStyle.DropDownList;
25
+
26
+            this.MaximizeBox = false;
27
+            this.StartPosition = FormStartPosition.CenterScreen;
28
+
29
+            //自动填充下拉框
30
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
31
+            using (Transaction traction = database.TransactionManager.StartTransaction())
32
+            {
33
+                //存放所有图层名
34
+                List<string> alllayername = new List<string>();
35
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
36
+                foreach (ObjectId objid in layertable)
37
+                {
38
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
39
+                    alllayername.Add(layertablerecord.Name);
40
+                }
41
+                alllayername.Sort();
42
+
43
+                for (int i = 0; i < alllayername.Count; i++)
44
+                {
45
+                    this.comboBox_ptLayer.Items.Add(alllayername[i]);
46
+                    this.comboBox_gw.Items.Add(alllayername[i]);
47
+                }
48
+
49
+                if (alllayername.Contains("8300"))
50
+                {
51
+                    int index = alllayername.IndexOf("8300");
52
+                    this.comboBox_ptLayer.SelectedIndex = index;
53
+                }
54
+                traction.Commit();
55
+            }
56
+        }
57
+
58
+        private void button_cancel_Click(object sender, EventArgs e)
59
+        {
60
+            this.Close();
61
+        }
62
+
63
+        private void button_ok_Click(object sender, EventArgs e)
64
+        {
65
+            if(comboBox_ptLayer.Text == "")
66
+            { 
67
+                MessageBox.Show("请选择高程点所在图层!");
68
+                return;
69
+            }
70
+            if (comboBox_gw.Text == "")
71
+            { 
72
+                MessageBox.Show("请选择格网所在图层!");
73
+                return;
74
+            }
75
+            if (textBox_density.Text == "")
76
+            {
77
+                MessageBox.Show("请输入密度!");
78
+                return;
79
+            }
80
+            EleptDenck.ptlayer = comboBox_ptLayer.Text;
81
+            EleptDenck.tklayer = comboBox_gw.Text;
82
+            EleptDenck.density = Convert.ToDouble(textBox_density.Text);
83
+            if(checkBox_below.Checked && !checkBox_upon.Checked)
84
+                EleptDenck.flag = 1;
85
+            else if (!checkBox_below.Checked && checkBox_upon.Checked)
86
+                EleptDenck.flag = 2;
87
+            else if(checkBox_below.Checked && checkBox_upon.Checked)
88
+                EleptDenck.flag = 3;
89
+            else if(!checkBox_below.Checked && !checkBox_upon.Checked)
90
+            { 
91
+                MessageBox.Show("请选择“大于密度”/“小于密度”!");
92
+                return;
93
+            }
94
+
95
+            EleptDenck denck = new EleptDenck();
96
+            denck.Ptdensity();
97
+            this.Close();
98
+        }
99
+    }
100
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/EleptDensity.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 612
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/FeatureOverlap.cs ファイルの表示

@@ -0,0 +1,612 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+
11
+namespace HCTools
12
+{
13
+    class FeatureOverlap
14
+    {
15
+
16
+        //比例尺
17
+        public static int blc;
18
+        //重叠地物数量
19
+        private int number = 0;
20
+        public void check()
21
+        {
22
+            LayerControl lc = new LayerControl();
23
+            if (lc.haslayername("地物重叠") == false)
24
+            {
25
+                lc.creatlayer("地物重叠", new colorgb(255, 0, 255));
26
+                lc.movelayertofront("地物重叠");
27
+            }
28
+            else
29
+            {
30
+                lc.movelayertofront("地物重叠");
31
+            }
32
+            //选择块
33
+            selecblock();
34
+            search(blocklist,entitylist);
35
+        }
36
+
37
+        /// <summary>
38
+        /// 定义一个块类,主要包括位置和名字
39
+        /// </summary>
40
+        public struct Block
41
+        {
42
+            public double x;
43
+            public double y;
44
+            public double z;
45
+            public string name;
46
+
47
+            public Block(double x, double y, double z, string name)
48
+            {
49
+                this.x = x;
50
+                this.y = y;
51
+                this.z = z;
52
+                this.name = name;
53
+            }
54
+        }
55
+
56
+        //块列表
57
+        private List<Block> blocklist = new List<Block>();
58
+        private List<Entity> entitylist = new List<Entity>();
59
+        private void selecblock()
60
+        {
61
+            Document document = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
62
+            Database database = HostApplicationServices.WorkingDatabase;
63
+            DocumentLock documentlock = null;
64
+            Transaction traction = null;
65
+            try
66
+            {
67
+                traction = database.TransactionManager.StartTransaction();
68
+                documentlock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
69
+                BlockTable blocktable = traction.GetObject(database.BlockTableId,
70
+                                          OpenMode.ForRead) as BlockTable;
71
+                Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
72
+                TypedValue[] typedvalue = new TypedValue[1];
73
+                typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "Insert"), 0);
74
+                SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
75
+                PromptSelectionResult psr = editor.GetSelection(selectionfilter); ///手动选择块参照
76
+                //PromptSelectionResult psr = editor.SelectAll();
77
+                if (psr.Status == PromptStatus.OK)
78
+                {
79
+                    SelectionSet selectionset = psr.Value;
80
+                    ObjectId[] obj = new ObjectId[selectionset.Count];
81
+                    obj = selectionset.GetObjectIds();
82
+                    for (int i = 0; i < obj.Length; i++)
83
+                    {
84
+                        ObjectId objid = obj[i];
85
+                        Entity entity = (Entity)traction.GetObject(objid, OpenMode.ForWrite);
86
+                        if (entity is BlockReference)
87
+                        {
88
+                            BlockReference block = entity as BlockReference;
89
+                            ObjectId id = block.BlockTableRecord;
90
+                            BlockTableRecord blocktablerecord = traction.GetObject(id,
91
+                                                            OpenMode.ForRead) as BlockTableRecord;
92
+                            string blockname = blocktablerecord.Name.ToLower();
93
+                            Block blc = new Block();
94
+                            ///块参照的位置
95
+                            blc.x = block.Position.X;
96
+                            blc.y = block.Position.Y;
97
+                            blc.z = block.Position.Z;
98
+                            blc.name = blockname;
99
+                            ///块参照的名称
100
+                            switch (blockname)
101
+                            {
102
+                                case "gc028":
103
+                                case "gc090":
104
+                                case "gc110":
105
+                                case "gc111":
106
+                                case "gc119":
107
+                                case "gc120":
108
+                                case "gc121":
109
+                                case "gc122":
110
+                                case "gc124":
111
+                                case "gc125":
112
+                                case "gc126":
113
+                                case "gc143":
114
+                                case "gc144":
115
+                                case "gc145":
116
+                                case "gc160":
117
+                                case "gc163":
118
+                                case "gc164":
119
+                                case "gc165":
120
+                                case "gc200":
121
+                                case "gc205":
122
+                                case "gc206":
123
+                                case "gc207":
124
+                                case "gc208":
125
+                                case "gc210":
126
+                                case "gc211":
127
+                                case "gc213":
128
+                                case "gc246":
129
+                                case "gc251":
130
+                                case "gc253":
131
+                                case "gc254":
132
+                                case "gc319":
133
+                                case "gc320":
134
+                                case "gc322":
135
+                                case "gc323":
136
+                                case "gc325":
137
+                                case "gc326":
138
+                                    entitylist.Add(entity);
139
+                                    blocklist.Add(blc);
140
+                                    break;
141
+                                case "gc170":
142
+                                    if (block.Layer == "9000")
143
+                                    {
144
+                                        entitylist.Add(entity);
145
+                                        blocklist.Add(blc);
146
+                                    }
147
+                                    break;
148
+
149
+                                default:
150
+                                    break;
151
+                            }
152
+                        }
153
+                    }
154
+                    editor.WriteMessage("\n" + "选中块数量:" + blocklist.Count.ToString());
155
+                }
156
+                traction.Commit();
157
+            }
158
+            catch (GrxCAD.Runtime.Exception)
159
+            {
160
+                traction.Abort();
161
+                return;
162
+            }
163
+            finally
164
+            {
165
+                traction.Dispose();
166
+                documentlock.Dispose();
167
+            }
168
+        }
169
+
170
+
171
+        /// <summary>
172
+        /// 寻找与上面已选实体相交的那部分
173
+        /// </summary>
174
+        /// <param name="list"></param>
175
+        public void search(List<Block> list, List<Entity> list1)
176
+        {
177
+            Database database = HostApplicationServices.WorkingDatabase;
178
+            Transaction traction = null;
179
+            DocumentLock documentlock = null;
180
+            try
181
+            {
182
+                Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
183
+                for (int i = 0; i < list.Count; i++)
184
+                {
185
+                    double x = Math.Round((double)list[i].x, 3, MidpointRounding.AwayFromZero);
186
+                    double y = Math.Round((double)list[i].y, 3, MidpointRounding.AwayFromZero);
187
+                    Entity entity1 = list1[i];
188
+                    string name = list[i].name;
189
+                    rebound reb = get_boundary(name);
190
+                    double height = reb.height;
191
+                    double width = reb.width;
192
+                    int type = reb.type;
193
+                    ///按照比例尺决定大小
194
+                    if (blc == 1000)
195
+                    {
196
+                        height = height / 2;
197
+                        width = width / 2;
198
+                    }
199
+                    else if (blc == 500)
200
+                    {
201
+                        height = height / 4;
202
+                        width = width / 4;
203
+                    }
204
+                    else if (blc == 2000)
205
+                    {
206
+                        height = height * 1;
207
+                        width = width * 1;
208
+                    }
209
+                    ///是为了获得四个角,好框选整个图形
210
+                    Point3d p1 = new Point3d(x - width, y, 0);
211
+                    Point3d p2 = new Point3d(x + width, y, 0);
212
+                    Point3d p3 = new Point3d(x + width, y + height, 0);
213
+                    Point3d p4 = new Point3d(x - width, y + height, 0);
214
+                    if (type == 2)
215
+                    {
216
+                        p1 = new Point3d(x - width, y - height, 0);
217
+                        p2 = new Point3d(x + width, y - height, 0);
218
+                        p3 = new Point3d(x + width, y + height, 0);
219
+                        p4 = new Point3d(x - width, y + height, 0);
220
+                    }
221
+                    else if (type == 3)
222
+                    {
223
+                        p1 = new Point3d(x - width, y - height, 0);
224
+                        p2 = new Point3d(x + width, y - height, 0);
225
+                        p3 = new Point3d(x + width, y, 0);
226
+                        p4 = new Point3d(x - width, y, 0);
227
+                    }
228
+                    using (Transaction acTrans = database.TransactionManager.StartTransaction())
229
+                    {
230
+                        ViewTableRecord currview = editor.GetCurrentView();
231
+                        currview.CenterPoint = new Point2d(x, y);
232
+                        currview.ViewDirection = new Vector3d(0, 0, 1);
233
+                        currview.Width = 40;
234
+                        currview.Height = 40;
235
+                        editor.SetCurrentView(currview);
236
+                        acTrans.Commit();
237
+                    }
238
+
239
+                    PromptSelectionResult pselectresult = editor.SelectCrossingWindow(p1, p3);///框选范围内相交的实体
240
+                                                                                              ///如果有,按照类型对相交实体进行判断
241
+
242
+                    traction = database.TransactionManager.StartTransaction();
243
+                    documentlock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
244
+                    BlockTable blocktable = traction.GetObject(database.BlockTableId,
245
+                                                 OpenMode.ForRead) as BlockTable;
246
+                    BlockTableRecord blocktablerecord = traction.GetObject(blocktable[BlockTableRecord.ModelSpace],
247
+                                                    OpenMode.ForWrite) as BlockTableRecord;
248
+                    if (pselectresult.Status == PromptStatus.OK)
249
+                    {
250
+                        SelectionSet selectionset = pselectresult.Value;
251
+                        ObjectId[] obj = new ObjectId[selectionset.Count];
252
+                        obj = selectionset.GetObjectIds();
253
+                        int count = 0;
254
+                        for (int j = 0; j < obj.Length; j++)
255
+                        {
256
+                            ObjectId objid = obj[j];
257
+                            Entity entity = (Entity)traction.GetObject(objid, OpenMode.ForWrite);
258
+                            ///块参照
259
+                            if (entity is BlockReference)
260
+                            {
261
+                                BlockReference cblock = entity as BlockReference;
262
+                                ObjectId cid = cblock.BlockTableRecord;
263
+                                BlockTableRecord crecord = traction.GetObject(cid,
264
+                                                                OpenMode.ForRead) as BlockTableRecord;
265
+                                string blockname = crecord.Name.ToLower();
266
+                                if (blockname != "gc086")
267
+                                {
268
+                                    count++;
269
+                                }
270
+                            }
271
+                            ///文字
272
+                            else if (entity is DBText)
273
+                            {
274
+                                string layer = entity.Layer;
275
+                                if (layer != "0")
276
+                                {
277
+                                    if (entity1 is BlockReference)
278
+                                    {
279
+                                        BlockReference cblock = entity1 as BlockReference;
280
+                                        DBText txt = entity as DBText;
281
+                                        if (cblock.Position.Z.ToString("N1") != txt.TextString)
282
+                                            count++;
283
+                                    }
284
+                                }
285
+                            }
286
+                            ///线
287
+                            else if (entity is Polyline || entity is Polyline2d)
288
+                            {
289
+                                string layer = entity.Layer;
290
+                                if (layer == "4400" || layer == "6100" || layer == "4300" || layer == "2000")
291
+                                {
292
+                                    if (name != "gc200")
293
+                                    {
294
+                                        count++;
295
+                                    }
296
+                                }
297
+                            }
298
+
299
+                        }
300
+                        if (count > 1)
301
+                        {
302
+                            double height1 = 2 * height;
303
+                            Point3d orip = new Point3d(x, y, 0);
304
+                            Point3d newp = new Point3d(x, y + height1, 0);
305
+                            if (name == "gc120" || name == "gc119" || name == "gc126" || name == "gc123" || name == "gc325" || name == "gc205"
306
+                                     || name == "gc206" || name == "gc207" || name == "gc125" || name == "gc165" || name == "gc326" || name == "gc170"
307
+                                     || name == "gc160" || name == "gc246" || name == "gc208" || name == "gc121" || name == "gc163" || name == "gc164"
308
+                                     || name == "gc090" || name == "gc124" || name == "gc379")
309
+                            {
310
+                                if (entity1.IsWriteEnabled == true)
311
+                                {
312
+                                    Move(entity1, orip, newp);
313
+                                }
314
+                            }
315
+                            
316
+                            double px1 = p1.X;
317
+                            double py1 = p1.Y;
318
+                            double px2 = p2.X;
319
+                            double py2 = p2.Y;
320
+                            double px3 = p3.X;
321
+                            double py3 = p3.Y;
322
+                            double px4 = p4.X;
323
+                            double py4 = p4.Y;
324
+                            p1 = new Point3d(px1, py1 + height1, 0);
325
+                            p2 = new Point3d(px2, py2 + height1, 0);
326
+                            p3 = new Point3d(px3, py3 + height1, 0);
327
+                            p4 = new Point3d(px4, py4 + height1, 0);
328
+                            Point3dCollection coll = new Point3dCollection();
329
+                            coll.Add(p1);
330
+                            coll.Add(p2);
331
+                            coll.Add(p3);
332
+                            coll.Add(p4);
333
+                            Polyline2d line2d = new Polyline2d(Poly2dType.SimplePoly, coll, 0, true, 0, 0, null);
334
+                            line2d.SetDatabaseDefaults();
335
+                            line2d.Layer = "地物重叠";
336
+                            blocktablerecord.AppendEntity(line2d);
337
+                            traction.AddNewlyCreatedDBObject(line2d, true);
338
+                            number++;
339
+                        }
340
+                    }
341
+                    traction.Commit();
342
+                }
343
+                editor.WriteMessage("\n");
344
+                editor.WriteMessage("检测到重叠地物:" + number);
345
+                editor.WriteMessage("\n");
346
+                number = 0;
347
+            }
348
+            catch (GrxCAD.Runtime.Exception)
349
+            {
350
+                traction.Abort();
351
+                return;
352
+            }
353
+            finally
354
+            {
355
+                if (documentlock != null)
356
+                {
357
+                    documentlock.Dispose();
358
+                }
359
+                if (traction != null)
360
+                {
361
+                    traction.Dispose();
362
+                }
363
+            }
364
+        }
365
+
366
+        /// <summary>
367
+        /// type=1表示图形为上半部分,type=2表示图形为上下两部分,type=3表示下半部分(中心点跟图形的关系)
368
+        /// </summary>
369
+        private struct rebound
370
+        {
371
+            public double height;
372
+            public double width;
373
+            public int type;
374
+
375
+            public rebound(double height, double width, int type)
376
+            {
377
+                this.height = height;
378
+                this.width = width;
379
+                this.type = type;
380
+            }
381
+        }
382
+
383
+        /// <summary>
384
+        /// 对每个地物图标的大小进行绘制
385
+        /// </summary>
386
+        /// <param name="name"></param>
387
+        /// <returns></returns>
388
+        private rebound get_boundary(string name)
389
+        {
390
+            double height = 0;
391
+            double width = 0;
392
+            int type = 0;
393
+
394
+            switch (name)
395
+            {
396
+                case "gc028":
397
+                    height = 5;
398
+                    width = 4;
399
+                    type = 2;
400
+                    break;
401
+                case "gc090":
402
+                    height = 2.5;
403
+                    width = 2.5;
404
+                    type = 2;
405
+                    break;
406
+                //case "gc110":
407
+                //    height = 4;
408
+                //    width = 4;
409
+                //    type = 2;
410
+                //    break;
411
+
412
+                //case "gc111":
413
+                //    height = 4;
414
+                //    width = 4;
415
+                //    type = 2;
416
+                //    break;
417
+
418
+                case "gc119":
419
+                    height = 2.6;
420
+                    width = 2.6;
421
+                    type = 1;
422
+                    break;
423
+                case "gc120":
424
+                    height = 5;
425
+                    width = 1;
426
+                    type = 1;
427
+                    break;
428
+                case "gc121":
429
+                    height = 1.1;
430
+                    width = 1.1;
431
+                    type = 2;
432
+                    break;
433
+                case "gc122":
434
+                    height = 2.1;
435
+                    width = 1.1;
436
+                    type = 2;
437
+                    break;
438
+                case "gc123":
439
+                    height = 4.2;
440
+                    width = 2.1;
441
+                    type = 2;
442
+                    break;
443
+                case "gc124":
444
+                    height = 3;
445
+                    width = 1.5;
446
+                    type = 1;
447
+                    break;
448
+                case "gc125":
449
+                    height = 3.8;
450
+                    width = 1.2;
451
+                    type = 2;
452
+                    break;
453
+                case "gc126":
454
+                    height = 2.5;
455
+                    width = 3;
456
+                    type = 2;
457
+                    break;
458
+                case "gc143":
459
+                    height = 6;
460
+                    width = 2;
461
+                    type = 1;
462
+                    break;
463
+                case "gc144":
464
+                    height = 6;
465
+                    width = 2;
466
+                    type = 1;
467
+                    break;
468
+                case "gc145":
469
+                    height = 6;
470
+                    width = 2;
471
+                    type = 1;
472
+                    break;
473
+                case "gc160":
474
+                    height = 4.7;
475
+                    width = 4.7;
476
+                    type = 2;
477
+                    break;
478
+                case "gc163":
479
+                    height = 0.6;
480
+                    width = 2.5;
481
+                    type = 2;
482
+                    break;
483
+                case "gc164":
484
+                    height = 0.7;
485
+                    width = 0.7;
486
+                    type = 2;
487
+                    break;
488
+                case "gc165":
489
+                    height = 5;
490
+                    width = 1;
491
+                    type = 2;
492
+                    break;
493
+                case "gc170":
494
+                    height = 1.1;
495
+                    width = 1.1;
496
+                    type = 2;
497
+                    break;
498
+                case "gc200":
499
+                    height = 1.5;
500
+                    width = 1.5;
501
+                    type = 2;
502
+                    break;
503
+                case "gc205":
504
+                    height = 5;
505
+                    width = 2;
506
+                    type = 1;
507
+                    break;
508
+                case "gc206":
509
+                    height = 5;
510
+                    width = 2;
511
+                    type = 1;
512
+                    break;
513
+                case "gc207":
514
+                    height = 4;
515
+                    width = 1;
516
+                    type = 2;
517
+                    break;
518
+                case "gc208":
519
+                    height = 1.6;
520
+                    width = 2.4;
521
+                    type = 2;
522
+                    break;
523
+                case "gc210":
524
+                    height = 6;
525
+                    width = 2.2;
526
+                    type = 1;
527
+                    break;
528
+                case "gc211":
529
+                    height = 3;
530
+                    width = 2.8;
531
+                    type = 3;
532
+                    break;
533
+                case "gc212":
534
+                    height = 5;
535
+                    width = 2.6;
536
+                    type = 1;
537
+                    break;
538
+                case "gc246":
539
+                    height = 6;
540
+                    width = 4;
541
+                    type = 1;
542
+                    break;
543
+                case "gc251":
544
+                    height = 1;
545
+                    width = 3.5;
546
+                    type = 2;
547
+                    break;
548
+                case "gc253":
549
+                    height = 0.7;
550
+                    width = 0.7;
551
+                    type = 2;
552
+                    break;
553
+                case "gc254":
554
+                    height = 3;
555
+                    width = 2.5;
556
+                    type = 2;
557
+                    break;
558
+                case "gc319":
559
+                    height = 6;
560
+                    width = 2;
561
+                    type = 1;
562
+                    break;
563
+                case "gc320":
564
+                    height = 6;
565
+                    width = 2;
566
+                    type = 1;
567
+                    break;
568
+                case "gc322":
569
+                    height = 6;
570
+                    width = 2;
571
+                    type = 1;
572
+                    break;
573
+                case "gc323":
574
+                    height = 4;
575
+                    width = 1.1;
576
+                    type = 1;
577
+                    break;
578
+                case "gc325":
579
+                    height = 5;
580
+                    width = 0.7;
581
+                    type = 1;
582
+                    break;
583
+                case "gc326":
584
+                    height = 1.6;
585
+                    width = 1.6;
586
+                    type = 2;
587
+                    break;
588
+
589
+                default:
590
+                    height = 2.5;
591
+                    width = 2;
592
+                    type = 2;
593
+                    break;
594
+            }
595
+            rebound rec = new rebound(height, width, type);
596
+            return rec;
597
+        }
598
+
599
+        /// <summary>
600
+        /// 指定基点与目标点移动实体
601
+        /// </summary>
602
+        /// <param name="ent">实体对象</param>
603
+        /// <param name="BasePt">基点</param>
604
+        /// <param name="TargetPt">目标点</param>
605
+        public static void Move(Entity ent, Point3d basePt, Point3d targetPt)
606
+        {
607
+            Vector3d vec = targetPt - basePt;
608
+            Matrix3d mt = Matrix3d.Displacement(vec);
609
+            ent.TransformBy(mt);
610
+        }
611
+    }
612
+}

+ 275
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj ファイルの表示

@@ -0,0 +1,275 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4
+  <PropertyGroup>
5
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7
+    <ProjectGuid>{ABB97F2C-1CCA-4782-B144-A796879EBE66}</ProjectGuid>
8
+    <OutputType>Library</OutputType>
9
+    <RootNamespace>HCTools</RootNamespace>
10
+    <AssemblyName>HCTools</AssemblyName>
11
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
12
+    <FileAlignment>512</FileAlignment>
13
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14
+    <Deterministic>true</Deterministic>
15
+  </PropertyGroup>
16
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17
+    <PlatformTarget>AnyCPU</PlatformTarget>
18
+    <DebugSymbols>true</DebugSymbols>
19
+    <DebugType>full</DebugType>
20
+    <Optimize>false</Optimize>
21
+    <OutputPath>bin\Debug\</OutputPath>
22
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
23
+    <ErrorReport>prompt</ErrorReport>
24
+    <WarningLevel>4</WarningLevel>
25
+  </PropertyGroup>
26
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27
+    <PlatformTarget>AnyCPU</PlatformTarget>
28
+    <DebugType>pdbonly</DebugType>
29
+    <Optimize>true</Optimize>
30
+    <OutputPath>bin\Release\</OutputPath>
31
+    <DefineConstants>TRACE</DefineConstants>
32
+    <ErrorReport>prompt</ErrorReport>
33
+    <WarningLevel>4</WarningLevel>
34
+  </PropertyGroup>
35
+  <PropertyGroup>
36
+    <StartupObject />
37
+  </PropertyGroup>
38
+  <ItemGroup>
39
+    <Reference Include="gmap">
40
+      <HintPath>..\..\..\..\..\..\04\浩辰\GstarCAD2020_Development_Tool\浩辰CAD2020_grxsdk\inc\gmap.dll</HintPath>
41
+      <Private>False</Private>
42
+    </Reference>
43
+    <Reference Include="gmdb">
44
+      <HintPath>..\..\..\..\..\..\04\浩辰\GstarCAD2020_Development_Tool\浩辰CAD2020_grxsdk\inc\gmdb.dll</HintPath>
45
+      <Private>False</Private>
46
+    </Reference>
47
+    <Reference Include="GrxCAD.Interop">
48
+      <HintPath>..\..\..\..\..\..\04\浩辰\GstarCAD2020_Development_Tool\浩辰CAD2020_grxsdk\inc-x64\GrxCAD.Interop.dll</HintPath>
49
+      <EmbedInteropTypes>True</EmbedInteropTypes>
50
+    </Reference>
51
+    <Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
52
+      <SpecificVersion>False</SpecificVersion>
53
+      <EmbedInteropTypes>True</EmbedInteropTypes>
54
+      <HintPath>..\..\..\CADTools\CADtools\bin\Debug\Microsoft.Office.Interop.Excel.dll</HintPath>
55
+    </Reference>
56
+    <Reference Include="System" />
57
+    <Reference Include="System.Core" />
58
+    <Reference Include="System.Management" />
59
+    <Reference Include="System.Xml.Linq" />
60
+    <Reference Include="System.Data.DataSetExtensions" />
61
+    <Reference Include="Microsoft.CSharp" />
62
+    <Reference Include="System.Data" />
63
+    <Reference Include="System.Deployment" />
64
+    <Reference Include="System.Drawing" />
65
+    <Reference Include="System.Net.Http" />
66
+    <Reference Include="System.Windows.Forms" />
67
+    <Reference Include="System.Xml" />
68
+  </ItemGroup>
69
+  <ItemGroup>
70
+    <Compile Include="AttributeForm.cs">
71
+      <SubType>Form</SubType>
72
+    </Compile>
73
+    <Compile Include="AttributeForm.Designer.cs">
74
+      <DependentUpon>AttributeForm.cs</DependentUpon>
75
+    </Compile>
76
+    <Compile Include="Attributeget.cs" />
77
+    <Compile Include="Chaginfos.cs">
78
+      <SubType>Form</SubType>
79
+    </Compile>
80
+    <Compile Include="Chaginfos.Designer.cs">
81
+      <DependentUpon>Chaginfos.cs</DependentUpon>
82
+    </Compile>
83
+    <Compile Include="CheckContourLine.cs" />
84
+    <Compile Include="CheckL.cs">
85
+      <SubType>Form</SubType>
86
+    </Compile>
87
+    <Compile Include="CheckL.Designer.cs">
88
+      <DependentUpon>CheckL.cs</DependentUpon>
89
+    </Compile>
90
+    <Compile Include="CheckPLOverlay.cs" />
91
+    <Compile Include="ChPLContradiction.cs" />
92
+    <Compile Include="CMCgis_Basicfunction.cs" />
93
+    <Compile Include="Conn.cs">
94
+      <SubType>Form</SubType>
95
+    </Compile>
96
+    <Compile Include="Conn.Designer.cs">
97
+      <DependentUpon>Conn.cs</DependentUpon>
98
+    </Compile>
99
+    <Compile Include="Connect.cs" />
100
+    <Compile Include="ContourLineFix.cs" />
101
+    <Compile Include="CutContourLine.cs" />
102
+    <Compile Include="CutCountL.cs">
103
+      <SubType>Form</SubType>
104
+    </Compile>
105
+    <Compile Include="CutCountL.Designer.cs">
106
+      <DependentUpon>CutCountL.cs</DependentUpon>
107
+    </Compile>
108
+    <Compile Include="DeleteElept.cs">
109
+      <SubType>Form</SubType>
110
+    </Compile>
111
+    <Compile Include="DeleteElept.Designer.cs">
112
+      <DependentUpon>DeleteElept.cs</DependentUpon>
113
+    </Compile>
114
+    <Compile Include="DeletePts.cs" />
115
+    <Compile Include="DgxAnnck.cs" />
116
+    <Compile Include="DgxAnno.cs">
117
+      <SubType>Form</SubType>
118
+    </Compile>
119
+    <Compile Include="DgxAnno.Designer.cs">
120
+      <DependentUpon>DgxAnno.cs</DependentUpon>
121
+    </Compile>
122
+    <Compile Include="DGXGeneral.cs">
123
+      <SubType>Form</SubType>
124
+    </Compile>
125
+    <Compile Include="DGXGeneral.Designer.cs">
126
+      <DependentUpon>DGXGeneral.cs</DependentUpon>
127
+    </Compile>
128
+    <Compile Include="DGXGeneralization.cs" />
129
+    <Compile Include="ElePtCheck.cs" />
130
+    <Compile Include="EleptDenck.cs" />
131
+    <Compile Include="EleptDensity.cs">
132
+      <SubType>Form</SubType>
133
+    </Compile>
134
+    <Compile Include="EleptDensity.Designer.cs">
135
+      <DependentUpon>EleptDensity.cs</DependentUpon>
136
+    </Compile>
137
+    <Compile Include="EleRd.cs">
138
+      <SubType>Form</SubType>
139
+    </Compile>
140
+    <Compile Include="EleRd.Designer.cs">
141
+      <DependentUpon>EleRd.cs</DependentUpon>
142
+    </Compile>
143
+    <Compile Include="EleRound.cs" />
144
+    <Compile Include="FeatureOverlap.cs" />
145
+    <Compile Include="Hierak.cs">
146
+      <SubType>Form</SubType>
147
+    </Compile>
148
+    <Compile Include="Hierak.Designer.cs">
149
+      <DependentUpon>Hierak.cs</DependentUpon>
150
+    </Compile>
151
+    <Compile Include="Hierarchy.cs" />
152
+    <Compile Include="InsertDOM.cs" />
153
+    <Compile Include="InstDOM.cs">
154
+      <SubType>Form</SubType>
155
+    </Compile>
156
+    <Compile Include="InstDOM.Designer.cs">
157
+      <DependentUpon>InstDOM.cs</DependentUpon>
158
+    </Compile>
159
+    <Compile Include="Inters.cs" />
160
+    <Compile Include="LayerChange.cs" />
161
+    <Compile Include="Layerchange_Form.cs">
162
+      <SubType>Form</SubType>
163
+    </Compile>
164
+    <Compile Include="Layerchange_Form.Designer.cs">
165
+      <DependentUpon>Layerchange_Form.cs</DependentUpon>
166
+    </Compile>
167
+    <Compile Include="MainClass.cs" />
168
+    <Compile Include="Menus.cs" />
169
+    <Compile Include="PickupPoint.cs" />
170
+    <Compile Include="PicPts.cs">
171
+      <SubType>Form</SubType>
172
+    </Compile>
173
+    <Compile Include="PicPts.Designer.cs">
174
+      <DependentUpon>PicPts.cs</DependentUpon>
175
+    </Compile>
176
+    <Compile Include="PLError_Overlay.cs">
177
+      <SubType>Form</SubType>
178
+    </Compile>
179
+    <Compile Include="PLError_Overlay.Designer.cs">
180
+      <DependentUpon>PLError_Overlay.cs</DependentUpon>
181
+    </Compile>
182
+    <Compile Include="Properties\AssemblyInfo.cs" />
183
+    <Compile Include="PtCheck.cs">
184
+      <SubType>Form</SubType>
185
+    </Compile>
186
+    <Compile Include="PtCheck.Designer.cs">
187
+      <DependentUpon>PtCheck.cs</DependentUpon>
188
+    </Compile>
189
+    <Compile Include="Scale.cs">
190
+      <SubType>Form</SubType>
191
+    </Compile>
192
+    <Compile Include="Scale.Designer.cs">
193
+      <DependentUpon>Scale.cs</DependentUpon>
194
+    </Compile>
195
+    <Compile Include="TKInfo.cs">
196
+      <SubType>Form</SubType>
197
+    </Compile>
198
+    <Compile Include="TKInfo.Designer.cs">
199
+      <DependentUpon>TKInfo.cs</DependentUpon>
200
+    </Compile>
201
+    <EmbeddedResource Include="AttributeForm.resx">
202
+      <DependentUpon>AttributeForm.cs</DependentUpon>
203
+    </EmbeddedResource>
204
+    <EmbeddedResource Include="Chaginfos.resx">
205
+      <DependentUpon>Chaginfos.cs</DependentUpon>
206
+    </EmbeddedResource>
207
+    <EmbeddedResource Include="CheckL.resx">
208
+      <DependentUpon>CheckL.cs</DependentUpon>
209
+    </EmbeddedResource>
210
+    <EmbeddedResource Include="Conn.resx">
211
+      <DependentUpon>Conn.cs</DependentUpon>
212
+    </EmbeddedResource>
213
+    <EmbeddedResource Include="CutCountL.resx">
214
+      <DependentUpon>CutCountL.cs</DependentUpon>
215
+    </EmbeddedResource>
216
+    <EmbeddedResource Include="DeleteElept.resx">
217
+      <DependentUpon>DeleteElept.cs</DependentUpon>
218
+    </EmbeddedResource>
219
+    <EmbeddedResource Include="DgxAnno.resx">
220
+      <DependentUpon>DgxAnno.cs</DependentUpon>
221
+    </EmbeddedResource>
222
+    <EmbeddedResource Include="DGXGeneral.resx">
223
+      <DependentUpon>DGXGeneral.cs</DependentUpon>
224
+    </EmbeddedResource>
225
+    <EmbeddedResource Include="EleptDensity.resx">
226
+      <DependentUpon>EleptDensity.cs</DependentUpon>
227
+    </EmbeddedResource>
228
+    <EmbeddedResource Include="EleRd.resx">
229
+      <DependentUpon>EleRd.cs</DependentUpon>
230
+    </EmbeddedResource>
231
+    <EmbeddedResource Include="Hierak.resx">
232
+      <DependentUpon>Hierak.cs</DependentUpon>
233
+    </EmbeddedResource>
234
+    <EmbeddedResource Include="InstDOM.resx">
235
+      <DependentUpon>InstDOM.cs</DependentUpon>
236
+    </EmbeddedResource>
237
+    <EmbeddedResource Include="Layerchange_Form.resx">
238
+      <DependentUpon>Layerchange_Form.cs</DependentUpon>
239
+    </EmbeddedResource>
240
+    <EmbeddedResource Include="PicPts.resx">
241
+      <DependentUpon>PicPts.cs</DependentUpon>
242
+    </EmbeddedResource>
243
+    <EmbeddedResource Include="PLError_Overlay.resx">
244
+      <DependentUpon>PLError_Overlay.cs</DependentUpon>
245
+    </EmbeddedResource>
246
+    <EmbeddedResource Include="Properties\Resources.resx">
247
+      <Generator>ResXFileCodeGenerator</Generator>
248
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
249
+      <SubType>Designer</SubType>
250
+    </EmbeddedResource>
251
+    <Compile Include="Properties\Resources.Designer.cs">
252
+      <AutoGen>True</AutoGen>
253
+      <DependentUpon>Resources.resx</DependentUpon>
254
+    </Compile>
255
+    <EmbeddedResource Include="PtCheck.resx">
256
+      <DependentUpon>PtCheck.cs</DependentUpon>
257
+    </EmbeddedResource>
258
+    <EmbeddedResource Include="Scale.resx">
259
+      <DependentUpon>Scale.cs</DependentUpon>
260
+    </EmbeddedResource>
261
+    <EmbeddedResource Include="TKInfo.resx">
262
+      <DependentUpon>TKInfo.cs</DependentUpon>
263
+    </EmbeddedResource>
264
+    <None Include="Properties\Settings.settings">
265
+      <Generator>SettingsSingleFileGenerator</Generator>
266
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
267
+    </None>
268
+    <Compile Include="Properties\Settings.Designer.cs">
269
+      <AutoGen>True</AutoGen>
270
+      <DependentUpon>Settings.settings</DependentUpon>
271
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
272
+    </Compile>
273
+  </ItemGroup>
274
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
275
+</Project>

+ 10
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj.user ファイルの表示

@@ -0,0 +1,10 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+  <PropertyGroup>
4
+    <ProjectView>ProjectFiles</ProjectView>
5
+  </PropertyGroup>
6
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
7
+    <StartAction>Program</StartAction>
8
+    <StartProgram>E:\浩辰CAD 2021\gcad.exe</StartProgram>
9
+  </PropertyGroup>
10
+</Project>

+ 126
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierak.Designer.cs ファイルの表示

@@ -0,0 +1,126 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class Hierak
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.comboBox_CrtLayer = new System.Windows.Forms.ComboBox();
33
+            this.label_CrtLayer = new System.Windows.Forms.Label();
34
+            this.textBox_Gap = new System.Windows.Forms.TextBox();
35
+            this.label_Gap = new System.Windows.Forms.Label();
36
+            this.btn_Cancel = new System.Windows.Forms.Button();
37
+            this.btn_OK = new System.Windows.Forms.Button();
38
+            this.SuspendLayout();
39
+            // 
40
+            // comboBox_CrtLayer
41
+            // 
42
+            this.comboBox_CrtLayer.BackColor = System.Drawing.SystemColors.Window;
43
+            this.comboBox_CrtLayer.FormattingEnabled = true;
44
+            this.comboBox_CrtLayer.Location = new System.Drawing.Point(204, 40);
45
+            this.comboBox_CrtLayer.Name = "comboBox_CrtLayer";
46
+            this.comboBox_CrtLayer.Size = new System.Drawing.Size(169, 23);
47
+            this.comboBox_CrtLayer.TabIndex = 7;
48
+            // 
49
+            // label_CrtLayer
50
+            // 
51
+            this.label_CrtLayer.AutoSize = true;
52
+            this.label_CrtLayer.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
53
+            this.label_CrtLayer.Location = new System.Drawing.Point(75, 43);
54
+            this.label_CrtLayer.Name = "label_CrtLayer";
55
+            this.label_CrtLayer.Size = new System.Drawing.Size(112, 15);
56
+            this.label_CrtLayer.TabIndex = 6;
57
+            this.label_CrtLayer.Text = "等高线所在图层";
58
+            // 
59
+            // textBox_Gap
60
+            // 
61
+            this.textBox_Gap.Location = new System.Drawing.Point(204, 97);
62
+            this.textBox_Gap.Name = "textBox_Gap";
63
+            this.textBox_Gap.Size = new System.Drawing.Size(169, 25);
64
+            this.textBox_Gap.TabIndex = 5;
65
+            // 
66
+            // label_Gap
67
+            // 
68
+            this.label_Gap.AutoSize = true;
69
+            this.label_Gap.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
70
+            this.label_Gap.Location = new System.Drawing.Point(135, 100);
71
+            this.label_Gap.Name = "label_Gap";
72
+            this.label_Gap.Size = new System.Drawing.Size(52, 15);
73
+            this.label_Gap.TabIndex = 4;
74
+            this.label_Gap.Text = "等高距";
75
+            // 
76
+            // btn_Cancel
77
+            // 
78
+            this.btn_Cancel.Location = new System.Drawing.Point(283, 149);
79
+            this.btn_Cancel.Margin = new System.Windows.Forms.Padding(4);
80
+            this.btn_Cancel.Name = "btn_Cancel";
81
+            this.btn_Cancel.Size = new System.Drawing.Size(100, 29);
82
+            this.btn_Cancel.TabIndex = 34;
83
+            this.btn_Cancel.Text = "取 消";
84
+            this.btn_Cancel.UseVisualStyleBackColor = true;
85
+            this.btn_Cancel.Click += new System.EventHandler(this.btn_Cancel_Click);
86
+            // 
87
+            // btn_OK
88
+            // 
89
+            this.btn_OK.Location = new System.Drawing.Point(117, 149);
90
+            this.btn_OK.Margin = new System.Windows.Forms.Padding(4);
91
+            this.btn_OK.Name = "btn_OK";
92
+            this.btn_OK.Size = new System.Drawing.Size(100, 29);
93
+            this.btn_OK.TabIndex = 33;
94
+            this.btn_OK.Text = "确 定";
95
+            this.btn_OK.UseVisualStyleBackColor = true;
96
+            this.btn_OK.Click += new System.EventHandler(this.btn_OK_Click);
97
+            // 
98
+            // Hierak
99
+            // 
100
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
101
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
102
+            this.ClientSize = new System.Drawing.Size(500, 219);
103
+            this.Controls.Add(this.btn_Cancel);
104
+            this.Controls.Add(this.btn_OK);
105
+            this.Controls.Add(this.comboBox_CrtLayer);
106
+            this.Controls.Add(this.label_CrtLayer);
107
+            this.Controls.Add(this.textBox_Gap);
108
+            this.Controls.Add(this.label_Gap);
109
+            this.Name = "Hierak";
110
+            this.Text = "等高线分层";
111
+            this.Load += new System.EventHandler(this.Hierak_Load);
112
+            this.ResumeLayout(false);
113
+            this.PerformLayout();
114
+
115
+        }
116
+
117
+        #endregion
118
+
119
+        private System.Windows.Forms.ComboBox comboBox_CrtLayer;
120
+        private System.Windows.Forms.Label label_CrtLayer;
121
+        private System.Windows.Forms.TextBox textBox_Gap;
122
+        private System.Windows.Forms.Label label_Gap;
123
+        private System.Windows.Forms.Button btn_Cancel;
124
+        private System.Windows.Forms.Button btn_OK;
125
+    }
126
+}

+ 87
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierak.cs ファイルの表示

@@ -0,0 +1,87 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+
11
+using GrxCAD.EditorInput;
12
+using GrxCAD.DatabaseServices;
13
+using GrxCAD.Geometry;
14
+
15
+namespace HCTools
16
+{
17
+    public partial class Hierak : Form
18
+    {
19
+        public Hierak()
20
+        {
21
+            InitializeComponent();
22
+        }
23
+
24
+        private void Hierak_Load(object sender, EventArgs e)
25
+        {
26
+            this.comboBox_CrtLayer.DropDownStyle = ComboBoxStyle.DropDownList;
27
+
28
+            this.MaximizeBox = false;
29
+            this.StartPosition = FormStartPosition.CenterScreen;
30
+
31
+            Database database = GrxCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
32
+            using (Transaction traction = database.TransactionManager.StartTransaction())
33
+            {
34
+                //存放所有图层名
35
+                List<string> alllayername = new List<string>();
36
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
37
+                foreach (ObjectId objid in layertable)
38
+                {
39
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
40
+                    alllayername.Add(layertablerecord.Name);
41
+                }
42
+
43
+                alllayername.Sort();
44
+
45
+                for (int i = 0; i < alllayername.Count; i++)
46
+                {
47
+                    this.comboBox_CrtLayer.Items.Add(alllayername[i]);
48
+                }
49
+
50
+                if (alllayername.Contains("8110"))
51
+                {
52
+                    int index = alllayername.IndexOf("8110");
53
+                    this.comboBox_CrtLayer.SelectedIndex = index;
54
+                }
55
+                traction.Commit();
56
+            }
57
+        }
58
+
59
+        private void btn_OK_Click(object sender, EventArgs e)
60
+        {
61
+            if (textBox_Gap.Text == "")
62
+            {
63
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请输入等高距");
64
+                return;
65
+            }
66
+
67
+            if (comboBox_CrtLayer.Text == "")
68
+            {
69
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("请选择当前等高线所在图层");
70
+                return;
71
+            }
72
+
73
+            Hierarchy.gap = Convert.ToInt32(textBox_Gap.Text.ToString());
74
+            Hierarchy.CrtLayerName = comboBox_CrtLayer.Text;
75
+
76
+
77
+            this.Close();
78
+            Hierarchy hier = new Hierarchy();
79
+            hier.hierarchy();
80
+        }
81
+
82
+        private void btn_Cancel_Click(object sender, EventArgs e)
83
+        {
84
+            this.Close();
85
+        }
86
+    }
87
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierak.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 91
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Hierarchy.cs ファイルの表示

@@ -0,0 +1,91 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using GrxCAD.ApplicationServices;
8
+using GrxCAD.DatabaseServices;
9
+using GrxCAD.EditorInput;
10
+
11
+
12
+namespace HCTools
13
+{
14
+    class Hierarchy
15
+    {
16
+        public static int gap;//等高距
17
+        public static string CrtLayerName;//当前等高线所在图层
18
+   
19
+        /// <summary>
20
+        /// 等高线分层
21
+        /// </summary>
22
+        public void hierarchy()
23
+        {
24
+            ObjectId[] ids = BasicFunction.getHeight(CrtLayerName);//存放获取的等高线id
25
+
26
+            //检查是否有计曲线图层,没有则创建
27
+            LayerControl layerscontrol = new LayerControl();
28
+            string Jilayname = "8120";
29
+            if (!layerscontrol.haslayername(Jilayname))
30
+            {
31
+                colorgb col = new colorgb(255, 255, 0);
32
+                layerscontrol.creatlayer(Jilayname, col);
33
+                layerscontrol.movelayertofront(Jilayname);
34
+            }
35
+            else
36
+                layerscontrol.movelayertofront(Jilayname);
37
+
38
+            //检查是否有首曲线图层,没有则创建
39
+            LayerControl layerscontrol1 = new LayerControl();
40
+            string Shoulayname = "8110";
41
+            if (!layerscontrol1.haslayername(Shoulayname))
42
+            {
43
+                colorgb col = new colorgb(0, 0, 0);
44
+                layerscontrol1.creatlayer(Shoulayname, col);
45
+                layerscontrol1.movelayertofront(Shoulayname);
46
+            }
47
+            else
48
+                layerscontrol1.movelayertofront(Shoulayname);
49
+
50
+
51
+            if (ids == null)
52
+                return;
53
+
54
+            for (int i = 0; i < ids.Length; i++)
55
+            {
56
+                Polyline pll = BasicFunction.GetDBObject(ids[i]) as Polyline;
57
+                if (Math.Round(pll.Elevation, 7, MidpointRounding.AwayFromZero) % (gap * 5) == 0 && pll.Layer != "8120")
58
+                {
59
+                    ChangeLayer(pll.Id, Jilayname);
60
+                }
61
+                if (Math.Round(pll.Elevation, 7, MidpointRounding.AwayFromZero) % (gap * 5) != 0 && pll.Layer != "8110")
62
+                {
63
+                    ChangeLayer(pll.Id, Shoulayname);
64
+                }
65
+                else
66
+                    continue;
67
+            }
68
+        }
69
+
70
+        
71
+
72
+
73
+        /// <summary>
74
+        /// 将计曲线移动到相应图层
75
+        /// </summary>
76
+        private void ChangeLayer(ObjectId c1Id, string LayerName)
77
+        {
78
+            Database db = HostApplicationServices.WorkingDatabase;
79
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
80
+            using (Transaction trans = db.TransactionManager.StartTransaction())
81
+            {
82
+                BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead);
83
+                BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
84
+                Entity ent1 = (Entity)c1Id.GetObject(OpenMode.ForWrite);
85
+                ent1.Layer = LayerName;
86
+                trans.Commit();
87
+            }
88
+            doclock.Dispose();
89
+        }
90
+    }
91
+}

+ 227
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InsertDOM.cs ファイルの表示

@@ -0,0 +1,227 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using GrxCAD.EditorInput;
4
+using GrxCAD.Geometry;
5
+using GrxCAD.Runtime;
6
+using System;
7
+using System.Collections.Generic;
8
+using System.IO;
9
+using System.Linq;
10
+using System.Text;
11
+using System.Threading.Tasks;
12
+using System.Windows;
13
+using System.Windows.Forms;
14
+
15
+namespace HCTools
16
+{
17
+    public class InsertDOM
18
+    {
19
+        public static string dompath;//DOM文件所在位置
20
+        public static string dwgpath;//DWG文件所在位置
21
+        public void InsertDOMToCAD()
22
+        {
23
+            List<String> dwgname = GetNameList(dwgpath, ".dwg");//获取dwg文件
24
+            if (dwgname.Count == 0)
25
+            {
26
+                MessageBox.Show("没有找到dwg文件!", "警告");
27
+                return;
28
+            }
29
+            List<String> tifname = GetNameList(dompath, ".tif");//获取tif文件
30
+            tifname.AddRange(GetNameList(dompath, ".Tif"));
31
+            if (tifname.Count == 0)
32
+            {
33
+                MessageBox.Show("没有找到dom文件!", "警告");
34
+                return;
35
+            }
36
+            List<String> tfwname = new List<string>();//tfw文件
37
+            List<String> errolist = new List<string>();//无法找到对应tif的dwg文件
38
+            foreach (String name in tifname)
39
+            {
40
+                if (name.Contains("tif"))
41
+                    tfwname.Add(name.Replace(".tif", ".tfw"));
42
+                else
43
+                    tfwname.Add(name.Replace(".Tif", ".tfw"));
44
+            }
45
+            for (int filenum = 0; filenum < dwgname.Count; filenum++)
46
+            {
47
+                string dwg = dwgpath + "\\" + dwgname[filenum];
48
+                if(tifname.Contains(dwgname[filenum].Replace(".dwg", ".tif"))||
49
+                    tifname.Contains(dwgname[filenum].Replace(".dwg", ".Tif")))
50
+                {
51
+                    Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.Add(dwg);//将dwg添加到cad中
52
+                    for (int i = 0; i < tifname.Count; i++)
53
+                    {
54
+                        //筛选与dwg同名的tif,并将tif插入到dwg中
55
+                        if (tifname[i] == (dwgname[filenum].Replace(".dwg", ".tif"))||
56
+                            tifname[i] == (dwgname[filenum].Replace(".dwg", ".Tif")))
57
+                        {
58
+                            InsertDOMs(tifname[i], tfwname[i], doc);
59
+                            tifname.RemoveAt(i);
60
+                            tfwname.RemoveAt(i);
61
+                            break;
62
+                        }
63
+                    }
64
+                }
65
+                else
66
+                {
67
+                    errolist.Add(dwgname[filenum]);
68
+                }
69
+            }
70
+            if (errolist.Count == 0)
71
+                MessageBox.Show("所有DOM插入成功","提示");
72
+            else
73
+            {
74
+                string erromsg=string.Empty;
75
+                foreach(string dwg in errolist)
76
+                {
77
+                    erromsg += dwg+"\n";
78
+                }
79
+                MessageBox.Show(erromsg+"无法找到与之匹配的tif图,插入失败!","警告");
80
+            }
81
+        }
82
+
83
+
84
+        /// <summary>
85
+        /// 获取文件夹中相应格式的所有文件
86
+        /// </summary>
87
+        private static List<String> GetNameList(String filespath, String filetype)
88
+        {
89
+            DirectoryInfo root = new DirectoryInfo(filespath);
90
+            List<String> filename = new List<string>();     //文件名
91
+            FileInfo[] files = root.GetFiles();
92
+            foreach (FileInfo file in files)
93
+            {
94
+                if (file.Name.Substring(file.Name.Length - 4, 4) != filetype)
95
+                    continue;
96
+                else
97
+                    filename.Add(file.Name);
98
+            }
99
+            return filename;
100
+        }
101
+
102
+
103
+        /// <summary>
104
+        /// 插入DOM
105
+        /// </summary>
106
+        public void InsertDOMs(string tiffilename, string tfwfilename, Document doc)
107
+        {
108
+            Database db = doc.Database;
109
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
110
+            ObjectIdCollection obidcoll = new ObjectIdCollection();
111
+            string imageName = new FileInfo(tiffilename).Name;
112
+            double scale = 0;
113
+            double X = 0, Y = 0;
114
+            try
115
+            {
116
+                StreamReader sr = new StreamReader(dompath + "\\" + tfwfilename);
117
+                scale = Convert.ToDouble(sr.ReadLine());
118
+                sr.ReadLine();
119
+                sr.ReadLine();
120
+                sr.ReadLine();
121
+                X = Convert.ToDouble(sr.ReadLine());
122
+                Y = Convert.ToDouble(sr.ReadLine());
123
+                sr.Close();
124
+                sr.Dispose();
125
+            }
126
+            catch (System.Exception ex)
127
+            {
128
+                MessageBox.Show("警告:" + tiffilename + "图像没有相应的.tfw文件或tfw文件出错,无法正确插入!\r\n\r\n");
129
+            }
130
+
131
+            using (DocumentLock docLock = doc.LockDocument())
132
+            {
133
+                using (Transaction tran = db.TransactionManager.StartTransaction())
134
+                {
135
+                    //建立名为DOM的图层
136
+                    LayerTable lt = tran.GetObject(db.LayerTableId, OpenMode.ForWrite) as LayerTable;
137
+                    try
138
+                    {
139
+                        if (!lt.Has("DOM"))
140
+                        {
141
+                            LayerTableRecord ltrec = new LayerTableRecord();
142
+                            ltrec.Name = "DOM";
143
+                            ObjectId obid = lt.Add(ltrec);
144
+                            tran.AddNewlyCreatedDBObject(ltrec, true);
145
+                        }
146
+                    }
147
+                    catch (GrxCAD.Runtime.Exception ex)
148
+                    {
149
+                        MessageBox.Show(ex.ToString());
150
+                    }
151
+                    tran.Commit();
152
+                }
153
+                using (Transaction tran = db.TransactionManager.StartTransaction())
154
+                {
155
+                    //插入DOM
156
+                    BlockTable blktbl = tran.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
157
+                    BlockTableRecord blktblrec = tran.GetObject(blktbl[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;
158
+                    DrawOrderTable dot = tran.GetObject(blktblrec.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
159
+                    try
160
+                    {
161
+                        #region
162
+                        //RasterImageDef dom = new RasterImageDef();
163
+                        ////domimage.TransformBy();
164
+                        //dom.ActiveFileName = domfilename;
165
+                        ////dom.OpenImage();
166
+                        //dom.Load();
167
+                        //dom.ImageModified = true;
168
+                        //dom.OpenImage();
169
+                        //dom.Embed();                        
170
+                        //RasterImage domimage = new RasterImage();
171
+                        ////Matrix3d.Mirroring();//将栅格图像坐标关于Y轴镜像还原
172
+                        ////Matrix3d.Displacement();//在Y轴正方向上移动图像原始高度距离
173
+                        ////domimage.TransformBy();//最后用6参数组织缩放、旋转、移动的变换矩阵                       
174
+                        //tran.AddNewlyCreatedDBObject(dom, true);
175
+                        //tran.Commit();
176
+                        ///////////////////
177
+                        //RasterImage domimage = new RasterImage();
178
+                        //PromptEntityOptions prent = new PromptEntityOptions("\n请选择山歌图像");
179
+                        //prent.SetRejectMessage("\n选择的不是栅格图像");
180
+                        //prent.AddAllowedClass(typeof(RasterImage), true);
181
+                        //PromptEntityResult prentres = ed.GetEntity(prent);
182
+                        //if (prentres.Status != PromptStatus.OK)
183
+                        //    return;
184
+                        //Matrix3d transform;
185
+                        //ObjectId imgid = prentres.ObjectId;
186
+                        //domimage = (RasterImage)tran.GetObject(imgid, OpenMode.ForRead);
187
+                        //transform = domimage.PixelToModelTransform;
188
+                        #endregion
189
+                        //////////////////////创建图像定义对象
190
+                        ObjectId imgid = RasterImageDef.GetImageDictionary(db);
191
+                        if (imgid == ObjectId.Null)
192
+                            imgid = RasterImageDef.CreateImageDictionary(db);
193
+                        DBDictionary imgdict = tran.GetObject(imgid, OpenMode.ForWrite) as DBDictionary;
194
+                        RasterImageDef imgdef = new RasterImageDef();
195
+                        imgdef.SourceFileName = dompath + "\\" + tiffilename;
196
+                        imgdef.Load();
197
+                        ObjectId imgdefid = imgdict.SetAt(imageName, imgdef);
198
+                        tran.AddNewlyCreatedDBObject(imgdef, true);
199
+                        RasterImage image = new RasterImage();
200
+                        image.ImageDefId = imgdefid;
201
+                        image.Layer = "DOM";
202
+                        blktblrec.AppendEntity(image);
203
+                        tran.AddNewlyCreatedDBObject(image, true);
204
+                        double height = imgdef.Size.Y;
205
+                        Vector3d vt1 = scale * image.Orientation.Xaxis;
206
+                        Vector3d vt2 = scale * image.Orientation.Yaxis;
207
+                        image.AssociateRasterDef(imgdef);
208
+                        //image.Draw();
209
+
210
+                        image.Orientation = new CoordinateSystem3d(new Point3d(X, Y - height * scale, 0), vt1, vt2);
211
+                        //影像后置
212
+                        obidcoll.Add(image.ObjectId);
213
+                        dot.MoveToBottom(obidcoll);
214
+                        obidcoll = new ObjectIdCollection();
215
+                        tran.Commit();
216
+                        GrxCAD.ApplicationServices.Application.UpdateScreen();
217
+                    }
218
+                    catch (GrxCAD.Runtime.Exception ex)
219
+                    {
220
+                        MessageBox.Show(ex.ToString());
221
+                    }
222
+                }
223
+            }
224
+            doc.CloseAndSave(db.Filename);
225
+        }
226
+    }
227
+}

+ 132
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InstDOM.Designer.cs ファイルの表示

@@ -0,0 +1,132 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class InstDOM
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.label2 = new System.Windows.Forms.Label();
34
+            this.textBox_dom = new System.Windows.Forms.TextBox();
35
+            this.textBox_dwg = new System.Windows.Forms.TextBox();
36
+            this.button_ok = new System.Windows.Forms.Button();
37
+            this.button_choose1 = new System.Windows.Forms.Button();
38
+            this.button_choose2 = new System.Windows.Forms.Button();
39
+            this.SuspendLayout();
40
+            // 
41
+            // label1
42
+            // 
43
+            this.label1.AutoSize = true;
44
+            this.label1.Location = new System.Drawing.Point(35, 46);
45
+            this.label1.Name = "label1";
46
+            this.label1.Size = new System.Drawing.Size(136, 15);
47
+            this.label1.TabIndex = 0;
48
+            this.label1.Text = "DOM文件所在位置:";
49
+            // 
50
+            // label2
51
+            // 
52
+            this.label2.AutoSize = true;
53
+            this.label2.Location = new System.Drawing.Point(35, 105);
54
+            this.label2.Name = "label2";
55
+            this.label2.Size = new System.Drawing.Size(136, 15);
56
+            this.label2.TabIndex = 1;
57
+            this.label2.Text = "DWG文件所在位置:";
58
+            // 
59
+            // textBox_dom
60
+            // 
61
+            this.textBox_dom.Location = new System.Drawing.Point(168, 36);
62
+            this.textBox_dom.Name = "textBox_dom";
63
+            this.textBox_dom.Size = new System.Drawing.Size(325, 25);
64
+            this.textBox_dom.TabIndex = 2;
65
+            // 
66
+            // textBox_dwg
67
+            // 
68
+            this.textBox_dwg.Location = new System.Drawing.Point(168, 95);
69
+            this.textBox_dwg.Name = "textBox_dwg";
70
+            this.textBox_dwg.Size = new System.Drawing.Size(325, 25);
71
+            this.textBox_dwg.TabIndex = 3;
72
+            // 
73
+            // button_ok
74
+            // 
75
+            this.button_ok.Location = new System.Drawing.Point(277, 144);
76
+            this.button_ok.Name = "button_ok";
77
+            this.button_ok.Size = new System.Drawing.Size(74, 33);
78
+            this.button_ok.TabIndex = 4;
79
+            this.button_ok.Text = "确 定";
80
+            this.button_ok.UseVisualStyleBackColor = true;
81
+            this.button_ok.Click += new System.EventHandler(this.button_ok_Click);
82
+            // 
83
+            // button_choose1
84
+            // 
85
+            this.button_choose1.Location = new System.Drawing.Point(509, 31);
86
+            this.button_choose1.Name = "button_choose1";
87
+            this.button_choose1.Size = new System.Drawing.Size(76, 31);
88
+            this.button_choose1.TabIndex = 5;
89
+            this.button_choose1.Text = "选 择";
90
+            this.button_choose1.UseVisualStyleBackColor = true;
91
+            this.button_choose1.Click += new System.EventHandler(this.button_choose1_Click);
92
+            // 
93
+            // button_choose2
94
+            // 
95
+            this.button_choose2.Location = new System.Drawing.Point(509, 89);
96
+            this.button_choose2.Name = "button_choose2";
97
+            this.button_choose2.Size = new System.Drawing.Size(76, 31);
98
+            this.button_choose2.TabIndex = 6;
99
+            this.button_choose2.Text = "选 择";
100
+            this.button_choose2.UseVisualStyleBackColor = true;
101
+            this.button_choose2.Click += new System.EventHandler(this.button_choose2_Click);
102
+            // 
103
+            // InstDOM
104
+            // 
105
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
106
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
107
+            this.ClientSize = new System.Drawing.Size(641, 200);
108
+            this.Controls.Add(this.button_choose2);
109
+            this.Controls.Add(this.button_choose1);
110
+            this.Controls.Add(this.button_ok);
111
+            this.Controls.Add(this.textBox_dwg);
112
+            this.Controls.Add(this.textBox_dom);
113
+            this.Controls.Add(this.label2);
114
+            this.Controls.Add(this.label1);
115
+            this.Name = "InstDOM";
116
+            this.Text = "InstDOM";
117
+            this.ResumeLayout(false);
118
+            this.PerformLayout();
119
+
120
+        }
121
+
122
+        #endregion
123
+
124
+        private System.Windows.Forms.Label label1;
125
+        private System.Windows.Forms.Label label2;
126
+        private System.Windows.Forms.TextBox textBox_dom;
127
+        private System.Windows.Forms.TextBox textBox_dwg;
128
+        private System.Windows.Forms.Button button_ok;
129
+        private System.Windows.Forms.Button button_choose1;
130
+        private System.Windows.Forms.Button button_choose2;
131
+    }
132
+}

+ 45
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InstDOM.cs ファイルの表示

@@ -0,0 +1,45 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.ComponentModel;
4
+using System.Data;
5
+using System.Drawing;
6
+using System.Linq;
7
+using System.Text;
8
+using System.Threading.Tasks;
9
+using System.Windows.Forms;
10
+
11
+namespace HCTools
12
+{
13
+    public partial class InstDOM : Form
14
+    {
15
+        public InstDOM()
16
+        {
17
+            InitializeComponent();
18
+        }
19
+
20
+        private void button_choose1_Click(object sender, EventArgs e)
21
+        {
22
+            FolderBrowserDialog open = new FolderBrowserDialog();
23
+            open.Description = "请选择文件夹";
24
+            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
25
+                textBox_dom.Text = open.SelectedPath;
26
+        }
27
+
28
+        private void button_choose2_Click(object sender, EventArgs e)
29
+        {
30
+            FolderBrowserDialog open = new FolderBrowserDialog();
31
+            open.Description = "请选择文件夹";
32
+            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
33
+                textBox_dwg.Text = open.SelectedPath;
34
+        }
35
+
36
+        private void button_ok_Click(object sender, EventArgs e)
37
+        {
38
+            InsertDOM.dompath = textBox_dom.Text.ToString();
39
+            InsertDOM.dwgpath = textBox_dwg.Text.ToString();
40
+            InsertDOM instdom = new InsertDOM();
41
+            instdom.InsertDOMToCAD();
42
+            this.Close();
43
+        }
44
+    }
45
+}

+ 120
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/InstDOM.resx ファイルの表示

@@ -0,0 +1,120 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 579
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Inters.cs ファイルの表示

@@ -0,0 +1,579 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using GrxCAD.ApplicationServices;
8
+using GrxCAD.DatabaseServices;
9
+using GrxCAD.EditorInput;
10
+using GrxCAD.Geometry;
11
+
12
+namespace HCTools
13
+{
14
+    class Inters
15
+    {
16
+        public static int blc;//比例尺
17
+        public static string jqx;
18
+        public static string sqx;
19
+
20
+        //由于AUTOCAD的IntersectWith()函数在实体离开原点过远的情况下精确度会大幅下降,
21
+        //在进行相交检查时需要将待检查的实体都添加到一个块中,移动块到原点再进行检查,
22
+        //将检查后的标记也添加到块中,检查完后移动回原位。
23
+        #region 线自相交
24
+        public void SelfInts()
25
+        {
26
+            double flagradius = 4.0 * blc / 1000;//画圆标记半径
27
+            string layername = jqx + "," + sqx;
28
+
29
+            Document doc = Application.DocumentManager.MdiActiveDocument;
30
+            Database db = doc.Database;
31
+            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
32
+
33
+            TypedValue[] value = new TypedValue[]
34
+            {
35
+                new TypedValue((int)DxfCode.LayerName,layername),
36
+                new TypedValue((int)DxfCode.Start,"LWPOLYLINE")
37
+            };//设置筛选条件
38
+            SelectionFilter filter = new SelectionFilter(value);//选择区域中全部对象
39
+            //PromptSelectionResult psr = ed.SelectAll(filter);// 要求在图形区域中手动选择对象
40
+            PromptSelectionResult psr = ed.GetSelection(filter);
41
+            
42
+            if (psr.Status == PromptStatus.OK)
43
+            {
44
+                Point3dCollection intersectPts = new Point3dCollection();
45
+                int j = 0;
46
+
47
+                SelectionSet ss = psr.Value;
48
+                if (ss == null)
49
+                    return;
50
+
51
+                //创建标注相交点符号的图层
52
+                LayerControl layerscontrol = new LayerControl();
53
+                string layname = "线自相交点";
54
+                if (!layerscontrol.haslayername(layname))
55
+                {
56
+                    colorgb col = new colorgb(255, 0, 255);
57
+                    layerscontrol.creatlayer(layname, col);
58
+                    layerscontrol.movelayertofront(layname);
59
+                }
60
+                else
61
+                    layerscontrol.movelayertofront(layname);
62
+
63
+                ObjectIdCollection idcoll1 = new ObjectIdCollection(ss.GetObjectIds());//需要添加到块中的实体
64
+                ObjectIdCollection idcoll2 = new ObjectIdCollection();//explode后重新添加到数据库的实体
65
+                ObjectIdCollection idcoll3 = new ObjectIdCollection();//添加标记后实体
66
+                Point3d MoveToPt = new Point3d(0, 0, 0);//目标点
67
+                Point3d SelfPt = new Point3d();//基点
68
+
69
+                //将选中多段线添加到块中并移动
70
+                DBObjectCollection objcoll = MovebyBlock(idcoll1, out SelfPt, MoveToPt);
71
+
72
+                //将explode之后的实体重新添加到数据库中并检查是否自相交
73
+                foreach (Polyline ent in objcoll)
74
+                {
75
+                    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
76
+                    using (Transaction trans = db.TransactionManager.StartTransaction())
77
+                    {
78
+                        BlockTable blocktable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
79
+                        BlockTableRecord blocktablerecord = trans.GetObject(blocktable[BlockTableRecord.ModelSpace],
80
+                            OpenMode.ForWrite) as BlockTableRecord;
81
+                        blocktablerecord.AppendEntity(ent);
82
+                        trans.AddNewlyCreatedDBObject(ent, true);
83
+                        idcoll2.Add(ent.Id);
84
+                        trans.Commit();
85
+                    }
86
+                    doclock.Dispose();
87
+                }
88
+
89
+                for(int i =0;i<idcoll2.Count;i++)
90
+                {
91
+                    Polyline pll = BasicFunction.GetDBObject(idcoll2[i]) as Polyline;
92
+                    SelfIntersectDetect(pll, out intersectPts);
93
+                    idcoll3.Add(idcoll2[i]);
94
+                    if (intersectPts.Count != 0)
95
+                    {
96
+                        j += intersectPts.Count;
97
+                        foreach (Point3d pt in intersectPts)
98
+                        {
99
+                            Makeflag(pt.X, pt.Y, pt.Z, flagradius, "线自相交点", idcoll3);
100
+                        }
101
+                    }
102
+                    else
103
+                        continue;
104
+                }
105
+
106
+                //将检查后的所有实体添加到块中并移动
107
+                Point3d Self = new Point3d();
108
+                Point3d MoveTo = SelfPt;
109
+                DBObjectCollection objcoll1 = MovebyBlock(idcoll3, out Self, MoveTo);
110
+
111
+                //将explode之后的实体添加到数据库中
112
+                foreach (Entity ent in objcoll1)
113
+                {
114
+                    ObjectIdCollection idcoll = new ObjectIdCollection();
115
+
116
+                    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
117
+                    using (Transaction trans = db.TransactionManager.StartTransaction())
118
+                    {
119
+                        BlockTable blocktable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
120
+                        BlockTableRecord blocktablerecord = trans.GetObject(blocktable[BlockTableRecord.ModelSpace],
121
+                            OpenMode.ForWrite) as BlockTableRecord;
122
+                        blocktablerecord.AppendEntity(ent);
123
+                        trans.AddNewlyCreatedDBObject(ent, true);
124
+                        DrawOrderTable orderTable = trans.GetObject(blocktablerecord.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
125
+                        idcoll.Add(ent.Id);
126
+                        orderTable.MoveToBottom(idcoll);
127
+                        trans.Commit();
128
+                    }
129
+                    doclock.Dispose();
130
+                }
131
+                ed.WriteMessage("有" + j.ToString() + "个交点");
132
+            }
133
+        }
134
+
135
+        /// <summary>
136
+        /// 线自相交检查
137
+        /// </summary>
138
+        private static bool SelfIntersectDetect(Polyline pPolyline, out Point3dCollection intersectPoint3Ds)
139
+        {
140
+            intersectPoint3Ds = new Point3dCollection();
141
+            try
142
+            {
143
+                // 自身与自身相交结果(包含顶点和相交点)
144
+                var intersectWithResult = new Point3dCollection();
145
+                //pPolyline.IntersectWith(pPolyline, Intersect.OnBothOperands, intersectWithResult, IntPtr.Zero, IntPtr.Zero);
146
+
147
+                // 存储顶点
148
+                List<Point3d> vertices = new List<Point3d>();
149
+                int count = pPolyline.NumberOfVertices;
150
+                for (int j = 0; j < count; j++)
151
+                {
152
+                    Point3d pt = pPolyline.GetPoint3dAt(j);
153
+                    //Point3d pt1 = new Point3d(Math.Round(pt.X, 6), Math.Round(pt.Y, 6), Math.Round(pt.Z, 6));
154
+                    vertices.Add(pt);
155
+                }
156
+                for (int i = 0; i < count - 2; i++)
157
+                {
158
+                    LineSegment3d lsgment0 = pPolyline.GetLineSegmentAt(i);
159
+                    for (int ii = i + 1; ii < count - 1; ii++)
160
+                    {
161
+                        LineSegment3d lsgment1 = pPolyline.GetLineSegmentAt(ii);
162
+                        Point3d[] itpt = lsgment0.IntersectWith(lsgment1);
163
+                        if (itpt != null)
164
+                        {
165
+                            foreach (Point3d pt in itpt)
166
+                            {
167
+                                intersectWithResult.Add(pt);
168
+                            }
169
+                        }
170
+                    }
171
+                    if (i == 0)
172
+                    {
173
+                        if (intersectWithResult.Count > 1)
174
+                        {
175
+                            for (int j = 0; j < intersectWithResult.Count - 1; j++)
176
+                            {
177
+                                for (int jj = j + 1; jj < intersectWithResult.Count; jj++)
178
+                                {
179
+                                    if (intersectWithResult[j] == intersectWithResult[jj]&&
180
+                                        !intersectPoint3Ds.Contains(intersectWithResult[jj]))
181
+                                    {
182
+                                        intersectPoint3Ds.Add(intersectWithResult[jj]);
183
+                                    }
184
+                                }
185
+                            }
186
+                            foreach (Point3d pt in intersectWithResult)
187
+                            {
188
+                                if (pt == vertices[1])
189
+                                    continue;
190
+                                else
191
+                                { 
192
+                                    if(!intersectPoint3Ds.Contains(pt))
193
+                                        intersectPoint3Ds.Add(pt);
194
+                                }
195
+                            }
196
+                        }
197
+                    }
198
+                    else if (i == count - 3)
199
+                    {
200
+                        if (intersectWithResult.Count > 1)
201
+                        {
202
+                            for (int j = 0; j < intersectWithResult.Count - 1; j++)
203
+                            {
204
+                                for (int jj = j + 1; jj < intersectWithResult.Count; jj++)
205
+                                {
206
+                                    if (intersectWithResult[j] == intersectWithResult[jj] &&
207
+                                        !intersectPoint3Ds.Contains(intersectWithResult[jj]))
208
+                                    {
209
+                                        intersectPoint3Ds.Add(intersectWithResult[jj]);
210
+                                    }
211
+                                }
212
+                            }
213
+                            foreach (Point3d pt in intersectWithResult)
214
+                            {
215
+                                if (pt == vertices[i])
216
+                                    continue;
217
+                                else
218
+                                {
219
+                                    if (!intersectPoint3Ds.Contains(pt))
220
+                                        intersectPoint3Ds.Add(pt);
221
+                                }
222
+                            }
223
+                        }
224
+                    }
225
+                    else
226
+                    {
227
+                        if (intersectWithResult.Count > 1)
228
+                        {
229
+                            for (int j = 0; j < intersectWithResult.Count - 1; j++)
230
+                            {
231
+                                for (int jj = j + 1; jj < intersectWithResult.Count; jj++)
232
+                                {
233
+                                    if (intersectWithResult[j] == intersectWithResult[jj] &&
234
+                                        !intersectPoint3Ds.Contains(intersectWithResult[jj]))
235
+                                    {
236
+                                        intersectPoint3Ds.Add(intersectWithResult[jj]);
237
+                                    }
238
+                                }
239
+                            }
240
+                            foreach (Point3d pt in intersectWithResult)
241
+                            {
242
+                                if (pt == vertices[i]||pt == vertices[i + 1])
243
+                                    continue;
244
+                                else
245
+                                {
246
+                                    if (!intersectPoint3Ds.Contains(pt))
247
+                                        intersectPoint3Ds.Add(pt);
248
+                                }
249
+                            }
250
+                        }
251
+                    }
252
+                    intersectWithResult.Clear();
253
+                }
254
+                return true;
255
+            }
256
+            catch (Exception ex)
257
+            {
258
+                string str = ex.ToString();
259
+                Application.ShowAlertDialog(str);
260
+                return false;
261
+            }
262
+        }
263
+        #endregion
264
+
265
+
266
+
267
+
268
+        #region 线相交
269
+        public void Ints()
270
+        {
271
+            double flagradius = 4.0 * blc / 1000;//画圆标记半径
272
+
273
+            Document doc = Application.DocumentManager.MdiActiveDocument;
274
+            Database db = doc.Database;
275
+            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
276
+            string layername = jqx + "," + sqx;
277
+
278
+            TypedValue[] value = new TypedValue[]
279
+            {
280
+                new TypedValue((int)DxfCode.LayerName,layername),
281
+                new TypedValue((int)DxfCode.Start,"LWPOLYLINE")
282
+            };//设置筛选条件
283
+            SelectionFilter filter = new SelectionFilter(value);//选择区域中全部对象
284
+            //PromptSelectionResult psr = ed.SelectAll(filter);// 要求在图形区域中手动选择对象
285
+            PromptSelectionResult psr = ed.GetSelection(filter);
286
+
287
+
288
+            if (psr.Status == PromptStatus.OK)
289
+            {
290
+                List<Point3d> intersectPts = new List<Point3d>();
291
+                int j = 0;
292
+
293
+                SelectionSet ss = psr.Value;
294
+                if (ss == null)
295
+                    return;
296
+
297
+                //创建标注相交点符号的图层
298
+                LayerControl layerscontrol = new LayerControl();
299
+                string layname = "线相交点";
300
+                if (!layerscontrol.haslayername(layname))
301
+                {
302
+                    colorgb col = new colorgb(0, 0, 255);
303
+                    layerscontrol.creatlayer(layname, col);
304
+                    layerscontrol.movelayertofront(layname);
305
+                }
306
+                else
307
+                    layerscontrol.movelayertofront(layname);
308
+
309
+
310
+                ObjectIdCollection idcoll1 = new ObjectIdCollection(ss.GetObjectIds());//需要添加到块中的实体
311
+                ObjectIdCollection idcoll2 = new ObjectIdCollection();//explode之后的实体
312
+                Point3d MoveToPt = new Point3d(0, 0, 0);//目标点
313
+                Point3d SelfPt = new Point3d();//基点
314
+
315
+                //将选中多段线添加到块中并移动
316
+                DBObjectCollection objcoll = MovebyBlock(idcoll1, out SelfPt, MoveToPt);
317
+
318
+                //将explode之后的实体重新添加到数据库中
319
+                foreach (Entity ent in objcoll)
320
+                {
321
+                    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
322
+                    using (Transaction trans = db.TransactionManager.StartTransaction())
323
+                    {
324
+                        BlockTable blocktable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
325
+                        BlockTableRecord blocktablerecord = trans.GetObject(blocktable[BlockTableRecord.ModelSpace],
326
+                            OpenMode.ForWrite) as BlockTableRecord;
327
+                        blocktablerecord.AppendEntity(ent);
328
+                        trans.AddNewlyCreatedDBObject(ent, true);
329
+                        idcoll2.Add(ent.Id);
330
+                        trans.Commit();
331
+                    }
332
+                    doclock.Dispose();
333
+                }
334
+
335
+                #region//检查线相交情况
336
+                ////检查线相交情况
337
+                //int num = 0;
338
+                //int numb = 0;//记录无法判断的实体数量
339
+                //ObjectIdCollection objidcoll_check = new ObjectIdCollection();
340
+                //List<Point3d> interpoint = new List<Point3d>();
341
+                //for (int i = 0; i < objcoll.Count; i++)
342
+                //{
343
+                //    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
344
+                //    using (Transaction trans = db.TransactionManager.StartTransaction())
345
+                //    {
346
+                //        Polyline pll1 = trans.GetObject(objcoll[i].Id, OpenMode.ForWrite) as Polyline;
347
+                //        ObjectIdCollection pllids = GetIntersectPlline(pll1,out num);//获取附近多段线
348
+                //        numb = numb + num;
349
+
350
+                //        //根据获取的多段线进行相交检查
351
+                //        for (int ii = 0; ii < pllids.Count; ii++)
352
+                //        {
353
+                //            if (objidcoll_check.Contains(pllids[ii]))
354
+                //                continue;
355
+                //            Polyline pll2 = trans.GetObject(pllids[ii], OpenMode.ForWrite) as Polyline;
356
+                //            EachIntersect(pll1, pll2, out intersectPts);
357
+                //            foreach (Point3d pt in intersectPts)
358
+                //            {
359
+                //                interpoint.Add(pt);
360
+                //            }
361
+                //        }
362
+                //        if (intersectPts.Count != 0)
363
+                //            objidcoll_check.Add(objcoll[i].Id);
364
+
365
+                //        trans.Commit();
366
+                //        doclock.Dispose();
367
+                //    }
368
+                //}
369
+                #endregion
370
+
371
+                //检查线相交情况
372
+                ObjectIdCollection objidcoll_check = new ObjectIdCollection();
373
+                List<Point3d> interpoint = new List<Point3d>();
374
+                for (int i = 0; i < objcoll.Count - 1; i++)
375
+                {
376
+                    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
377
+                    using (Transaction trans = db.TransactionManager.StartTransaction())
378
+                    {
379
+                        Polyline pll1 = trans.GetObject(objcoll[i].Id, OpenMode.ForWrite) as Polyline;
380
+                        for (int ii = i + 1; ii < objcoll.Count; ii++)
381
+                        {
382
+                            Polyline pll2 = trans.GetObject(objcoll[ii].Id, OpenMode.ForWrite) as Polyline;
383
+                            EachIntersect(pll1, pll2, out intersectPts);
384
+                            foreach (Point3d pt in intersectPts)
385
+                            {
386
+                                interpoint.Add(pt);
387
+                            }
388
+                        }
389
+                        if (intersectPts.Count != 0)
390
+                            objidcoll_check.Add(objcoll[i].Id);
391
+
392
+                        trans.Commit();
393
+                        doclock.Dispose();
394
+                    }
395
+
396
+                    if (interpoint.Count != 0)
397
+                    {
398
+                        j = interpoint.Count;
399
+                        foreach (Point3d pt in interpoint)
400
+                        {
401
+                            Makeflag(pt.X, pt.Y, pt.Z, flagradius, "线相交点", idcoll2);
402
+                        }
403
+                    }
404
+                }
405
+
406
+                //将检查后的实体都添加到块中并移动
407
+                Point3d Self = new Point3d();
408
+                Point3d MoveTo = SelfPt;
409
+                DBObjectCollection objcoll1 = MovebyBlock(idcoll2, out Self, MoveTo);
410
+
411
+                //将explode之后的实体添加到数据库中
412
+                foreach (Entity ent in objcoll1)
413
+                {
414
+                    ObjectIdCollection idcoll = new ObjectIdCollection();
415
+
416
+                    DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
417
+                    using (Transaction trans = db.TransactionManager.StartTransaction())
418
+                    {
419
+                        BlockTable blocktable = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
420
+                        BlockTableRecord blocktablerecord = trans.GetObject(blocktable[BlockTableRecord.ModelSpace],
421
+                            OpenMode.ForWrite) as BlockTableRecord;
422
+                        blocktablerecord.AppendEntity(ent);
423
+                        trans.AddNewlyCreatedDBObject(ent, true);
424
+                        DrawOrderTable orderTable = trans.GetObject(blocktablerecord.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable;
425
+                        idcoll.Add(ent.Id);
426
+                        orderTable.MoveToBottom(idcoll);
427
+                        trans.Commit();
428
+                    }
429
+                    doclock.Dispose();
430
+                }
431
+                ed.WriteMessage("有" + j.ToString() + "个交点");
432
+                //ed.WriteMessage("\n有" + numb.ToString() + "处无法判断");
433
+            }
434
+        }
435
+
436
+
437
+        /// <summary>
438
+        /// 获取附近多段线
439
+        /// </summary>
440
+        private static ObjectIdCollection GetIntersectPlline(Polyline pll, out int num)
441
+        {
442
+            num = 0;
443
+            ObjectIdCollection objidcoll = new ObjectIdCollection();
444
+            DBObjectCollection objcoll = new DBObjectCollection();
445
+            Editor editor = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
446
+            Point3dCollection ptcoll = new Point3dCollection();
447
+
448
+            //检查是否有相交线
449
+            pll.GetStretchPoints(ptcoll);
450
+
451
+            TypedValue[] vl = new TypedValue[]
452
+            {
453
+                new TypedValue((int)DxfCode.LayerName,"8110,8120"),
454
+                new TypedValue((int)DxfCode.Start,"LWPOLYLINE")
455
+            };//设置筛选条件
456
+            SelectionFilter selefilter = new SelectionFilter(vl);//选择区域中全部对象
457
+            //PromptSelectionResult psr = ed.SelectAll(filter);// 要求在图形区域中手动选择对象
458
+
459
+
460
+            //SelectFence()无法找到不在当前视图的实体,需要将视图转移到实体所在的位置
461
+            dynamic acadApp = Application.AcadApplication;
462
+            acadApp.ZoomExtents();
463
+            PromptSelectionResult seleresult = editor.SelectFence(ptcoll, selefilter);
464
+            acadApp.ZoomPrevious();
465
+
466
+
467
+            if (seleresult.Status == PromptStatus.OK)
468
+            {
469
+                SelectionSet selectionset = seleresult.Value;
470
+                objidcoll = new ObjectIdCollection(selectionset.GetObjectIds());
471
+                if (objidcoll.Contains(pll.Id))
472
+                    objidcoll.Remove(pll.Id);
473
+            }
474
+            return objidcoll;
475
+        }
476
+
477
+
478
+        /// <summary>
479
+        /// 线相交检查
480
+        /// </summary>
481
+        private static bool EachIntersect(Polyline oPolyline, Polyline tPolyline, out List<Point3d> intersectPoint3Ds)
482
+        {
483
+            intersectPoint3Ds = new List<Point3d>();
484
+            try
485
+            {
486
+                //两线相交结果
487
+                var intersectWithResult = new Point3dCollection();
488
+                double temp = oPolyline.Elevation;
489
+                oPolyline.Elevation = tPolyline.Elevation;
490
+                oPolyline.IntersectWith(tPolyline, Intersect.OnBothOperands, intersectWithResult, IntPtr.Zero, IntPtr.Zero);
491
+
492
+                if (intersectWithResult.Count!=0)
493
+                {
494
+                    for (int i = 0; i < intersectWithResult.Count; i++)
495
+                        intersectPoint3Ds.Add(intersectWithResult[i]);
496
+                }
497
+                oPolyline.Elevation = temp;
498
+                return true;
499
+            }
500
+            catch (Exception ex)
501
+            {
502
+                string str = ex.ToString();
503
+                Application.ShowAlertDialog(str);
504
+                return false;
505
+            }
506
+        }
507
+        #endregion
508
+
509
+
510
+        /// <summary>
511
+        /// 将多段线添加到块后将块移动到目标位置并explode
512
+        /// </summary>
513
+        private static DBObjectCollection MovebyBlock(ObjectIdCollection idcoll, out Point3d SelfPt, Point3d MoveToPt)
514
+        {
515
+            Document doc = Application.DocumentManager.MdiActiveDocument;
516
+            Database db = doc.Database;
517
+
518
+            DBObjectCollection objcoll = new DBObjectCollection();//explode后的实体
519
+            ObjectId btrid = new ObjectId();//块id
520
+
521
+
522
+            DocumentLock documentlock1 = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
523
+            using (Transaction trans = db.TransactionManager.StartTransaction())
524
+            {
525
+                BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
526
+                BlockTableRecord btr = new BlockTableRecord();
527
+                Polyline pll = trans.GetObject(idcoll[0], OpenMode.ForRead) as Polyline;
528
+                btr.Name = "BLK";
529
+                bt.UpgradeOpen();
530
+                btrid = bt.Add(btr);
531
+                trans.AddNewlyCreatedDBObject(btr, true);
532
+                btr.AssumeOwnershipOf(idcoll);
533
+                btr.Origin = pll.StartPoint;
534
+                SelfPt = pll.StartPoint;
535
+
536
+                BlockTableRecord ms = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
537
+                BlockReference br = new BlockReference(pll.StartPoint, btrid);
538
+                Vector3d acVec3d = SelfPt.GetVectorTo(MoveToPt);
539
+                br.TransformBy(Matrix3d.Displacement(acVec3d));
540
+
541
+                ms.AppendEntity(br);
542
+                trans.AddNewlyCreatedDBObject(br, true);
543
+                br.Explode(objcoll);
544
+                btr.UpgradeOpen();
545
+                btr.Erase();
546
+                trans.Commit();
547
+            }
548
+            documentlock1.Dispose();
549
+            return objcoll;
550
+        }
551
+
552
+        /// <summary>
553
+        /// 错误标记
554
+        /// </summary>
555
+        private void Makeflag(double x, double y, double z, double radius, string layername, ObjectIdCollection idcoll)
556
+        {
557
+            Database database = HostApplicationServices.WorkingDatabase;
558
+            DocumentLock doclock = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
559
+            using (Transaction traction = database.TransactionManager.StartTransaction())
560
+            {
561
+                BlockTable blocktable = traction.GetObject(database.BlockTableId,OpenMode.ForWrite) as BlockTable;
562
+                BlockTableRecord blocktablerecord = traction.GetObject(blocktable[BlockTableRecord.ModelSpace],
563
+                                               OpenMode.ForWrite) as BlockTableRecord;
564
+                Circle circ = new Circle();
565
+                circ.Center = new Point3d(x, y, z);
566
+                circ.Radius = radius;
567
+                circ.Normal = new Vector3d(0, 0, 1);
568
+                circ.SetDatabaseDefaults();
569
+                circ.Layer = layername;
570
+                blocktablerecord.AppendEntity(circ);
571
+                traction.AddNewlyCreatedDBObject(circ, true);
572
+                idcoll.Add(circ.Id);
573
+                traction.Commit();
574
+                //traction.Dispose();
575
+            }
576
+            doclock.Dispose();
577
+        }
578
+    }
579
+}

+ 136
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/LayerChange.cs ファイルの表示

@@ -0,0 +1,136 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+using GrxCAD.ApplicationServices;
8
+using GrxCAD.DatabaseServices;
9
+using GrxCAD.EditorInput;
10
+using System.Collections;
11
+using GrxCAD.Geometry;
12
+using System.IO;
13
+using System.Windows.Forms;
14
+
15
+namespace HCTools
16
+{
17
+    class LayerChange
18
+    {
19
+        public static string dwgpath;//dwg文件所在位置
20
+        public static List<string> lys;//要删除/打开/关闭的图层
21
+        public static string savepath;//保存位置
22
+        public static int flag;
23
+
24
+        public void chagly()
25
+        {
26
+            try
27
+            {
28
+                List<String> dwgname = GetNameList(dwgpath, ".dwg");//获取dwg文件
29
+                if (dwgname.Count == 0)
30
+                {
31
+                    MessageBox.Show("没有找到dwg文件!", "警告");
32
+                    return;
33
+                }
34
+                foreach (string dwgfile in dwgname)
35
+                {
36
+                    string dwg = dwgpath + "\\" + dwgfile;
37
+                    Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.Add(dwg);
38
+                    if (flag == 0)
39
+                    {
40
+                        Delete(lys, doc, dwgfile);
41
+                    }
42
+                    else if (flag == 1)
43
+                    {
44
+                        Closely(lys, doc, dwgfile);
45
+                    }
46
+                    else if (flag == 2)
47
+                    {
48
+                        Openly(lys, doc, dwgfile);
49
+                    }
50
+                    doc.CloseAndDiscard();
51
+                }
52
+            }
53
+            catch (GrxCAD.Runtime.Exception ex)
54
+            {
55
+                GrxCAD.ApplicationServices.Application.ShowAlertDialog("Error:\n" + ex.Message);
56
+            }
57
+        }
58
+
59
+        private void Delete(List<string> lys, Document doc,string dwgfile)
60
+        {
61
+            Database database = doc.Database;
62
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
63
+            using (Transaction transaction = database.TransactionManager.StartTransaction())
64
+            {
65
+                LayerTable layerTable = transaction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
66
+                for (int i = 0; i < lys.Count; i++)
67
+                {
68
+                    LayerTableRecord layerTableRecord = transaction.GetObject(layerTable[lys[i]], OpenMode.ForWrite) as LayerTableRecord;
69
+                    if (database.Clayer == layerTableRecord.ObjectId)
70
+                    {
71
+                        database.Clayer = layerTable["0"];
72
+                    }
73
+                    layerTableRecord.Erase();
74
+                }
75
+                database.SaveAs(savepath + "\\" + dwgfile, DwgVersion.AC1024);
76
+                transaction.Commit();
77
+            }
78
+            ed.WriteMessage("删除成功!\n");
79
+        }
80
+
81
+        private void Openly(List<string> lys, Document doc, string dwgfile)
82
+        {
83
+            Database database = doc.Database;
84
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
85
+            using (Transaction transaction = database.TransactionManager.StartTransaction())
86
+            {
87
+                LayerTable layerTable = transaction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
88
+                for (int i = 0; i < lys.Count; i++)
89
+                {
90
+                    LayerTableRecord layerTableRecord = transaction.GetObject(layerTable[lys[i]], OpenMode.ForWrite) as LayerTableRecord;
91
+                    layerTableRecord.IsOff = false;
92
+                }
93
+                database.SaveAs(savepath + "\\" + dwgfile, DwgVersion.AC1024);
94
+                transaction.Commit();
95
+            }
96
+            ed.WriteMessage("打开成功!\n");
97
+        }
98
+
99
+        private void Closely(List<string> lys, Document doc, string dwgfile)
100
+        {
101
+            Database database = doc.Database;
102
+            Editor ed = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
103
+            using (Transaction transaction = database.TransactionManager.StartTransaction())
104
+            {
105
+                LayerTable layerTable = transaction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
106
+                for (int i = 0; i < lys.Count; i++)
107
+                {
108
+                    LayerTableRecord layerTableRecord = transaction.GetObject(layerTable[lys[i]], OpenMode.ForWrite) as LayerTableRecord;
109
+                    layerTableRecord.IsOff = true;
110
+                }
111
+                database.SaveAs(savepath + "\\" + dwgfile, DwgVersion.AC1024);
112
+                transaction.Commit();
113
+            }
114
+            ed.WriteMessage("关闭成功!\n");
115
+        }
116
+
117
+        /// <summary>
118
+        /// 获取文件夹中相应格式的所有文件
119
+        /// </summary>
120
+        private static List<String> GetNameList(String filespath, String filetype)
121
+        {
122
+            DirectoryInfo root = new DirectoryInfo(filespath);
123
+            List<String> filename = new List<string>();     //文件名
124
+            FileInfo[] files = root.GetFiles();
125
+            foreach (FileInfo file in files)
126
+            {
127
+                if (file.Name.Substring(file.Name.Length - 4, 4) != filetype)
128
+                    continue;
129
+                else
130
+                    filename.Add(file.Name);
131
+            }
132
+            return filename;
133
+        }
134
+
135
+    }
136
+}

+ 208
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Layerchange_Form.Designer.cs ファイルの表示

@@ -0,0 +1,208 @@
1
+
2
+namespace HCTools
3
+{
4
+    partial class Layerchange_Form
5
+    {
6
+        /// <summary>
7
+        /// Required designer variable.
8
+        /// </summary>
9
+        private System.ComponentModel.IContainer components = null;
10
+
11
+        /// <summary>
12
+        /// Clean up any resources being used.
13
+        /// </summary>
14
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
15
+        protected override void Dispose(bool disposing)
16
+        {
17
+            if (disposing && (components != null))
18
+            {
19
+                components.Dispose();
20
+            }
21
+            base.Dispose(disposing);
22
+        }
23
+
24
+        #region Windows Form Designer generated code
25
+
26
+        /// <summary>
27
+        /// Required method for Designer support - do not modify
28
+        /// the contents of this method with the code editor.
29
+        /// </summary>
30
+        private void InitializeComponent()
31
+        {
32
+            this.label1 = new System.Windows.Forms.Label();
33
+            this.textBox_dwgpath = new System.Windows.Forms.TextBox();
34
+            this.label2 = new System.Windows.Forms.Label();
35
+            this.button_ok = new System.Windows.Forms.Button();
36
+            this.button_cancel = new System.Windows.Forms.Button();
37
+            this.checkedListBox_tc = new System.Windows.Forms.CheckedListBox();
38
+            this.checkBox_delete = new System.Windows.Forms.CheckBox();
39
+            this.checkBox_open = new System.Windows.Forms.CheckBox();
40
+            this.checkBox_close = new System.Windows.Forms.CheckBox();
41
+            this.button_choose = new System.Windows.Forms.Button();
42
+            this.label3 = new System.Windows.Forms.Label();
43
+            this.textBox_savepath = new System.Windows.Forms.TextBox();
44
+            this.button_cssavepath = new System.Windows.Forms.Button();
45
+            this.SuspendLayout();
46
+            // 
47
+            // label1
48
+            // 
49
+            this.label1.AutoSize = true;
50
+            this.label1.Location = new System.Drawing.Point(31, 35);
51
+            this.label1.Name = "label1";
52
+            this.label1.Size = new System.Drawing.Size(121, 15);
53
+            this.label1.TabIndex = 0;
54
+            this.label1.Text = "dwg所在文件夹:";
55
+            // 
56
+            // textBox_dwgpath
57
+            // 
58
+            this.textBox_dwgpath.Location = new System.Drawing.Point(158, 29);
59
+            this.textBox_dwgpath.Name = "textBox_dwgpath";
60
+            this.textBox_dwgpath.Size = new System.Drawing.Size(275, 25);
61
+            this.textBox_dwgpath.TabIndex = 1;
62
+            // 
63
+            // label2
64
+            // 
65
+            this.label2.AutoSize = true;
66
+            this.label2.Location = new System.Drawing.Point(61, 102);
67
+            this.label2.Name = "label2";
68
+            this.label2.Size = new System.Drawing.Size(82, 15);
69
+            this.label2.TabIndex = 2;
70
+            this.label2.Text = "选择图层:";
71
+            // 
72
+            // button_ok
73
+            // 
74
+            this.button_ok.Location = new System.Drawing.Point(98, 276);
75
+            this.button_ok.Name = "button_ok";
76
+            this.button_ok.Size = new System.Drawing.Size(71, 31);
77
+            this.button_ok.TabIndex = 4;
78
+            this.button_ok.Text = "确 定";
79
+            this.button_ok.UseVisualStyleBackColor = true;
80
+            this.button_ok.Click += new System.EventHandler(this.button_ok_Click);
81
+            // 
82
+            // button_cancel
83
+            // 
84
+            this.button_cancel.Location = new System.Drawing.Point(403, 276);
85
+            this.button_cancel.Name = "button_cancel";
86
+            this.button_cancel.Size = new System.Drawing.Size(75, 31);
87
+            this.button_cancel.TabIndex = 5;
88
+            this.button_cancel.Text = "取 消";
89
+            this.button_cancel.UseVisualStyleBackColor = true;
90
+            this.button_cancel.Click += new System.EventHandler(this.button_cancel_Click);
91
+            // 
92
+            // checkedListBox_tc
93
+            // 
94
+            this.checkedListBox_tc.FormattingEnabled = true;
95
+            this.checkedListBox_tc.Location = new System.Drawing.Point(158, 102);
96
+            this.checkedListBox_tc.Name = "checkedListBox_tc";
97
+            this.checkedListBox_tc.Size = new System.Drawing.Size(275, 164);
98
+            this.checkedListBox_tc.TabIndex = 6;
99
+            // 
100
+            // checkBox_delete
101
+            // 
102
+            this.checkBox_delete.AutoSize = true;
103
+            this.checkBox_delete.Location = new System.Drawing.Point(476, 128);
104
+            this.checkBox_delete.Name = "checkBox_delete";
105
+            this.checkBox_delete.Size = new System.Drawing.Size(89, 19);
106
+            this.checkBox_delete.TabIndex = 7;
107
+            this.checkBox_delete.Text = "删除图层";
108
+            this.checkBox_delete.UseVisualStyleBackColor = true;
109
+            // 
110
+            // checkBox_open
111
+            // 
112
+            this.checkBox_open.AutoSize = true;
113
+            this.checkBox_open.Location = new System.Drawing.Point(476, 176);
114
+            this.checkBox_open.Name = "checkBox_open";
115
+            this.checkBox_open.Size = new System.Drawing.Size(89, 19);
116
+            this.checkBox_open.TabIndex = 8;
117
+            this.checkBox_open.Text = "打开图层";
118
+            this.checkBox_open.UseVisualStyleBackColor = true;
119
+            // 
120
+            // checkBox_close
121
+            // 
122
+            this.checkBox_close.AutoSize = true;
123
+            this.checkBox_close.Location = new System.Drawing.Point(476, 223);
124
+            this.checkBox_close.Name = "checkBox_close";
125
+            this.checkBox_close.Size = new System.Drawing.Size(89, 19);
126
+            this.checkBox_close.TabIndex = 9;
127
+            this.checkBox_close.Text = "关闭图层";
128
+            this.checkBox_close.UseVisualStyleBackColor = true;
129
+            // 
130
+            // button_choose
131
+            // 
132
+            this.button_choose.Location = new System.Drawing.Point(476, 18);
133
+            this.button_choose.Name = "button_choose";
134
+            this.button_choose.Size = new System.Drawing.Size(75, 32);
135
+            this.button_choose.TabIndex = 10;
136
+            this.button_choose.Text = "选 择";
137
+            this.button_choose.UseVisualStyleBackColor = true;
138
+            this.button_choose.Click += new System.EventHandler(this.button_choose_Click);
139
+            // 
140
+            // label3
141
+            // 
142
+            this.label3.AutoSize = true;
143
+            this.label3.Location = new System.Drawing.Point(61, 70);
144
+            this.label3.Name = "label3";
145
+            this.label3.Size = new System.Drawing.Size(82, 15);
146
+            this.label3.TabIndex = 11;
147
+            this.label3.Text = "保存路径:";
148
+            // 
149
+            // textBox_savepath
150
+            // 
151
+            this.textBox_savepath.Location = new System.Drawing.Point(158, 67);
152
+            this.textBox_savepath.Name = "textBox_savepath";
153
+            this.textBox_savepath.Size = new System.Drawing.Size(275, 25);
154
+            this.textBox_savepath.TabIndex = 12;
155
+            // 
156
+            // button_cssavepath
157
+            // 
158
+            this.button_cssavepath.Location = new System.Drawing.Point(476, 61);
159
+            this.button_cssavepath.Name = "button_cssavepath";
160
+            this.button_cssavepath.Size = new System.Drawing.Size(75, 32);
161
+            this.button_cssavepath.TabIndex = 13;
162
+            this.button_cssavepath.Text = "选 择";
163
+            this.button_cssavepath.UseVisualStyleBackColor = true;
164
+            this.button_cssavepath.Click += new System.EventHandler(this.button_cssavepath_Click);
165
+            // 
166
+            // Layerchange_Form
167
+            // 
168
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
169
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
170
+            this.ClientSize = new System.Drawing.Size(599, 337);
171
+            this.Controls.Add(this.button_cssavepath);
172
+            this.Controls.Add(this.textBox_savepath);
173
+            this.Controls.Add(this.label3);
174
+            this.Controls.Add(this.button_choose);
175
+            this.Controls.Add(this.checkBox_close);
176
+            this.Controls.Add(this.checkBox_open);
177
+            this.Controls.Add(this.checkBox_delete);
178
+            this.Controls.Add(this.checkedListBox_tc);
179
+            this.Controls.Add(this.button_cancel);
180
+            this.Controls.Add(this.button_ok);
181
+            this.Controls.Add(this.label2);
182
+            this.Controls.Add(this.textBox_dwgpath);
183
+            this.Controls.Add(this.label1);
184
+            this.Name = "Layerchange_Form";
185
+            this.Text = "图层删改";
186
+            this.Load += new System.EventHandler(this.Layerchange_Form_Load);
187
+            this.ResumeLayout(false);
188
+            this.PerformLayout();
189
+
190
+        }
191
+
192
+        #endregion
193
+
194
+        private System.Windows.Forms.Label label1;
195
+        private System.Windows.Forms.TextBox textBox_dwgpath;
196
+        private System.Windows.Forms.Label label2;
197
+        private System.Windows.Forms.Button button_ok;
198
+        private System.Windows.Forms.Button button_cancel;
199
+        private System.Windows.Forms.CheckedListBox checkedListBox_tc;
200
+        private System.Windows.Forms.CheckBox checkBox_delete;
201
+        private System.Windows.Forms.CheckBox checkBox_open;
202
+        private System.Windows.Forms.CheckBox checkBox_close;
203
+        private System.Windows.Forms.Button button_choose;
204
+        private System.Windows.Forms.Label label3;
205
+        private System.Windows.Forms.TextBox textBox_savepath;
206
+        private System.Windows.Forms.Button button_cssavepath;
207
+    }
208
+}

+ 143
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Layerchange_Form.cs ファイルの表示

@@ -0,0 +1,143 @@
1
+using GrxCAD.ApplicationServices;
2
+using GrxCAD.DatabaseServices;
3
+using System;
4
+using System.Collections.Generic;
5
+using System.ComponentModel;
6
+using System.Data;
7
+using System.Drawing;
8
+using System.IO;
9
+using System.Linq;
10
+using System.Text;
11
+using System.Threading.Tasks;
12
+using System.Windows.Forms;
13
+
14
+namespace HCTools
15
+{
16
+    public partial class Layerchange_Form : Form
17
+    {
18
+        public Layerchange_Form()
19
+        {
20
+            InitializeComponent();
21
+        }
22
+
23
+        private void button_choose_Click(object sender, EventArgs e)
24
+        {
25
+            FolderBrowserDialog open = new FolderBrowserDialog();
26
+            open.Description = "请选择文件夹";
27
+            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
28
+            {
29
+                textBox_dwgpath.Text = open.SelectedPath;
30
+            }
31
+            if (textBox_dwgpath.Text == "")
32
+            { 
33
+                MessageBox.Show("未选择文件夹");
34
+                return;
35
+            }
36
+            // 获取dwg文件
37
+            else
38
+            {
39
+                this.Hide();
40
+                DirectoryInfo root = new DirectoryInfo(textBox_dwgpath.Text);
41
+                List<String> filename = new List<string>();     //文件名
42
+                FileInfo[] files = root.GetFiles();
43
+                foreach (FileInfo file in files)
44
+                {
45
+                    if (file.Name.Substring(file.Name.Length - 4, 4) != ".dwg")
46
+                        continue;
47
+                    else
48
+                        filename.Add(file.Name);
49
+                }
50
+                string dwg = textBox_dwgpath.Text + "\\" + filename[0];
51
+                //获取文件中图层
52
+                Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.Add(dwg);
53
+                Database database = doc.Database;
54
+                using (Transaction traction = database.TransactionManager.StartTransaction())
55
+                {
56
+                    //存放所有图层名
57
+                    List<string> alllayername = new List<string>();
58
+                    LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
59
+                    foreach (ObjectId objid in layertable)
60
+                    {
61
+                        LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
62
+                        alllayername.Add(layertablerecord.Name);
63
+                    }
64
+
65
+                    alllayername.Sort();
66
+
67
+                    for (int i = 0; i < alllayername.Count; i++)
68
+                    {
69
+                        this.checkedListBox_tc.Items.Add(alllayername[i]);
70
+                    }
71
+                    traction.Commit();
72
+                }
73
+                doc.CloseAndDiscard();
74
+                this.Show();
75
+            }
76
+        }
77
+
78
+        private void button_ok_Click(object sender, EventArgs e)
79
+        {
80
+            if (textBox_dwgpath.Text == "")
81
+            { 
82
+                MessageBox.Show("未选择文件夹!");
83
+                return;
84
+            }
85
+            else if (textBox_savepath.Text == "")
86
+            { 
87
+                MessageBox.Show("未选择保存路径!");
88
+                return;
89
+            }
90
+            else
91
+            {
92
+                LayerChange.dwgpath = textBox_dwgpath.Text;
93
+                List<string> list = new List<string>();
94
+                for (int i = 0; i < checkedListBox_tc.CheckedItems.Count; i++)
95
+                {
96
+                    list.Add(checkedListBox_tc.CheckedItems[i].ToString());
97
+                }
98
+                LayerChange.lys = list;
99
+                if (checkBox_delete.Checked == true)
100
+                {
101
+                    LayerChange lyc = new LayerChange();
102
+                    LayerChange.flag = 0;
103
+                    lyc.chagly();
104
+                    this.Close();
105
+                }
106
+                if (checkBox_close.Checked == true)
107
+                {
108
+                    LayerChange lyc = new LayerChange();
109
+                    LayerChange.flag = 1;
110
+                    lyc.chagly();
111
+                    this.Close();
112
+                }
113
+                if (checkBox_open.Checked == true)
114
+                {
115
+                    LayerChange lyc = new LayerChange();
116
+                    LayerChange.flag = 2;
117
+                    lyc.chagly();
118
+                    this.Close();
119
+                }
120
+            }
121
+        }
122
+
123
+        private void button_cancel_Click(object sender, EventArgs e)
124
+        {
125
+            this.Close();
126
+        }
127
+
128
+        private void Layerchange_Form_Load(object sender, EventArgs e)
129
+        {
130
+            this.MaximizeBox = false;
131
+            this.StartPosition = FormStartPosition.CenterScreen;
132
+        }
133
+
134
+        private void button_cssavepath_Click(object sender, EventArgs e)
135
+        {
136
+            FolderBrowserDialog open = new FolderBrowserDialog();
137
+            open.Description = "请选择文件夹";
138
+            if (open.ShowDialog() == System.Windows.Forms.DialogResult.OK)
139
+                textBox_savepath.Text = open.SelectedPath;
140
+            LayerChange.savepath = textBox_savepath.Text;
141
+        }
142
+    }
143
+}

+ 0
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Layerchange_Form.resx ファイルの表示


変更されたファイルが多すぎるため、一部のファイルは表示されません

読み込み中…
キャンセル
保存