프로젝트

일반

사용자정보

개정판 d03dde83

IDd03dde83c3d5ecb7b09ee09d2f61894b69f3a78a
상위 87f22597
하위 ab3f2ca0, faba1fc7

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #1230 : get attribute info

Change-Id: I3d40f948a4092bcc1ee16f118ec82484aea02a60

차이점 보기:

DTI_PID/APIDConverter/APIDConverterExplorer.Designer.cs
32 32
            DevExpress.XtraSplashScreen.SplashScreenManager splashScreenManager = new DevExpress.XtraSplashScreen.SplashScreenManager(this, null, true, true, typeof(System.Windows.Forms.UserControl));
33 33
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(APIDConverterExplorer));
34 34
            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
35
            this.textDrawingY = new DevExpress.XtraEditors.TextEdit();
36
            this.btnDrawingSize = new DevExpress.XtraEditors.SimpleButton();
37
            this.textDrawingX = new DevExpress.XtraEditors.TextEdit();
35 38
            this.btnOpenConverter = new DevExpress.XtraEditors.SimpleButton();
36 39
            this.Root = new DevExpress.XtraLayout.LayoutControlGroup();
37 40
            this.emptySpaceItem1 = new DevExpress.XtraLayout.EmptySpaceItem();
38 41
            this.layoutControlGroup1 = new DevExpress.XtraLayout.LayoutControlGroup();
39 42
            this.layoutControlItem1 = new DevExpress.XtraLayout.LayoutControlItem();
40
            this.defaultLookAndFeel = new DevExpress.LookAndFeel.DefaultLookAndFeel(this.components);
41
            this.textDrawingX = new DevExpress.XtraEditors.TextEdit();
42
            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
43 43
            this.layoutControlGroup2 = new DevExpress.XtraLayout.LayoutControlGroup();
44
            this.btnDrawingSize = new DevExpress.XtraEditors.SimpleButton();
44
            this.layoutControlItem2 = new DevExpress.XtraLayout.LayoutControlItem();
45 45
            this.layoutControlItem3 = new DevExpress.XtraLayout.LayoutControlItem();
46
            this.textDrawingY = new DevExpress.XtraEditors.TextEdit();
47 46
            this.layoutControlItem4 = new DevExpress.XtraLayout.LayoutControlItem();
47
            this.defaultLookAndFeel = new DevExpress.LookAndFeel.DefaultLookAndFeel(this.components);
48
            this.btnGetAttribute = new DevExpress.XtraEditors.SimpleButton();
49
            this.layoutControlItem5 = new DevExpress.XtraLayout.LayoutControlItem();
48 50
            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).BeginInit();
49 51
            this.layoutControl1.SuspendLayout();
52
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingY.Properties)).BeginInit();
53
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingX.Properties)).BeginInit();
50 54
            ((System.ComponentModel.ISupportInitialize)(this.Root)).BeginInit();
51 55
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).BeginInit();
52 56
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).BeginInit();
53 57
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).BeginInit();
54
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingX.Properties)).BeginInit();
55
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
56 58
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).BeginInit();
59
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).BeginInit();
57 60
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).BeginInit();
58
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingY.Properties)).BeginInit();
59 61
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).BeginInit();
62
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).BeginInit();
60 63
            this.SuspendLayout();
61 64
            // 
62 65
            // splashScreenManager
......
65 68
            // 
66 69
            // layoutControl1
67 70
            // 
71
            this.layoutControl1.Controls.Add(this.btnGetAttribute);
68 72
            this.layoutControl1.Controls.Add(this.textDrawingY);
69 73
            this.layoutControl1.Controls.Add(this.btnDrawingSize);
70 74
            this.layoutControl1.Controls.Add(this.textDrawingX);
......
77 81
            this.layoutControl1.TabIndex = 0;
78 82
            this.layoutControl1.Text = "layoutControl1";
79 83
            // 
84
            // textDrawingY
85
            // 
86
            this.textDrawingY.Location = new System.Drawing.Point(63, 220);
