Parcourir la source

新增工具:等高线平滑连接,批量连接错位等高线,根据水边线和水下点注记生成同位置高程点,修改bug

qyx il y a 2 semaines
Parent
révision
5880f1b7be
55 fichiers modifiés avec 3650 ajouts et 41 suppressions
  1. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/.vs/CADTools/v16/.suo
  2. 27
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/CADTools.csproj
  3. 12
    12
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/CMCgis_Basicfunction.cs
  4. 2
    2
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Chaginfos.cs
  5. 14
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/CutDgx.cs
  6. 294
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/DgxFix.Designer.cs
  7. 522
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/DgxFix.cs
  8. 123
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/DgxFix.resx
  9. 122
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Dgxconnect.Designer.cs
  10. 341
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Dgxconnect.cs
  11. 120
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Dgxconnect.resx
  12. 5
    5
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/LayerChange.cs
  13. 36
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/MainClass.cs
  14. 9
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Menus.cs
  15. 1
    1
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/MergeDwg.cs
  16. 183
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/UwPtAssignment.Designer.cs
  17. 235
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/UwPtAssignment.cs
  18. 120
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/UwPtAssignment.resx
  19. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/bin/Debug/CADTools.dll
  20. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/bin/Debug/CADTools.pdb
  21. 247
    3
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/cutdgx_method.cs
  22. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.DgxFix.resources
  23. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.Dgxconnect.resources
  24. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.UwPtAssignment.resources
  25. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.AssemblyReference.cache
  26. 1
    1
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.CoreCompileInputs.cache
  27. 3
    0
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.FileListAbsolute.txt
  28. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.GenerateResource.cache
  29. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.dll
  30. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.pdb
  31. BIN
      加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  32. BIN
      加密后软件工具/CAD插件工具/Thumbnail_HC/.vs/Thumbnail/v16/.suo
  33. BIN
      加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/bin/Debug/Thumbnail.dll
  34. BIN
      加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/bin/Debug/Thumbnail.pdb
  35. 1
    1
      加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/getThumbnail.cs
  36. BIN
      加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/obj/Debug/Thumbnail.csproj.GenerateResource.cache
  37. BIN
      加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/obj/Debug/Thumbnail.dll
  38. BIN
      加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/obj/Debug/Thumbnail.pdb
  39. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/.suo
  40. 6
    6
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CMCgis_Basicfunction.cs
  41. 2
    2
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.cs
  42. 1
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj
  43. 5
    5
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/LayerChange.cs
  44. 1
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/MergeDwg.cs
  45. 1
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/OutputbyTK_Form.cs
  46. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.dll
  47. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.pdb
  48. 1215
    0
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/cutdgx_method.cs
  49. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/DesignTimeResolveAssemblyReferences.cache
  50. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  51. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.AssemblyReference.cache
  52. 1
    1
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.CoreCompileInputs.cache
  53. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.GenerateResource.cache
  54. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.dll
  55. BIN
      加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.pdb

BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/.vs/CADTools/v16/.suo Voir le fichier


+ 27
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/CADTools.csproj Voir le fichier

@@ -142,7 +142,19 @@
142 142
     <Compile Include="DgxAnno.Designer.cs">
143 143
       <DependentUpon>DgxAnno.cs</DependentUpon>
144 144
     </Compile>
145
+    <Compile Include="Dgxconnect.cs">
146
+      <SubType>Form</SubType>
147
+    </Compile>
148
+    <Compile Include="Dgxconnect.Designer.cs">
149
+      <DependentUpon>Dgxconnect.cs</DependentUpon>
150
+    </Compile>
145 151
     <Compile Include="DgxCrossrvrd.cs" />
152
+    <Compile Include="DgxFix.cs">
153
+      <SubType>Form</SubType>
154
+    </Compile>
155
+    <Compile Include="DgxFix.Designer.cs">
156
+      <DependentUpon>DgxFix.cs</DependentUpon>
157
+    </Compile>
146 158
     <Compile Include="DGXGeneral.cs">
147 159
       <SubType>Form</SubType>
148 160
     </Compile>
@@ -279,6 +291,12 @@
279 291
     <Compile Include="TKInfo.Designer.cs">
280 292
       <DependentUpon>TKInfo.cs</DependentUpon>
281 293
     </Compile>
294
+    <Compile Include="UwPtAssignment.cs">
295
+      <SubType>Form</SubType>
296
+    </Compile>
297
+    <Compile Include="UwPtAssignment.Designer.cs">
298
+      <DependentUpon>UwPtAssignment.cs</DependentUpon>
299
+    </Compile>
282 300
     <EmbeddedResource Include="AttributeForm.resx">
283 301
       <DependentUpon>AttributeForm.cs</DependentUpon>
284 302
     </EmbeddedResource>
@@ -300,6 +318,12 @@
300 318
     <EmbeddedResource Include="DgxAnno.resx">
301 319
       <DependentUpon>DgxAnno.cs</DependentUpon>
302 320
     </EmbeddedResource>
321
+    <EmbeddedResource Include="Dgxconnect.resx">
322
+      <DependentUpon>Dgxconnect.cs</DependentUpon>
323
+    </EmbeddedResource>
324
+    <EmbeddedResource Include="DgxFix.resx">
325
+      <DependentUpon>DgxFix.cs</DependentUpon>
326
+    </EmbeddedResource>
303 327
     <EmbeddedResource Include="DGXGeneral.resx">
304 328
       <DependentUpon>DGXGeneral.cs</DependentUpon>
305 329
     </EmbeddedResource>
@@ -369,6 +393,9 @@
369 393
     <EmbeddedResource Include="TKInfo.resx">
370 394
       <DependentUpon>TKInfo.cs</DependentUpon>
371 395
     </EmbeddedResource>
396
+    <EmbeddedResource Include="UwPtAssignment.resx">
397
+      <DependentUpon>UwPtAssignment.cs</DependentUpon>
398
+    </EmbeddedResource>
372 399
     <None Include="FodyWeavers.xsd">
373 400
       <SubType>Designer</SubType>
374 401
     </None>

+ 12
- 12
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/CMCgis_Basicfunction.cs Voir le fichier

@@ -957,8 +957,8 @@ namespace CADTools
957 957
 
958 958
 
959 959
                 //图幅号
960
-                p1 = new Point3d(LB.X - 100, LB.Y - 100, 0);
961
-                p2 = new Point3d(RT.X + 100, RT.Y + 100, 0);
960
+                p1 = new Point3d(LB.X, LB.Y, 0);
961
+                p2 = new Point3d(RT.X, RT.Y, 0);
962 962
                 Number = GetNumber(p1, p2);
963 963
 
964 964
                 //新建一个dwg
@@ -986,8 +986,8 @@ namespace CADTools
986 986
                 draw();
987 987
 
988 988
                 zoom();
989
-                database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1024);
990
-                //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1021, database.SecurityParameters);
989
+                //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1800);
990
+                database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1800, database.SecurityParameters);
991 991
                 //document.CloseAndSave(Number.ToString() + ".dwg");
992 992
                 document.CloseAndDiscard();
993 993
             }
@@ -2682,8 +2682,8 @@ namespace CADTools
2682 2682
 
2683 2683
 
2684 2684
 
2685
-            //document.Database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1021, document.Database.SecurityParameters);
2686
-            //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1024);
2685
+            //document.Database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1800, document.Database.SecurityParameters);
2686
+            //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1800);
2687 2687
             traction.Commit();
2688 2688
 
2689 2689
             //}
@@ -2941,12 +2941,12 @@ namespace CADTools
2941 2941
             //typed.SetValue(new TypedValue((int)DxfCode.Start, "Polyline,LWPolyline"), 0);
2942 2942
             //SelectionFilter filter = new SelectionFilter(typed);
2943 2943
 
2944
-            //ViewTableRecord currview = editor.GetCurrentView();
2945
-            //currview.CenterPoint = new Point2d((RT.X - LT.X) / 2 + LT.X, (LT.Y - LB.Y) / 2 + LB.Y);
2946
-            //currview.ViewDirection = new Vector3d(0, 0, 1);
2947
-            //currview.Width = RT.X - LT.X + TKInfo.BLC / 10;
2948
-            //currview.Height = LT.Y - LB.Y + TKInfo.BLC / 10;
2949
-            //editor.SetCurrentView(currview);
2944
+            ViewTableRecord currview = editor.GetCurrentView();
2945
+            currview.CenterPoint = new Point2d((RT.X - LT.X) / 2 + LT.X, (LT.Y - LB.Y) / 2 + LB.Y);
2946
+            currview.ViewDirection = new Vector3d(0, 0, 1);
2947
+            currview.Width = RT.X - LT.X + TKInfo.BLC / 10;
2948
+            currview.Height = LT.Y - LB.Y + TKInfo.BLC / 10;
2949
+            editor.SetCurrentView(currview);
2950 2950
 
2951 2951
             //PromptSelectionResult psr = editor.SelectWindow(p1, p2, filter);
2952 2952
             TypedValue[] typed_T = new TypedValue[1];

+ 2
- 2
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Chaginfos.cs Voir le fichier

@@ -276,8 +276,8 @@ namespace CADTools
276 276
 
277 277
                 //Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
278 278
                 //2007版本格式
279
-                //data.SaveAs(path_Save + "\\" + name, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
280
-                data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1021);
279
+                //data.SaveAs(path_Save + "\\" + name, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
280
+                data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1800);
281 281
                 //2004版本格式
282 282
                 //data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1800);
283 283
                 //2000版本格式

+ 14
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/CutDgx.cs Voir le fichier

@@ -61,18 +61,31 @@ namespace CADTools
61 61
         private void button_ok_Click(object sender, EventArgs e)
