hytos / DTI_PID / SPPIDConverter / Main.vb @ 24015dc6
이력 | 보기 | 이력해설 | 다운로드 (70.1 KB)
1 | 4f359afa | Gyusu | Imports System.IO |
---|---|---|---|
2 | Imports System.Data.SqlClient |
||
3 | Imports System.Data.SQLite |
||
4 | Imports Plaice |
||
5 | Imports Llama |
||
6 | Imports PidA |
||
7 | 962b2464 | Gyusu | |
8 | e282643f | Gyusu | |
9 | Imports System.Threading |
||
10 | |||
11 | 4f359afa | Gyusu | Public Class Main |
12 | |||
13 | 171ac39d | Gyusu | Dim _Mapping_DB As DataTable = New DataTable() |
14 | Dim _Attribute_DB As DataTable = New DataTable() |
||
15 | 4f359afa | Gyusu | Dim _Placement As New Placement |
16 | Dim _DWG_X = 0.84 '0.695 '1 ' |
||
17 | Dim _DWG_Y = 0.594 '0.585 '0.8 ' |
||
18 | |||
19 | 171ac39d | Gyusu | Dim _IMG_X = 0 |
20 | Dim _IMG_Y = 0 |
||
21 | |||
22 | Dim _Unit As String |
||
23 | 4f359afa | Gyusu | |
24 | 31d47a80 | Gyusu | 'Drawing 전역변수 |
25 | Dim _objPIDADrawing As Object |
||
26 | e282643f | Gyusu | '현재선택한 폴더경로 |
27 | Dim _selectFolderPath As String |
||
28 | |||
29 | Private _Main_trd As Thread |
||
30 | |||
31 | 171ac39d | Gyusu | Private _DrawingsList As List(Of Drawing) |
32 | 272662f9 | Gyusu | |
33 | |||
34 | |||
35 | 4f359afa | Gyusu | Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
36 | 272662f9 | Gyusu | |
37 | e282643f | Gyusu | If My.Settings.DBPath <> "" And My.Settings.Plant_Hierarchy <> "" Then |
38 | Dim sDBPath As String = My.Settings.DBPath |
||
39 | 171ac39d | Gyusu | _Mapping_DB = Load_DB(sDBPath, _DB_TABLE_MAPPING) |
40 | _Attribute_DB = Load_DB(sDBPath, _DB_TABLE_ATTRIBUTE) |
||
41 | e282643f | Gyusu | 'TestPID() |
42 | Else |
||
43 | MessageBox.Show("설정값을 먼저 확인해주세요") |
||
44 | End If |
||
45 | End Sub |
||
46 | |||
47 | Public Function GetDrawingInfo(ByVal errorList As ArrayList) |
||
48 | Dim ds As Llama.LMADataSource |
||
49 | ds = New Llama.LMADataSource |
||
50 | Dim lmaItem As Llama.LMAItem |
||
51 | |||
52 | For i = 0 To errorList.Count - 1 |
||
53 | lmaItem = ds.GetModelItem(errorList.Item(i).m_strSPID()).AsLMAItem |
||
54 | Dim drawingInfo As DrawingInfo |
||
55 | drawingInfo = GetDrawingName(lmaItem.ItemType, lmaItem.Id) |
||
56 | errorList.Item(i).m_LMAItem = lmaItem |
||
57 | errorList.Item(i).m_strDrawingName = drawingInfo.mDrawingName |
||
58 | errorList.Item(i).m_strDrawingPath = drawingInfo.mPath |
||
59 | Next |
||
60 | End Function |
||
61 | Private mDataSource As Object |
||
62 | |||
63 | 'Public Sub New() |
||
64 | |||
65 | ' ' mDataSource.ProjectNumber = m_Information.InfoSite.SiteName |
||
66 | ' ' mDataSource.SiteNode = m_Information.InfoProject.ProjectINI |
||
67 | ' 'm_Information = SPPIDClass.Information.GetInstance() |
||
68 | |||
69 | ' 'If m_Information.InfoProject.ProjectVersion = SPPIDClass.InfoProject.SPPID_43 Then |
||
70 | ' ' 'SPPID4.3용 |
||
71 | ' ' mDataSource.ProjectNumber = m_Information.InfoSite.SiteName |
||
72 | ' 'Else |
||
73 | ' ' 'SPPID2007, SPPID2009용 |
||
74 | ' ' mDataSource.ProjectNumber = m_Information.InfoSite.SiteName & "!" & m_Information.InfoSite.SiteName |
||
75 | ' 'End If |
||
76 | |||
77 | ' ' mDataSource.SiteNode = m_Information.InfoProject.ProjectINI |
||
78 | ' ' mDataSource.ProjectNumber = m_Information.InfoSite.SiteName & "!" & m_Information.InfoSite.SiteName |
||
79 | ' '#If LATE_BINDING Then |
||
80 | ' ' mInstruments = CreateObject("Llama.LMInstruments", "") |
||
81 | ' ' mPipingComps = CreateObject("Llama.LMPipingComps", "") |
||
82 | ' ' mVessels = CreateObject("Llama.LMVessels", "") |
||
83 | ' ' mDrawings = CreateObject("Llama.LMDrawings", "") |
||
84 | ' ' mEquipments = CreateObject("Llama.LMEquipments", "") |
||
85 | ' ' mExchangers = CreateObject("Llama.LMExchangers", "") |
||
86 | ' ' mMechanicals = CreateObject("Llama.LMMechanicals", "") |
||
87 | ' ' mNozzles = CreateObject("Llama.LMNozzles", "") |
||
88 | ' ' mPipeRuns = CreateObject("Llama.LMPipeRuns", "") |
||
89 | ' ' mEquipmentOthers = CreateObject("Llama.LMEquipmentOthers", "") |
||
90 | ' '#Else |
||
91 | ' ' mInstruments = New Llama.LMInstruments |
||
92 | ' ' mPipingComps = New Llama.LMPipingComps |
||
93 | ' ' mVessels = New Llama.LMVessels |
||
94 | ' ' mDrawings = New Llama.LMDrawings |
||
95 | ' ' mEquipments = New Llama.LMEquipments |
||
96 | ' ' mExchangers = New Llama.LMExchangers |
||
97 | ' ' mMechanicals = New Llama.LMMechanicals |
||
98 | ' ' mNozzles = New Llama.LMNozzles |
||
99 | ' ' mPipeRuns = New Llama.LMPipeRuns |
||
100 | ' ' mEquipmentOthers = New Llama.LMEquipmentOthers |
||
101 | ' '#End If |
||
102 | 'End Sub |
||
103 | Public Function GetDrawingName(ByVal itemType As String, ByVal itemName As String) As DrawingInfo |
||
104 | |||
105 | Dim objFilter As Object |
||
106 | objFilter = CreateObject("Llama.LMAFilter", "") |
||
107 | |||
108 | Dim drawingInfo As DrawingInfo |
||
109 | drawingInfo = New DrawingInfo |
||
110 | |||
111 | objFilter.Criteria.AddNew("FirstOne") |
||
112 | objFilter.Criteria.Item("FirstOne").SourceAttributeName = "SP_ID" |
||
113 | objFilter.Critedkria.Item("FirstOne").ValueAttribute = itemName |
||
114 | |||
115 | objFilter.Criteria.Item("FirstOne").Operator = "=" |
||
116 | objFilter.Criteria.AddNew("SecondOne") |
||
117 | objFilter.Criteria.Item("SecondOne").SourceAttributeName = "ItemStatus" |
||
118 | objFilter.Criteria.Item("SecondOne").ValueAttribute = 1 |
||
119 | objFilter.Criteria.Item("SecondOne").Operator = "=" |
||
120 | objFilter.Criteria.Item("SecondOne").Conjunctive = -1 |
||
121 | objFilter.ItemType = itemType |
||
122 | |||
123 | Dim PlantItems As Object |
||
124 | PlantItems = CreateObject("Llama.LMPlantItems", "") |
||
125 | PlantItems.Collect(mDataSource, Filter:=objFilter) |
||
126 | |||
127 | If PlantItems.Count = 0 Then |
||
128 | drawingInfo.mSpID = "PlantStockpile" |
||
129 | End If |
||
130 | |||
131 | For Each PlantItem In PlantItems |
||
132 | |||
133 | 'If Not PlantItem.Representations.Nth(1).DrawingID.Value.ToString().Equals("0") Then |
||
134 | Try |
||
135 | drawingInfo.mDrawingName = PlantItem.Representations.Nth(1).DrawingObject.Attributes("Name").Value |
||
136 | drawingInfo.mSpID = PlantItem.Representations.Nth(1).DrawingID |
||
137 | drawingInfo.mPath = PlantItem.Representations.Nth(1).DrawingObject.Attributes("Path").Value |
||
138 | Debug.WriteLine("DrawingName : " & drawingInfo.mDrawingName & ", SPID : " & drawingInfo.mSpID & ", Path : " & drawingInfo.mPath) |
||
139 | Catch ex As Exception |
||
140 | |||
141 | End Try |
||
142 | |||
143 | 'End If |
||
144 | |||
145 | Next |
||
146 | |||
147 | Return drawingInfo |
||
148 | |||
149 | End Function |
||
150 | |||
151 | Private Sub TestPID() |
||
152 | |||
153 | Try |
||
154 | |||
155 | Dim datasource As LMADataSource |
||
156 | Dim objPIDAutoApp As Object |
||
157 | Dim objPIDADrawing As Object |
||
158 | Dim objDrawing As LMDrawing |
||
159 | Dim objDrawings As LMDrawings |
||
160 | datasource = New LMADataSource |
||
161 | |||
162 | |||
163 | Dim oObj As Object = Nothing |
||
164 | objDrawing = datasource.GetDrawing(oObj) |
||
165 | objDrawings = New LMDrawings |
||
166 | objDrawings.Collect(datasource) |
||
167 | objPIDAutoApp = GetObject(, "SmartPlantPID.Application") '// CreateObject("PIDAutomation.Application") |
||
168 | For Each objDrawing In objDrawings |
||
169 | If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
||
170 | objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(objDrawing.Attributes("Name")) |
||
171 | If Not objPIDADrawing Is Nothing Then |
||
172 | MessageBox.Show("Drawing " & objDrawing.Attributes("Name").Value & " is opened!") |
||
173 | objPIDADrawing.CloseDrawing |
||
174 | End If |
||
175 | End If |
||
176 | Next |
||
177 | objPIDAutoApp.Quit |
||
178 | objPIDAutoApp = Nothing |
||
179 | objPIDADrawing = Nothing |
||
180 | objDrawing = Nothing |
||
181 | objDrawings = Nothing |
||
182 | Catch ex As Exception |
||
183 | |||
184 | End Try |
||
185 | |||
186 | |||
187 | 962b2464 | Gyusu | |
188 | End Sub |
||
189 | e282643f | Gyusu | Public Function SetActiveSiteFromConfigInfo(ByVal strActiveSite As String) As Boolean |
190 | |||
191 | On Error GoTo errHandler |
||
192 | Dim objConfigInfo As Object 'interopigrConfigInfo412.igrConfigInfo |
||
193 | objConfigInfo = CreateObject("interopigrConfigInfo412.igrConfigInfo", "") |
||
194 | If Not objConfigInfo Is Nothing Then |
||
195 | objConfigInfo.ApplicationName = "SmartPlantManager" |
||
196 | objConfigInfo.SetConfigString(3, "SmartPlant Manager", "SiteServer", strActiveSite) |
||
197 | SetActiveSiteFromConfigInfo = True |
||
198 | End If |
||
199 | objConfigInfo = Nothing |
||
200 | |||
201 | Exit Function |
||
202 | |||
203 | errHandler: |
||
204 | ' LogAndRaiseError ModuleName & "::GetConfigInfo " |
||
205 | End Function |
||
206 | 4f359afa | Gyusu | |
207 | 1229ad76 | Gyusu | Private Function CreateDwg(ByVal oDwgName As String) As Boolean |
208 | Dim objPIDADrawing As Object = Nothing |
||
209 | Dim objPIDAutoApp As Object = Nothing |
||
210 | Dim datasource As LMADataSource = Nothing |
||
211 | 4f359afa | Gyusu | Try |
212 | Dim DrawingNumber As String |
||
213 | Dim DrawingName As String |
||
214 | 1229ad76 | Gyusu | Dim sPlantGroupName As String = "Test" |
215 | Dim sTemplateName As String = "\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\P&ID Reference Data\Template Files\Gazprom Project.pid" |
||
216 | Dim objDrawing As LMDrawing |
||
217 | Dim objDrawings As LMDrawings |
||
218 | objDrawings = New LMDrawings |
||
219 | datasource = New LMADataSource |
||
220 | Debug.Print(datasource.ProjectNumber) |
||
221 | Debug.Print(datasource.SiteNode) |
||
222 | Debug.Print(datasource.IsSatellite) |
||
223 | Debug.Print(datasource.GetSystemEditingToolbarSetting) |
||
224 | objDrawings.Collect(datasource) |
||
225 | Dim sPath As String = "\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\188943-8121-PR-DW-011001.pid" |
||
226 | objPIDAutoApp = CreateObject("PIDAutomation.Application") |
||
227 | For Each objDrawing In objDrawings |
||
228 | If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
||
229 | objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(sPath) |
||
230 | If Not objPIDADrawing Is Nothing Then |
||
231 | |||
232 | objPIDADrawing.CloseDrawing |
||
233 | End If |
||
234 | End If |
||
235 | Next |
||
236 | 4f359afa | Gyusu | |
237 | Dim extension As String = Path.GetExtension(oDwgName) |
||
238 | oDwgName = oDwgName.Replace(extension, "") |
||
239 | 1229ad76 | Gyusu | |
240 | 4f359afa | Gyusu | objPIDAutoApp = CreateObject("PIDAutomation.Application") |
241 | 1229ad76 | Gyusu | |
242 | 'For Each objDrawing In objPIDAutoApp.Drawings |
||
243 | ' objDrawing.CloseDrawing(True) |
||
244 | 'Next |
||
245 | |||
246 | objPIDAutoApp.Drawings.OpenDrawing(oDwgName + ".pid") |
||
247 | |||
248 | objPIDAutoApp.ActiveWindow.Fit() |
||
249 | |||
250 | Return True |
||
251 | Catch ex As Exception |
||
252 | If objPIDADrawing IsNot Nothing Then |
||
253 | 4f359afa | Gyusu | objPIDADrawing.CloseDrawing |
254 | End If |
||
255 | 1229ad76 | Gyusu | If objPIDAutoApp IsNot Nothing Then |
256 | objPIDAutoApp.Quit |
||
257 | End If |
||
258 | datasource = Nothing |
||
259 | 4f359afa | Gyusu | objPIDAutoApp = Nothing |
260 | objPIDADrawing = Nothing |
||
261 | Return False |
||
262 | End Try |
||
263 | 1229ad76 | Gyusu | If objPIDADrawing IsNot Nothing Then |
264 | objPIDADrawing.CloseDrawing |
||
265 | End If |
||
266 | 4f359afa | Gyusu | |
267 | End Function |
||
268 | |||
269 | 1229ad76 | Gyusu | |
270 | 171ac39d | Gyusu | Private Function GetDataFromMappingDB(ByVal sSymbolName As String, ByVal sColumn As String) As String |
271 | Dim sValue As String = "" |
||
272 | If _Mapping_DB.Rows.Count > 0 Then |
||
273 | Dim oSelectRow() As DataRow = _Mapping_DB.Select("[pid_symbolname] = '" + sSymbolName + "'") |
||
274 | e282643f | Gyusu | If oSelectRow.Length = 1 Then |
275 | 171ac39d | Gyusu | sValue = oSelectRow(0).Item(sColumn).ToString() |
276 | e282643f | Gyusu | End If |
277 | 4f359afa | Gyusu | End If |
278 | 171ac39d | Gyusu | Return sValue |
279 | 4f359afa | Gyusu | End Function |
280 | |||
281 | 171ac39d | Gyusu | Private Function GetAttributeMapping(ByVal sAttributeName As String, ByVal sColumn As String) As String |
282 | Dim sSPPIDAttribute As String = "" |
||
283 | If _Attribute_DB.Rows.Count > 0 Then |
||
284 | Dim oSelectRow() As DataRow = _Attribute_DB.Select("[pid_attribute] = '" + sAttributeName + "'") |
||
285 | If oSelectRow.Length = 1 Then |
||
286 | sSPPIDAttribute = oSelectRow(0).Item(sColumn).ToString() |
||
287 | End If |
||
288 | End If |
||
289 | Return sSPPIDAttribute |
||
290 | End Function |
||
291 | e282643f | Gyusu | |
292 | 171ac39d | Gyusu | Private Function LoadSymbolInXml(ByVal sXmlPath As String) As Drawing |
293 | Dim CDrawing As Drawing = New Drawing() |
||
294 | 4f359afa | Gyusu | Dim oDt As DataTable = LoadSymbol_DT() |
295 | Dim oElement As XElement = XElement.Load(sXmlPath) |
||
296 | 171ac39d | Gyusu | |
297 | 4f359afa | Gyusu | If oElement IsNot Nothing Then |
298 | 171ac39d | Gyusu | CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value |
299 | CDrawing.Size = oElement.Element(_XML_DWGSIZE).Value |
||
300 | SplitLocation(CDrawing.Size, _IMG_X, _IMG_Y) |
||
301 | CDrawing.Unit = oElement.Element(_XML_UNIT).Value |
||
302 | |||
303 | Dim oLineno_list As New List(Of Line_no) |
||
304 | |||
305 | For Each oLineNo As Object In oElement.Elements(_XML_CATEGORY_LINENO) |
||
306 | Dim CLineNo As Line_no = New Line_no() |
||
307 | CLineNo.Uid = oLineNo.Element(_XML_LINENO_UID).Value |
||
308 | CLineNo.Text = oLineNo.Element(_XML_LINENO_TEXT).Value |
||
309 | CLineNo.Location = oLineNo.Element(_XML_LINENO_LOCATION).Value |
||
310 | CLineNo.Angle = oLineNo.Element(_XML_LINENO_LOCATION).Value |
||
311 | CLineNo.SystemPath = GetDataFromMappingDB(_XML_CATEGORY_LINENO, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
312 | |||
313 | Dim oLine_Dt As DataTable = Line_Dt() |
||
314 | Dim oSymbol_Dt As DataTable = Symbol_Dt() |
||
315 | Dim oAttribute_Dt As DataTable = Attribute_Dt() |
||
316 | |||
317 | For Each oLine As Object In oLineNo.Elements(_XML_CATEGORY_LINE) |
||
318 | Dim oAddrow As DataRow = oLine_Dt.NewRow() |
||
319 | Dim oEleObj As XElement |
||
320 | Dim sUid As String |
||
321 | Dim sStartpoint As String |
||
322 | Dim sEndpoint As String |
||
323 | oEleObj = oLine.Element(_XML_LINE_UID) |
||
324 | sUid = oEleObj.Value |
||
325 | oEleObj = oLine.Element(_XML_LINE_STARTPOINT) |
||
326 | sStartpoint = oEleObj.Value |
||
327 | oEleObj = oLine.Element(_XML_LINE_ENDPOINT) |
||
328 | sEndpoint = oEleObj.Value |
||
329 | |||
330 | oAddrow(_XML_LINE_UID) = sUid |
||
331 | oAddrow(_XML_LINE_STARTPOINT) = sStartpoint |
||
332 | oAddrow(_XML_LINE_ENDPOINT) = sEndpoint |
||
333 | oAddrow(_XML_LINE_SYSTEMPATH) = GetDataFromMappingDB(_XML_CATEGORY_LINE, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
334 | oLine_Dt.Rows.Add(oAddrow) |
||
335 | Next |
||
336 | |||
337 | For Each oSymbol As Object In oLineNo.Elements(_XML_CATEGORY_SYMBOL) |
||
338 | Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
||
339 | Dim oEleObj As XElement |
||
340 | Dim sUid As String |
||
341 | Dim sName As String |
||
342 | Dim sLocation As String |
||
343 | Dim sSize As String |
||
344 | Dim sAngle As String |
||
345 | |||
346 | oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
||
347 | sUid = oEleObj.Value |
||
348 | oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
||
349 | sName = oEleObj.Value |
||
350 | oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
||
351 | sLocation = oEleObj.Value |
||
352 | oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
||
353 | sSize = oEleObj.Value |
||
354 | oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
||
355 | sAngle = oEleObj.Value |
||
356 | |||
357 | oAddrow(_XML_SYMBOL_UID) = sUid |
||
358 | oAddrow(_XML_SYMBOL_NAME) = sName |
||
359 | oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
||
360 | oAddrow(_XML_SYMBOL_SIZE) = sSize |
||
361 | oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
||
362 | oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
363 | oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
||
364 | |||
365 | oSymbol_Dt.Rows.Add(oAddrow) |
||
366 | Next |
||
367 | |||
368 | For Each oAtrribute As Object In oLineNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
||
369 | |||
370 | Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
||
371 | Dim oEleObj As XElement |
||
372 | Dim sUid As String |
||
373 | Dim sName As String |
||
374 | Dim sValue As String |
||
375 | |||
376 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
||
377 | sUid = oEleObj.Value |
||
378 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
||
379 | sName = oEleObj.Value |
||
380 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
||
381 | sValue = oEleObj.Value |
||
382 | |||
383 | oAddrow(_XML_ATTRIBUTE_UID) = sUid |
||
384 | oAddrow(_XML_ATTRIBUTE_NAME) = sName |
||
385 | oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
||
386 | oAttribute_Dt.Rows.Add(oAddrow) |
||
387 | 4f359afa | Gyusu | Next |
388 | 171ac39d | Gyusu | CLineNo.Dt_Line = oLine_Dt |
389 | CLineNo.Dt_Symbol = oSymbol_Dt |
||
390 | CLineNo.Dt_Attribute = oAttribute_Dt |
||
391 | |||
392 | |||
393 | 'For Each oSymbol As Object In oLineNo.Elements(_XML_CATEGORY_SYMBOL) |
||
394 | |||
395 | ' Dim oAddrow As DataRow = oDt.NewRow() |
||
396 | |||
397 | ' Dim oObj As XElement = oSymbol.Element(_XML_SYMBOL_NAME) |
||
398 | ' Dim oName As String = oObj.Value |
||
399 | |||
400 | ' oObj = oSymbol.Element(_XML_SYMBOL_UID) |
||
401 | ' Dim oUid = oObj.Value |
||
402 | |||
403 | ' ' Dim oSymbolPath As String = "\" + oSymbol + "\" + oClass + "\" + oType + "\" + oItem + ".sym" |
||
404 | ' Dim oSymbolPath As String = GetSymbolMapping(oName) |
||
405 | |||
406 | ' oObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
||
407 | ' Dim sOriginPoint = oObj.Value |
||
408 | |||
409 | ' oObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
||
410 | ' Dim oAngle = oObj.Value |
||
411 | |||
412 | ' Dim oSplitPos As String() = sOriginPoint.Split(",") |
||
413 | ' Dim oX As Double = 0.0 |
||
414 | ' Dim oY As Double = 0.0 |
||
415 | ' If IsNumeric(oSplitPos(0)) Then |
||
416 | ' oX = Double.Parse(oSplitPos(0)) |
||
417 | ' End If |
||
418 | ' If IsNumeric(oSplitPos(1)) Then |
||
419 | ' oY = Double.Parse(oSplitPos(1)) |
||
420 | ' End If |
||
421 | ' ConvertPoint(oX, oY, _IMG_X, _IMG_Y) |
||
422 | ' oAddrow("x") = oX '+ 0.05 |
||
423 | ' oAddrow("Y") = oY |
||
424 | ' oAddrow("Angle") = oAngle |
||
425 | ' oAddrow("SystemPath") = oSymbolPath |
||
426 | ' oAddrow("Name") = oName |
||
427 | ' oAddrow("uid") = |
||
428 | ' oDt.Rows.Add(oAddrow) |
||
429 | 'Next |
||
430 | |||
431 | |||
432 | oLineno_list.Add(CLineNo) |
||
433 | 4f359afa | Gyusu | Next |
434 | 171ac39d | Gyusu | |
435 | CDrawing.Line_nos = oLineno_list |
||
436 | 4f359afa | Gyusu | End If |
437 | 171ac39d | Gyusu | Return CDrawing |
438 | 4f359afa | Gyusu | End Function |
439 | |||
440 | |||
441 | |||
442 | 171ac39d | Gyusu | 'Private Function LoadPipeInXml(ByVal sXmlPath As String) As DataTable |
443 | ' Try |
||
444 | ' Dim oDt As DataTable = LoadPipe_DT() |
||
445 | ' Dim oElement As XElement = XElement.Load(sXmlPath) |
||
446 | ' If oElement IsNot Nothing Then |
||
447 | ' Dim DWGElement As XElement = oElement.Element("DWGNAME") |
||
448 | ' Dim DWGNAME = DWGElement.Value |
||
449 | ' Dim sXY As XElement = oElement.Element("SIZE") |
||
450 | ' Dim sSize = sXY.Value |
||
451 | ' Dim oSplitDWGPos As String() = sSize.Split(", ") |
||
452 | 4f359afa | Gyusu | |
453 | 171ac39d | Gyusu | ' If IsNumeric(oSplitDWGPos(0)) Then |
454 | ' _IMG_X = Double.Parse(oSplitDWGPos(0)) |
||
455 | ' End If |
||
456 | ' If IsNumeric(oSplitDWGPos(1)) Then |
||
457 | ' _IMG_Y = Double.Parse(oSplitDWGPos(1)) |
||
458 | ' End If |
||
459 | 4f359afa | Gyusu | |
460 | 171ac39d | Gyusu | ' For Each pipes As Object In oElement.Elements("IMGLINES") |
461 | ' For Each pipe As Object In pipes.Elements("IMGLINE") |
||
462 | ' Dim oAddrow As DataRow = oDt.NewRow() |
||
463 | ' Dim oObj As XElement = pipe.Element("ITEM") |
||
464 | ' Dim oItem = oObj.Value |
||
465 | ' ' Dim oSymbolPath As String = "\" + oSymbol + "\" + oClass + "\" + oType + "\" + oItem + ".sym" |
||
466 | ' Dim oSymbolPath As String = GetSystemPathFromMappingDB(oItem) |
||
467 | ' oObj = pipe.Element("START") |
||
468 | ' Dim oStartPoint = oObj.Value |
||
469 | ' Dim oSplitPos As String() = oStartPoint.Split(", ") |
||
470 | ' Dim oStartpos_X As Double = 0.0 |
||
471 | ' Dim oStartpos_Y As Double = 0.0 |
||
472 | ' If IsNumeric(oSplitPos(0)) Then |
||
473 | ' oStartpos_X = Double.Parse(oSplitPos(0)) |
||
474 | ' End If |
||
475 | ' If IsNumeric(oSplitPos(1)) Then |
||
476 | ' oStartpos_Y = Double.Parse(oSplitPos(1)) |
||
477 | ' End If |
||
478 | 4f359afa | Gyusu | |
479 | 171ac39d | Gyusu | ' ConvertPoint(oStartpos_X, oStartpos_Y, _DWG_X, _DWG_Y) |
480 | ' oObj = pipe.Element("End") |
||
481 | ' Dim oEndPoint = oObj.Value |
||
482 | ' oSplitPos = oEndPoint.Split(", ") |
||
483 | ' Dim oEndpos_X As Double = 0.0 |
||
484 | ' Dim oEndpos_Y As Double = 0.0 |
||
485 | ' If IsNumeric(oSplitPos(0)) Then |
||
486 | ' oEndpos_X = Double.Parse(oSplitPos(0)) |
||
487 | ' End If |
||
488 | ' If IsNumeric(oSplitPos(1)) Then |
||
489 | ' oEndpos_Y = Double.Parse(oSplitPos(1)) |
||
490 | ' End If |
||
491 | ' ConvertPoint(oEndpos_X, oEndpos_Y, _DWG_X, _DWG_Y) |
||
492 | 4f359afa | Gyusu | |
493 | 171ac39d | Gyusu | ' oAddrow("start_x") = oStartpos_X '+ 0.05 |
494 | ' oAddrow("start_y") = oStartpos_Y |
||
495 | ' oAddrow("end_x") = oEndpos_X |
||
496 | ' oAddrow("end_y") = oEndpos_Y |
||
497 | ' oAddrow("SystemPath") = oSymbolPath |
||
498 | ' oDt.Rows.Add(oAddrow) |
||
499 | ' Next |
||
500 | ' Next |
||
501 | |||
502 | ' End If |
||
503 | 4f359afa | Gyusu | |
504 | 171ac39d | Gyusu | |
505 | ' Return oDt |
||
506 | ' Catch ex As Exception |
||
507 | ' Return Nothing |
||
508 | ' End Try |
||
509 | 'End Function |
||
510 | 4f359afa | Gyusu | |
511 | |||
512 | Private Sub ConvertPoint(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double) |
||
513 | |||
514 | Dim calcx As Double = 0 |
||
515 | Dim calcy As Double = 0 |
||
516 | calcx = (dX * _DWG_X) / dDwgX 'Math.Round((dX * _DWG_X) / dDwgX, 2) |
||
517 | 171ac39d | Gyusu | calcy = _DWG_Y - ((dY * _DWG_Y) / dDwgY) '_DWG_Y - Math.Round((dY * _DWG_Y) / dDwgY, 2) |
518 | 4f359afa | Gyusu | dX = calcx |
519 | dY = calcy |
||
520 | End Sub |
||
521 | |||
522 | e1cde8f2 | Gyusu | |
523 | '@brief Convert To SPPID |
||
524 | '@author : Gyusu Park |
||
525 | '@date : 2018-04-10 |
||
526 | '@history: |
||
527 | |||
528 | 171ac39d | Gyusu | Private Sub SplitLocation(ByVal sLocation As String, ByRef dX As Double, ByRef dY As Double) |
529 | |||
530 | Dim opointstr As String() = Split(sLocation, ",") |
||
531 | If (opointstr.Length > 1) Then |
||
532 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
533 | dX = opointstr(0) |
||
534 | dY = opointstr(1) |
||
535 | End If |
||
536 | End If |
||
537 | |||
538 | End Sub |
||
539 | |||
540 | |||
541 | |||
542 | |||
543 | |||
544 | |||
545 | e1cde8f2 | Gyusu | Private Function AutoConverting(ByVal oPipe_Dt As DataTable, ByVal oSymbol_Dt As DataTable, ByVal oTreeNode As TreeNode) As Boolean |
546 | e282643f | Gyusu | Dim iTotalCount As Double = oPipe_Dt.Rows.Count + oSymbol_Dt.Rows.Count |
547 | Dim iSymbolcount As Double = 0 |
||
548 | |||
549 | e1cde8f2 | Gyusu | Dim lobjDatasource As Object = _Placement.PIDDataSource |
550 | e282643f | Gyusu | |
551 | e1cde8f2 | Gyusu | ' lobjDatasource.BeginTransaction() |
552 | e282643f | Gyusu | ' datasource = objPlacement.PIDDataSource |
553 | 'Dim iPipecnt As Integer = 0 |
||
554 | e1cde8f2 | Gyusu | SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
555 | e282643f | Gyusu | |
556 | e1cde8f2 | Gyusu | Dim iPipeCnt As Integer = 0 |
557 | e282643f | Gyusu | If oPipe_Dt IsNot Nothing Then |
558 | For Each oRow As DataRow In oPipe_Dt.Rows |
||
559 | Dim oposition As String = oRow("position").ToString() |
||
560 | 20c84e05 | Gyusu | Dim oSymbol As String = oRow("SystemPath").ToString() |
561 | 171ac39d | Gyusu | |
562 | e282643f | Gyusu | Dim objConnector As LMConnector |
563 | Dim objInputs As PlaceRunInputs |
||
564 | objInputs = New PlaceRunInputs |
||
565 | 171ac39d | Gyusu | Dim oSplitStr As String() = Split(oposition, " ") |
566 | e282643f | Gyusu | For Each sposition As String In oSplitStr |
567 | 20c84e05 | Gyusu | Dim opointstr As String() = Split(sposition, ", ") |
568 | e282643f | Gyusu | |
569 | If (opointstr.Length > 1) Then |
||
570 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
571 | Dim ox As Double = opointstr(0) |
||
572 | Dim oy As Double = opointstr(1) |
||
573 | ConvertPoint(ox, oy, _IMG_X, _IMG_Y) |
||
574 | objInputs.AddPoint(ox, oy) |
||
575 | End If |
||
576 | 4f359afa | Gyusu | End If |
577 | e282643f | Gyusu | Next |
578 | Dim objItem As LMAItem |
||
579 | e1cde8f2 | Gyusu | objItem = _Placement.PIDCreateItem(oSymbol) |
580 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
581 | SetListBoxItems(ListBox_Result, " Place PipeLine...." & "(" & (iPipeCnt + 1) & "/" & oPipe_Dt.Rows.Count) |
||
582 | e282643f | Gyusu | 'Dim objPipeRun As LMPipeRun = datasource.GetPipeRun(objConnector.ModelItemID) |
583 | 'objPipeRun.Attributes("OperFluidCode").Value = "AFS" |
||
584 | 'objPipeRun.Commit() |
||
585 | iSymbolcount = iSymbolcount + 1 |
||
586 | e1cde8f2 | Gyusu | iPipeCnt = iPipeCnt + 1 |
587 | e282643f | Gyusu | Next |
588 | End If |
||
589 | 4f359afa | Gyusu | |
590 | e1cde8f2 | Gyusu | SetListBoxItems(ListBox_Result, " Place PipeLine....완료") |
591 | |||
592 | Dim iAllInstrumentCnt As Integer = oSymbol_Dt.Select("Name = 'INSTRUMENTATION'").Length |
||
593 | 20c84e05 | Gyusu | Dim iValveCnt As Integer = oSymbol_Dt.Select("Class = 'VALVES'").Length |
594 | e1cde8f2 | Gyusu | Dim iInstrumentCnt As Integer = 1 |
595 | Dim iFittingsCnt As Integer = 1 |
||
596 | |||
597 | Dim oInsNode As TreeNode = oTreeNode.Nodes.Find(oTreeNode.Name & "\Instruments", True)(0) |
||
598 | Dim oValveNode As TreeNode = oTreeNode.Nodes.Find(oTreeNode.Name & "\Valves", True)(0) |
||
599 | Dim oFittingsNode As TreeNode = oTreeNode.Nodes.Find(oTreeNode.Name & "\Fittings", True)(0) |
||
600 | e282643f | Gyusu | For Each oRow As DataRow In oSymbol_Dt.Rows |
601 | 4f359afa | Gyusu | |
602 | e282643f | Gyusu | Try |
603 | e1cde8f2 | Gyusu | |
604 | 20c84e05 | Gyusu | Dim sSystemPath As String = oRow("SystemPath").ToString() |
605 | Dim sName As String = oRow("Name").ToString() |
||
606 | Dim sType As String = oRow("Type").ToString() |
||
607 | Dim sText As String = oRow("Text").ToString() |
||
608 | Dim sClass As String = oRow("Class").ToString() |
||
609 | Dim sItem As String = oRow("Item").ToString() |
||
610 | e1cde8f2 | Gyusu | |
611 | e282643f | Gyusu | Dim oX As Double = 0.0 |
612 | Dim oY As Double = 0.0 |
||
613 | 20c84e05 | Gyusu | If IsNumeric(oRow("x").ToString()) Then |
614 | oX = Double.Parse(oRow("x").ToString()) |
||
615 | e282643f | Gyusu | End If |
616 | 20c84e05 | Gyusu | If IsNumeric(oRow("y").ToString()) Then |
617 | oY = Double.Parse(oRow("y").ToString()) |
||
618 | e282643f | Gyusu | End If |
619 | Dim oAngle As Double = 0.0 |
||
620 | 20c84e05 | Gyusu | If IsNumeric(oRow("Angle").ToString()) Then |
621 | oAngle = Double.Parse(oRow("Angle").ToString()) |
||
622 | e282643f | Gyusu | End If |
623 | ' oSymbol = "\INSTRUMENTation\SYSTEM FUNCTIONS\D C S\DCS FUNC ACCESS IN PRIME LOC.sym" |
||
624 | e1cde8f2 | Gyusu | If sSystemPath <> "" Then |
625 | If sName = _TYPE_Instumentation Then |
||
626 | |||
627 | e282643f | Gyusu | Dim sTagsuffix As String = "" |
628 | Dim sTagSequenceNo As String = "" |
||
629 | Dim sMeasuredVariableCode As String = "" |
||
630 | Dim sInstrumentTypeModifier As String = "" |
||
631 | e1cde8f2 | Gyusu | |
632 | If sText <> "" Then |
||
633 | If sText.Contains(",") Then |
||
634 | Dim splitstr() As String = sText.Split(",") |
||
635 | e282643f | Gyusu | For i = 0 To splitstr.Count - 1 |
636 | If i = 0 Then |
||
637 | sMeasuredVariableCode = Mid(splitstr(i), 1, 1) |
||
638 | sTagSequenceNo = Mid(splitstr(i), 2, Len(splitstr(i))) |
||
639 | Else |
||
640 | If Len(splitstr(i)) = 1 Then |
||
641 | sInstrumentTypeModifier = splitstr(i) |
||
642 | ElseIf Len(splitstr(i)) = 0 Then |
||
643 | |||
644 | ElseIf Len(splitstr(i)) > 1 Then |
||
645 | sInstrumentTypeModifier = Mid(splitstr(i), 1, 1) |
||
646 | sTagsuffix = Mid(splitstr(i), 2, Len(splitstr(i))) |
||
647 | End If |
||
648 | End If |
||
649 | Next |
||
650 | Else |
||
651 | e1cde8f2 | Gyusu | sMeasuredVariableCode = Mid(sText, 1, 1) |
652 | sTagSequenceNo = Mid(sText, 2, Len(sText)) |
||
653 | e282643f | Gyusu | End If |
654 | 4f359afa | Gyusu | |
655 | e282643f | Gyusu | End If |
656 | 4f359afa | Gyusu | |
657 | e282643f | Gyusu | Dim objInstrSym As LMSymbol |
658 | e1cde8f2 | Gyusu | objInstrSym = _Placement.PIDPlaceSymbol(sSystemPath, oX, oY, , oAngle) |
659 | SetListBoxItems(ListBox_Result, " Place Instrument...." & "(" & (iInstrumentCnt + 1) & "/" & iAllInstrumentCnt & ")") |
||
660 | |||
661 | ' SetTreeViewItems(Tree_Result, oTreeNode.Nodes, sTagSequenceNo) |
||
662 | Dim action As Action = Sub() |
||
663 | oInsNode.Nodes.Add(sClass & "-" & iInstrumentCnt) |
||
664 | oInsNode.ExpandAll() |
||
665 | End Sub |
||
666 | oInsNode.TreeView.Invoke(action) |
||
667 | |||
668 | |||
669 | e282643f | Gyusu | Dim objInstr As LMInstrument |
670 | objInstr = lobjDatasource.GetInstrument(objInstrSym.ModelItemID) |
||
671 | 4f359afa | Gyusu | |
672 | e282643f | Gyusu | Dim objItem As LMAItem |
673 | e1cde8f2 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
674 | |||
675 | 4f359afa | Gyusu | |
676 | e282643f | Gyusu | objInstr.Attributes("MeasuredVariableCode").Value = sMeasuredVariableCode |
677 | objInstr.Attributes("InstrumentTypeModifier").Value = sInstrumentTypeModifier |
||
678 | objInstr.Attributes("TagSuffix").Value = sTagsuffix |
||
679 | objInstr.Attributes("TagSequenceNo").Value = sTagSequenceNo |
||
680 | objInstr.Commit() |
||
681 | e1cde8f2 | Gyusu | iInstrumentCnt = iInstrumentCnt + 1 |
682 | ElseIf sName = "GATE VALVE WITH PLUG" Then |
||
683 | 4f359afa | Gyusu | |
684 | e1cde8f2 | Gyusu | ElseIf sName = "MEDIUM 1D 1TO1" Then |
685 | 4f359afa | Gyusu | |
686 | e1cde8f2 | Gyusu | ElseIf sClass = "VALVES" Then |
687 | Dim action As Action = Sub() |
||
688 | oValveNode.ExpandAll() |
||
689 | oValveNode.Nodes.Add(sClass & "-" & iValveCnt) |
||
690 | End Sub |
||
691 | oValveNode.TreeView.Invoke(action) |
||
692 | |||
693 | _Placement.PIDPlaceSymbol(sSystemPath, oX, oY, , oAngle) |
||
694 | |||
695 | iValveCnt = iValveCnt + 1 |
||
696 | e282643f | Gyusu | Else |
697 | e1cde8f2 | Gyusu | Dim action As Action = Sub() |
698 | oFittingsNode.ExpandAll() |
||
699 | oFittingsNode.Nodes.Add(sClass & "-" & iFittingsCnt) |
||
700 | End Sub |
||
701 | oFittingsNode.TreeView.Invoke(action) |
||
702 | _Placement.PIDPlaceSymbol(sSystemPath, oX, oY, , oAngle) |
||
703 | |||
704 | iFittingsCnt = iFittingsCnt + 1 |
||
705 | 4f359afa | Gyusu | |
706 | e282643f | Gyusu | End If |
707 | iSymbolcount = iSymbolcount + 1 |
||
708 | Else |
||
709 | 4f359afa | Gyusu | End If |
710 | e282643f | Gyusu | Catch ex As Exception |
711 | 4f359afa | Gyusu | |
712 | e282643f | Gyusu | End Try |
713 | Dim dCalcProgressValue As Double = (iSymbolcount / iTotalCount) * 100 |
||
714 | SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
||
715 | ' ProgressBar_Status.Value = (iSymbolcount / iTotalCount) * 100 |
||
716 | e1cde8f2 | Gyusu | |
717 | 4f359afa | Gyusu | Next |
718 | |||
719 | e1cde8f2 | Gyusu | MsgBox("Complete AutoConverting") |
720 | SetListBoxItems(ListBox_Result, "Place Instrument....변환완료") |
||
721 | SetListBoxItems(ListBox_Result, "총 symbol: " & iSymbolcount & "개 변환완료") |
||
722 | SetProgressbar(ProgressBar_Status, 100) |
||
723 | e282643f | Gyusu | ' MsgBox("symbol: " & iSymbolcount & "개, pipe : " & iPipecnt & "개 변환완료") |
724 | 4f359afa | Gyusu | End Function |
725 | |||
726 | |||
727 | 272662f9 | Gyusu | Private Sub Tree_XMLFiles_AfterCheck(sender As Object, e As TreeViewEventArgs) |
728 | 4f359afa | Gyusu | If e.Node.Checked = True Then |
729 | For Each oNode As TreeNode In e.Node.Nodes |
||
730 | oNode.Checked = True |
||
731 | Next |
||
732 | Else |
||
733 | For Each oNode As TreeNode In e.Node.Nodes |
||
734 | oNode.Checked = False |
||
735 | Next |
||
736 | End If |
||
737 | End Sub |
||
738 | |||
739 | 171ac39d | Gyusu | Private Function Load_DB(ByVal sDBPath As String, ByVal sTableName As String) As DataTable |
740 | 4f359afa | Gyusu | |
741 | Try |
||
742 | 171ac39d | Gyusu | Dim oDt As New DataTable |
743 | 4f359afa | Gyusu | Dim sConnectionstring As String = "Data Source=" & sDBPath & ";Version=3;Synchronous=Off;UTF8Encoding=True;" |
744 | Dim conn As SQLiteConnection = New SQLiteConnection(sConnectionstring) |
||
745 | conn.Open() |
||
746 | 171ac39d | Gyusu | Dim sQuery As String = "Select * from " & sTableName |
747 | 4f359afa | Gyusu | Dim cmd As SQLiteCommand = conn.CreateCommand() |
748 | Dim adapter As SQLiteDataAdapter = New SQLiteDataAdapter(sQuery, conn) |
||
749 | Dim oDataSet As DataSet = New DataSet() |
||
750 | adapter.Fill(oDataSet) |
||
751 | 171ac39d | Gyusu | oDt = oDataSet.Tables(0) |
752 | Return oDt |
||
753 | 4f359afa | Gyusu | Catch ex As Exception |
754 | 171ac39d | Gyusu | Return Nothing |
755 | 4f359afa | Gyusu | End Try |
756 | |||
757 | |||
758 | 171ac39d | Gyusu | End Function |
759 | 4f359afa | Gyusu | |
760 | 171ac39d | Gyusu | Private Sub Load_AttributeDB(ByVal sDBPath As String) |
761 | |||
762 | Try |
||
763 | Dim sConnectionstring As String = "Data Source=" & sDBPath & ";Version=3;Synchronous=Off;UTF8Encoding=True;" |
||
764 | Dim conn As SQLiteConnection = New SQLiteConnection(sConnectionstring) |
||
765 | conn.Open() |
||
766 | Dim sQuery As String = "Select * from Attribute" |
||
767 | Dim cmd As SQLiteCommand = conn.CreateCommand() |
||
768 | Dim adapter As SQLiteDataAdapter = New SQLiteDataAdapter(sQuery, conn) |
||
769 | Dim oDataSet As DataSet = New DataSet() |
||
770 | adapter.Fill(oDataSet) |
||
771 | _Attribute_DB = oDataSet.Tables(0) |
||
772 | Catch ex As Exception |
||
773 | |||
774 | End Try |
||
775 | 962b2464 | Gyusu | |
776 | |||
777 | 171ac39d | Gyusu | End Sub |
778 | |||
779 | 272662f9 | Gyusu | 'Private Sub Tree_XMLFiles_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles Tree_XMLFiles.AfterSelect |
780 | ' If first_start = False Then Exit Sub |
||
781 | ' Dim pa = e.Node.FullPath.ToString |
||
782 | 962b2464 | Gyusu | |
783 | 272662f9 | Gyusu | ' printfilesfolders_here(pa, e.Node) |
784 | 962b2464 | Gyusu | |
785 | 272662f9 | Gyusu | ' displayfiles(pa) |
786 | |||
787 | ' Dim coco As String = "" |
||
788 | ' coco = pa.ToString |
||
789 | ' coco = coco.Replace("\\", "\") |
||
790 | ' Me.Text = coco |
||
791 | ' folders_path = coco |
||
792 | 'End Sub |
||
793 | 962b2464 | Gyusu | |
794 | Sub printfilesfolders_here(ByVal path As String, ByRef itree As TreeNode) |
||
795 | |||
796 | Dim foldername As String |
||
797 | Dim filename As String |
||
798 | itree.Nodes.Clear() |
||
799 | On Error GoTo eee |
||
800 | For Each foldername In Directory.GetDirectories(path) |
||
801 | On Error GoTo eee |
||
802 | Dim jj = foldername.LastIndexOf("\") |
||
803 | Dim jj1 = foldername.Length - jj |
||
804 | Dim foldr = foldername.Substring((jj + 1), (jj1 - 1)) |
||
805 | itree.Nodes.Add(foldr, foldr) |
||
806 | Next ' if you put this next at the end of procedure recursive will be done on first folder only |
||
807 | Exit Sub |
||
808 | eee: |
||
809 | End Sub |
||
810 | |||
811 | e282643f | Gyusu | |
812 | 962b2464 | Gyusu | |
813 | 272662f9 | Gyusu | ' Private Sub Tree_XMLFiles_MouseMove(sender As Object, e As MouseEventArgs) Handles Tree_XMLFiles.MouseMove |
814 | ' first_start = True |
||
815 | ' End Sub |
||
816 | |||
817 | ' Private Sub ListView_File_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView_File.SelectedIndexChanged |
||
818 | ' Dim indexes As ListView.SelectedIndexCollection = |
||
819 | ' Me.ListView_File.SelectedIndices |
||
820 | ' Dim index As Integer |
||
821 | |||
822 | ' For Each index In indexes |
||
823 | ' 'On Error Resume Next |
||
824 | ' If folders_path.EndsWith("\") = True Then |
||
825 | ' Me.Status_Main.Items(0).Text = folders_path + (Me.ListView_File.Items(index).Text) |
||
826 | ' 'On Error Resume Next |
||
827 | ' Else |
||
828 | ' Me.Status_Main.Items(0).Text = folders_path + "\" + (Me.ListView_File.Items(index).Text) |
||
829 | ' End If |
||
830 | |||
831 | ' Dim infoReader As System.IO.FileInfo |
||
832 | ' infoReader = My.Computer.FileSystem.GetFileInfo(Me.Status_Main.Items(0).Text) |
||
833 | ' Me.Status_Main.Items(1).Text = " Created : " + infoReader.CreationTime.ToString + " " + infoReader.Attributes.ToString |
||
834 | ' Next |
||
835 | ' End Sub |
||
836 | |||
837 | ' Private Sub Procees() |
||
838 | ' Dim indexes As ListView.SelectedIndexCollection = |
||
839 | ' Me.ListView_File.SelectedIndices |
||
840 | ' Dim index As Integer |
||
841 | |||
842 | ' For Each index In indexes |
||
843 | ' 'On Error Resume Next |
||
844 | ' If folders_path.EndsWith("\") = True Then |
||
845 | ' On Error GoTo out |
||
846 | ' Me.Status_Main.Items(0).Text = folders_path + (Me.ListView_File.Items(index).Text) |
||
847 | ' On Error GoTo out |
||
848 | ' 'On Error Resume Next |
||
849 | ' Else |
||
850 | ' Me.Status_Main.Items(0).Text = folders_path + "\" + (Me.ListView_File.Items(index).Text) |
||
851 | ' On Error GoTo out |
||
852 | ' End If |
||
853 | |||
854 | ' Dim infoReader As System.IO.FileInfo |
||
855 | ' infoReader = My.Computer.FileSystem.GetFileInfo(Me.Status_Main.Items(0).Text) |
||
856 | ' Me.Status_Main.Items(1).Text = " Created : " + infoReader.CreationTime.ToString + " " + infoReader.Attributes.ToString |
||
857 | ' On Error GoTo out |
||
858 | ' MsgBox(Me.Status_Main.Items(0).Text + " is processed") |
||
859 | ' On Error GoTo out |
||
860 | ' Next |
||
861 | ' Exit Sub |
||
862 | 'out: |
||
863 | ' MsgBox(Err.Description) |
||
864 | 'End Sub |
||
865 | 962b2464 | Gyusu | |
866 | 31d47a80 | Gyusu | Private Function LoadAllDrawing() As DataTable |
867 | e282643f | Gyusu | |
868 | |||
869 | e1cde8f2 | Gyusu | SetListBoxItems(ListBox_Result, "도면정보 로드중....") |
870 | e282643f | Gyusu | |
871 | 31d47a80 | Gyusu | Dim oDt As DataTable = Drawing_Dt() |
872 | e282643f | Gyusu | Dim sHierarchy As String = My.Settings.Plant_Hierarchy |
873 | |||
874 | |||
875 | Dim files() As String |
||
876 | files = Directory.GetFiles(sHierarchy, "*.pid", SearchOption.AllDirectories) |
||
877 | For Each FileName As String In files |
||
878 | Dim sName As String = FileName |
||
879 | 31d47a80 | Gyusu | Dim oAddRow As DataRow = oDt.NewRow() |
880 | e282643f | Gyusu | oAddRow("Name") = Path.GetFileNameWithoutExtension(sName) |
881 | oAddRow("Path") = FileName |
||
882 | 31d47a80 | Gyusu | oDt.Rows.Add(oAddRow) |
883 | Next |
||
884 | Return oDt |
||
885 | End Function |
||
886 | |||
887 | e282643f | Gyusu | Private Function LoadAllDrawing2() As DataTable |
888 | 31d47a80 | Gyusu | Dim datasource As LMADataSource |
889 | Dim objPIDAutoApp As Object |
||
890 | Dim objPIDADrawing As Object |
||
891 | Dim objDrawing As Object 'Drawing |
||
892 | 'Dim objDrawing As LMDrawing |
||
893 | 'Dim objDrawings As LMDrawings |
||
894 | |||
895 | datasource = New LMADataSource |
||
896 | |||
897 | ' objDrawings = New LMDrawings |
||
898 | 'objDrawings.Collect(datasource) |
||
899 | objPIDAutoApp = CreateObject("PIDAutomation.Application") |
||
900 | |||
901 | For Each objDrawing In objPIDAutoApp.Drawings |
||
902 | objDrawing.CloseDrawing(True) |
||
903 | Next |
||
904 | Try |
||
905 | objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing("UY1-K-2000_P1_300dpi_0321_TEST_1") |
||
906 | Catch ex As Exception |
||
907 | Process.Start("\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\UY1-K-2000_P1_300dpi_0321_TEST_1.pid") |
||
908 | End Try |
||
909 | |||
910 | |||
911 | |||
912 | Dim sType As Type = objPIDAutoApp.GetType() |
||
913 | Dim iCount As Integer = 0 |
||
914 | ' Dim sPath As String = "\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\188943-8121-PR-DW-011001.pid" |
||
915 | |||
916 | objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing("1") |
||
917 | |||
918 | For Each objDrawing In objPIDAutoApp.Drawings |
||
919 | If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
||
920 | Try |
||
921 | |||
922 | Dim sName As String = objDrawing.Attributes("Name").Value |
||
923 | |||
924 | iCount = iCount + 1 |
||
925 | If sName = "UY1-K-2000_P1_300dpi_0321_TEST_1" Then |
||
926 | objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(objDrawing.Attributes("Name")) |
||
927 | objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing("\8121\8121-1\UY1-K-2000_P1_300dpi_0321_TEST_1.pid") |
||
928 | If Not objPIDADrawing Is Nothing Then |
||
929 | objPIDADrawing.CloseDrawing() |
||
930 | End If |
||
931 | End If |
||
932 | |||
933 | |||
934 | Catch ex As Exception |
||
935 | |||
936 | End Try |
||
937 | |||
938 | End If |
||
939 | Next |
||
940 | objPIDAutoApp.Quit |
||
941 | objPIDAutoApp = Nothing |
||
942 | objPIDADrawing = Nothing |
||
943 | objDrawing = Nothing |
||
944 | ' objDrawings = Nothing |
||
945 | e282643f | Gyusu | End Function |
946 | |||
947 | 272662f9 | Gyusu | Dim _XMLList As ListView = New ListView() |
948 | e282643f | Gyusu | |
949 | 272662f9 | Gyusu | |
950 | |||
951 | e1cde8f2 | Gyusu | |
952 | 171ac39d | Gyusu | |
953 | |||
954 | Private Function CheckOpenDrawing() As Boolean |
||
955 | Try |
||
956 | |||
957 | Dim lobjDatasource As Object |
||
958 | _Placement = CreateObject("Plaice.Placement", "") |
||
959 | lobjDatasource = _Placement.PIDDataSource |
||
960 | Return True |
||
961 | Catch ex As Exception |
||
962 | Return False |
||
963 | End Try |
||
964 | |||
965 | End Function |
||
966 | |||
967 | |||
968 | Private Sub Btn_Convert_Click(sender As Object, e As EventArgs) Handles Btn_Convert.Click |
||
969 | |||
970 | Main_Tab.SelectedIndex = 1 |
||
971 | ListBox_Result.Items.Clear() |
||
972 | DataGrid_Result.DataSource = New DataTable() |
||
973 | Me.ProgressBar_Status.Visible = True |
||
974 | ProgressBar_Status.Maximum = 100 |
||
975 | ProgressBar_Status.Value = 0 |
||
976 | ' _selectFolderPath = Tree_XMLFiles.SelectedNode.FullPath.Replace("\\", "\") |
||
977 | _Main_trd = New Thread(AddressOf ThreadTask) |
||
978 | _Main_trd.IsBackground = True |
||
979 | _Main_trd.Start() |
||
980 | |||
981 | End Sub |
||
982 | 7824381a | Gyusu | 'Private Sub ThreadTask() |
983 | e1cde8f2 | Gyusu | |
984 | e282643f | Gyusu | |
985 | 7824381a | Gyusu | ' If _XMLList.Items.Count > 0 Then |
986 | 31d47a80 | Gyusu | |
987 | 7824381a | Gyusu | ' Dim oDwg_Dt As DataTable = LoadAllDrawing() |
988 | ' Dim iDwgCnt As Integer = 0 |
||
989 | ' Dim objPIDAutoApp As Object |
||
990 | ' objPIDAutoApp = CreateObject("PIDAutomation.Application") |
||
991 | e282643f | Gyusu | |
992 | e1cde8f2 | Gyusu | |
993 | 7824381a | Gyusu | ' Dim myList = DirectCast(Invoke(New GetListViewDelegate(AddressOf GetListViewItems), _XMLList), List(Of String)) |
994 | ' For i = 0 To myList.Count - 1 |
||
995 | e1cde8f2 | Gyusu | |
996 | 7824381a | Gyusu | ' Dim sDwgName As String = Path.GetFileNameWithoutExtension(myList(i)) |
997 | ' Txt_Status.Text = sDwgName & "..(" & i + 1 & "/" & myList.Count & ")" |
||
998 | ' SetListBoxItems(ListBox_Result, Txt_Status.Text & " 처리중....") |
||
999 | ' Dim sDwgNo As String = myList(i) |
||
1000 | ' Dim oDwgPath As String = "" |
||
1001 | ' oDwgPath = _selectFolderPath + "\" + sDwgNo |
||
1002 | e1cde8f2 | Gyusu | |
1003 | 7824381a | Gyusu | ' Dim sPath As String = OpenDrawing(oDwg_Dt, sDwgName) |
1004 | ' If sPath <> "" Then |
||
1005 | e1cde8f2 | Gyusu | |
1006 | 7824381a | Gyusu | ' Process.Start(sPath) |
1007 | e1cde8f2 | Gyusu | |
1008 | 7824381a | Gyusu | ' Dim bCheckOpenDrawing As Boolean = False |
1009 | ' While (True) |
||
1010 | ' bCheckOpenDrawing = CheckOpenDrawing() |
||
1011 | ' If bCheckOpenDrawing = True Then |
||
1012 | ' Exit While |
||
1013 | ' Else |
||
1014 | ' Thread.Sleep(2000) |
||
1015 | ' End If |
||
1016 | ' End While |
||
1017 | e1cde8f2 | Gyusu | |
1018 | 7824381a | Gyusu | ' If bCheckOpenDrawing Then |
1019 | ' SetListBoxItems(ListBox_Result, sDwgName & " 도면 Open....") |
||
1020 | ' Dim oPipe_Dt As DataTable = New DataTable() 'LoadPipeInXml(oDwgPath) |
||
1021 | e282643f | Gyusu | |
1022 | 7824381a | Gyusu | ' Dim oSymbol_Dt As DataTable = LoadSymbolInXml(oDwgPath) |
1023 | ' Dim oTreeNode As New TreeNode 'SetTreeViewItems(Tree_Result, Tree_Result.Nodes, sDwgName, sDwgName) |
||
1024 | ' 'oTreeNode = Tree_Result.Nodes.Find(sDwgName, True)(0) |
||
1025 | ' Dim action As Action = Sub() |
||
1026 | ' oTreeNode = Tree_Result.Nodes.Add(sDwgName, sDwgName) |
||
1027 | ' SetTreeViewItems(Tree_Result, oTreeNode.Nodes, sDwgName & "\Instruments", "Instuments") |
||
1028 | ' SetTreeViewItems(Tree_Result, oTreeNode.Nodes, sDwgName & "\Pipes", "Pipes") |
||
1029 | ' SetTreeViewItems(Tree_Result, oTreeNode.Nodes, sDwgName & "\Valves", "Valves") |
||
1030 | ' SetTreeViewItems(Tree_Result, oTreeNode.Nodes, sDwgName & "\Fittings", "Fittings") |
||
1031 | ' oTreeNode.ExpandAll() |
||
1032 | ' End Sub |
||
1033 | ' Tree_Result.Invoke(action) |
||
1034 | e1cde8f2 | Gyusu | |
1035 | e282643f | Gyusu | |
1036 | 7824381a | Gyusu | ' ' oTreeNode.Expand() |
1037 | ' SetListBoxItems(ListBox_Result, sDwgName & " Auto converting 대기....") |
||
1038 | ' AutoConverting(oPipe_Dt, oSymbol_Dt, oTreeNode) |
||
1039 | 4f359afa | Gyusu | |
1040 | 7824381a | Gyusu | ' End If |
1041 | |||
1042 | ' End If |
||
1043 | ' ''도면 생성 |
||
1044 | ' 'If CreateDwg(sDwgName) Then |
||
1045 | ' ' 'AutoConverting |
||
1046 | |||
1047 | ' 'End If |
||
1048 | |||
1049 | ' Next |
||
1050 | ' End If |
||
1051 | 'End Sub |
||
1052 | e282643f | Gyusu | |
1053 | 171ac39d | Gyusu | Dim _objPIDAutoApp As Object |
1054 | e282643f | Gyusu | |
1055 | 171ac39d | Gyusu | Private Function OpenSPPID(ByVal oDwg_Dt As DataTable, ByVal sDwgName As String) As Boolean |
1056 | Dim bCheckOpen As Boolean = False |
||
1057 | ' Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgPath) |
||
1058 | SetListBoxItems(ListBox_Result, sDwgName & " 도면 Open....") |
||
1059 | _objPIDAutoApp = CreateObject("PIDAutomation.Application") |
||
1060 | e1cde8f2 | Gyusu | |
1061 | 171ac39d | Gyusu | Dim sPath As String = OpenDrawing(oDwg_Dt, sDwgName) |
1062 | If sPath <> "" Then |
||
1063 | Process.Start(sPath) |
||
1064 | Else |
||
1065 | Return bCheckOpen |
||
1066 | End If |
||
1067 | |||
1068 | Dim bCheckOpenDrawing As Boolean = False |
||
1069 | While (True) |
||
1070 | bCheckOpenDrawing = CheckOpenDrawing() |
||
1071 | If bCheckOpenDrawing = True Then |
||
1072 | bCheckOpen = True |
||
1073 | Exit While |
||
1074 | Else |
||
1075 | Thread.Sleep(2000) |
||
1076 | End If |
||
1077 | End While |
||
1078 | |||
1079 | |||
1080 | Return bCheckOpen |
||
1081 | End Function |
||
1082 | |||
1083 | Private Function GetDrawing(ByVal sDwgName As String) As Drawing |
||
1084 | For Each CDrawing In _DrawingsList |
||
1085 | If CDrawing.DwgName = sDwgName Then |
||
1086 | Return CDrawing |
||
1087 | End If |
||
1088 | Next |
||
1089 | Return Nothing |
||
1090 | End Function |
||
1091 | |||
1092 | Private Function GetLineNo(ByVal CDrawing As Drawing, ByVal sLineNoUid As String) As Line_no |
||
1093 | For Each CLineNo In CDrawing.Line_nos |
||
1094 | If CLineNo.Uid = sLineNoUid Then |
||
1095 | Return CLineNo |
||
1096 | End If |
||
1097 | Next |
||
1098 | Return Nothing |
||
1099 | End Function |
||
1100 | |||
1101 | Private Function ConvertPoint(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean |
||
1102 | Try |
||
1103 | Dim opointstr As String() = Split(sPoint, ",") |
||
1104 | If (opointstr.Length > 1) Then |
||
1105 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
1106 | dX = opointstr(0) |
||
1107 | dY = opointstr(1) |
||
1108 | ConvertPoint(dX, dY, _IMG_X, _IMG_Y) |
||
1109 | Else |
||
1110 | dX = 0 |
||
1111 | dY = 0 |
||
1112 | Return False |
||
1113 | End If |
||
1114 | End If |
||
1115 | e1cde8f2 | Gyusu | Return True |
1116 | Catch ex As Exception |
||
1117 | Return False |
||
1118 | End Try |
||
1119 | 171ac39d | Gyusu | End Function |
1120 | |||
1121 | Private Function DrawLine(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByRef iPipelinecnt As Integer) As LMPipeRun |
||
1122 | Try |
||
1123 | Dim oPipeRun As LMPipeRun |
||
1124 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" + sUid + "'") |
||
1125 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
1126 | |||
1127 | If oPipeRow.Length > 0 Then |
||
1128 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1129 | Dim objItem As LMAItem |
||
1130 | Dim objConnector As LMConnector |
||
1131 | Dim objInputs As PlaceRunInputs |
||
1132 | objInputs = New PlaceRunInputs |
||
1133 | Dim dStart_x As Double = 0.0 |
||
1134 | Dim dStart_y As Double = 0.0 |
||
1135 | Dim dEnd_x As Double = 0.0 |
||
1136 | Dim dEnd_y As Double = 0.0 |
||
1137 | |||
1138 | Dim sSystempath As String = oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
||
1139 | Dim sStartpoint As String = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
1140 | Dim sEndpoint As String = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
1141 | ConvertPoint(sStartpoint, dStart_x, dStart_y) |
||
1142 | If ConvertPoint(sEndpoint, dEnd_x, dEnd_y) Then |
||
1143 | If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
1144 | objInputs.AddPoint(dStart_x, dStart_y) |
||
1145 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
1146 | objItem = _Placement.PIDCreateItem(sSystempath) |
||
1147 | SetListBoxItems(ListBox_Result, "Draw PipeLine.." & iPipelinecnt & " count ") |
||
1148 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
1149 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
1150 | If oAttributeRow.Length > 0 Then |
||
1151 | For Each oAttribute In oAttributeRow |
||
1152 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
1153 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
1154 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
1155 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
1156 | Next |
||
1157 | oPipeRun.Commit() |
||
1158 | End If |
||
1159 | End If |
||
1160 | End If |
||
1161 | e1cde8f2 | Gyusu | |
1162 | 171ac39d | Gyusu | |
1163 | End If |
||
1164 | Return oPipeRun |
||
1165 | Catch ex As Exception |
||
1166 | Return Nothing |
||
1167 | End Try |
||
1168 | e1cde8f2 | Gyusu | End Function |
1169 | |||
1170 | 171ac39d | Gyusu | Private Function DrawSymbol(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByRef iInstrumentcnt As Integer, |
1171 | ByRef iFittingcnt As Integer, ByRef iValvecnt As Integer) As Boolean |
||
1172 | Try |
||
1173 | e282643f | Gyusu | |
1174 | 171ac39d | Gyusu | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
1175 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
1176 | If oSymbolRow.Length > 0 Then |
||
1177 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1178 | Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
||
1179 | Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
1180 | Dim sLocation As String = oSymbolRow(0)(_XML_SYMBOL_LOCATION).ToString() |
||
1181 | Dim dAngle As Double = 0.0 |
||
1182 | If IsNumeric(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) Then |
||
1183 | dAngle = Double.Parse(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) |
||
1184 | End If |
||
1185 | |||
1186 | Dim objSymbol As LMSymbol |
||
1187 | Dim dX As Double = 0.0 |
||
1188 | Dim dY As Double = 0.0 |
||
1189 | |||
1190 | If ConvertPoint(sLocation, dX, dY) Then |
||
1191 | Dim oInstrument As LMInstrument |
||
1192 | If sSymbolCompType = _SYMBOL_INSTUMENT Then |
||
1193 | iInstrumentcnt = iInstrumentcnt + 1 |
||
1194 | objSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1195 | SetListBoxItems(ListBox_Result, "Draw Instrument.." & iInstrumentcnt & " count ") |
||
1196 | oInstrument = oDatasource.GetInstrument(objSymbol.ModelItemID) |
||
1197 | If oAttributeRow.Length > 0 Then |
||
1198 | For Each oAttribute In oAttributeRow |
||
1199 | Dim sPIDAttribute As String = oAttribute(0)(_XML_ATTRIBUTE_NAME).ToString() |
||
1200 | Dim sPIDValue As String = oAttribute(0)(_XML_ATTRIBUTE_VALUE).ToString() |
||
1201 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
1202 | oInstrument.Attributes(0)(sSPPIDAttribute).Value = sPIDValue |
||
1203 | Next |
||
1204 | oInstrument.Commit() |
||
1205 | End If |
||
1206 | |||
1207 | ElseIf sSymbolCompType = _SYMBOL_VALVES Then |
||
1208 | iValvecnt = iValvecnt + 1 |
||
1209 | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1210 | SetListBoxItems(ListBox_Result, "Draw Valve.." & iValvecnt & " count ") |
||
1211 | |||
1212 | ElseIf sSymbolCompType = _SYMBOL_FITTINGS Then |
||
1213 | iFittingcnt = iFittingcnt + 1 |
||
1214 | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1215 | SetListBoxItems(ListBox_Result, "Draw Fitting.." & iFittingcnt & " count ") |
||
1216 | Else |
||
1217 | iFittingcnt = iFittingcnt + 1 |
||
1218 | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1219 | SetListBoxItems(ListBox_Result, "Draw Fitting.." & iFittingcnt & " count ") |
||
1220 | |||
1221 | End If |
||
1222 | |||
1223 | End If |
||
1224 | |||
1225 | End If |
||
1226 | |||
1227 | Catch ex As Exception |
||
1228 | Return False |
||
1229 | End Try |
||
1230 | End Function |
||
1231 | |||
1232 | Private Function DrawLineNo(ByVal oPiperun As LMPipeRun, ByVal CLine_No As Line_no) As Boolean |
||
1233 | Try |
||
1234 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1235 | Dim sLocation = CLine_No.Location |
||
1236 | Dim dX As Double = 0.0 |
||
1237 | Dim dY As Double = 0.0 |
||
1238 | If ConvertPoint(sLocation, dX, dY) Then |
||
1239 | Dim dLineNoLocation(2) As Double |
||
1240 | dLineNoLocation(1) = dX |
||
1241 | dLineNoLocation(2) = dY |
||
1242 | 'Label |
||
1243 | Dim sSystemPath As String = CLine_No.SystemPath |
||
1244 | Dim labelpersist As LMLabelPersist |
||
1245 | |||
1246 | For Each representation In oPiperun.Representations |
||
1247 | If representation.RepresentationType = "Connector" Then |
||
1248 | labelpersist = _Placement.PIDPlaceLabel(sSystemPath, |
||
1249 | dLineNoLocation,, 0, LabeledItem:=representation) |
||
1250 | End If |
||
1251 | Next |
||
1252 | Return True |
||
1253 | Else |
||
1254 | Return False |
||
1255 | End If |
||
1256 | |||
1257 | Catch ex As Exception |
||
1258 | Return False |
||
1259 | End Try |
||
1260 | End Function |
||
1261 | |||
1262 | Private Function GetCheckNodeCount(ByVal oTreeNode As TreeNode) As Integer |
||
1263 | Dim iCheckCount As Integer = 0 |
||
1264 | For Each oNode As TreeNode In oTreeNode.Nodes |
||
1265 | If oNode.Checked Then |
||
1266 | iCheckCount = iCheckCount + 1 |
||
1267 | End If |
||
1268 | Next |
||
1269 | Return iCheckCount |
||
1270 | End Function |
||
1271 | |||
1272 | Private Function AutoModeling() As Boolean |
||
1273 | Try |
||
1274 | |||
1275 | SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
||
1276 | Dim oDwg_Dt As DataTable = LoadAllDrawing() |
||
1277 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
1278 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
1279 | |||
1280 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
1281 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
1282 | If CDrawing IsNot Nothing Then |
||
1283 | If OpenSPPID(oDwg_Dt, oDwgNode.Text) Then |
||
1284 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
1285 | Dim iLineNoCount As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
1286 | SetListBoxItems(ListBox_Result, "Draw " & CDrawing.DwgName & "....") |
||
1287 | |||
1288 | For Each oLinenoNode As TreeNode In oDwgNode.Nodes |
||
1289 | |||
1290 | Dim sLineNoUid As String = oLinenoNode.Name |
||
1291 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sLineNoUid) |
||
1292 | |||
1293 | Dim iPipelinecnt As Integer = 0 |
||
1294 | Dim iInstrumentcnt As Integer = 0 |
||
1295 | Dim iFittingcnt As Integer = 0 |
||
1296 | Dim iValvescnt As Integer = 0 |
||
1297 | |||
1298 | If CLineNo IsNot Nothing Then |
||
1299 | Dim oPipeRun As LMPipeRun |
||
1300 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
1301 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
1302 | Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
||
1303 | Dim oDrawLinenoLabel As Boolean = False |
||
1304 | For Each oLineNode As TreeNode In oLinenoNode.Nodes |
||
1305 | Dim sLineUid As String = oLineNode.Name |
||
1306 | If oLineNode.Checked Then |
||
1307 | iPipelinecnt = iPipelinecnt + 1 |
||
1308 | Dim sUid As String = oLineNode.Name |
||
1309 | oPipeRun = DrawLine(sUid, sLineNoUid, oLine_Dt, oAttribute_Dt, iPipelinecnt) |
||
1310 | If oDrawLinenoLabel = False Then |
||
1311 | DrawLineNo(oPipeRun, CLineNo) |
||
1312 | oDrawLinenoLabel = True |
||
1313 | End If |
||
1314 | |||
1315 | End If |
||
1316 | Next |
||
1317 | |||
1318 | For Each oSymbolNode As TreeNode In oLinenoNode.Nodes |
||
1319 | If oSymbolNode.Checked Then |
||
1320 | Dim sUid As String = oSymbolNode.Name |
||
1321 | DrawSymbol(sUid, sLineNoUid, oSymbol_Dt, oAttribute_Dt, iInstrumentcnt, iFittingcnt, iValvescnt) |
||
1322 | End If |
||
1323 | Next |
||
1324 | End If |
||
1325 | iLineNoCount = iLineNoCount + 1 |
||
1326 | Dim dCalcProgressValue As Double = (iLineNoCount / iLineNoCount) * 100 |
||
1327 | SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
||
1328 | Next |
||
1329 | |||
1330 | End If |
||
1331 | End If |
||
1332 | |||
1333 | Next |
||
1334 | |||
1335 | |||
1336 | |||
1337 | Next |
||
1338 | SetProgressbar(ProgressBar_Status, 100) |
||
1339 | SetListBoxItems(ListBox_Result, " Auto converting 완료") |
||
1340 | Return True |
||
1341 | Catch ex As Exception |
||
1342 | Return False |
||
1343 | End Try |
||
1344 | End Function |
||
1345 | |||
1346 | |||
1347 | 'Private Function GetModelingTable() As DataTable |
||
1348 | ' Dim oModeling_Dt As DataTable = Modeling_Dt() |
||
1349 | e1cde8f2 | Gyusu | |
1350 | e282643f | Gyusu | |
1351 | 171ac39d | Gyusu | ' For Each oLinenoNode As TreeNode In Tree_Result.Nodes |
1352 | ' Dim sLineNoUid As String = oLinenoNode.Name |
||
1353 | ' For Each oLineNode As TreeNode In oLinenoNode.Nodes |
||
1354 | ' Dim sLineUid As String = oLineNode.Name |
||
1355 | ' If oLineNode.Checked Then |
||
1356 | |||
1357 | |||
1358 | |||
1359 | |||
1360 | ' Dim oAddRow As DataRow = oModeling_Dt.NewRow |
||
1361 | ' oAddRow(_XML_MODELING_UID) = oLineNode.Name |
||
1362 | ' oAddRow(_XML_MODELING_NAME) = _XML_CATEGORY_LINE |
||
1363 | ' oAddRow(_XML_MODELING_PIPELINE) = sLineNoUid |
||
1364 | ' oAddRow(_XML_MODELING_SYSTEMPATH) = GetDataFromMappingDB(oLineNode.Text) |
||
1365 | ' oModeling_Dt.Rows.Add(oAddRow) |
||
1366 | ' End If |
||
1367 | ' Next |
||
1368 | |||
1369 | ' For Each oSymbolNode As TreeNode In oLinenoNode.Nodes |
||
1370 | ' If oSymbolNode.Checked Then |
||
1371 | ' Dim oAddRow As DataRow = oModeling_Dt.NewRow |
||
1372 | ' oAddRow(_XML_MODELING_UID) = oSymbolNode.Name |
||
1373 | ' oAddRow(_XML_MODELING_NAME) = _XML_CATEGORY_SYMBOL |
||
1374 | ' oAddRow(_XML_MODELING_PIPELINE) = sLineNoUid |
||
1375 | ' oAddRow(_XML_MODELING_SYSTEMPATH) = GetDataFromMappingDB(oSymbolNode.Text) |
||
1376 | ' oModeling_Dt.Rows.Add(oAddRow) |
||
1377 | ' End If |
||
1378 | ' Next |
||
1379 | ' Next |
||
1380 | ' Return oModeling_Dt |
||
1381 | 'End Function |
||
1382 | |||
1383 | |||
1384 | Private Sub ThreadTask() |
||
1385 | |||
1386 | If _DrawingsList.Count > 0 Then |
||
1387 | AutoModeling() |
||
1388 | End If |
||
1389 | e282643f | Gyusu | End Sub |
1390 | |||
1391 | |||
1392 | 171ac39d | Gyusu | |
1393 | Private Function ModelingPipe(ByVal oPipeRow As DataRow) As Boolean |
||
1394 | Try |
||
1395 | Dim lobjDatasource As Object = _Placement.PIDDataSource |
||
1396 | Dim datasource As LMADataSource |
||
1397 | datasource = _Placement.PIDDataSource |
||
1398 | Dim sSystempath As String = oPipeRow(_XML_MODELING_SYSTEMPATH).ToString() |
||
1399 | Dim objItem As LMAItem |
||
1400 | Dim objConnector As LMConnector |
||
1401 | Dim objInputs As PlaceRunInputs |
||
1402 | objInputs = New PlaceRunInputs |
||
1403 | objInputs.AddPoint(0.1, 0.1) |
||
1404 | objInputs.AddPoint(0.2, 0.1) |
||
1405 | objItem = _Placement.PIDCreateItem(sSystempath) |
||
1406 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
1407 | Dim objPipeRun As LMPipeRun = datasource.GetPipeRun(objConnector.ModelItemID) |
||
1408 | objPipeRun.Attributes("NominalDiameter").Value = "250 mm" |
||
1409 | objPipeRun.Attributes("OperFluidCode").Value = "ADH" |
||
1410 | objPipeRun.Attributes("TagSequenceNo").Value = "0026" |
||
1411 | objPipeRun.Attributes("pipingmaterialsclass").Value = "NA1S" |
||
1412 | objPipeRun.Attributes("InsulPurpose").Value = "H" |
||
1413 | objPipeRun.Commit() |
||
1414 | Dim twopoints(2) As Double |
||
1415 | twopoints(1) = 0.12 |
||
1416 | twopoints(2) = 0.11 |
||
1417 | 'Label |
||
1418 | Dim labelName1 As String = "\Piping\Labels - Piping Segments\Line Number.sym" |
||
1419 | Dim labelpersist As LMLabelPersist |
||
1420 | |||
1421 | For Each representation In objPipeRun.Representations |
||
1422 | If representation.RepresentationType = "Connector" Then |
||
1423 | labelpersist = _Placement.PIDPlaceLabel(labelName1, |
||
1424 | twopoints,, 0, LabeledItem:=representation) |
||
1425 | End If |
||
1426 | Next |
||
1427 | 'labelpersist = objPlaceme |
||
1428 | Catch ex As Exception |
||
1429 | Return False |
||
1430 | End Try |
||
1431 | End Function |
||
1432 | |||
1433 | |||
1434 | |||
1435 | e282643f | Gyusu | Private Function GetCheckList(ByVal listviewItem As ListViewItem) |
1436 | |||
1437 | End Function |
||
1438 | |||
1439 | Private Sub newThreadFunc(ByVal state As Object) |
||
1440 | |||
1441 | End Sub |
||
1442 | |||
1443 | Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
||
1444 | Dim oRows As DataRow() = oDt.Select("[Name] = '" & sDwgName & "'") |
||
1445 | Dim oPath As String = "" |
||
1446 | If oRows.Length > 0 Then |
||
1447 | oPath = oRows(0).Item("Path").ToString() |
||
1448 | End If |
||
1449 | Return oPath |
||
1450 | End Function |
||
1451 | |||
1452 | |||
1453 | Private Sub Btn_Setting_Click(sender As Object, e As EventArgs) Handles Btn_Setting.Click |
||
1454 | Dim oSettings As Settings = New Settings() |
||
1455 | oSettings.ShowDialog() |
||
1456 | End Sub |
||
1457 | |||
1458 | Private Sub Btn_Stop_Click(sender As Object, e As EventArgs) Handles Btn_Stop.Click |
||
1459 | e1cde8f2 | Gyusu | Try |
1460 | _Main_trd.Abort() |
||
1461 | Catch ex As Exception |
||
1462 | e282643f | Gyusu | |
1463 | e1cde8f2 | Gyusu | End Try |
1464 | e282643f | Gyusu | End Sub |
1465 | |||
1466 | Private Sub DropDown_File_Click(sender As Object, e As EventArgs) Handles DropDown_File.Click |
||
1467 | |||
1468 | End Sub |
||
1469 | |||
1470 | 171ac39d | Gyusu | Private Sub TestLineToolStripMenuItem_Click(sender As Object, e As EventArgs) |
1471 | e1cde8f2 | Gyusu | |
1472 | Dim objPlacement As New Placement |
||
1473 | 'PipeLine |
||
1474 | 'Nominal diameter -fluidcode- tagseqno-piping material spec - insulation purpose |
||
1475 | Dim datasource As LMADataSource |
||
1476 | datasource = objPlacement.PIDDataSource |
||
1477 | Dim PipeRunLoc As String |
||
1478 | Dim objItem As LMAItem |
||
1479 | |||
1480 | Dim objConnector As LMConnector |
||
1481 | Dim objInputs As PlaceRunInputs |
||
1482 | Dim objSymbol As LMSymbol |
||
1483 | Dim InstrumentLoc As String |
||
1484 | PipeRunLoc = "\Piping\Routing\Process Lines\Primary Piping.sym" |
||
1485 | objInputs = New PlaceRunInputs |
||
1486 | objInputs.AddPoint(0.1, 0.1) |
||
1487 | objInputs.AddPoint(0.2, 0.1) |
||
1488 | objItem = objPlacement.PIDCreateItem(PipeRunLoc) |
||
1489 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
1490 | Dim objPipeRun As LMPipeRun = datasource.GetPipeRun(objConnector.ModelItemID) |
||
1491 | objPipeRun.Attributes("NominalDiameter").Value = "250 mm" |
||
1492 | objPipeRun.Attributes("OperFluidCode").Value = "ADH" |
||
1493 | objPipeRun.Attributes("TagSequenceNo").Value = "0026" |
||
1494 | objPipeRun.Attributes("pipingmaterialsclass").Value = "NA1S" |
||
1495 | objPipeRun.Attributes("InsulPurpose").Value = "H" |
||
1496 | objPipeRun.Commit() |
||
1497 | Dim twopoints(2) As Double |
||
1498 | twopoints(1) = 0.12 |
||
1499 | twopoints(2) = 0.11 |
||
1500 | 'Label |
||
1501 | Dim labelName1 As String = "\Piping\Labels - Piping Segments\Line Number.sym" |
||
1502 | Dim labelpersist As LMLabelPersist |
||
1503 | |||
1504 | For Each representation In objPipeRun.Representations |
||
1505 | If representation.RepresentationType = "Connector" Then |
||
1506 | labelpersist = objPlacement.PIDPlaceLabel(labelName1, |
||
1507 | twopoints,, 0, LabeledItem:=representation) |
||
1508 | End If |
||
1509 | Next |
||
1510 | 'labelpersist = objPlacement.PIDPlaceLabel(labelName1, |
||
1511 | ' twopoints, LabeledItem:=objPipeRun.Representations.Nth(0)) |
||
1512 | 'twopoints(1) = 0.17 |
||
1513 | 'twopoints(2) = 0.1 |
||
1514 | 'labelpersist = objPlacement.PIDPlaceLabel(labelName1, |
||
1515 | ' twopoints, LabeledItem:=objPipeRun.Representations.Nth(0)) |
||
1516 | |||
1517 | |||
1518 | 'Instrument |
||
1519 | InstrumentLoc = "\Instrumentation\Off-Line\Without Implied Components\Single Function\Disc Single-Func Access in Prime Loc.sym" |
||
1520 | objSymbol = objPlacement.PIDPlaceSymbol(InstrumentLoc, 0.15, 0.3, , 0) |
||
1521 | |||
1522 | Dim objInstr As LMInstrument |
||
1523 | objInstr = datasource.GetInstrument(objSymbol.ModelItemID) |
||
1524 | objInstr.Attributes("MeasuredVariableCode").Value = "L" |
||
1525 | objInstr.Attributes("InstrumentTypeModifier").Value = "G" |
||
1526 | objInstr.Attributes("TagSuffix").Value = "" |
||
1527 | objInstr.Attributes("TagSequenceNo").Value = "4003" |
||
1528 | objInstr.Commit() |
||
1529 | |||
1530 | objInputs = New PlaceRunInputs |
||
1531 | objInputs.AddConnectorTarget(objConnector, 0.15, 0.1) |
||
1532 | objInputs.AddPoint(0.15, 0.15) |
||
1533 | objInputs.AddPoint(0.12, 0.15) |
||
1534 | objInputs.AddPoint(0.12, 0.2) |
||
1535 | objInputs.AddPoint(0.15, 0.2) |
||
1536 | objInputs.AddSymbolTarget(objSymbol, 0.15, 0.3) |
||
1537 | objItem = objPlacement.PIDCreateItem(PipeRunLoc) |
||
1538 | |||
1539 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
1540 | objPipeRun = datasource.GetPipeRun(objConnector.ModelItemID) |
||
1541 | twopoints(1) = 0.14 |
||
1542 | twopoints(2) = 0.22 |
||
1543 | |||
1544 | For Each representation In objPipeRun.Representations |
||
1545 | If representation.RepresentationType = "Connector" Then |
||
1546 | labelpersist = objPlacement.PIDPlaceLabel(labelName1, |
||
1547 | twopoints,, 1.57, LabeledItem:=representation) |
||
1548 | End If |
||
1549 | Next |
||
1550 | ' Measured Variable Code, Instr Type Modifier |
||
1551 | ' TagSeqNo, TagSuffix |
||
1552 | e282643f | Gyusu | |
1553 | |||
1554 | e1cde8f2 | Gyusu | 'OPC |
1555 | |||
1556 | |||
1557 | 'Valve |
||
1558 | |||
1559 | |||
1560 | |||
1561 | |||
1562 | |||
1563 | End Sub |
||
1564 | 272662f9 | Gyusu | |
1565 | 171ac39d | Gyusu | Private Sub ToolStripDropDownButton1_Click(sender As Object, e As EventArgs) |
1566 | 272662f9 | Gyusu | |
1567 | End Sub |
||
1568 | |||
1569 | Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
||
1570 | 171ac39d | Gyusu | 'Dim oOpen_Xml = New LoadXml() |
1571 | 'oOpen_Xml = New LoadXml() |
||
1572 | 'oOpen_Xml.ShowDialog() |
||
1573 | '_XMLList = oOpen_Xml.GetCheckList() |
||
1574 | 'LoadXmlItem() |
||
1575 | |||
1576 | If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
||
1577 | LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
||
1578 | End If |
||
1579 | 272662f9 | Gyusu | |
1580 | 171ac39d | Gyusu | End Sub |
1581 | Private Sub LoadXmlItem(ByVal sFolderPath As String) |
||
1582 | _DrawingsList = New List(Of Drawing) |
||
1583 | Dim sfileEntries As String() = Directory.GetFiles(sFolderPath) |
||
1584 | If Tree_Result.Nodes.Count > 0 Then |
||
1585 | Tree_Result.Nodes(0).Nodes.Clear() |
||
1586 | For Each sfileName In sfileEntries |
||
1587 | Dim sExtension As String = Path.GetExtension(sfileName) |
||
1588 | If sExtension = ".xml" Then |
||
1589 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(sfileName) |
||
1590 | Dim sDwgPath As String = sfileName |
||
1591 | Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
||
1592 | Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
||
1593 | _DrawingsList.Add(oDwg) |
||
1594 | End If |
||
1595 | Next |
||
1596 | Tree_Result.Nodes(0).Expand() |
||
1597 | End If |
||
1598 | End Sub |
||
1599 | 272662f9 | Gyusu | |
1600 | Private Sub LoadXmlItem() |
||
1601 | 171ac39d | Gyusu | _DrawingsList = New List(Of Drawing) |
1602 | |||
1603 | 272662f9 | Gyusu | If Tree_Result.Nodes.Count > 0 Then |
1604 | Tree_Result.Nodes(0).Nodes.Clear() |
||
1605 | |||
1606 | For i = 0 To _XMLList.CheckedItems.Count - 1 |
||
1607 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(_XMLList.CheckedItems(i).Text) |
||
1608 | 20c84e05 | Gyusu | Dim sDwgPath As String = _XMLList.CheckedItems(i).Name |
1609 | Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
||
1610 | 171ac39d | Gyusu | Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
1611 | _DrawingsList.Add(oDwg) |
||
1612 | 272662f9 | Gyusu | Next |
1613 | Tree_Result.Nodes(0).Expand() |
||
1614 | End If |
||
1615 | |||
1616 | 20c84e05 | Gyusu | End Sub |
1617 | 272662f9 | Gyusu | |
1618 | 20c84e05 | Gyusu | ''' <summary> |
1619 | ''' XML Tree 구조 생성 |
||
1620 | ''' </summary> |
||
1621 | ''' <param name="sDwgPath"></param> |
||
1622 | 171ac39d | Gyusu | Private Function AddSymbolItem(ByVal sDwgPath As String, ByVal oParentNode As TreeNode) As Drawing |
1623 | Dim oDwg_Ds As Drawing = LoadSymbolInXml(sDwgPath) |
||
1624 | 20c84e05 | Gyusu | |
1625 | 171ac39d | Gyusu | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
1626 | 20c84e05 | Gyusu | 'PipeLine 구분 |
1627 | |||
1628 | 171ac39d | Gyusu | For Each oLinelist In oLineLists |
1629 | Dim sLineNoUid As String = oLinelist.Uid |
||
1630 | Dim sLineNo As String = oLinelist.Text |
||
1631 | Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
||
1632 | For Each oLineRow In oLinelist.Dt_Line.Rows |
||
1633 | Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
||
1634 | Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
||
1635 | oPipeNode.Tag = sLineNoUid |
||
1636 | Next |
||
1637 | 272662f9 | Gyusu | |
1638 | 171ac39d | Gyusu | For Each oSymbolRow In oLinelist.Dt_Symbol.Rows |
1639 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
1640 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
1641 | Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
1642 | oSymbolNode.Tag = sLineNoUid |
||
1643 | Next |
||
1644 | Next |
||
1645 | 272662f9 | Gyusu | |
1646 | |||
1647 | 171ac39d | Gyusu | 'Dim oLineNo_Dt As DataTable = oDwg_Ds.Tables(_XML_CATEGORY_LINENO) |
1648 | ''Type구분 |
||
1649 | '' Dim oParentNodeName = oParentNode.Text |
||
1650 | 'Dim oDistinct_Name_Dt As DataTable = oDt.DefaultView.ToTable(True, "Name") |
||
1651 | ''Name 별 |
||
1652 | 'For Each oNameRow In oDistinct_Name_Dt.Rows |
||
1653 | ' Dim sName As String = oNameRow("Name").ToString() |
||
1654 | ' Dim sNameKey As String = oParentNode.Text & "\" & sName |
||
1655 | ' Dim oNameNode As TreeNode = oParentNode.Nodes.Add(sNameKey, sName) |
||
1656 | ' Dim oSelectNameRows As DataRow() = oDt.Select("[Name] = '" & sName & "'") |
||
1657 | 272662f9 | Gyusu | |
1658 | 171ac39d | Gyusu | ' Dim oDistinct_Class_Dt As DataTable = oSelectNameRows.CopyToDataTable.DefaultView.ToTable(True, "Class") |
1659 | ' 'Class 별 |
||
1660 | ' For Each oClassRow In oDistinct_Class_Dt.Rows |
||
1661 | 272662f9 | Gyusu | |
1662 | 171ac39d | Gyusu | ' Dim sClass As String = oClassRow("Class").ToString() |
1663 | ' If sClass.Contains("'") Then |
||
1664 | ' sClass = sClass.Replace("'", "''") |
||
1665 | ' End If |
||
1666 | ' Dim sClassKey As String = oNameNode.Name & "\" & sClass |
||
1667 | ' Dim oClassNode As TreeNode = oNameNode.Nodes.Add(sClassKey, sClass) |
||
1668 | |||
1669 | ' Dim oSelectClassRows As DataRow() = oSelectNameRows.CopyToDataTable.Select("[Class] = '" & sClass & "'") |
||
1670 | ' 'Item 별 |
||
1671 | |||
1672 | ' For Each oItemRow In oSelectClassRows |
||
1673 | ' Dim sItem As String = oItemRow("Item").ToString() |
||
1674 | ' Dim sItemKey As String = oItemRow("uid").ToString() |
||
1675 | ' Dim oItemName As TreeNode = oClassNode.Nodes.Add(sItemKey, sItem) |
||
1676 | ' Next |
||
1677 | |||
1678 | ' Next |
||
1679 | |||
1680 | 'Next |
||
1681 | Return oDwg_Ds |
||
1682 | End Function |
||
1683 | 272662f9 | Gyusu | |
1684 | Private Sub Tree_Result_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterSelect |
||
1685 | |||
1686 | End Sub |
||
1687 | 20c84e05 | Gyusu | ''' <summary> |
1688 | ''' Parent 노트 선택시 일괄 체크,해제 |
||
1689 | ''' </summary> |
||
1690 | ''' <param name="sender"></param> |
||
1691 | ''' <param name="e"></param> |
||
1692 | 272662f9 | Gyusu | Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
1693 | If e.Node.Checked = True Then |
||
1694 | For Each oNode As TreeNode In e.Node.Nodes |
||
1695 | oNode.Checked = True |
||
1696 | Next |
||
1697 | Else |
||
1698 | For Each oNode As TreeNode In e.Node.Nodes |
||
1699 | oNode.Checked = False |
||
1700 | Next |
||
1701 | End If |
||
1702 | End Sub |
||
1703 | 171ac39d | Gyusu | |
1704 | e282643f | Gyusu | End Class |
1705 | |||
1706 | |||
1707 | Public Class DrawingInfo |
||
1708 | Public mDrawingName As String |
||
1709 | Public mSpID As String |
||
1710 | Public mPath As String |
||
1711 | 4f359afa | Gyusu | End Class |
1712 | e282643f | Gyusu | |
1713 | |||
1714 | |||
1715 |