87
            this.textDrawingY.Name = "textDrawingY";
88
            this.textDrawingY.Size = new System.Drawing.Size(145, 20);
89
            this.textDrawingY.StyleController = this.layoutControl1;
90
            this.textDrawingY.TabIndex = 7;
91
            // 
92
            // btnDrawingSize
93
            // 
94
            this.btnDrawingSize.Location = new System.Drawing.Point(24, 170);
95
            this.btnDrawingSize.Name = "btnDrawingSize";
96
            this.btnDrawingSize.Size = new System.Drawing.Size(184, 22);
97
            this.btnDrawingSize.StyleController = this.layoutControl1;
98
            this.btnDrawingSize.TabIndex = 6;
99
            this.btnDrawingSize.Text = "Get Drawing Size";
100
            this.btnDrawingSize.Click += new System.EventHandler(this.btnDrawingSize_Click);
101
            // 
102
            // textDrawingX
103
            // 
104
            this.textDrawingX.Location = new System.Drawing.Point(63, 196);
105
            this.textDrawingX.Name = "textDrawingX";
106
            this.textDrawingX.Size = new System.Drawing.Size(145, 20);
107
            this.textDrawingX.StyleController = this.layoutControl1;
108
            this.textDrawingX.TabIndex = 5;
109
            // 
80 110
            // btnOpenConverter
81 111
            // 
82 112
            this.btnOpenConverter.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnOpenConverter.ImageOptions.SvgImage")));
......
103 133
            // emptySpaceItem1
104 134
            // 
105 135
            this.emptySpaceItem1.AllowHotTrack = false;
106
            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 204);
136
            this.emptySpaceItem1.Location = new System.Drawing.Point(0, 244);
107 137
            this.emptySpaceItem1.Name = "emptySpaceItem1";
108
            this.emptySpaceItem1.Size = new System.Drawing.Size(212, 336);
138
            this.emptySpaceItem1.Size = new System.Drawing.Size(212, 296);
109 139
            this.emptySpaceItem1.TextSize = new System.Drawing.Size(0, 0);
110 140
            // 
111 141
            // layoutControlGroup1
112 142
            // 
113 143
            this.layoutControlGroup1.GroupStyle = DevExpress.Utils.GroupStyle.Card;
114 144
            this.layoutControlGroup1.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
115
            this.layoutControlItem1});
145
            this.layoutControlItem1,
146
            this.layoutControlItem5});
116 147
            this.layoutControlGroup1.Location = new System.Drawing.Point(0, 0);
117 148
            this.layoutControlGroup1.Name = "layoutControlGroup1";
118
            this.layoutControlGroup1.Size = new System.Drawing.Size(212, 85);
149
            this.layoutControlGroup1.Size = new System.Drawing.Size(212, 125);
119 150
            this.layoutControlGroup1.Text = "APID Converter";
120 151
            // 
121 152
            // layoutControlItem1
......
127 158
            this.layoutControlItem1.TextSize = new System.Drawing.Size(0, 0);
128 159
            this.layoutControlItem1.TextVisible = false;
129 160
            // 
130
            // defaultLookAndFeel
131
            // 
132
            this.defaultLookAndFeel.LookAndFeel.SkinName = "Office 2019 Colorful";
133
            // 
134
            // textDrawingX
135
            // 
136
            this.textDrawingX.Location = new System.Drawing.Point(63, 156);
137
            this.textDrawingX.Name = "textDrawingX";
138
            this.textDrawingX.Size = new System.Drawing.Size(145, 20);
139
            this.textDrawingX.StyleController = this.layoutControl1;
140
            this.textDrawingX.TabIndex = 5;
141
            // 
142
            // layoutControlItem2
143
            // 
144
            this.layoutControlItem2.Control = this.textDrawingX;
145
            this.layoutControlItem2.Location = new System.Drawing.Point(0, 26);
146
            this.layoutControlItem2.Name = "layoutControlItem2";