62 62
         {
63 63
             if (comboBox_jqx.Text == "")
64
+            {
64 65
                 MessageBox.Show("请选择计曲线图层");
66
+                return;
67
+            }
65 68
             if (comboBox_sqx.Text == "")
69
+            {
66 70
                 MessageBox.Show("请选择首曲线图层");
71
+                return;
72
+            }
67 73
             if (textBox_cj.Text == "")
74
+            {
68 75
                 MessageBox.Show("请输入裁剪宽度");
76
+                return;
77
+            }
69 78
             //if (textBox_dgj.Text == "")
70 79
             //    MessageBox.Show("请输入等高距");
71 80
             if (textBox_ignore.Text == "")
81
+            {
72 82
                 MessageBox.Show("请输入可忽略阈值");
83
+                return;
84
+            }
73 85
             if(!double.TryParse(textBox_cj.Text, out double doubleResult1))
74 86
             {
75 87
                 MessageBox.Show("裁剪宽度必须为数字");
88
+                return;
76 89
             }
77 90
             //if (!double.TryParse(textBox_dgj.Text, out double doubleResult2))
78 91
             //{
@@ -81,6 +94,7 @@ namespace CADTools
81 94
             if (!double.TryParse(textBox_ignore.Text, out double doubleResult3))
82 95
             {
83 96
                 MessageBox.Show("可忽略阈值必须为数字");
97
+                return;
84 98
             }
85 99
 
86 100
             string jqx = comboBox_jqx.Text;

+ 294
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/DgxFix.Designer.cs Voir le fichier

@@ -0,0 +1,294 @@
1
+
2
+namespace CADTools
3
+{
4
+    partial class DgxFix
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.label1 = new System.Windows.Forms.Label();
34
+            this.comboBox_layer = new System.Windows.Forms.ComboBox();
35
+            this.label2 = new System.Windows.Forms.Label();
36
+            this.label3 = new System.Windows.Forms.Label();
37
+            this.button_preview = new System.Windows.Forms.Button();
38
+            this.button_select = new System.Windows.Forms.Button();
39
+            this.button_confirm = new System.Windows.Forms.Button();
40
+            this.textBox_casscode = new System.Windows.Forms.TextBox();
41
+            this.label4 = new System.Windows.Forms.Label();
42
+            this.trackBar_mirror = new System.Windows.Forms.TrackBar();
43
+            this.trackBar_intersept = new System.Windows.Forms.TrackBar();
44
+            this.numericUpDown_mirror = new System.Windows.Forms.NumericUpDown();
45
+            this.numericUpDown_interse = new System.Windows.Forms.NumericUpDown();
46
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
47
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
48
+            this.label5 = new System.Windows.Forms.Label();
49
+            this.checkBox1 = new System.Windows.Forms.CheckBox();
50
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar_mirror)).BeginInit();
51
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar_intersept)).BeginInit();
52
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_mirror)).BeginInit();
53
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_interse)).BeginInit();
54
+            this.groupBox1.SuspendLayout();
55
+            this.SuspendLayout();
56
+            // 
57
+            // label1
58
+            // 
59
+            this.label1.AutoSize = true;
60
+            this.label1.Location = new System.Drawing.Point(10, 32);
61
+            this.label1.Name = "label1";
62
+            this.label1.Size = new System.Drawing.Size(82, 15);
63
+            this.label1.TabIndex = 0;
64
+            this.label1.Text = "图层选择:";
65
+            // 
66
+            // comboBox_layer
67
+            // 
68
+            this.comboBox_layer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
69
+            this.comboBox_layer.FormattingEnabled = true;
70
+            this.comboBox_layer.Location = new System.Drawing.Point(98, 29);
71
+            this.comboBox_layer.Name = "comboBox_layer";
72
+            this.comboBox_layer.Size = new System.Drawing.Size(136, 23);
73
+            this.comboBox_layer.TabIndex = 1;
74
+            // 
75
+            // label2
76
+            // 
77
+            this.label2.AutoSize = true;
78
+            this.label2.Location = new System.Drawing.Point(35, 164);
79
+            this.label2.Name = "label2";
80
+            this.label2.Size = new System.Drawing.Size(82, 15);
81
+            this.label2.TabIndex = 2;
82
+            this.label2.Text = "镜像距离:";
83
+            // 
84
+            // label3
85
+            // 
86
+            this.label3.AutoSize = true;
87
+            this.label3.Location = new System.Drawing.Point(35, 233);
88
+            this.label3.Name = "label3";
89
+            this.label3.Size = new System.Drawing.Size(82, 15);
90
+            this.label3.TabIndex = 4;
91
+            this.label3.Text = "插入点数:";
92
+            // 
93
+            // button_preview
94
+            // 
95
+            this.button_preview.Location = new System.Drawing.Point(154, 284);
96
+            this.button_preview.Name = "button_preview";
97
+            this.button_preview.Size = new System.Drawing.Size(75, 32);
98
+            this.button_preview.TabIndex = 6;
99
+            this.button_preview.Text = "预 览";
100
+            this.button_preview.UseVisualStyleBackColor = true;
101
+            this.button_preview.Click += new System.EventHandler(this.button_preview_Click);
102
+            // 
103
+            // button_select
104
+            // 
105
+            this.button_select.Location = new System.Drawing.Point(452, 185);
106
+            this.button_select.Name = "button_select";
107
+            this.button_select.Size = new System.Drawing.Size(110, 32);
108
+            this.button_select.TabIndex = 7;
109
+            this.button_select.Text = "开 始 选 择";
110
+            this.button_select.UseVisualStyleBackColor = true;
111
+            this.button_select.Click += new System.EventHandler(this.button_select_Click);
112
+            // 
113
+            // button_confirm
114
+            // 
115
+            this.button_confirm.Location = new System.Drawing.Point(321, 284);
116
+            this.button_confirm.Name = "button_confirm";
117
+            this.button_confirm.Size = new System.Drawing.Size(137, 32);
118
+            this.button_confirm.TabIndex = 8;
119
+            this.button_confirm.Text = "确 认 连 接";
120
+            this.button_confirm.UseVisualStyleBackColor = true;
121
+            this.button_confirm.Click += new System.EventHandler(this.button_confirm_Click);
122
+            // 
123
+            // textBox_casscode
124
+            // 
125
+            this.textBox_casscode.Location = new System.Drawing.Point(100, 66);
126
+            this.textBox_casscode.Name = "textBox_casscode";
127
+            this.textBox_casscode.Size = new System.Drawing.Size(100, 25);
128
+            this.textBox_casscode.TabIndex = 10;
129
+            // 
130
+            // label4
131
+            // 
132
+            this.label4.AutoSize = true;
133
+            this.label4.Location = new System.Drawing.Point(12, 69);
134
+            this.label4.Name = "label4";
135
+            this.label4.Size = new System.Drawing.Size(69, 15);
136
+            this.label4.TabIndex = 9;
137
+            this.label4.Text = "cass码:";
138
+            // 
139
+            // trackBar_mirror
140
+            // 
141
+            this.trackBar_mirror.Location = new System.Drawing.Point(218, 161);
142
+            this.trackBar_mirror.Maximum = 1000;
143
+            this.trackBar_mirror.Minimum = 1;
144
+            this.trackBar_mirror.Name = "trackBar_mirror";
145
+            this.trackBar_mirror.Size = new System.Drawing.Size(195, 56);
146
+            this.trackBar_mirror.TabIndex = 11;
147
+            this.trackBar_mirror.Value = 20;
148
+            this.trackBar_mirror.Scroll += new System.EventHandler(this.trackBar_mirror_Scroll);
149
+            // 
150
+            // trackBar_intersept
151
+            // 
152
+            this.trackBar_intersept.Location = new System.Drawing.Point(218, 223);
153
+            this.trackBar_intersept.Maximum = 100;
154
+            this.trackBar_intersept.Minimum = 1;
155
+            this.trackBar_intersept.Name = "trackBar_intersept";
156
+            this.trackBar_intersept.Size = new System.Drawing.Size(195, 56);
157
+            this.trackBar_intersept.TabIndex = 12;
158
+            this.trackBar_intersept.Value = 10;
159
+            this.trackBar_intersept.Scroll += new System.EventHandler(this.trackBar_intersept_Scroll);
160
+            // 
161
+            // numericUpDown_mirror
162
+            // 
163
+            this.numericUpDown_mirror.DecimalPlaces = 1;
164
+            this.numericUpDown_mirror.Increment = new decimal(new int[] {
165
+            1,
166
+            0,
167
+            0,
168
+            65536});
169
+            this.numericUpDown_mirror.Location = new System.Drawing.Point(123, 162);
170
+            this.numericUpDown_mirror.Minimum = new decimal(new int[] {
171
+            1,
172
+            0,
173
+            0,
174
+            65536});
175
+            this.numericUpDown_mirror.Name = "numericUpDown_mirror";
176
+            this.numericUpDown_mirror.Size = new System.Drawing.Size(66, 25);
177
+            this.numericUpDown_mirror.TabIndex = 13;
178
+            this.numericUpDown_mirror.Value = new decimal(new int[] {
179
+            1,
180
+            0,
181
+            0,
182
+            65536});
183
+            this.numericUpDown_mirror.ValueChanged += new System.EventHandler(this.numericUpDown_mirror_ValueChanged);
184
+            // 
185
+            // numericUpDown_interse
186
+            // 
187
+            this.numericUpDown_interse.Location = new System.Drawing.Point(123, 231);
188
+            this.numericUpDown_interse.Minimum = new decimal(new int[] {
189
+            1,
190
+            0,
191
+            0,
192
+            0});
193
+            this.numericUpDown_interse.Name = "numericUpDown_interse";
194
+            this.numericUpDown_interse.Size = new System.Drawing.Size(66, 25);
195
+            this.numericUpDown_interse.TabIndex = 14;
196
+            this.numericUpDown_interse.Value = new decimal(new int[] {
197
+            1,
198
+            0,
199
+            0,
200
+            0});
201
+            this.numericUpDown_interse.ValueChanged += new System.EventHandler(this.numericUpDown_interse_ValueChanged);
202
+            // 
203
+            // timer1
204
+            // 
205
+            this.timer1.Interval = 300;
206
+            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
207
+            // 
208
+            // groupBox1
209
+            // 
210
+            this.groupBox1.Controls.Add(this.label5);
211
+            this.groupBox1.Controls.Add(this.textBox_casscode);
212
+            this.groupBox1.Controls.Add(this.label1);
213
+            this.groupBox1.Controls.Add(this.comboBox_layer);
214
+            this.groupBox1.Controls.Add(this.label4);
215
+            this.groupBox1.Location = new System.Drawing.Point(22, 43);
216
+            this.groupBox1.Name = "groupBox1";
217
+            this.groupBox1.Size = new System.Drawing.Size(571, 100);
218
+            this.groupBox1.TabIndex = 16;
219
+            this.groupBox1.TabStop = false;
220
+            this.groupBox1.Text = "精细选择(在选择时只会选中对应图层中的图形)";
221
+            // 
222
+            // label5
223
+            // 
224
+            this.label5.AutoSize = true;
225
+            this.label5.ForeColor = System.Drawing.Color.Gray;
226
+            this.label5.Location = new System.Drawing.Point(212, 69);
227
+            this.label5.Name = "label5";
228
+            this.label5.Size = new System.Drawing.Size(353, 15);
229
+            this.label5.TabIndex = 11;
230
+            this.label5.Text = "(如需输入多个,用“,”隔开,如:201101,201102)";
231
+            // 
232
+            // checkBox1
233
+            // 
234
+            this.checkBox1.AutoSize = true;
235
+            this.checkBox1.Location = new System.Drawing.Point(22, 12);
236
+            this.checkBox1.Name = "checkBox1";
237
+            this.checkBox1.Size = new System.Drawing.Size(89, 19);
238
+            this.checkBox1.TabIndex = 17;
239
+            this.checkBox1.Text = "精细选择";
240
+            this.checkBox1.UseVisualStyleBackColor = true;
241
+            this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
242
+            // 
243
+            // DgxFix
244
+            // 
245
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
246
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
247
+            this.ClientSize = new System.Drawing.Size(605, 340);
248
+            this.Controls.Add(this.checkBox1);
249
+            this.Controls.Add(this.groupBox1);
250
+            this.Controls.Add(this.numericUpDown_interse);
251
+            this.Controls.Add(this.numericUpDown_mirror);
252
+            this.Controls.Add(this.trackBar_intersept);
253
+            this.Controls.Add(this.trackBar_mirror);
254
+            this.Controls.Add(this.button_confirm);
255
+            this.Controls.Add(this.button_select);
256
+            this.Controls.Add(this.button_preview);
257
+            this.Controls.Add(this.label3);
258
+            this.Controls.Add(this.label2);
259
+            this.Name = "DgxFix";
260
+            this.Text = "等高线修复";
261
+            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.DgxFix_FormClosing);
262
+            this.Load += new System.EventHandler(this.DgxFix_Load);
263
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar_mirror)).EndInit();
264
+            ((System.ComponentModel.ISupportInitialize)(this.trackBar_intersept)).EndInit();
265
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_mirror)).EndInit();
266
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_interse)).EndInit();
267
+            this.groupBox1.ResumeLayout(false);
268
+            this.groupBox1.PerformLayout();
269
+            this.ResumeLayout(false);
270
+            this.PerformLayout();
271
+
272
+        }
273
+
274
+        #endregion
275
+
276
+        private System.Windows.Forms.Label label1;
277
+        private System.Windows.Forms.ComboBox comboBox_layer;
278
+        private System.Windows.Forms.Label label2;
279
+        private System.Windows.Forms.Label label3;
280
+        private System.Windows.Forms.Button button_preview;
281
+        private System.Windows.Forms.Button button_select;
282
+        private System.Windows.Forms.Button button_confirm;
283
+        private System.Windows.Forms.TextBox textBox_casscode;
284
+        private System.Windows.Forms.Label label4;
285
+        private System.Windows.Forms.TrackBar trackBar_mirror;
286
+        private System.Windows.Forms.TrackBar trackBar_intersept;
287
+        private System.Windows.Forms.NumericUpDown numericUpDown_mirror;
288
+        private System.Windows.Forms.NumericUpDown numericUpDown_interse;
289
+        private System.Windows.Forms.Timer timer1;
290
+        private System.Windows.Forms.GroupBox groupBox1;
291
+        private System.Windows.Forms.Label label5;
292
+        private System.Windows.Forms.CheckBox checkBox1;
293
+    }
294
+}

+ 522
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/DgxFix.cs Voir le fichier