147
            this.layoutControlItem2.Size = new System.Drawing.Size(188, 24);
148
            this.layoutControlItem2.Text = "Width";
149
            this.layoutControlItem2.TextSize = new System.Drawing.Size(36, 14);
150
            // 
151 161
            // layoutControlGroup2
152 162
            // 
153 163
            this.layoutControlGroup2.Items.AddRange(new DevExpress.XtraLayout.BaseLayoutItem[] {
154 164
            this.layoutControlItem2,
155 165
            this.layoutControlItem3,
156 166
            this.layoutControlItem4});
157
            this.layoutControlGroup2.Location = new System.Drawing.Point(0, 85);
167
            this.layoutControlGroup2.Location = new System.Drawing.Point(0, 125);
158 168
            this.layoutControlGroup2.Name = "layoutControlGroup2";
159 169
            this.layoutControlGroup2.Size = new System.Drawing.Size(212, 119);
160 170
            this.layoutControlGroup2.Text = "Drawing Size Setting";
161 171
            // 
162
            // btnDrawingSize
172
            // layoutControlItem2
163 173
            // 
164
            this.btnDrawingSize.Location = new System.Drawing.Point(24, 130);
165
            this.btnDrawingSize.Name = "btnDrawingSize";
166
            this.btnDrawingSize.Size = new System.Drawing.Size(184, 22);
167
            this.btnDrawingSize.StyleController = this.layoutControl1;
168
            this.btnDrawingSize.TabIndex = 6;
169
            this.btnDrawingSize.Text = "Get Drawing Size";
170
            this.btnDrawingSize.Click += new System.EventHandler(this.btnDrawingSize_Click);
174
            this.layoutControlItem2.Control = this.textDrawingX;
175
            this.layoutControlItem2.Location = new System.Drawing.Point(0, 26);
176
            this.layoutControlItem2.Name = "layoutControlItem2";
177
            this.layoutControlItem2.Size = new System.Drawing.Size(188, 24);
178
            this.layoutControlItem2.Text = "Width";
179
            this.layoutControlItem2.TextSize = new System.Drawing.Size(36, 14);
171 180
            // 
172 181
            // layoutControlItem3
173 182
            // 
......
178 187
            this.layoutControlItem3.TextSize = new System.Drawing.Size(0, 0);
179 188
            this.layoutControlItem3.TextVisible = false;
180 189
            // 
181
            // textDrawingY
182
            // 
183
            this.textDrawingY.Location = new System.Drawing.Point(63, 180);
184
            this.textDrawingY.Name = "textDrawingY";
185
            this.textDrawingY.Size = new System.Drawing.Size(145, 20);
186
            this.textDrawingY.StyleController = this.layoutControl1;
187
            this.textDrawingY.TabIndex = 7;
188
            // 
189 190
            // layoutControlItem4
190 191
            // 
191 192
            this.layoutControlItem4.Control = this.textDrawingY;
......
195 196
            this.layoutControlItem4.Text = "Height";
196 197
            this.layoutControlItem4.TextSize = new System.Drawing.Size(36, 14);
197 198
            // 
199
            // defaultLookAndFeel
200
            // 
201
            this.defaultLookAndFeel.LookAndFeel.SkinName = "Office 2019 Colorful";
202
            // 
203
            // btnGetAttribute
204
            // 
205
            this.btnGetAttribute.ImageOptions.SvgImage = ((DevExpress.Utils.Svg.SvgImage)(resources.GetObject("btnGetAttribute.ImageOptions.SvgImage")));
206
            this.btnGetAttribute.Location = new System.Drawing.Point(24, 85);
207
            this.btnGetAttribute.Name = "btnGetAttribute";
208
            this.btnGetAttribute.Size = new System.Drawing.Size(184, 36);
209
            this.btnGetAttribute.StyleController = this.layoutControl1;
210
            this.btnGetAttribute.TabIndex = 8;
211
            this.btnGetAttribute.Text = "Get Attribute\r\nFrom Select Item";