@@ -0,0 +1,522 @@
1
+using Autodesk.AutoCAD.ApplicationServices;
2
+using Autodesk.AutoCAD.DatabaseServices;
3
+using Autodesk.AutoCAD.EditorInput;
4
+using Autodesk.AutoCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.ComponentModel;
8
+using System.Data;
9
+using System.Drawing;
10
+using System.Linq;
11
+using System.Text;
12
+using System.Threading.Tasks;
13
+using System.Windows.Forms;
14
+
15
+namespace CADTools
16
+{
17
+    public partial class DgxFix : Form
18
+    {
19
+        public DgxFix()
20
+        {
21
+            InitializeComponent();
22
+        }
23
+        List<Polyline> pllist = new List<Polyline>();
24
+        List<Polyline> addpllist = new List<Polyline>();
25
+
26
+        private void DgxFix_Load(object sender, EventArgs e)
27
+        {
28
+            BindTrackBarAndNumeric(trackBar_mirror, numericUpDown_mirror);
29
+            BindTrackBarAndNumeric(trackBar_intersept, numericUpDown_interse);
30
+            //自动填充下拉框
31
+            Database database = Autodesk.AutoCAD.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_layer.Items.Add(alllayername[i]);
48
+                }
49
+
50
+                if (alllayername.Contains("8110"))
51
+                {
52
+                    int index = alllayername.IndexOf("8110");
53
+                    this.comboBox_layer.SelectedIndex = index;
54
+                }
55
+                traction.Commit();
56
+            }
57
+            groupBox1.Enabled = checkBox1.Checked;
58
+        }
59
+        private void BindTrackBarAndNumeric(TrackBar trackBar, NumericUpDown numeric)
60
+        {
61
+            if(trackBar.Maximum==1000)
62
+            {
63
+                // 事件绑定
64
+                trackBar.Scroll += (s, e) =>
65
+                {
66
+                    numeric.Value = trackBar.Value / 10m;
67
+                };
68
+
69
+                numeric.ValueChanged += (s, e) =>
70
+                {
71
+                    trackBar.Value = (int)(numeric.Value * 10);
72
+                };
73
+
74
+                numeric.Value = trackBar.Value / 10m;
75
+
76
+            }
77
+            else
78
+            {
79
+                trackBar.Scroll += (s, e) =>
80
+                {
81
+                    numeric.Value = trackBar.Value;
82
+                };
83
+
84
+                numeric.ValueChanged += (s, e) =>
85
+                {
86
+                    trackBar.Value = (int)numeric.Value ;
87
+                };
88
+
89
+                numeric.Value = trackBar.Value;
90
+            }
91
+            
92
+        }
93
+        private void button_select_Click(object sender, EventArgs e)
94
+        {
95
+
96
+            if (checkBox1.Checked==true && comboBox_layer.Text == "" && textBox_casscode.Text == "")
97
+            {
98
+                MessageBox.Show("已选择精细选择,请选择图层或输入cass码");
99
+                return;
100
+            }
101
+            this.WindowState = FormWindowState.Minimized;
102
+            select_Dgx();
103
+            this.WindowState = FormWindowState.Normal;
104
+        }
105
+
106
+        private void select_Dgx()
107
+        {
108
+            pllist.Clear();
109
+            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
110
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
111
+            ed.UpdateScreen();
112
+
113
+            string[] casscodes = textBox_casscode.Text.Split(',');
114
+            TypedValue[] typedvalue = new TypedValue[2];
115
+            if(checkBox1.Checked==true)
116
+            {
117
+                typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, comboBox_layer.Text), 0);
118
+                typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "LWPolyline"), 1);
119
+            }
120
+            else
121
+            {
122
+                typedvalue = new TypedValue[1];
123
+                typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "LWPolyline"), 0);
124
+            }
125
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
126
+            PromptSelectionResult psr = ed.GetSelection(selectionfilter);
127
+            
128
+
129
+            if (psr.Status == PromptStatus.OK)
130
+            {
131
+                SelectionSet ss = psr.Value;
132
+                ObjectId[] obj = new ObjectId[ss.Count];
133
+                obj = ss.GetObjectIds();
134
+                for (int i = 0; i < obj.Length; i++)
135
+                {
136
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
137
+                    {
138
+                        Polyline pll = tr.GetObject(obj[i], OpenMode.ForRead) as Polyline;
139
+                        if (checkBox1.Checked == true && textBox_casscode.Text!="")
140
+                        {
141
+                            string casscode = GetCassCode(pll);
142
+                            if (casscodes.Contains(casscode))
143
+                                pllist.Add(pll);
144
+                        }
145
+                        else
146
+                            pllist.Add(pll);
147
+                        tr.Commit();
148
+                    }
149
+                }
150
+            }
151
+        }
152
+
153
+        /// <summary>
154
+        /// 从实体中读取 CASS 编码
155
+        /// </summary>
156
+        public static string GetCassCode(Entity ent)
157
+        {
158
+            if (ent.XData == null) return null;
159
+
160
+            ResultBuffer rb = ent.GetXDataForApplication("SOUTH");
161
+            if (rb == null) return null;
162
+
163
+            foreach (TypedValue tv in rb.AsArray())
164
+            {
165
+                var i = (int)DxfCode.Text;
166
+                // 1000 组码为字符串类型,通常第一个就是 CASS 编码
167
+                if (tv.TypeCode == 1000)
168
+                {
169
+                    return tv.Value?.ToString();
170
+                }
171
+            }
172
+            return null;
173
+        }
174
+
175
+        private void button_preview_Click(object sender, EventArgs e)
176
+        {
177
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
178
+            if(button_preview.Text== "预 览")
179
+            {
180
+                if (addpllist.Count == 0 && pllist.Count != 0)
181
+                {
182
+                    var pllist_goruped = pllist.GroupBy(p => p.Elevation);
183
+                    foreach (var item in pllist_goruped)
184
+                    {
185
+                        if (item.Count() >= 2)
186
+                        {
187
+                            Polyline pl1 = item.ElementAt(0);
188
+                            Polyline pl2 = item.ElementAt(1);
189
+                            var pts = calculate(pl1.StartPoint, pl1.EndPoint, pl2.StartPoint, pl2.EndPoint);
190
+
191
+                            var points = bezier(pl1, pl2, pts);
192
+
193
+                            DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
194
+                            using (Transaction tr = db.TransactionManager.StartTransaction())
195
+                            {
196
+                                // 创建多段线
197
+                                Polyline polyline = new Polyline();
198
+
199
+                                // 添加起点
200
+                                polyline.AddVertexAt(0, new Point2d(pts[0].X, pts[0].Y), 0, 0, 0);
201
+
202
+                                // 添加插值点
203
+                                for (int i = 0; i < points.Count; i++)
204
+                                {
205
+                                    polyline.AddVertexAt(i + 1, new Point2d(points[i].X, points[i].Y), 0, 0, 0);
206
+                                }
207
+
208
+                                // 添加终点
209
+                                polyline.AddVertexAt(points.Count + 1, new Point2d(pts[1].X, pts[1].Y), 0, 0, 0);
210
+                                polyline.Elevation = item.Key;
211
+                                polyline.ColorIndex = 1;
212
+
213
+                                // 添加到模型空间
214
+                                BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
215
+                                btr.AppendEntity(polyline);
216
+                                tr.AddNewlyCreatedDBObject(polyline, true);
217
+                                addpllist.Add(polyline);
218
+                                tr.Commit();
219
+                            }
220
+                            doclock.Dispose();
221
+                        }
222
+
223
+                    }
224
+                    Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
225
+                    ed.UpdateScreen();
226
+                    button_preview.Text = "取 消";
227
+                    button_preview.Refresh();
228
+                }
229
+            }
230
+            else if(button_preview.Text=="取 消")
231
+            {
232
+                DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
233
+                for (int i = 0; i < addpllist.Count; i++)
234
+                {
235
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
236
+                    {
237
+                        if (!addpllist[i].ObjectId.IsErased)
238
+                        {
239
+                            Polyline pl = tr.GetObject(addpllist[i].ObjectId, OpenMode.ForWrite) as Polyline;
240
+                            pl.Erase();
241
+                        }
242
+                        tr.Commit();
243
+                    }
244
+                }
245
+                doclock.Dispose();
246
+                addpllist.Clear();
247
+                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
248
+                ed.UpdateScreen();
249
+                button_preview.Text = "预 览";
250
+                button_preview.Refresh();
251
+            }
252
+        }
253
+
254
+        /// <summary>
255
+        /// 计算获得连接点
256
+        /// </summary>
257
+        private Point3dCollection calculate(Point3d startpt1, Point3d endpt1, Point3d startpt2, Point3d endpt2)
258
+        {
259
+            Double[] distance = new Double[4];
260
+            Point3dCollection joinpoint = new Point3dCollection();
261
+            int i = 0;
262
+
263
+            //两线段四个端点之间的距离
264
+            distance[0] = Math.Sqrt(Math.Pow((startpt1.X - startpt2.X), 2) + Math.Pow((startpt1.Y - startpt2.Y), 2));
265
+            distance[1] = Math.Sqrt(Math.Pow((startpt1.X - endpt2.X), 2) + Math.Pow((startpt1.Y - endpt2.Y), 2));
266
+            distance[2] = Math.Sqrt(Math.Pow((endpt1.X - startpt2.X), 2) + Math.Pow((endpt1.Y - startpt2.Y), 2));
267
+            distance[3] = Math.Sqrt(Math.Pow((endpt1.X - endpt2.X), 2) + Math.Pow((endpt1.Y - endpt2.Y), 2));
268
+
269
+            //比较获取最小的距离,得到连接点
270
+            for (i = 0; i < distance.Length; i++)
271
+            {
272
+                if (distance[i] == distance.Min())
273
+                    break;
274
+            }
275
+            switch (i.ToString())
276
+            {
277
+                case "0":
278
+                    joinpoint.Add(startpt1);
279
+                    joinpoint.Add(startpt2);
280
+                    break;
281
+
282
+                case "1":
283
+                    joinpoint.Add(startpt1);
284
+                    joinpoint.Add(endpt2);
285
+                    break;
286
+
287
+                case "2":
288
+                    joinpoint.Add(endpt1);
289
+                    joinpoint.Add(startpt2);
290
+                    break;
291
+
292
+                case "3":
293
+                    joinpoint.Add(endpt1);
294
+                    joinpoint.Add(endpt2);
295
+                    break;
296
+            }
297
+            return joinpoint;
298
+        }
299
+
300
+        private Point3dCollection selectPt(Point3dCollection pts ,Polyline pl1,Polyline pl2)
301
+        {
302
+            var result = new Point3dCollection();
303
+            var p1 = pts[0] == pl1.StartPoint
304
+                        ? pl1.GetPoint3dAt(1) 
305
+                        : pl1.GetPointAtParameter(pl1.GetParameterAtPoint(pts[0]) - 1);
306
+            var p2 = pts[1] == pl2.StartPoint
307
+                        ? pl2.GetPoint3dAt(1)
308
+                        : pl2.GetPointAtParameter(pl2.GetParameterAtPoint(pts[1]) - 1);
309
+            result.Add(p1);
310
+            result.Add(p2);
311
+            return result;
312
+        }
313
+
314
+        private List<Point3d> bezier(Polyline pl1,Polyline pl2, Point3dCollection pts)
315
+        {
316
+            var pts_back = selectPt(pts, pl1, pl2);
317
+
318
+            // 计算 L1 = 距离(p0, p1)
319
+            double L1 = pts[0].DistanceTo(pts_back[0]);
320
+
321
+            // 计算 L2 = 距离(p4, p5)
322
+            double L2 = pts[1].DistanceTo(pts_back[1]);
323
+
324
+            // 避免除零错误
325
+            if (L1 < 1e-6 || L2 < 1e-6)
326
+            {
327
+                throw new ArgumentException("距离太小,无法计算延长点");
328
+            }
329
+
330
+            double d = Convert.ToDouble(numericUpDown_mirror.Text);
331
+            // 计算 P2 坐标
332
+            double x2 = pts[0].X + (d * (pts[0].X - pts_back[0].X)) / L1;
333
+            double y2 = pts[0].Y + (d * (pts[0].Y - pts_back[0].Y)) / L1;
334
+            double z2 = pts[0].Z;  // Z坐标保持不变
335
+            Point3d p2 = new Point3d(x2, y2, z2);
336
+
337
+            // 计算 P3 坐标
338
+            double x3 = pts[1].X + (d * (pts[1].X - pts_back[1].X)) / L2;
339
+            double y3 = pts[1].Y + (d * (pts[1].Y - pts_back[1].Y)) / L2;
340
+            double z3 = pts[1].Z;  // Z坐标保持不变
341
+            Point3d p3 = new Point3d(x3, y3, z3);
342
+
343
+
344
+            List<Point3d> points = new List<Point3d>();
345
+            int n = Convert.ToInt32(numericUpDown_interse.Text);
346
+            for (int i = 1; i <= n; i++)
347
+            {
348
+                double t = (double)i / (n + 1);
349
+
350
+                // 计算贝塞尔曲线上的点
351
+                double x = Math.Pow(1 - t, 3) * pts[0].X +
352
+                           3 * t * Math.Pow(1 - t, 2) * p2.X +
353
+                           3 * Math.Pow(t, 2) * (1 - t) * p3.X +
354
+                           Math.Pow(t, 3) * pts[1].X;
355
+
356
+                double y = Math.Pow(1 - t, 3) * pts[0].Y +
357
+                           3 * t * Math.Pow(1 - t, 2) * p2.Y +
358
+                           3 * Math.Pow(t, 2) * (1 - t) * p3.Y +
359
+                           Math.Pow(t, 3) * pts[1].Y;
360
+
361
+                double z = Math.Pow(1 - t, 3) * pts[0].Z +
362
+                           3 * t * Math.Pow(1 - t, 2) * p2.Z +
363
+                           3 * Math.Pow(t, 2) * (1 - t) * p3.Z +
364
+                           Math.Pow(t, 3) * pts[1].Z;
365
+
366
+                points.Add(new Point3d(x, y, z));
367
+            }
368
+            return points;
369
+        }
370
+
371
+        private void trackBar_mirror_Scroll(object sender, EventArgs e)
372
+        {
373
+            // 每次滚动都重置定时器
374
+            this.timer1.Stop();
375
+            this.timer1.Start();
376
+        }
377
+
378
+        private void trackBar_intersept_Scroll(object sender, EventArgs e)
379
+        {
380
+            // 每次滚动都重置定时器
381
+            this.timer1.Stop();
382
+            this.timer1.Start();
383
+        }
384
+
385
+        private void timer1_Tick(object sender, EventArgs e)
386
+        {
387
+            this.timer1.Stop();
388
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
389
+            DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
390
+            for (int i = 0; i < addpllist.Count; i++)
391
+            {
392
+                using (Transaction tr = db.TransactionManager.StartTransaction())
393
+                {
394
+                    Polyline pl = tr.GetObject(addpllist[i].ObjectId, OpenMode.ForWrite) as Polyline;
395
+                    pl.Erase();
396
+                    tr.Commit();
397
+                }
398
+            }
399
+            doclock.Dispose();
400
+            addpllist.Clear();
401
+            var pllist_goruped = pllist.GroupBy(p => p.Elevation);
402
+            foreach (var item in pllist_goruped)
403
+            {
404
+                if (item.Count() >= 2)
405
+                {
406
+                    Polyline pl1 = item.ElementAt(0);
407
+                    Polyline pl2 = item.ElementAt(1);
408
+                    var pts = calculate(pl1.StartPoint, pl1.EndPoint, pl2.StartPoint, pl2.EndPoint);
409
+                    var points = bezier(pl1, pl2, pts);
410
+                    DocumentLock doclock1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
411
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
412
+                    {
413
+                        // 创建多段线
414
+                        Polyline polyline = new Polyline();
415
+
416
+                        // 添加起点
417
+                        polyline.AddVertexAt(0, new Point2d(pts[0].X, pts[0].Y), 0, 0, 0);
418
+
419
+                        // 添加插值点
420
+                        for (int i = 0; i < points.Count; i++)
421
+                        {
422
+                            polyline.AddVertexAt(i + 1, new Point2d(points[i].X, points[i].Y), 0, 0, 0);
423
+                        }
424
+
425
+                        // 添加终点
426
+                        polyline.AddVertexAt(points.Count + 1, new Point2d(pts[1].X, pts[1].Y), 0, 0, 0);
427
+                        polyline.Elevation = item.Key;
428
+                        polyline.ColorIndex = 1;
429
+                        // 添加到模型空间
430
+                        BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
431
+                        btr.AppendEntity(polyline);
432
+                        tr.AddNewlyCreatedDBObject(polyline, true);
433
+                        addpllist.Add(polyline);
434
+                        tr.Commit();
435
+                    }
436
+                    doclock1.Dispose();
437
+                }
438
+
439
+            }
440
+            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
441
+            ed.UpdateScreen();
442
+        }
443
+
444
+        private void DgxFix_FormClosing(object sender, FormClosingEventArgs e)
445
+        {
446
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
447
+            if (button_preview.Text=="取 消")
448
+            {
449
+                DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
450
+                for (int i = 0; i < addpllist.Count; i++)
451
+                {
452
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
453
+                    {
454
+                        if (!addpllist[i].ObjectId.IsErased)
455
+                        {
456
+                            Polyline pl = tr.GetObject(addpllist[i].ObjectId, OpenMode.ForWrite) as Polyline;
457
+                            pl.Erase();
458
+                        }
459
+                        tr.Commit();
460
+                    }
461
+                }
462
+                doclock.Dispose();
463
+                pllist.Clear();
464
+                addpllist.Clear();
465
+            }
466
+        }
467
+
468
+        private void button_confirm_Click(object sender, EventArgs e)
469
+        {
470
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
471
+            if (pllist.Count > 0 && addpllist.Count > 0)
472
+            {
473
+                var pllist_goruped = pllist.GroupBy(p => p.Elevation);
474
+                foreach (var item in pllist_goruped)
475
+                {
476
+                    if (item.Count() >= 2)
477
+                    {
478
+                        Polyline pl = addpllist.Where(p => p.Elevation == item.Key).First();
479
+
480
+                        DocumentLock doclock1 = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
481
+                        using (Transaction tr = db.TransactionManager.StartTransaction())
482
+                        {
483
+                            Polyline pl1 = tr.GetObject(item.ElementAt(0).ObjectId,OpenMode.ForWrite)as Polyline;
484
+                            Polyline[] joinpls = new Polyline[2] { pl, item.ElementAt(1) }; 
485
+                            pl1.JoinEntities(joinpls);
486
+                            Polyline pl2 = tr.GetObject(pl.ObjectId, OpenMode.ForWrite) as Polyline;
487
+                            Polyline pl3 = tr.GetObject(item.ElementAt(1).ObjectId, OpenMode.ForWrite) as Polyline;
488
+                            pl2.Erase();
489
+                            pl3.Erase();
490
+                            tr.Commit();
491
+                        }
492
+                        doclock1.Dispose();
493
+                    }
494
+                }
495
+                addpllist.Clear();
496
+                pllist.Clear();
497
+            }
498
+            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
499
+            ed.UpdateScreen();
500
+            button_preview.Text = "预 览";
501
+            button_preview.Refresh();
502
+        }
503
+
504
+        private void numericUpDown_mirror_ValueChanged(object sender, EventArgs e)
505
+        { 
506
+            this.timer1.Stop();
507
+            this.timer1.Start();
508
+
509
+        }
510
+
511
+        private void numericUpDown_interse_ValueChanged(object sender, EventArgs e)
512
+        {
513
+            this.timer1.Stop();
514
+            this.timer1.Start();
515
+        }
516
+
517
+        private void checkBox1_CheckedChanged(object sender, EventArgs e)
518
+        {
519
+            groupBox1.Enabled = checkBox1.Checked;
520
+        }
521
+    }
522
+}

+ 123
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/DgxFix.resx Voir le fichier

@@ -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="timer1.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>

+ 122
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Dgxconnect.Designer.cs Voir le fichier

@@ -0,0 +1,122 @@
1
+
2
+namespace CADTools
3
+{
4
+    partial class Dgxconnect
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_lyr = new System.Windows.Forms.CheckedListBox();
33
+            this.label1 = new System.Windows.Forms.Label();
34
+            this.button1 = new System.Windows.Forms.Button();
35
+            this.label2 = new System.Windows.Forms.Label();
36
+            this.textBox1 = new System.Windows.Forms.TextBox();
37
+            this.label5 = new System.Windows.Forms.Label();
38
+            this.SuspendLayout();
39
+            // 
40
+            // checkedListBox_lyr
41
+            // 
42
+            this.checkedListBox_lyr.FormattingEnabled = true;
43
+            this.checkedListBox_lyr.Location = new System.Drawing.Point(99, 106);
44
+            this.checkedListBox_lyr.Name = "checkedListBox_lyr";
45
+            this.checkedListBox_lyr.Size = new System.Drawing.Size(365, 124);
46
+            this.checkedListBox_lyr.TabIndex = 0;
47
+            // 
48
+            // label1
49
+            // 
50
+            this.label1.AutoSize = true;
51
+            this.label1.Location = new System.Drawing.Point(64, 76);
52
+            this.label1.Name = "label1";
53
+            this.label1.Size = new System.Drawing.Size(142, 15);
54
+            this.label1.TabIndex = 1;
55
+            this.label1.Text = "待连接线所在图层:";
56
+            // 
57
+            // button1
58
+            // 
59
+            this.button1.Location = new System.Drawing.Point(233, 256);
60
+            this.button1.Name = "button1";
61
+            this.button1.Size = new System.Drawing.Size(81, 28);
62
+            this.button1.TabIndex = 2;
63
+            this.button1.Text = "确 定";
64
+            this.button1.UseVisualStyleBackColor = true;
65
+            this.button1.Click += new System.EventHandler(this.button1_Click);
66
+            // 
67
+            // label2
68
+            // 
69
+            this.label2.AutoSize = true;
70
+            this.label2.Location = new System.Drawing.Point(34, 42);
71
+            this.label2.Name = "label2";
72
+            this.label2.Size = new System.Drawing.Size(172, 15);
73
+            this.label2.TabIndex = 3;
74
+            this.label2.Text = "待连接线之间最大距离:";
75
+            // 
76
+            // textBox1
77
+            // 
78
+            this.textBox1.Location = new System.Drawing.Point(212, 39);
79
+            this.textBox1.Name = "textBox1";
80
+            this.textBox1.Size = new System.Drawing.Size(100, 25);
81
+            this.textBox1.TabIndex = 4;
82
+            this.textBox1.Text = "2";
83
+            // 
84
+            // label5
85
+            // 
86
+            this.label5.AutoSize = true;
87
+            this.label5.ForeColor = System.Drawing.Color.Gray;
88
+            this.label5.Location = new System.Drawing.Point(12, 9);
89
+            this.label5.Name = "label5";
90
+            this.label5.Size = new System.Drawing.Size(502, 15);
91
+            this.label5.TabIndex = 12;
92
+            this.label5.Text = "点击确定后选择图框,按下空格后工具会自动连接在图框上的待连接等高线";
93
+            // 
94
+            // Dgxconnect
95
+            // 
96
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
97
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
98
+            this.ClientSize = new System.Drawing.Size(541, 298);
99
+            this.Controls.Add(this.label5);
100
+            this.Controls.Add(this.textBox1);
101
+            this.Controls.Add(this.label2);
102
+            this.Controls.Add(this.button1);
103
+            this.Controls.Add(this.label1);
104
+            this.Controls.Add(this.checkedListBox_lyr);
105
+            this.Name = "Dgxconnect";
106
+            this.Text = "批量连接错位等高线";
107
+            this.Load += new System.EventHandler(this.Dgxconnect_Load);
108
+            this.ResumeLayout(false);
109
+            this.PerformLayout();
110
+
111
+        }
112
+
113
+        #endregion
114
+
115
+        private System.Windows.Forms.CheckedListBox checkedListBox_lyr;
116
+        private System.Windows.Forms.Label label1;
117
+        private System.Windows.Forms.Button button1;
118
+        private System.Windows.Forms.Label label2;
119
+        private System.Windows.Forms.TextBox textBox1;
120
+        private System.Windows.Forms.Label label5;
121
+    }
122
+}

+ 341
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Dgxconnect.cs Voir le fichier