212
            this.btnGetAttribute.Click += new System.EventHandler(this.btnGetAttribute_Click);
213
            // 
214
            // layoutControlItem5
215
            // 
216
            this.layoutControlItem5.Control = this.btnGetAttribute;
217
            this.layoutControlItem5.Location = new System.Drawing.Point(0, 40);
218
            this.layoutControlItem5.Name = "layoutControlItem5";
219
            this.layoutControlItem5.Size = new System.Drawing.Size(188, 40);
220
            this.layoutControlItem5.TextSize = new System.Drawing.Size(0, 0);
221
            this.layoutControlItem5.TextVisible = false;
222
            // 
198 223
            // APIDConverterExplorer
199 224
            // 
200 225
            this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
......
204 229
            this.Size = new System.Drawing.Size(232, 560);
205 230
            ((System.ComponentModel.ISupportInitialize)(this.layoutControl1)).EndInit();
206 231
            this.layoutControl1.ResumeLayout(false);
232
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingY.Properties)).EndInit();
233
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingX.Properties)).EndInit();
207 234
            ((System.ComponentModel.ISupportInitialize)(this.Root)).EndInit();
208 235
            ((System.ComponentModel.ISupportInitialize)(this.emptySpaceItem1)).EndInit();
209 236
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup1)).EndInit();
210 237
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem1)).EndInit();
211
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingX.Properties)).EndInit();
212
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
213 238
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlGroup2)).EndInit();
239
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem2)).EndInit();
214 240
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem3)).EndInit();
215
            ((System.ComponentModel.ISupportInitialize)(this.textDrawingY.Properties)).EndInit();
216 241
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem4)).EndInit();
242
            ((System.ComponentModel.ISupportInitialize)(this.layoutControlItem5)).EndInit();
217 243
            this.ResumeLayout(false);
218 244

  
219 245
        }
......
234 260
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem2;
235 261
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem3;
236 262
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem4;
263
        private DevExpress.XtraEditors.SimpleButton btnGetAttribute;
264
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem5;
237 265
    }
238 266
}
DTI_PID/APIDConverter/APIDConverterExplorer.cs
33 33

  
34 34
        private void btnOpenConverter_Click(object sender, EventArgs e)
35 35
        {
36
            
37 36
            APIDConverter form = new APIDConverter();
38 37
            if (AcadApp.ShowModalDialog(form) == DialogResult.OK)
39 38
            {
......
115 114
                }
116 115
            }
117 116
        }
117

  
118
        private void btnGetAttribute_Click(object sender, EventArgs e)
119
        {
120
            Autodesk.AutoCAD.Internal.Utils.SetFocusToDwgView();
121
            Autodesk.AutoCAD.Interop.AcadApplication acadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication as Autodesk.AutoCAD.Interop.AcadApplication;
122
            Autodesk.AutoCAD.Interop.AcadDocument acadDocument = acadApplication.ActiveDocument;
123
            acadDocument.Activate();
124
            acadDocument.SendCommand("GIFF ");
125
        }
118 126
    }
119 127
}
DTI_PID/APIDConverter/APIDConverterExplorer.resx
118 118
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119 119
  </resheader>
120 120
  <assembly alias="DevExpress.Data.v18.2" name="DevExpress.Data.v18.2, Version=18.2.7.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
121
  <data name="btnGetAttribute.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v18.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
122
    <value>
123
        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE4LjIsIFZlcnNpb249MTguMi43
124
        LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl
125
        dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAJcDAAAC77u/
126
        PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi
127
        IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv
128
        MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBlbmFibGUt
129
        YmFja2dyb3VuZD0ibmV3IDAgMCAzMiAzMiIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgaWQ9IkxheWVyXzEi
130
        Pg0KICA8ZyBpZD0iRW5hYmxlU2VhcmNoIj4NCiAgICA8cGF0aCBkPSJNMTQuNSwxNy44QzEwLjgsMTcu