@@ -0,0 +1,341 @@
1
+using Autodesk.AutoCAD.ApplicationServices;
2
+using Autodesk.AutoCAD.DatabaseServices;
3
+using Autodesk.AutoCAD.EditorInput;
4
+using Autodesk.AutoCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.ComponentModel;
8
+using System.Data;
9
+using System.Drawing;
10
+using System.Linq;
11
+using System.Text;
12
+using System.Threading.Tasks;
13
+using System.Windows.Forms;
14
+
15
+namespace CADTools
16
+{
17
+    public partial class Dgxconnect : Form
18
+    {
19
+        public Dgxconnect()
20
+        {
21
+            InitializeComponent();
22
+        }
23
+
24
+        private void Dgxconnect_Load(object sender, EventArgs e)
25
+        {
26
+            //自动填充
27
+            Database database = Autodesk.AutoCAD.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.checkedListBox_lyr.Items.Add(alllayername[i]);
44
+                    if (alllayername[i] == "8110")
45
+                    {
46
+                        int index = this.checkedListBox_lyr.Items.IndexOf("8110");
47
+                        this.checkedListBox_lyr.SetItemChecked(index, true);
48
+                    }
49
+                    if (alllayername[i] == "8120")
50
+                    {
51
+                        int index = this.checkedListBox_lyr.Items.IndexOf("8120");
52
+                        this.checkedListBox_lyr.SetItemChecked(index, true);
53
+                    }
54
+                }
55
+                traction.Commit();
56
+            }
57
+        }
58
+
59
+        private void button1_Click(object sender, EventArgs e)
60
+        {
61
+            this.WindowState = FormWindowState.Minimized;
62
+            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
63
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
64
+            ed.UpdateScreen();
65
+
66
+            var lyr = string.Join(",", checkedListBox_lyr.Items.Cast<string>()
67
+                .Where((item, index) => checkedListBox_lyr.GetItemChecked(index)));
68
+            List<Point3dCollection> fwlist = new List<Point3dCollection>();
69
+            List<List<Point3d>> viewpts = new List<List<Point3d>>();
70
+            List<Polyline> pllist = new List<Polyline>();
71
+            double limitdist = Convert.ToDouble(textBox1.Text);
72
+            
73
+            //范围线,根据这条线选择起点或终点正好在它上面的等高线,为后面连接做准备
74
+            TypedValue[] typedvalue = new TypedValue[1];
75
+            typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "LWPolyline"), 0);
76
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
77
+            PromptSelectionResult psr = ed.GetSelection(selectionfilter);
78
+            if (psr.Status == PromptStatus.OK)
79
+            {
80
+                SelectionSet ss = psr.Value;
81
+                ObjectId[] obj = new ObjectId[ss.Count];
82
+                obj = ss.GetObjectIds();
83
+                for (int i = 0; i < obj.Length; i++)
84
+                {
85
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
86
+                    {
87
+                        Polyline pl = tr.GetObject(obj[i], OpenMode.ForRead) as Polyline;
88
+                        pllist.Add(pl);
89
+                        Point3dCollection pts = new Point3dCollection();
90
+                        int count = pl.NumberOfVertices;
91
+                        for (int j = 0; j < count; j++)
92
+                        {
93
+                          Point3d pt = pl.GetPoint3dAt(j);
94
+                          if (!pts.Contains(pt))  
95
+                                pts.Add(pt); 
96
+                        }
97
+                        pts.Add(pts[0]);
98
+                        fwlist.Add(pts);
99
+
100
+                        var maxpt = pl.Bounds.Value.MaxPoint;
101
+                        var minpt = pl.Bounds.Value.MinPoint;
102
+                        Point3d pt1 = new Point3d(maxpt.X + 1, maxpt.Y + 1, maxpt.Z);
103
+                        Point3d pt2 = new Point3d(minpt.X - 1, minpt.Y - 1, minpt.Z);
104
+                        List<Point3d> viewpt = new List<Point3d>() { pt1,pt2};
105
+                        viewpts.Add(viewpt);
106
+                        tr.Commit();
107
+                    }
108
+                }
109
+            }
110
+
111
+            //按范围线筛选需要连接的线
112
+            for (int i = 0; i < fwlist.Count; i++)
113
+            {
114
+                Polyline fw = pllist[i];
115
+                ZoomView(ed, viewpts[i][0], viewpts[i][1]);
116
+
117
+                TypedValue[] typedvalue1 = new TypedValue[2];
118
+                typedvalue1.SetValue(new TypedValue((int)DxfCode.LayerName, lyr), 0);
119
+                typedvalue1.SetValue(new TypedValue((int)DxfCode.Start, "LWPolyline"), 1);
120
+                SelectionFilter selectionfilter1 = new SelectionFilter(typedvalue1);
121
+                PromptSelectionResult psr1 = ed.SelectCrossingWindow(viewpts[i][1],viewpts[i][0],selectionfilter1);
122
+
123
+                if(psr1.Status == PromptStatus.OK)
124
+                {
125
+                    SelectionSet ss = psr1.Value;
126
+                    ObjectId[] obj = new ObjectId[ss.Count];
127
+                    obj = ss.GetObjectIds();
128
+
129
+                    List<Polyline> selectedpl = new List<Polyline>();
130
+                    for (int j = 0; j < obj.Length; j++)
131
+                    {
132
+                        using (Transaction tr = db.TransactionManager.StartTransaction())
133
+                        {
134
+                            Polyline pl = tr.GetObject(obj[j], OpenMode.ForRead) as Polyline;
135
+                            Point3d closestpt1 = fw.GetClosestPointTo(pl.StartPoint, false);
136
+                            Point3d closestpt2 = fw.GetClosestPointTo(pl.EndPoint, false);
137
+                            double dist1 = new Point2d(closestpt1.X,closestpt1.Y).GetDistanceTo(new Point2d(pl.StartPoint.X,pl.StartPoint.Y));
138
+                            double dist2 = new Point2d(closestpt2.X, closestpt2.Y).GetDistanceTo(new Point2d(pl.EndPoint.X, pl.EndPoint.Y));
139
+                            if (dist1 < limitdist || dist2 < limitdist)
140
+                                selectedpl.Add(pl);
141
+                            tr.Commit();
142
+                        }
143
+                    }
144
+
145
+                    var selectedpl_sorted = selectedpl.GroupBy(x => x.Elevation).ToList();
146
+                    foreach (var group in selectedpl_sorted)
147
+                    {
148
+                        List<int> con_index = new List<int>();
149
+                        var grouplist = group.ToList();
150
+                        for (int j = 0; j < group.Count()-1; j++)
151
+                        {
152
+                            if (con_index.Contains(j))
153
+                                continue;
154
+                            Polyline pl1 = grouplist[j];
155
+                            for (int jj = j + 1; jj < group.Count(); jj++)
156
+                            {
157
+                                Polyline pl2 = grouplist[jj];
158
+                                Point3d pt1 = pl1.StartPoint;
159
+                                Point3d pt2 = pl1.EndPoint;
160
+                                Point3d pt3 = pl2.StartPoint;
161
+                                Point3d pt4 = pl2.EndPoint;
162
+                                var connectpt = Calculate(pt1, pt2, pt3, pt4);
163
+                                if(connectpt.Count!=0)
164
+                                {
165
+                                    Point3d getpt = fw.GetClosestPointTo(connectpt[0], false);
166
+                                    double dist = new Point2d(getpt.X, getpt.Y).GetDistanceTo(new Point2d(connectpt[0].X, connectpt[1].Y));
167
+                                    if (dist < limitdist)
168
+                                    {
169
+                                        Polyline Connectedpl = Connectpl(pl1, pl2, connectpt);
170
+                                        if (Connectedpl.IsErased)
171
+                                            continue;
172
+                                        pl1 = Connectedpl;
173
+                                        con_index.Add(jj);
174
+                                        con_index.Add(j);
175
+                                    }
176
+                                }
177
+                            }
178
+                        }
179
+                    }
180
+                }
181
+            }
182
+
183
+            this.Close();
184
+        }
185
+
186
+        private void ZoomView(Editor edit, Point3d pt1, Point3d pt2)
187
+        {
188
+            var x_min = Math.Min(pt1.X, pt2.X);
189
+            var y_min = Math.Min(pt1.Y, pt2.Y);
190
+            using (ViewTableRecord currview1 = edit.GetCurrentView())
191
+            {
192
+                currview1.CenterPoint = new Point2d(Math.Abs((pt2.X - pt1.X) / 2) + x_min,
193
+                                                    Math.Abs((pt2.Y - pt1.Y) / 2) + y_min);
194
+                currview1.Width = Math.Abs(pt2.X - pt1.X) + 10;
195
+                currview1.Height = Math.Abs(pt2.Y - pt1.Y) + 10;
196
+                edit.SetCurrentView(currview1);
197
+            }
198
+            edit.UpdateScreen();
199
+        }
200
+
201
+        /// <summary>
202
+        /// 计算获得连接点
203
+        /// </summary>
204
+        private Point3dCollection Calculate(Point3d startpt1, Point3d endpt1, Point3d startpt2, Point3d endpt2)
205
+        {
206
+            Double[] distance = new Double[4];
207
+            Point3dCollection joinpoint = new Point3dCollection();
208
+            int i = 0;
209
+
210
+            //两线段四个端点之间的距离
211
+            distance[0] = Math.Sqrt(Math.Pow((startpt1.X - startpt2.X), 2) + Math.Pow((startpt1.Y - startpt2.Y), 2));
212
+            distance[1] = Math.Sqrt(Math.Pow((startpt1.X - endpt2.X), 2) + Math.Pow((startpt1.Y - endpt2.Y), 2));
213
+            distance[2] = Math.Sqrt(Math.Pow((endpt1.X - startpt2.X), 2) + Math.Pow((endpt1.Y - startpt2.Y), 2));
214
+            distance[3] = Math.Sqrt(Math.Pow((endpt1.X - endpt2.X), 2) + Math.Pow((endpt1.Y - endpt2.Y), 2));
215
+
216
+            //比较获取最小的距离,得到连接点
217
+            for (i = 0; i < distance.Length; i++)
218
+            {
219
+                if (distance[i] == distance.Min())
220
+                {
221
+                    if (distance[i] < Convert.ToDouble(textBox1.Text)) break;
222
+                    else return joinpoint;
223
+                }
224
+                    
225
+            }
226
+            switch (i.ToString())
227
+            {
228
+                case "0":
229
+                    joinpoint.Add(startpt1);
230
+                    joinpoint.Add(startpt2);
231
+                    break;
232
+
233
+                case "1":
234
+                    joinpoint.Add(startpt1);
235
+                    joinpoint.Add(endpt2);
236
+                    break;
237
+
238
+                case "2":
239
+                    joinpoint.Add(endpt1);
240
+                    joinpoint.Add(startpt2);
241
+                    break;
242
+
243
+                case "3":
244
+                    joinpoint.Add(endpt1);
245
+                    joinpoint.Add(endpt2);
246
+                    break;
247
+            }
248
+            return joinpoint;
249
+        }
250
+
251
+        private Polyline Connectpl(Polyline pl1, Polyline pl2, Point3dCollection connctpt)
252
+        {
253
+            Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
254
+            Polyline re=new Polyline();
255
+
256
+            double index1 = pl1.GetParameterAtPoint(connctpt[0]);
257
+            double index2 = pl2.GetParameterAtPoint(connctpt[1]);
258
+
259
+            int numa = 2;
260
+            int numb = 2;
261
+            if (pl1.NumberOfVertices <= 2) numa = 0;
262
+            if (pl2.NumberOfVertices <= 2) numb = 0;
263
+            double index1_2 = index1 == 0 ? numa : (int)(index1 - numa);
264
+            double index2_2 = index2 == 0 ? numb : (int)(index2 - numb);
265
+            DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
266
+            using (Transaction tr = db.TransactionManager.StartTransaction())
267
+            {
268
+                Polyline pl_wt1 = tr.GetObject(pl1.ObjectId, OpenMode.ForWrite) as Polyline;
269
+                Polyline pl_wt2 = tr.GetObject(pl2.ObjectId, OpenMode.ForWrite) as Polyline;
270
+                Polyline addpl = new Polyline();
271
+                List<Point2d> vertex = new List<Point2d>();
272
+                int num1 = 3;
273
+                int num2 = 3;
274
+                if (pl_wt1.NumberOfVertices < 4) num1 = pl_wt1.NumberOfVertices - 2;
275
+                if (pl_wt2.NumberOfVertices < 4) num2 = pl_wt2.NumberOfVertices - 2;
276
+                vertex.Add(pl_wt1.GetPoint2dAt(index1 == 0 ? num1 : (int)(index1 - num1)));
277
+                vertex.Add(pl_wt2.GetPoint2dAt(index2 == 0 ? num2 : (int)(index2 - num2)));
278
+                addpl.AddVertexAt(0, vertex[0], 0, 0, 0);
279
+                addpl.AddVertexAt(1, vertex[1], 0, 0, 0);
280
+
281
+                // 确保 index1< index1_2
282
+                if (index1 > index1_2)
283
+                {
284
+                    double temp = index1;
285
+                    index1 = index1_2;
286
+                    index1_2 = temp;
287
+                }
288
+                double removeCount = (index1_2 - index1 + 1);
289
+                // 从后往前删除,避免索引变化
290
+                for (int i = (int)index1_2; i >= (int)index1; i--)
291
+                {
292
+                    pl_wt1.RemoveVertexAt(i);
293
+                }
294
+
295
+                // 确保 index2< index2_2
296
+                if (index2 > index2_2)
297
+                {
298
+                    double temp = index2;
299
+                    index2 = index2_2;
300
+                    index2_2 = temp;
301
+                }
302
+                double removeCount2 = (index2_2 - index2 + 1);
303
+                // 从后往前删除,避免索引变化
304
+                for (int i = (int)index2_2; i >= (int)index2; i--)
305
+                {
306
+                    pl_wt2.RemoveVertexAt(i);
307
+                }
308
+                addpl.Elevation = pl_wt1.Elevation;
309
+                if (pl_wt1.NumberOfVertices >= 2 && pl_wt2.NumberOfVertices >= 2)
310
+                {
311
+                    Entity[] entities = new Entity[2] { addpl, pl_wt2 };
312
+                    pl_wt1.JoinEntities(entities);
313
+                }
314
+                else if (pl_wt1.NumberOfVertices >= 2 && pl_wt2.NumberOfVertices < 2)
315
+                {
316
+                    pl_wt1.JoinEntity(addpl);
317
+                }
318
+                else if (pl_wt1.NumberOfVertices < 2 && pl_wt2.NumberOfVertices >= 2)
319
+                {
320
+                    pl_wt1.Erase();
321
+                    addpl.JoinEntity(pl_wt2);
322
+                }
323
+                else
324
+                {
325
+                    BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
326
+                    BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
327
+                    btr.AppendEntity(addpl);
328
+                    tr.AddNewlyCreatedDBObject(addpl, true);
329
+                    pl_wt1.Erase();
330
+                }
331
+                if (!pl_wt1.IsErased)
332
+                    // 删除原来的 pl_wt2
333
+                    pl_wt2.Erase();
334
+                re = pl_wt1;
335
+                tr.Commit();
336
+            }
337
+            doclock.Dispose();
338
+            return re;
339
+        }
340
+    }
341
+}

+ 120
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Dgxconnect.resx Voir le fichier

@@ -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>

+ 5
- 5
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/LayerChange.cs Voir le fichier

@@ -88,7 +88,7 @@ namespace CADTools
88 88
                             }
89 89
                         }
90 90
                     }
91
-                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
91
+                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
92 92
                     ed.WriteMessage("删除成功!\n");
93 93
                     trans.Commit();
94 94
                 }
@@ -119,7 +119,7 @@ namespace CADTools
119 119
                             layerTableRecord.Erase();
120 120
                     }
121 121
                     transaction.Commit();
122
-                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
122
+                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
123 123
                 }
124 124
                 doclock.Dispose();
125 125
                 ed.WriteMessage("删除成功!\n");
@@ -167,7 +167,7 @@ namespace CADTools
167 167
                             }
168 168
                         }
169 169
                     }
170
-                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
170
+                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
171 171
                     transaction.Commit();
172 172
                     ed.WriteMessage("删除成功!\n");
173 173
                 }
@@ -194,7 +194,7 @@ namespace CADTools
194 194
                         layerTableRecord.IsOff = false;
195 195
                     }
196 196
                 }
197
-                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
197
+                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
198 198
                 transaction.Commit();
199 199
             }
200 200
             doclock.Dispose();
@@ -219,7 +219,7 @@ namespace CADTools
219 219
                         layerTableRecord.IsOff = true;
220 220
                     }
221 221
                 }
222
-                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
222
+                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
223 223
                 transaction.Commit();
224 224
             }
225 225
             doclock.Dispose();

+ 36
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/MainClass.cs Voir le fichier

@@ -680,5 +680,41 @@ namespace CADTools
680 680
                 form.Show();
681 681
             }
682 682
         }
683
+
684
+        //平滑连接等高线
685
+        [CommandMethod("FixDgx")]
686
+        public void FixDgx()
687
+        {
688
+            Verify();
689
+            if (num == 1)
690
+            {
691
+                DgxFix form = new DgxFix();
692
+                form.Show();
693
+            }
694
+        }
695
+
696
+        //批量连接错位等高线
697
+        [CommandMethod("ConnectMismDgx")]
698
+        public void ConnectMismDgx()
699
+        {
700
+            Verify();
701
+            if (num == 1)
702
+            {
703
+                Dgxconnect form = new Dgxconnect();
704
+                form.Show();
705
+            }
706
+        }
707
+
708
+        //水下点赋值
709
+        [CommandMethod("UnderwaterPtAssignment")]
710
+        public void UnderwaterPtAssignment()
711
+        {
712
+            Verify();
713
+            if (num == 1)
714
+            {
715
+                UwPtAssignment form = new UwPtAssignment();
716
+                form.Show();
717
+            }
718
+        }
683 719
     }
684 720
 }

+ 9
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/Menus.cs Voir le fichier

@@ -44,6 +44,9 @@ namespace CADTools
44 44
             pmi = pm.AddMenuItem(pm.Count + 1, "按图框等高线裁剪", "CutDgxByTK ");
45 45
             pmi.HelpString = "按图框等高线裁剪";
46 46
 
47
+            pmi = pm.AddMenuItem(pm.Count + 1, "批量连接错位等高线", "ConnectMismDgx ");
48
+            pmi.HelpString = "连接错位等高线";
49
+
47 50
             //pmi = pm.AddMenuItem(pm.Count + 1, "伪节点检查", "FakeCheck ");