131
        MSw4LDEzLjksOCwxMGMwLTQuNCwzLjYtOCw4LThzOCwzLjYsOCw4YzAsMS41LTAuNCwyLjgtMS4xLDRj
132
        MCwwLDAuMSwwLDAuMSwwICAgYzAuNywwLDEuNCwwLjEsMi4xLDAuMmMwLjYtMS4zLDAuOS0yLjcsMC45
133
        LTQuMmMwLTUuNS00LjUtMTAtMTAtMTBDMTAuNSwwLDYsNC41LDYsMTBjMCwyLjEsMC43LDQuMSwxLjgs
134
        NS43bC03LjUsNy42ICAgYy0wLjQsMC4zLTAuNCwwLjksMCwxLjNsMS4yLDEuMmMwLjMsMC4zLDAuOSww
135
        LjMsMS4yLDBsNy42LTcuNmMwLjksMC42LDEuOSwxLjEsMi45LDEuNEMxMy42LDE5LDE0LDE4LjQsMTQu
136
        NSwxNy44eiIgZmlsbD0iIzExNzdENyIgY2xhc3M9IkJsdWUiIC8+DQogICAgPHBhdGggZD0iTTIzLDE2
137
        Yy00LjQsMC04LjEsMy05LDdjMC45LDQsNC42LDcsOSw3YzQuNCwwLDguMS0zLDktN0MzMS4xLDE5LDI3
138
        LjQsMTYsMjMsMTZ6IE0yMywyOGMtMy4zLDAtNi4xLTItNy01ICAgYzAuOS0zLDMuNy01LDctNXM2LjEs
139
        Miw3LDVDMjkuMSwyNiwyNi4zLDI4LDIzLDI4eiBNMjMsMjZjLTEuNywwLTMtMS4zLTMtM3MxLjMtMywz
140
        LTNzMywxLjMsMywzUzI0LjcsMjYsMjMsMjZ6IiBmaWxsPSIjNzI3MjcyIiBjbGFzcz0iQmxhY2siIC8+
141
        DQogIDwvZz4NCjwvc3ZnPgs=
142
</value>
143
  </data>
121 144
  <data name="btnOpenConverter.ImageOptions.SvgImage" type="DevExpress.Utils.Svg.SvgImage, DevExpress.Data.v18.2" mimetype="application/x-microsoft.net.object.bytearray.base64">
122 145
    <value>
123 146
        AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE4LjIsIFZlcnNpb249MTguMi43
DTI_PID/APIDConverter/AutoModeling.cs
273 273

  
274 274
                    if (!bAngle)
275 275
                    {
276
                        ObjectId objectId = GetObjectIdByHandle(handle);
276
                        ObjectId objectId = APIDUtils.GetObjectIdByHandle(handle);
277 277
                        if (objectId != ObjectId.Null)
278 278
                        {
279 279
                            SetBlockReferenceRotation(objectId, symbol.ANGLE);
......
365 365
                }
366 366
                if (datas.Count > 0)
367 367
                {
368
                    datas.Add(new Tuple<string, string>("AddLabel", "No"));
369 368
                    ObjectId objectId = GetFirstPolyLineObjectId(line.Aveva.Handle);
370 369
                    if (!objectId.IsNull)
371 370
                        SetAttributeByAvevaForm(objectId.Handle.Value, datas);
......
390 389
                }
391 390
                if (datas.Count > 0)
392 391
                {
393
                    ObjectId objectId = GetObjectIdByHandle(symbol.Aveva.Handle);
392
                    ObjectId objectId = APIDUtils.GetObjectIdByHandle(symbol.Aveva.Handle);
394 393
                    if (!objectId.IsNull)
395 394
                        SetAttributeByAvevaForm(objectId.Handle.Value, datas);
396 395
                }
......
674 673

  
675 674
            return result;
676 675
        }
677
        private ObjectId GetObjectIdByHandle(long lHandle)
678
        {
679
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
680
            Database acCurDb = acDoc.Database;
681
            Handle handle = new Handle(lHandle);
682
            ObjectId result = ObjectId.Null;
683
            try
684
            {
685
                result = acCurDb.GetObjectId(false, handle, 0);
686
            }
687
            catch (System.Exception ex)
688
            {
689

  
690
            }
691
            return result;
692
        }
693
        private Entity GetEntityByHandle(long handle)
694
        {
695
            Entity entity = null;
696
            ObjectId objectId = GetObjectIdByHandle(handle);
697
            if (objectId != ObjectId.Null)
698
            {
699
                Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
700
                Database acCurDb = acDoc.Database;
701
                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
702
                {
703
                    entity = (Entity)acTrans.GetObject(objectId, OpenMode.ForRead);
704
                    acTrans.Commit();
705
                }
706
            }
707

  
708
            return entity;
709
        }
710 676
        private void SetBlockReferenceRotation(ObjectId objectId, double rotation)
711 677
        {
712 678
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
......
732 698
        #region For Aveva
733 699
        private void SetAttributeByAvevaForm(long handle, List<Tuple<string, string>> datas)
734 700
        {
735
            Entity entity = GetEntityByHandle(handle);
701
            Entity entity = APIDUtils.GetEntityByHandle(handle);
736 702

  
737 703
            ComponentPropertiesHelper componentPropertiesHelper = new ComponentPropertiesHelper();
738 704
            AvevaThread.Run(ThreadType.AddProperty, datas);
......
957 923
        }
958 924
        public static void TESTStatic(long handle)
959 925
        {
960
            AutoModeling auto = new AutoModeling(null);
961
            auto.SetAttributeByAvevaForm(handle, new List<Tuple<string, string>>() { new Tuple<string, string>("Size", "100") });
926

  
962 927
        }
963 928
        #endregion
964 929
    }
DTI_PID/APIDConverter/PIDCustomization.cs
179 179
                AutoModeling.Running.Run();
180 180
            }
181 181
        }
182
        [CommandMethod("GIFF")]
183
        public static void GetAttributeInformationFromForm()
184
        {
185
            // Get the current document and database, and start a transaction
186
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
187
            Database acCurDb = acDoc.Database;
188
            Editor acDocEd = acDoc.Editor;
189

  
190
            // Request for objects to be selected in the drawing area
191
            PromptSelectionResult acSSPrompt = acDocEd.GetSelection();
192
            
193
            // If the prompt status is OK, objects were selected
194
            if (acSSPrompt.Status == PromptStatus.OK)
195
            {
196
                ObjectId[] selectedObjectIds = acSSPrompt.Value.GetObjectIds();
197

  
198
                if (selectedObjectIds.Length > 0)
199
                {
200
                    ObjectId objIdBlock = selectedObjectIds[0];
201
                    Entity entity = APIDUtils.GetEntityByHandle(objIdBlock.Handle.Value);
202

  
203
                    GUI.ComponentPropertiesHelper componentPropertiesHelper = new GUI.ComponentPropertiesHelper();
204
                    AvevaThread.Run(ThreadType.GetAttributeInformationFromForm, null);
205
                    if (!componentPropertiesHelper.DisplayComponentProperties(entity))
206
                    {
207
                        AvevaThread.Stop(ThreadType.GetAttributeInformationFromForm);
208
                        MessageBox.Show("Fail Save Attribute!", "APID Converter", MessageBoxButtons.OK, MessageBoxIcon.Error);
209
                    }
210
                    else
211
                        MessageBox.Show("Success Save Attribute!", "APID Converter", MessageBoxButtons.OK, MessageBoxIcon.Information);
212
                }
213
            }
214
        }
182 215
        #endregion
183 216
        #region private methods
184 217
        private string SaveBinaryDrawing()