48 51
             //pmi.HelpString = "伪节点检查";
49 52
 
@@ -111,6 +114,9 @@ namespace CADTools
111 114
             pmi = pm.AddMenuItem(pm.Count + 1, "删除整数高程点", "Deleteintgcd ");
112 115
             pmi.HelpString = "删除整数高程点";
113 116
 
117
+            pmi = pm.AddMenuItem(pm.Count + 1, "水下点赋值", "UnderwaterPtAssignment ");
118
+            pmi.HelpString = "水下点赋值";
119
+
114 120
             pmi = pm.AddMenuItem(pm.Count + 1, "等高线分层", "Hierarchy ");
115 121
             pmi.HelpString = "等高线分层";
116 122
 
@@ -153,6 +159,9 @@ namespace CADTools
153 159
             pmi = pm.AddMenuItem(pm.Count + 1, "等高线过河流道路房屋陡坎裁剪", "Dgxthrorvrd ");
154 160
             pmi.HelpString = "等高线过河流道路房屋陡坎裁剪";
155 161
 
162
+            pmi = pm.AddMenuItem(pm.Count + 1, "等高线修复", "FixDgx ");
163
+            pmi.HelpString = "等高线修复";
164
+
156 165
             //添加一个分隔条以区分不同类型的命令
157 166
             pm.AddSeparator(pm.Count + 1);
158 167
 

+ 1
- 1
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/MergeDwg.cs Voir le fichier

@@ -94,7 +94,7 @@ namespace CADTools
94 94
                 dynamic acadApp = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication;
95 95
                 acadApp.ZoomExtents();
96 96
                 string newFilePath = Path.Combine(textBox_aftermerge.Text.ToString(), dwgname1[i]);
97
-                newdb.SaveAs(newFilePath, true, DwgVersion.AC1021, newdb.SecurityParameters);
97
+                newdb.SaveAs(newFilePath, true, DwgVersion.AC1800, newdb.SecurityParameters);
98 98
                 document.CloseAndDiscard();
99 99
             }
100 100
             this.Close();

+ 183
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/UwPtAssignment.Designer.cs Voir le fichier

@@ -0,0 +1,183 @@
1
+
2
+namespace CADTools
3
+{
4
+    partial class UwPtAssignment
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_waterline = new System.Windows.Forms.ComboBox();
34
+            this.label2 = new System.Windows.Forms.Label();
35
+            this.comboBox_underpt = new System.Windows.Forms.ComboBox();
36
+            this.button1 = new System.Windows.Forms.Button();
37
+            this.checkBox_minus = new System.Windows.Forms.CheckBox();
38
+            this.checkBox_plus = new System.Windows.Forms.CheckBox();
39
+            this.label3 = new System.Windows.Forms.Label();
40
+            this.comboBox_addpt = new System.Windows.Forms.ComboBox();
41
+            this.label4 = new System.Windows.Forms.Label();
42
+            this.textBox1 = new System.Windows.Forms.TextBox();
43
+            this.SuspendLayout();
44
+            // 
45
+            // label1
46
+            // 
47
+            this.label1.AutoSize = true;
48
+            this.label1.Location = new System.Drawing.Point(63, 33);
49
+            this.label1.Name = "label1";
50
+            this.label1.Size = new System.Drawing.Size(127, 15);
51
+            this.label1.TabIndex = 0;
52
+            this.label1.Text = "水边线所在图层:";
53
+            // 
54
+            // comboBox_waterline
55
+            // 
56
+            this.comboBox_waterline.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
57
+            this.comboBox_waterline.FormattingEnabled = true;
58
+            this.comboBox_waterline.Location = new System.Drawing.Point(213, 30);
59
+            this.comboBox_waterline.Name = "comboBox_waterline";
60
+            this.comboBox_waterline.Size = new System.Drawing.Size(142, 23);
61
+            this.comboBox_waterline.TabIndex = 1;
62
+            // 
63
+            // label2
64
+            // 
65
+            this.label2.AutoSize = true;
66
+            this.label2.Location = new System.Drawing.Point(66, 73);
67
+            this.label2.Name = "label2";
68
+            this.label2.Size = new System.Drawing.Size(127, 15);
69
+            this.label2.TabIndex = 2;
70
+            this.label2.Text = "水下点所在图层:";
71
+            // 
72
+            // comboBox_underpt
73
+            // 
74
+            this.comboBox_underpt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
75
+            this.comboBox_underpt.FormattingEnabled = true;
76
+            this.comboBox_underpt.Location = new System.Drawing.Point(213, 70);
77
+            this.comboBox_underpt.Name = "comboBox_underpt";
78
+            this.comboBox_underpt.Size = new System.Drawing.Size(142, 23);
79
+            this.comboBox_underpt.TabIndex = 3;
80
+            // 
81
+            // button1
82
+            // 
83
+            this.button1.Location = new System.Drawing.Point(176, 219);
84
+            this.button1.Name = "button1";
85
+            this.button1.Size = new System.Drawing.Size(75, 31);
86
+            this.button1.TabIndex = 4;
87
+            this.button1.Text = "确 定";
88
+            this.button1.UseVisualStyleBackColor = true;
89
+            this.button1.Click += new System.EventHandler(this.button1_Click);
90
+            // 
91
+            // checkBox_minus
92
+            // 
93
+            this.checkBox_minus.AutoSize = true;
94
+            this.checkBox_minus.Location = new System.Drawing.Point(31, 190);
95
+            this.checkBox_minus.Name = "checkBox_minus";
96
+            this.checkBox_minus.Size = new System.Drawing.Size(149, 19);
97
+            this.checkBox_minus.TabIndex = 5;
98
+            this.checkBox_minus.Text = "水下点深度是正数";
99
+            this.checkBox_minus.UseVisualStyleBackColor = true;
100
+            // 
101
+            // checkBox_plus
102
+            // 
103
+            this.checkBox_plus.AutoSize = true;
104
+            this.checkBox_plus.Location = new System.Drawing.Point(257, 190);
105
+            this.checkBox_plus.Name = "checkBox_plus";
106
+            this.checkBox_plus.Size = new System.Drawing.Size(149, 19);
107
+            this.checkBox_plus.TabIndex = 6;
108
+            this.checkBox_plus.Text = "水下点深度是负数";
109
+            this.checkBox_plus.UseVisualStyleBackColor = true;
110
+            // 
111
+            // label3
112
+            // 
113
+            this.label3.AutoSize = true;
114
+            this.label3.Location = new System.Drawing.Point(33, 111);
115
+            this.label3.Name = "label3";
116
+            this.label3.Size = new System.Drawing.Size(157, 15);
117
+            this.label3.TabIndex = 7;
118
+            this.label3.Text = "新增高程点所在图层:";
119
+            // 
120
+            // comboBox_addpt
121
+            // 
122
+            this.comboBox_addpt.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
123
+            this.comboBox_addpt.FormattingEnabled = true;
124
+            this.comboBox_addpt.Location = new System.Drawing.Point(213, 111);
125
+            this.comboBox_addpt.Name = "comboBox_addpt";
126
+            this.comboBox_addpt.Size = new System.Drawing.Size(142, 23);
127
+            this.comboBox_addpt.TabIndex = 8;
128
+            // 
129
+            // label4
130
+            // 
131
+            this.label4.AutoSize = true;
132
+            this.label4.Location = new System.Drawing.Point(93, 152);
133
+            this.label4.Name = "label4";
134
+            this.label4.Size = new System.Drawing.Size(97, 15);
135
+            this.label4.TabIndex = 9;
136
+            this.label4.Text = "高程点块名:";
137
+            // 
138
+            // textBox1
139
+            // 
140
+            this.textBox1.Location = new System.Drawing.Point(213, 149);
141
+            this.textBox1.Name = "textBox1";
142
+            this.textBox1.Size = new System.Drawing.Size(100, 25);
143
+            this.textBox1.TabIndex = 10;
144
+            // 
145
+            // UwPtAssignment
146
+            // 
147
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
148
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
149
+            this.ClientSize = new System.Drawing.Size(442, 274);
150
+            this.Controls.Add(this.textBox1);
151
+            this.Controls.Add(this.label4);
152
+            this.Controls.Add(this.comboBox_addpt);
153
+            this.Controls.Add(this.label3);
154
+            this.Controls.Add(this.checkBox_plus);
155
+            this.Controls.Add(this.checkBox_minus);
156
+            this.Controls.Add(this.button1);
157
+            this.Controls.Add(this.comboBox_underpt);
158
+            this.Controls.Add(this.label2);
159
+            this.Controls.Add(this.comboBox_waterline);
160
+            this.Controls.Add(this.label1);
161
+            this.Name = "UwPtAssignment";
162
+            this.Text = "水下点赋值";
163
+            this.Load += new System.EventHandler(this.UwPtAssignment_Load);
164
+            this.ResumeLayout(false);
165
+            this.PerformLayout();
166
+
167
+        }
168
+
169
+        #endregion
170
+
171
+        private System.Windows.Forms.Label label1;
172
+        private System.Windows.Forms.ComboBox comboBox_waterline;
173
+        private System.Windows.Forms.Label label2;
174
+        private System.Windows.Forms.ComboBox comboBox_underpt;
175
+        private System.Windows.Forms.Button button1;
176
+        private System.Windows.Forms.CheckBox checkBox_minus;
177
+        private System.Windows.Forms.CheckBox checkBox_plus;
178
+        private System.Windows.Forms.Label label3;
179
+        private System.Windows.Forms.ComboBox comboBox_addpt;
180
+        private System.Windows.Forms.Label label4;
181
+        private System.Windows.Forms.TextBox textBox1;
182
+    }
183
+}

+ 235
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/UwPtAssignment.cs Voir le fichier