DTI_PID/APIDConverter/Utils/APIDUtils.cs
6 6
using System.IO;
7 7
using System.Reflection;
8 8
using System.Data;
9

  
10
using Autodesk.AutoCAD.ApplicationServices;
11
using Autodesk.AutoCAD.ApplicationServices.Core;
12
using Autodesk.AutoCAD.DatabaseServices;
9 13
using Autodesk.AutoCAD.EditorInput;
14
using Autodesk.AutoCAD.Geometry;
15
using Autodesk.AutoCAD.Interop;
16
using Autodesk.AutoCAD.Interop.Common;
17
using Autodesk.AutoCAD.Runtime;
18
using Autodesk.AutoCAD.Windows;
10 19

  
11 20
using AVEVA.PID.Components;
12 21
using AVEVA.PID.GUI;
......
22 31
    public class APIDUtils
23 32
    {
24 33
        #region APID Converter
25
        public static object FindObjectByUID(Document document, string UID)
34
        public static object FindObjectByUID(Model.Document document, string UID)
26 35
        {
27 36
            if (!string.IsNullOrEmpty(UID) && UID != "None")
28 37
            {
......
46 55
                    dY = Convert.ToDouble(pointArr[1]);
47 56
                }
48 57
            }
49
            catch (Exception)
58
            catch (System.Exception)
50 59
            {
51 60
                dX = 0;
52 61
                dY = 0;
......
55 64

  
56 65
            return true;
57 66
        }
58
        public static bool IsConnectedLine(Line line1, Line line2)
67
        public static bool IsConnectedLine(Model.Line line1, Model.Line line2)
59 68
        {
60 69
            bool result = false;
61 70

  
......
141 150
        {
142 151
            return PID.Utilities.PipeLabelHelper.GetPipeDisplayLabelFields().ToDictionary(x => x.Key, y => y.Value);
143 152
        }
144
        private static DataTable GetSymbolAttributes()
153
        private static System.Data.DataTable GetSymbolAttributes()
145 154
        {
146
            DataTable dt = new DataTable();
155
            System.Data.DataTable dt = new System.Data.DataTable();
147 156
            dt.Columns.Add("Name", typeof(string));
148 157
            dt.Columns.Add("DisplayType", typeof(string));
149 158
            dt.Columns.Add("Value", typeof(string));
150 159
            dt.Columns.Add("DisplayMember", typeof(string));
151 160

  
152 161
            #region UDA
153
            DataTable udaDT = Project_DB.SelectUDADetails();
162
            System.Data.DataTable udaDT = Project_DB.SelectUDADetails();
154 163
            udaDT = udaDT.DefaultView.ToTable(true, "UDAName");
155 164
            string display = "User Defined Attribute";
156 165
            foreach (DataRow item in udaDT.Rows)
......
165 174

  
166 175
            return dt;
167 176
        }
168
        private static DataTable GetPipeAttributes()
177
        private static System.Data.DataTable GetPipeAttributes()
169 178
        {
170
            DataTable dt = new DataTable();
179
            System.Data.DataTable dt = new System.Data.DataTable();
171 180
            dt.Columns.Add("Name", typeof(string));
172 181
            dt.Columns.Add("DisplayType", typeof(string));
173 182
            dt.Columns.Add("Value", typeof(string));
......
184 193

  
185 194
            return dt;
186 195
        }
187
        public static DataTable GetAPIDAttributes()
196
        public static System.Data.DataTable GetAPIDAttributes()
188 197
        {
189
            DataTable attributeTable = new DataTable();
198
            System.Data.DataTable attributeTable = new System.Data.DataTable();
190 199
            attributeTable.Columns.Add("Name", typeof(string));
191 200
            attributeTable.Columns.Add("DisplayType", typeof(string));
192 201
            attributeTable.Columns.Add("Value", typeof(string));
......
198 207

  
199 208
            return attributeTable;
200 209
        }
210
        public static Entity GetEntityByHandle(long handle)
211
        {
212
            Entity entity = null;
213
            ObjectId objectId = GetObjectIdByHandle(handle);
214
            if (objectId != ObjectId.Null)
215
            {
216
                Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
217
                Database acCurDb = acDoc.Database;
218
                using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
219
                {
220
                    entity = (Entity)acTrans.GetObject(objectId, OpenMode.ForRead);
221
                    acTrans.Commit();
222
                }
223
            }
224

  
225
            return entity;
226
        }
227
        public static ObjectId GetObjectIdByHandle(long lHandle)
228
        {
229
            Autodesk.AutoCAD.ApplicationServices.Document acDoc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
230
            Database acCurDb = acDoc.Database;
231
            Handle handle = new Handle(lHandle);
232
            ObjectId result = ObjectId.Null;
233
            try
234
            {
235
                result = acCurDb.GetObjectId(false, handle, 0);
236
            }
237
            catch (System.Exception ex)
238
            {
239

  
240
            }
241
            return result;
242
        }
201 243
        #endregion
202 244
    }
203 245
}
DTI_PID/APIDConverter/Utils/AvevaACAD18String.cs
15 15
            "AVEVA P&ID 12 Valve Properties",
16 16
            "AVEVA P&ID 12 Page Connector Properties"
17 17
        };
18
        static List<string> labelNames = new List<string>()
19
        {
20
            "AddLabel",
21
            "AddPrefix",
22
            "AddType",
23
            "AddNumber",
24
            "AddSuffix",
25
        };
26
        public static List<string> LabelNames { get { return labelNames; } }
18 27
        public static List<string> PropertiesFormNames { get { return propertiesFormNames; } }
19 28

  
20 29
    }
DTI_PID/APIDConverter/Utils/AvevaThread.cs
42 42
        None = 0,
43 43
        LineNumberModeling = 1,
44 44
        AddProperty = 2,
45
        DuplicationWarning = 4
45
        DuplicationWarning = 4,
46
        GetAttributeInformationFromForm = 8,
46 47
    }
47 48

  
48 49
    class AvevaThread
......
116 117
                    thread.Start();
117 118
                    Running |= ThreadType.DuplicationWarning;
118 119
                }
120
                else if (type.HasFlag(ThreadType.GetAttributeInformationFromForm) && !Running.HasFlag(ThreadType.GetAttributeInformationFromForm))
121
                {
122
                    Thread thread = new Thread(GetAttributeInformationFromForm);
123
                    thread.IsBackground = true;
124
                    thread.Start();
125
                    Running |= ThreadType.GetAttributeInformationFromForm;
126
                }
119 127
            }
120 128
        }
121 129

  
......
219 227

  
220 228
            }
221 229
        }
230
        public static void GetAttributeInformationFromForm()
231
        {
232
            while (Running.HasFlag(ThreadType.GetAttributeInformationFromForm))
233
            {
234
                int handle = FindPropertiesFormHandle();
235
                if (handle > 0)
236
                {
237
                    System.Windows.Forms.Control control = System.Windows.Forms.Control.FromHandle((IntPtr)handle);
238
                    if (control != null && control.GetType() == typeof(ComponentPropertiesUI))
239
                    {
240
                        ComponentPropertiesUI UI = control as ComponentPropertiesUI;
241
                        string level1 = UI.Text;
242
                        foreach (PropertyRegion region in UI.PropertyRegions)
243
                        {
244
                            string level2 = region.Title;
245
                            foreach (PropertyField field in region.PropertyFields)
246
                            {
247
                                string level3 = field.Key;
248
                                string displayName = field.Name;
249

  
250

  
251
                            }
252
                        }
253

  
254
                        int button = FindWindowEx(handle, 0, null, "Cancel");
255
                        if (button > 0)
256
                        {
257
                            SendMessage((IntPtr)button, BM_CLICK, (IntPtr)0, (IntPtr)0);
258
                            Running &= ~ThreadType.GetAttributeInformationFromForm;
259
                            break;
260
                        }
261
                    }
262
                }
263
            }
264
        }
222 265

  
223 266
        public static int FindPropertiesFormHandle()
224 267
        {
......
232 275

  
233 276
            return result;
234 277
        }
235
        public static void Test()
236
        {
237
            
238
        }
278
       
239 279
    }
240 280
}

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)