@@ -0,0 +1,235 @@
1
+using Autodesk.AutoCAD.ApplicationServices;
2
+using Autodesk.AutoCAD.DatabaseServices;
3
+using Autodesk.AutoCAD.EditorInput;
4
+using Autodesk.AutoCAD.Geometry;
5
+using System;
6
+using System.Collections.Generic;
7
+using System.ComponentModel;
8
+using System.Data;
9
+using System.Drawing;
10
+using System.Linq;
11
+using System.Text;
12
+using System.Threading.Tasks;
13
+using System.Windows.Forms;
14
+
15
+namespace CADTools
16
+{
17
+    public partial class UwPtAssignment : Form
18
+    {
19
+        public UwPtAssignment()
20
+        {
21
+            InitializeComponent();
22
+        }
23
+
24
+        List<Polyline3d> pl3dlist = new List<Polyline3d>();
25
+
26
+        private void UwPtAssignment_Load(object sender, EventArgs e)
27
+        {
28
+            //自动填充
29
+            Database database = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
30
+            using (Transaction traction = database.TransactionManager.StartTransaction())
31
+            {
32
+                //存放所有图层名
33
+                List<string> alllayername = new List<string>();
34
+                LayerTable layertable = traction.GetObject(database.LayerTableId, OpenMode.ForRead) as LayerTable;
35
+                foreach (ObjectId objid in layertable)
36
+                {
37
+                    LayerTableRecord layertablerecord = traction.GetObject(objid, OpenMode.ForRead) as LayerTableRecord;
38
+                    alllayername.Add(layertablerecord.Name);
39
+                }
40
+
41
+                alllayername.Sort();
42
+
43
+                for (int i = 0; i < alllayername.Count; i++)
44
+                {
45
+                    this.comboBox_underpt.Items.Add(alllayername[i]);
46
+                    this.comboBox_waterline.Items.Add(alllayername[i]);
47
+                    this.comboBox_addpt.Items.Add(alllayername[i]);
48
+                }
49
+                traction.Commit();
50
+            }
51
+        }
52
+
53
+        private void button1_Click(object sender, EventArgs e)
54
+        {
55
+            if (comboBox_underpt.Text == "")
56
+            {
57
+                MessageBox.Show("请选择水下点图层");
58
+                return;
59
+            }
60
+            if (comboBox_waterline.Text == "")
61
+            {
62
+                MessageBox.Show("请选择水边线图层");
63
+                return;
64
+            }
65
+            if (checkBox_minus.Checked==false&&checkBox_plus.Checked == false)
66
+            {
67
+                MessageBox.Show("请选择水下点深度是正数还是负数");
68
+                return;
69
+            }
70
+            PtAssign();
71
+            this.Close();
72
+            MessageBox.Show("完成");
73
+        }
74
+        private void PtAssign()
75
+        {
76
+            Database db = Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase;
77
+
78
+            int flag = 0;
79
+            List<ObjectId> waterline = selectentities(comboBox_waterline.Text, "POLYLINE", db);
80
+            List<ObjectId> underpt = selectentities(comboBox_underpt.Text, "Insert", db);
81
+            if(underpt.Count==0)
82
+            {
83
+                underpt = selectentities(comboBox_underpt.Text, "Text", db);
84
+                flag = 1;
85
+            }
86
+            var pl3dptlist = GetPl3dPts(pl3dlist);
87
+
88
+            for (int i = 0; i < underpt.Count; i++)
89
+            {
90
+                DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
91
+                using (Transaction tr = db.TransactionManager.StartTransaction())
92
+                {
93
+                    Point3d pos = new Point3d();
94
+                    if (flag == 0)
95
+                    {
96
+                        BlockReference br = tr.GetObject(underpt[i], OpenMode.ForWrite) as BlockReference;
97
+                        pos = br.Position;
98
+                    }
99
+                    else
100
+                    {
101
+                        DBText t = tr.GetObject(underpt[i], OpenMode.ForWrite) as DBText;
102
+                        pos = new Point3d(t.Position.X, t.Position.Y, Convert.ToDouble(t.TextString));
103
+                         
104
+                    }
105
+                    double dist = double.MaxValue;
106
+                    double ele = 0;
107
+                    for (int j = 0; j < waterline.Count; j++)
108
+                    {
109
+                        Polyline3d pl3d = tr.GetObject(waterline[j], OpenMode.ForRead) as Polyline3d;
110
+                        Point3d ptonline = GetClosesetpt(pl3dptlist[j], pos);
111
+                        Point3d pt1 = new Point3d(ptonline.X, ptonline.Z, 0);
112
+                        Point3d pt2 = new Point3d(pos.X, pos.Y, 0);
113
+                        double dist2pt = pt1.DistanceTo(pt2);
114
+                        if (dist2pt < dist)
115
+                        {
116
+                            if (checkBox_minus.Checked)
117
+                                ele = ptonline.Z - pos.Z;
118
+                            else if(checkBox_plus.Checked)
119
+                                ele = ptonline.Z + pos.Z;
120
+                            dist = dist2pt;
121
+                        }
122
+                    }
123
+                    Point3d newpt = new Point3d(pos.X, pos.Y, ele);
124
+
125
+                    BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
126
+
127
+                    // 2. 创建块参照对象
128
+                    BlockReference br_new = new BlockReference(newpt, bt[textBox1.Text]);
129
+                    br_new.ScaleFactors = new Scale3d(1.0);  // 设置XYZ统一比例
130
+                    br_new.Rotation = 0;                 // 设置旋转角度(弧度)
131
+                    br_new.Layer = comboBox_addpt.Text;
132
+
133
+                    // 3. 添加到模型空间
134
+                    BlockTableRecord ms = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
135
+                    ms.AppendEntity(br_new);
136
+                    tr.AddNewlyCreatedDBObject(br_new, true);
137
+
138
+                    tr.Commit();
139
+                }
140
+                doclock.Dispose();
141
+                pl3dlist.Clear();
142
+            }
143
+        }
144
+
145
+        private List<ObjectId> selectentities(string layer,string type, Database db)
146
+        {
147
+            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
148
+            List<ObjectId> entites = new List<ObjectId>();
149
+
150
+            TypedValue[] typedvalue = new TypedValue[2];
151
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, layer), 0);
152
+            typedvalue.SetValue(new TypedValue((int)DxfCode.Start, type), 1);
153
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
154
+            PromptSelectionResult psr = ed.SelectAll(selectionfilter);
155
+            if (psr.Status == PromptStatus.OK)
156
+            {
157
+                SelectionSet ss = psr.Value;
158
+                ObjectId[] obj = new ObjectId[ss.Count];
159
+                obj = ss.GetObjectIds();
160
+
161
+                List<Polyline> selectedpl = new List<Polyline>();
162
+                for (int j = 0; j < obj.Length; j++)
163
+                {
164
+                    using (Transaction tr = db.TransactionManager.StartTransaction())
165
+                    {
166
+                        Entity ent = tr.GetObject(obj[j], OpenMode.ForRead)as Entity;
167
+                        if(ent is Polyline3d)
168
+                        {
169
+                            Polyline3d pl3d = (Polyline3d)ent;
170
+                            pl3dlist.Add(pl3d);
171
+                        }
172
+                        entites.Add(ent.ObjectId);
173
+                        tr.Commit();
174
+                    }
175
+                }
176
+            }
177
+            return entites;
178
+        }
179
+
180
+
181
+        //获取三维多段线上的点
182
+        public static List<List<Point3d>> GetPl3dPts(List<Polyline3d> pl3dlist)
183
+        {
184
+            List<List<Point3d>> result = new List<List<Point3d>>();
185
+            List<Point3d> pts = new List<Point3d>();
186
+            foreach (var pl3d in pl3dlist)
187
+            {
188
+                // 克隆三维多段线
189
+                Polyline3d clonedPl3d = pl3d.Clone() as Polyline3d;
190
+                DocumentLock doclock = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument();
191
+                //修改克隆线的所有顶点Z坐标为目标点的Z值
192
+                using (Transaction tr = pl3d.Database.TransactionManager.StartTransaction())
193
+                {
194
+                    // 遍历所有顶点
195
+                    foreach (PolylineVertex3d vertex in clonedPl3d)
196
+                    {
197
+                        if (vertex != null)
198
+                        {
199
+                            Point3d Pos = vertex.Position;
200
+                            pts.Add(Pos);
201
+                        }
202
+                    }
203
+                    tr.Commit();
204
+                }
205
+                doclock.Dispose();
206
+                result.Add(pts);
207
+            }
208
+            
209
+            return result;
210
+        }
211
+
212
+        /// <summary>
213
+        /// 计算两点之间的平面距离(忽略Z坐标)
214
+        /// </summary>
215
+        public static Point3d GetClosesetpt(List<Point3d> pts, Point3d pos)
216
+        {
217
+            Point3d result = new Point3d();
218
+            double compareparam = double.MaxValue;
219
+            foreach (var pt in pts)
220
+            {
221
+                double dx = pt.X - pos.X;
222
+                double dy = pt.Y - pos.Y;
223
+
224
+                double dist = Math.Sqrt(dx * dx + dy * dy);
225
+                if(dist<compareparam)
226
+                {
227
+                    result = pt;
228
+                    compareparam = dist;
229
+                }
230
+            }
231
+            
232
+            return result;
233
+        }
234
+    }
235
+}

+ 120
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/UwPtAssignment.resx Voir le fichier

@@ -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>

BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/bin/Debug/CADTools.dll Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/bin/Debug/CADTools.pdb Voir le fichier


+ 247
- 3
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/cutdgx_method.cs Voir le fichier

@@ -40,7 +40,17 @@ namespace CADTools
40 40
             public Geometry Intersection { get; set; }
41 41
             public Geometry Buffer { get; set; }
42 42
         }
43
-
43
+        /// <summary>
44
+        /// 连接信息类
45
+        /// </summary>
46
+        private class ConnectionInfo
47
+        {
48
+            public Entity Entity1 { get; set; }
49
+            public Entity Entity2 { get; set; }
50
+            public Line ConnectionLine { get; set; }
51
+            public Point3d ConnectionPoint1 { get; set; }
52
+            public Point3d ConnectionPoint2 { get; set; }
53
+        }
44 54
 
45 55
         public void cutdgx(string jqx,string sqx,double cj,double ignore)
46 56
         {
@@ -50,6 +60,7 @@ namespace CADTools
50 60
             dynamic acadApp = Application.AcadApplication;
51 61
             acadApp.ZoomExtents();
52 62
             ed.Regen();
63
+            mergedgx(db, ed, jqx, sqx);
53 64
             TypedValue[] typedvalue = new TypedValue[2];
54 65
             typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, jqx), 0);
55 66
             typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "LWPolyline"), 1);
@@ -140,6 +151,237 @@ namespace CADTools
140 151
 
141 152
             }
142 153
         }
154
+        #region 融合等高线
155
+        private void mergedgx(Database db,Editor ed, string jqx, string sqx)
156
+        {
157
+            
158
+            TypedValue[] typedvalue = new TypedValue[2];
159
+            typedvalue.SetValue(new TypedValue((int)DxfCode.LayerName, jqx+","+sqx), 0);
160
+            typedvalue.SetValue(new TypedValue((int)DxfCode.Start, "LWPolyline"), 1);
161
+            SelectionFilter selectionfilter = new SelectionFilter(typedvalue);
162
+            PromptSelectionResult selRes = ed.SelectAll(selectionfilter);
163
+            if (selRes.Status != PromptStatus.OK) return;
164
+
165
+            using (Transaction tr = db.TransactionManager.StartTransaction())
166
+            {
167
+                // 按高程分组
168
+                var groups = new Dictionary<double, List<Entity>>();
169
+
170
+                foreach (SelectedObject so in selRes.Value)
171
+                {
172
+                    Polyline ent = tr.GetObject(so.ObjectId, OpenMode.ForWrite) as Polyline;
173
+                    if (ent == null) continue;
174
+
175
+                    double? elevation = ent.Elevation;
176
+                    if (elevation.HasValue)
177
+                    {
178
+                        if (!groups.ContainsKey(elevation.Value))
179
+                            groups[elevation.Value] = new List<Entity>();
180
+                        groups[elevation.Value].Add(ent);
181
+                    }
182
+                }
183
+
184
+                BlockTableRecord space = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
185
+                HashSet<ObjectId> toDelete = new HashSet<ObjectId>();
186
+                List<Entity> newConnections = new List<Entity>(); // 存储新创建的连接线
187
+                foreach (var group in groups)
188
+                {
189
+                    if(group.Key==4267)
190
+                    {
191
+                        int jj = 0;
192
+                    }
193
+                    // 先处理间隙,创建连接线
194
+                    List<Entity> allEntities = new List<Entity>(group.Value);
195
+                    List<ConnectionInfo> connections = FindAndCreateConnections(allEntities, group.Key, space, tr);
196
+                    // 将新创建的连接线添加到待合并集合中
197
+                    foreach (var conn in connections)
198
+                    {
199
+                        allEntities.Add(conn.ConnectionLine);
200
+                        newConnections.Add(conn.ConnectionLine);
201
+                        toDelete.Add(conn.ConnectionLine.ObjectId);
202
+                    }
203
+
204
+                    // 找出该高程下所有相连的曲线组(包括新创建的连接线)
205
+                    var visited = new HashSet<Entity>();
206
+                    foreach (Entity ent in allEntities)
207
+                    {
208
+                        if (visited.Contains(ent)) continue;
209
+
210
+                        // 找出与当前实体相连的所有实体
211
+                        List<Entity> connectedGroup = FindConnectedGroup(allEntities, ent, visited);
212
+
213
+                        if (connectedGroup.Count > 1)
214
+                        {
215
+                            Polyline pl = connectedGroup[0] as Polyline;
216
+                            // 准备合并的曲线集合
217
+                            Entity[] toJoin = new Entity[connectedGroup.Count-1];
218
+                            for (int i = 1; i < connectedGroup.Count; i++)
219
+                            {
220
+                                var e = connectedGroup[i];
221
+                                toJoin[i-1] = e;
222
+                                toDelete.Add(e.ObjectId);
223
+                            }
224
+
225
+                            // 执行合并
226
+                            IntegerCollection joined = pl.JoinEntities(toJoin);
227
+
228
+                            //space.AppendEntity(pl);
229
+                            //tr.AddNewlyCreatedDBObject(pl, true);
230
+                        }
231
+                        else if (connectedGroup.Count == 1)
232
+                        {
233
+                            // 单独的曲线,不需要合并,但保留
234
+                            visited.Add(ent);
235
+                        }
236
+                    }
237
+                }
238
+
239
+                // 删除原始曲线
240
+                foreach (ObjectId id in toDelete)
241
+                {
242
+                    Entity ent = tr.GetObject(id, OpenMode.ForWrite) as Entity;
243
+                    if (ent != null && !ent.IsDisposed)
244
+                        ent.Erase();
245
+                }
246
+                tr.Commit();
247
+            }
248
+        }
249
+
250
+        /// <summary>
251
+        /// 查找需要连接的端点并创建连接线
252
+        /// </summary>
253
+        private List<ConnectionInfo> FindAndCreateConnections(List<Entity> entities, double elevation, BlockTableRecord space, Transaction tr)
254
+        {
255
+            List<ConnectionInfo> connections = new List<ConnectionInfo>();
256
+            HashSet<Tuple<ObjectId, ObjectId>> processedPairs = new HashSet<Tuple<ObjectId, ObjectId>>();
257
+
258
+            double tolerance = 0.001;
259
+            double createConnectionThreshold = 100.0; // 最大创建连接线的距离阈值(可根据需要调整)
260
+
261
+            for (int i = 0; i < entities.Count; i++)
262
+            {
263
+                Entity ent1 = entities[i];
264
+                Point3d[] ends1 = GetEndPoints(ent1);
265
+                if (ends1 == null) continue;
266
+
267
+                for (int j = i + 1; j < entities.Count; j++)
268
+                {
269
+                    Entity ent2 = entities[j];
270
+
271
+                    // 避免重复处理同一对实体
272
+                    var pair = new Tuple<ObjectId, ObjectId>(ent1.ObjectId, ent2.ObjectId);
273
+                    if (processedPairs.Contains(pair)) continue;
274
+                    processedPairs.Add(pair);
275
+
276
+                    Point3d[] ends2 = GetEndPoints(ent2);
277
+                    if (ends2 == null) continue;
278
+
279
+                    // 检查是否有相连的端点;
280
+                    Point3d closest1 = Point3d.Origin;
281
+                    Point3d closest2 = Point3d.Origin;
282
+                    double minDistance = double.MaxValue;
283
+
284
+                    foreach (var p1 in ends1)
285
+                    {
286
+                        foreach (var p2 in ends2)
287
+                        {
288
+                            double distance = p1.DistanceTo(p2);
289
+                            if (distance <= tolerance&&distance>0)
290
+                            {
291
+                                minDistance = distance;
292
+                                closest1 = p1;
293
+                                closest2 = p2;
294
+                            }
295
+                        }
296
+                    }
297
+
298
+                    // 如果端点距离在 (0, 0.001] 范围内,创建连接线
299
+                    if (minDistance > 0 && minDistance <= tolerance)
300
+                    {
301
+                        ConnectionInfo conn = new ConnectionInfo
302
+                        {
303
+                            Entity1 = ent1,
304
+                            Entity2 = ent2,
305
+                            ConnectionPoint1 = closest1,
306
+                            ConnectionPoint2 = closest2
307
+                        };
308
+
309
+                        // 创建连接线
310
+                        Line connectionLine = new Line(closest1, closest2);
311
+
312
+                        // 添加到数据库
313
+                        space.AppendEntity(connectionLine);
314
+                        tr.AddNewlyCreatedDBObject(connectionLine, true);
315
+
316
+                        conn.ConnectionLine = connectionLine;
317
+                        connections.Add(conn);
318
+                    }
319
+                }
320
+            }
321
+
322
+            return connections;
323
+        }
324
+
325
+        // 找出相连的曲线组
326
+        private List<Entity> FindConnectedGroup(List<Entity> all, Entity start, HashSet<Entity> visited)
327
+        {
328
+            List<Entity> result = new List<Entity>();
329
+            Queue<Entity> queue = new Queue<Entity>();
330
+            queue.Enqueue(start);
331
+            visited.Add(start);
332
+
333
+            double tolerance = 0.001;
334
+
335
+            while (queue.Count > 0)
336
+            {
337
+                Entity current = queue.Dequeue();
338
+                result.Add(current);
339
+
340
+                Point3d[] currentEnds = GetEndPoints(current);
341
+                if (currentEnds == null) continue;
342
+
343
+                foreach (Entity candidate in all)
344
+                {
345
+                    if (visited.Contains(candidate)) continue;
346
+
347
+                    Point3d[] candidateEnds = GetEndPoints(candidate);
348
+                    if (candidateEnds == null) continue;
349
+
350
+                    // 检查是否相连
351
+                    if (IsConnected(currentEnds, candidateEnds, tolerance))
352
+                    {
353
+                        visited.Add(candidate);
354
+                        queue.Enqueue(candidate);
355
+                    }
356
+                }
357
+            }
358
+
359
+            return result;
360
+        }
361
+
362
+        private Point3d[] GetEndPoints(Entity ent)
363
+        {
364
+            if (ent is Line line)
365
+                return new[] { line.StartPoint, line.EndPoint };
366
+            else if (ent is Polyline pl)
367
+            {
368
+                if (pl.NumberOfVertices > 0)
369
+                    return new[] { pl.GetPoint3dAt(0), pl.GetPoint3dAt(pl.NumberOfVertices - 1) };
370
+            }
371
+            else if (ent is Arc arc)
372
+                return new[] { arc.StartPoint, arc.EndPoint };
373
+            return null;
374
+        }
375
+
376
+        private bool IsConnected(Point3d[] ends1, Point3d[] ends2, double tol)
377
+        {
378
+            foreach (var p1 in ends1)
379
+                foreach (var p2 in ends2)
380
+                    if (p1.DistanceTo(p2) < tol)
381
+                        return true;
382
+            return false;
383
+        }
384
+        #endregion
143 385
 
144 386
         // 将 CAD 多段线转换为 NTS 的 LineString,并提取高程
145 387
         private List<ContourData> LoadContours(List<Polyline> pllist)
@@ -846,7 +1088,8 @@ namespace CADTools
846 1088
                             double distance = double.MinValue;
847 1089
                             foreach (var item in self_interse)
848 1090
                             {
849
-                                var pt_dist = line.GetDistAtPoint(line.GetClosestPointTo(item,false));
1091
+                                //var pt_dist = line.GetDistAtPoint(line.GetClosestPointTo(item,false));
1092
+                                var pt_dist = line.StartPoint.DistanceTo(item);
850 1093
                                 if (pt_dist > distance)
851 1094
                                 {
852 1095
                                     line.StartPoint = item;
@@ -859,7 +1102,8 @@ namespace CADTools
859 1102
                             double distance = double.MaxValue;
860 1103
                             foreach (var item in neighb_interse)
861 1104
                             {
862
-                                var pt_dist = line.GetDistAtPoint(line.GetClosestPointTo(item, false));
1105
+                                //var pt_dist = line.GetDistAtPoint(line.GetClosestPointTo(item, false));
1106
+                                var pt_dist = line.StartPoint.DistanceTo(item);
863 1107
                                 if (pt_dist < distance)
864 1108
                                 {
865 1109
                                     line.EndPoint = item;

BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.DgxFix.resources Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.Dgxconnect.resources Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.UwPtAssignment.resources Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.AssemblyReference.cache Voir le fichier


+ 1
- 1
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.CoreCompileInputs.cache Voir le fichier

@@ -1 +1 @@
1
-008bdd636a7689a503d5e05f76a5916129d5254b
1
+89b490b061f92b279588d40f397f7ec76a691a51

+ 3
- 0
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.FileListAbsolute.txt Voir le fichier

@@ -40,3 +40,6 @@ F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\C
40 40
 F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\CADTools\obj\Debug\CADTools.csproj.CopyComplete
41 41
 F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\CADTools\obj\Debug\CADTools.dll
42 42
 F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\CADTools\obj\Debug\CADTools.pdb
43
+F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\CADTools\obj\Debug\CADTools.DgxFix.resources
44
+F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\CADTools\obj\Debug\CADTools.Dgxconnect.resources
45
+F:\daima\Tools\加密后软件工具\CAD插件工具\Autocad源代码\CADTools\CADTools\obj\Debug\CADTools.UwPtAssignment.resources

BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.csproj.GenerateResource.cache Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.dll Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/CADTools.pdb Voir le fichier


BIN
加密后软件工具/CAD插件工具/Autocad源代码/CADTools/CADTools/obj/Debug/DesignTimeResolveAssemblyReferences.cache Voir le fichier


BIN
加密后软件工具/CAD插件工具/Thumbnail_HC/.vs/Thumbnail/v16/.suo Voir le fichier


BIN
加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/bin/Debug/Thumbnail.dll Voir le fichier


BIN
加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/bin/Debug/Thumbnail.pdb Voir le fichier


+ 1
- 1
加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/getThumbnail.cs Voir le fichier

@@ -131,7 +131,7 @@ namespace Thumbnail
131 131
                 }
132 132
                 dynamic acadApp = GrxCAD.ApplicationServices.Application.AcadApplication;
133 133
                 acadApp.ZoomExtents();
134
-                doc.Database.SaveAs(savepath + "\\" + filename[filenum], true, DwgVersion.AC1024, doc.Database.SecurityParameters);
134
+                doc.Database.SaveAs(savepath + "\\" + filename[filenum], true, DwgVersion.AC1800, doc.Database.SecurityParameters);
135 135
                 doc.CloseAndDiscard();
136 136
             }
137 137
             MessageBox.Show("替换完成");

BIN
加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/obj/Debug/Thumbnail.csproj.GenerateResource.cache Voir le fichier


BIN
加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/obj/Debug/Thumbnail.dll Voir le fichier


BIN
加密后软件工具/CAD插件工具/Thumbnail_HC/Thumbnail/obj/Debug/Thumbnail.pdb Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/.vs/HCTools/v16/.suo Voir le fichier


+ 6
- 6
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/CMCgis_Basicfunction.cs Voir le fichier

@@ -957,8 +957,8 @@ namespace HCTools
957 957
 
958 958
 
959 959
                 //图幅号
960
-                p1 = new Point3d(LB.X - 100, LB.Y - 100, 0);
961
-                p2 = new Point3d(RT.X + 100, RT.Y + 100, 0);
960
+                p1 = new Point3d(LB.X, LB.Y, 0);
961
+                p2 = new Point3d(RT.X, RT.Y, 0);
962 962
                 Number = GetNumber(p1, p2);
963 963
 
964 964
                 //新建一个dwg
@@ -986,8 +986,8 @@ namespace HCTools
986 986
                 draw();
987 987
 
988 988
                 zoom();
989
-                //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1024);
990
-                database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1021, database.SecurityParameters);
989
+                //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1800);
990
+                database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1800, database.SecurityParameters);
991 991
                 //document.CloseAndSave(Number.ToString() + ".dwg");
992 992
                 document.CloseAndDiscard();
993 993
             }
@@ -2682,8 +2682,8 @@ namespace HCTools
2682 2682
 
2683 2683
 
2684 2684
 
2685
-            //document.Database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1021, document.Database.SecurityParameters);
2686
-            //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1024);
2685
+            //document.Database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", true, DwgVersion.AC1800, document.Database.SecurityParameters);
2686
+            //database.SaveAs(TKInfo.SV + "\\" + Number.ToString() + ".dwg", DwgVersion.AC1800);
2687 2687
             traction.Commit();
2688 2688
 
2689 2689
             //}

+ 2
- 2
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/Chaginfos.cs Voir le fichier

@@ -280,8 +280,8 @@ namespace HCTools
280 280
 
281 281
                 //Document doc = GrxCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
282 282
                 //2007版本格式
283
-                //data.SaveAs(path_Save + "\\" + name, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
284
-                data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1021);
283
+                //data.SaveAs(path_Save + "\\" + name, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
284
+                data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1800);
285 285
                 //2004版本格式
286 286
                 //data.SaveAs(path_Save + "\\" + name, DwgVersion.AC1800);
287 287
                 //2000版本格式

+ 1
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/HCTools.csproj Voir le fichier

@@ -269,6 +269,7 @@
269 269
     <Compile Include="CutDgxByTK.Designer.cs">
270 270
       <DependentUpon>CutDgxByTK.cs</DependentUpon>
271 271
     </Compile>
272
+    <Compile Include="cutdgx_method.cs" />
272 273
     <Compile Include="DeleteElept.cs">
273 274
       <SubType>Form</SubType>
274 275
     </Compile>

+ 5
- 5
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/LayerChange.cs Voir le fichier

@@ -87,7 +87,7 @@ namespace HCTools
87 87
                             }
88 88
                         }
89 89
                     }
90
-                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
90
+                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
91 91
                     ed.WriteMessage("删除成功!\n");
92 92
                     trans.Commit();
93 93
                 }
@@ -116,7 +116,7 @@ namespace HCTools
116 116
                             layerTableRecord.Erase();
117 117
                     }
118 118
                     transaction.Commit();
119
-                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
119
+                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
120 120
                 }
121 121
                 ed.WriteMessage("删除成功!\n");
122 122
             }
@@ -162,7 +162,7 @@ namespace HCTools
162 162
                             }
163 163
                         }
164 164
                     }
165
-                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
165
+                    database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
166 166
                     transaction.Commit();
167 167
                     ed.WriteMessage("删除成功!\n");
168 168
                 }
@@ -187,7 +187,7 @@ namespace HCTools
187 187
                         layerTableRecord.IsOff = false;
188 188
                     }
189 189
                 }
190
-                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
190
+                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
191 191
                 transaction.Commit();
192 192
             }
193 193
             ed.WriteMessage("打开成功!\n");
@@ -210,7 +210,7 @@ namespace HCTools
210 210
                         layerTableRecord.IsOff = true;
211 211
                     }
212 212
                 }
213
-                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1021, doc.Database.SecurityParameters);
213
+                database.SaveAs(savepath + "\\" + dwgfile, true, DwgVersion.AC1800, doc.Database.SecurityParameters);
214 214
                 transaction.Commit();
215 215
             }
216 216
             ed.WriteMessage("关闭成功!\n");

+ 1
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/MergeDwg.cs Voir le fichier

@@ -94,7 +94,7 @@ namespace HCTools
94 94
                 dynamic acadApp = GrxCAD.ApplicationServices.Application.AcadApplication;
95 95
                 acadApp.ZoomExtents();
96 96
                 string newFilePath = Path.Combine(textBox_aftermerge.Text.ToString(), dwgname1[i]);
97
-                newdb.SaveAs(newFilePath, true, DwgVersion.AC1021, newdb.SecurityParameters);
97
+                newdb.SaveAs(newFilePath, true, DwgVersion.AC1800, newdb.SecurityParameters);
98 98
 
99 99
             }
100 100
 

+ 1
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/OutputbyTK_Form.cs Voir le fichier

@@ -302,7 +302,7 @@ namespace HCTools
302 302
                     acadApp.ZoomExtents();
303 303
                     //保存新DWG文件
304 304
                     string newFilePath = output + "\\" + tfh[i] + ".dwg";
305
-                    newDb.SaveAs(newFilePath, true, DwgVersion.AC1021, newDb.SecurityParameters);
305
+                    newDb.SaveAs(newFilePath, true, DwgVersion.AC1800, newDb.SecurityParameters);
306 306
                     newDb.Dispose();
307 307
                     document.CloseAndDiscard();
308 308
                 }

BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.dll Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/bin/Debug/HCTools.pdb Voir le fichier


+ 1215
- 0
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/cutdgx_method.cs
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/DesignTimeResolveAssemblyReferences.cache Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.AssemblyReference.cache Voir le fichier


+ 1
- 1
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.CoreCompileInputs.cache Voir le fichier

@@ -1 +1 @@
1
-445887fbd03fdfde94cd4eabae5c3f383dcff98e
1
+7e04ee8a76ed50c4af69982778feb360254774f8

BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.csproj.GenerateResource.cache Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.dll Voir le fichier


BIN
加密后软件工具/CAD插件工具/源代码/HCTools/HCTools/obj/Debug/HCTools.pdb Voir le fichier


Loading…
Annuler
Enregistrer