개정판 54b98e09
update
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
10 | 10 |
|
11 | 11 |
Public Class Main |
12 | 12 |
|
13 |
Dim _Mapping_DB As DataTable = New DataTable() |
|
13 |
'Dim _Mapping_DB As DataTable = New DataTable() |
|
14 |
Dim _Mapping_DB As DataSet = New DataSet() |
|
14 | 15 |
Dim _Attribute_DB As DataTable = New DataTable() |
15 | 16 |
Dim _PIDSymbol_DB As DataTable = New DataTable() |
16 | 17 |
Dim _Placement As New Placement |
... | ... | |
28 | 29 |
Dim _selectFolderPath As String |
29 | 30 |
|
30 | 31 |
Private _Main_trd As Thread |
32 |
Private _Opc_trd As Thread |
|
33 |
|
|
34 |
Private _CompleteConvert As Boolean = False |
|
31 | 35 |
|
32 | 36 |
Private _DrawingsList As List(Of Drawing) |
33 | 37 |
|
... | ... | |
40 | 44 |
Private _iEquipmentcnt As Integer |
41 | 45 |
Private _iNozzlecnt As Integer |
42 | 46 |
|
43 |
|
|
47 |
Dim _Gembox As New CGembox() |
|
44 | 48 |
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
49 |
LoadDB() |
|
50 |
|
|
51 |
End Sub |
|
45 | 52 |
|
53 |
Private Sub LoadDB() |
|
46 | 54 |
If My.Settings.DBPath <> "" And My.Settings.Plant_Hierarchy <> "" Then |
47 | 55 |
Dim sDBPath As String = My.Settings.DBPath |
48 |
_Mapping_DB = Load_DB(sDBPath, _DB_TABLE_MAPPING) |
|
56 |
|
|
57 |
_Gembox.isLoadFile(My.Settings.SymbolLibrary) |
|
58 |
_Mapping_DB = _Gembox.LoadFileFunc() |
|
59 |
' _Mapping_DB = Load_DB(sDBPath, _DB_TABLE_MAPPING) |
|
49 | 60 |
_Attribute_DB = Load_DB(sDBPath, _DB_TABLE_ATTRIBUTE) |
50 | 61 |
_PIDSymbol_DB = Load_DB(sDBPath, _DB_TABLE_SYMBOLNAME) |
51 | 62 |
'TestPID() |
... | ... | |
54 | 65 |
MessageBox.Show("설정값을 먼저 확인해주세요") |
55 | 66 |
End If |
56 | 67 |
End Sub |
57 |
|
|
58 | 68 |
Public Function GetDrawingInfo(ByVal errorList As ArrayList) |
59 | 69 |
Dim ds As Llama.LMADataSource |
60 | 70 |
ds = New Llama.LMADataSource |
61 | 71 |
Dim lmaItem As Llama.LMAItem |
62 |
|
|
63 | 72 |
For i = 0 To errorList.Count - 1 |
64 | 73 |
lmaItem = ds.GetModelItem(errorList.Item(i).m_strSPID()).AsLMAItem |
65 | 74 |
Dim drawingInfo As DrawingInfo |
... | ... | |
119 | 128 |
Dim objDrawing As LMDrawing |
120 | 129 |
Dim objDrawings As LMDrawings |
121 | 130 |
datasource = New Llama.LMADataSource |
122 |
|
|
123 | 131 |
objPIDAutoApp = CreateObject("PIDAutomation.Application") |
124 | 132 |
objDrawings = New Llama.LMDrawings 'New LMDrawings |
125 |
|
|
126 | 133 |
datasource.SiteNode = "\\desktop-9vlq0dp\Test03Site\smartplantv4.ini" |
127 | 134 |
datasource.ProjectNumber = "SBR_PBR" |
128 | 135 |
objDrawings.Collect(datasource) |
129 | 136 |
|
130 |
|
|
131 | 137 |
For Each objDrawing In objDrawings |
132 | 138 |
If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
133 | 139 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(objDrawing.Attributes("Name")) |
... | ... | |
194 | 200 |
End Function |
195 | 201 |
|
196 | 202 |
Private Sub TestPID() |
197 |
|
|
198 | 203 |
Try |
199 | 204 |
Const CONST_SPID_OPC As String = "426E89964A7F49208AD79E1F320DA251" |
200 | 205 |
Dim datasource As LMADataSource |
... | ... | |
207 | 212 |
Dim objpairOPC As LMOPC |
208 | 213 |
objOPC = datasource.GetOPC(CONST_SPID_OPC) |
209 | 214 |
objpairOPC = objOPC.pairedWithOPCObject |
210 |
|
|
211 | 215 |
Dim oObj As Object = Nothing |
212 | 216 |
objDrawing = datasource.GetDrawing(oObj) |
213 | 217 |
objDrawings = New LMDrawings |
... | ... | |
228 | 232 |
objDrawing = Nothing |
229 | 233 |
objDrawings = Nothing |
230 | 234 |
Catch ex As Exception |
231 |
|
|
232 | 235 |
End Try |
233 | 236 |
End Sub |
234 | 237 |
|
... | ... | |
267 | 270 |
objDrawings.Collect(datasource) |
268 | 271 |
Dim sPath As String = "\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\188943-8121-PR-DW-011001.pid" |
269 | 272 |
objPIDAutoApp = CreateObject("PIDAutomation.Application") |
273 |
|
|
270 | 274 |
For Each objDrawing In objDrawings |
271 | 275 |
If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
272 | 276 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(sPath) |
273 | 277 |
If Not objPIDADrawing Is Nothing Then |
274 |
|
|
275 | 278 |
objPIDADrawing.CloseDrawing |
276 | 279 |
End If |
277 | 280 |
End If |
... | ... | |
312 | 315 |
|
313 | 316 |
Private Function GetDataFromMappingDB(ByVal sSymbolName As String, ByVal sColumn As String) As String |
314 | 317 |
Dim sValue As String = "" |
315 |
If _Mapping_DB.Rows.Count > 0 Then |
|
316 |
Dim oSelectRow() As DataRow = _Mapping_DB.Select("[pid_symbolname] = '" + sSymbolName + "'") |
|
317 |
If oSelectRow.Length = 1 Then |
|
318 |
sValue = oSelectRow(0).Item(sColumn).ToString() |
|
318 |
For Each oDt As DataTable In _Mapping_DB.Tables |
|
319 |
If oDt.Rows.Count > 0 Then |
|
320 |
Dim oSelectRow() As DataRow = oDt.Select("[img_symbolname] = '" + sSymbolName + "'") |
|
321 |
If oSelectRow.Length = 1 Then |
|
322 |
If sColumn = _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME Then |
|
323 |
sValue = oSelectRow(0).Item("SYM FILE NAME").ToString() |
|
324 |
ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH Then |
|
325 |
sValue = "\" & oSelectRow(0).Item("SYMBOL PATH").ToString() & "\" & oSelectRow(0).Item("SYM FILE NAME").ToString() |
|
326 |
ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_COMPTPYE Then |
|
327 |
sValue = oSelectRow(0).Item("ITEM TYPE").ToString() |
|
328 |
ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_CLASS Then |
|
329 |
sValue = oSelectRow(0).Item("CLASS").ToString() |
|
330 |
Else |
|
331 |
sValue = oSelectRow(0).Item("SYMBOL PATH").ToString() & "\" & oSelectRow(0).Item("SYM FILE NAME").ToString() |
|
332 |
End If |
|
333 |
|
|
334 |
End If |
|
319 | 335 |
End If |
320 |
End If |
|
336 |
Next |
|
337 |
|
|
321 | 338 |
Return sValue |
322 | 339 |
End Function |
323 | 340 |
|
... | ... | |
336 | 353 |
|
337 | 354 |
|
338 | 355 |
Private Function LoadSymbolInXml(ByVal sXmlPath As String) As Drawing |
339 |
'' _TempSymbolDt = Symbol_Dt() |
|
340 |
Dim CDrawing As Drawing = New Drawing() |
|
341 |
Dim oDt As DataTable = LoadSymbol_DT() |
|
342 |
Dim oElement As XElement = XElement.Load(sXmlPath) |
|
343 |
|
|
344 |
If oElement IsNot Nothing Then |
|
345 |
CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value |
|
346 |
CDrawing.Size = oElement.Element(_XML_DWGSIZE).Value |
|
347 |
SplitLocation(CDrawing.Size, _IMG_X, _IMG_Y) |
|
348 |
CDrawing.Unit = oElement.Element(_XML_UNIT).Value |
|
349 |
|
|
350 |
Dim oLineno_list As New List(Of Line_no) |
|
351 |
Dim oEqp_list As New List(Of Eqp_no) |
|
352 |
|
|
353 |
For Each oLineNo As Object In oElement.Elements(_XML_CATEGORY_LINENO) |
|
354 |
Dim CLineNo As Line_no = New Line_no() |
|
355 |
Try |
|
356 |
CLineNo.Uid = oLineNo.Element(_XML_LINENO_UID).Value |
|
357 |
CLineNo.Text = oLineNo.Element(_XML_LINENO_TEXT).Value |
|
358 |
CLineNo.Location = oLineNo.Element(_XML_LINENO_LOCATION).Value |
|
359 |
CLineNo.Angle = oLineNo.Element(_XML_LINENO_ANGLE).Value |
|
360 |
CLineNo.SystemPath = GetDataFromMappingDB(_XML_CATEGORY_LINENO, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
361 |
Catch ex As Exception |
|
362 |
'CLineNo.Text = "PipeLineNo" |
|
363 |
'CLineNo.Uid = "PipeLineNo" |
|
364 |
End Try |
|
356 |
Try |
|
357 |
'' _TempSymbolDt = Symbol_Dt() |
|
358 |
Dim CDrawing As Drawing = New Drawing() |
|
359 |
Dim oDt As DataTable = LoadSymbol_DT() |
|
360 |
Dim oElement As XElement = XElement.Load(sXmlPath) |
|
365 | 361 |
|
362 |
If oElement IsNot Nothing Then |
|
363 |
CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value |
|
364 |
CDrawing.Size = oElement.Element(_XML_DWGSIZE).Value |
|
365 |
SplitLocation(CDrawing.Size, _IMG_X, _IMG_Y) |
|
366 |
CDrawing.Unit = oElement.Element(_XML_UNIT).Value |
|
366 | 367 |
|
367 |
Dim oLine_Dt As DataTable = Line_Dt() |
|
368 |
Dim oSymbol_Dt As DataTable = Symbol_Dt() |
|
369 |
Dim oAttribute_Dt As DataTable = Attribute_Dt() |
|
370 |
|
|
371 |
For Each oRun As Object In oLineNo.Elements(_XML_CATEGORY_RUN) |
|
372 |
For Each oLine As Object In oRun.Elements(_XML_CATEGORY_LINE) |
|
373 |
Dim oAddrow As DataRow = oLine_Dt.NewRow() |
|
374 |
Dim oEleObj As XElement |
|
375 |
Dim sUid As String |
|
376 |
Dim sStartpoint As String |
|
377 |
Dim sEndpoint As String |
|
378 |
oEleObj = oLine.Element(_XML_LINE_UID) |
|
379 |
sUid = oEleObj.Value |
|
380 |
oEleObj = oLine.Element(_XML_LINE_STARTPOINT) |
|
381 |
sStartpoint = oEleObj.Value |
|
382 |
oEleObj = oLine.Element(_XML_LINE_ENDPOINT) |
|
383 |
sEndpoint = oEleObj.Value |
|
384 |
|
|
385 |
oAddrow(_XML_LINE_UID) = sUid |
|
386 |
oAddrow(_XML_LINE_STARTPOINT) = sStartpoint |
|
387 |
oAddrow(_XML_LINE_ENDPOINT) = sEndpoint |
|
388 |
oAddrow(_XML_LINE_SYSTEMPATH) = GetDataFromMappingDB(_XML_CATEGORY_LINE, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
389 |
oLine_Dt.Rows.Add(oAddrow) |
|
390 |
Next |
|
368 |
Dim oLineno_list As New List(Of Line_no) |
|
369 |
Dim oEqp_list As New List(Of Eqp_no) |
|
370 |
|
|
371 |
For Each oLineNo As Object In oElement.Elements(_XML_CATEGORY_LINENO) |
|
372 |
|
|
373 |
Dim CLineNo As Line_no = New Line_no() |
|
374 |
Try |
|
375 |
CLineNo.Uid = oLineNo.Element(_XML_LINENO_UID).Value |
|
376 |
CLineNo.Text = oLineNo.Element(_XML_LINENO_TEXT).Value |
|
377 |
CLineNo.Location = oLineNo.Element(_XML_LINENO_LOCATION).Value |
|
378 |
CLineNo.Angle = oLineNo.Element(_XML_LINENO_ANGLE).Value |
|
379 |
CLineNo.SystemPath = "\Piping\Labels - Piping Segments\Kemya Line Number.sym" 'GetDataFromMappingDB(_XML_CATEGORY_LINENO, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
380 |
Catch ex As Exception |
|
381 |
'CLineNo.Text = "PipeLineNo" |
|
382 |
'CLineNo.Uid = "PipeLineNo" |
|
383 |
End Try |
|
384 |
|
|
385 |
|
|
386 |
Dim oLine_Dt As DataTable = Line_Dt() |
|
387 |
Dim oSymbol_Dt As DataTable = Symbol_Dt() |
|
388 |
Dim oAttribute_Dt As DataTable = Attribute_Dt() |
|
389 |
|
|
390 |
For Each oRun As Object In oLineNo.Elements(_XML_CATEGORY_RUN) |
|
391 |
For Each oLine As Object In oRun.Elements(_XML_CATEGORY_LINE) |
|
392 |
Try |
|
393 |
Dim oAddrow As DataRow = oLine_Dt.NewRow() |
|
394 |
Dim oEleObj As XElement |
|
395 |
Dim sUid As String |
|
396 |
Dim sStartpoint As String |
|
397 |
Dim sEndpoint As String |
|
398 |
oEleObj = oLine.Element(_XML_LINE_UID) |
|
399 |
sUid = oEleObj.Value |
|
400 |
oEleObj = oLine.Element(_XML_LINE_STARTPOINT) |
|
401 |
sStartpoint = oEleObj.Value |
|
402 |
oEleObj = oLine.Element(_XML_LINE_ENDPOINT) |
|
403 |
sEndpoint = oEleObj.Value |
|
404 |
|
|
405 |
oAddrow(_XML_LINE_UID) = sUid |
|
406 |
oAddrow(_XML_LINE_STARTPOINT) = sStartpoint |
|
407 |
oAddrow(_XML_LINE_ENDPOINT) = sEndpoint |
|
408 |
oAddrow(_XML_LINE_SYSTEMPATH) = GetDataFromMappingDB(_XML_CATEGORY_LINE, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
409 |
oAddrow(_XML_LINE_DRAWING) = "FALSE" |
|
410 |
oLine_Dt.Rows.Add(oAddrow) |
|
411 |
Catch ex As Exception |
|
412 |
|
|
413 |
End Try |
|
414 |
|
|
415 |
Next |
|
416 |
|
|
417 |
For Each oSymbol As Object In oRun.Elements(_XML_CATEGORY_SYMBOL) |
|
418 |
Try |
|
419 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
|
420 |
Dim oEleObj As XElement |
|
421 |
Dim sUid As String |
|
422 |
Dim sName As String |
|
423 |
Dim sLocation As String |
|
424 |
Dim sSize As String |
|
425 |
Dim sAngle As String |
|
426 |
Dim sOriginalPoint As String = "" |
|
427 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
|
428 |
sUid = oEleObj.Value |
|
429 |
oEleObj = oSymbol.Element(_XML_SYMBOL_PARENT) |
|
430 |
sName = oEleObj.Value |
|
431 |
oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
|
432 |
sLocation = oEleObj.Value |
|
433 |
oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
|
434 |
sSize = oEleObj.Value |
|
435 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
|
436 |
sAngle = oEleObj.Value |
|
437 |
Try |
|
438 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
439 |
sOriginalPoint = oEleObj.Value |
|
440 |
Catch ex As Exception |
|
441 |
|
|
442 |
End Try |
|
443 |
|
|
444 |
oAddrow(_XML_SYMBOL_UID) = sUid |
|
445 |
oAddrow(_XML_SYMBOL_NAME) = IO.Path.GetFileNameWithoutExtension(GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME)) |
|
446 |
oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
|
447 |
oAddrow(_XML_SYMBOL_SIZE) = sSize |
|
448 |
oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
|
449 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
450 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
451 |
oAddrow(_XML_SYMBOL_CLASS) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_CLASS) |
|
452 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
453 |
|
|
454 |
oSymbol_Dt.Rows.Add(oAddrow) |
|
455 |
Catch ex As Exception |
|
456 |
|
|
457 |
End Try |
|
458 |
|
|
459 |
Next |
|
460 |
|
|
461 |
For Each oAtrribute As Object In oRun.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
462 |
Try |
|
463 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
464 |
Dim oEleObj As XElement |
|
465 |
Dim sUid As String |
|
466 |
Dim sName As String |
|
467 |
Dim sValue As String |
|
468 |
|
|
469 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
470 |
sUid = oEleObj.Value |
|
471 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
472 |
sName = oEleObj.Value |
|
473 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
474 |
sValue = oEleObj.Value |
|
475 |
|
|
476 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
477 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
478 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
479 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
480 |
Catch ex As Exception |
|
481 |
|
|
482 |
End Try |
|
391 | 483 |
|
392 |
For Each oSymbol As Object In oRun.Elements(_XML_CATEGORY_SYMBOL) |
|
393 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
|
394 |
Dim oEleObj As XElement |
|
395 |
Dim sUid As String |
|
396 |
Dim sName As String |
|
397 |
Dim sLocation As String |
|
398 |
Dim sSize As String |
|
399 |
Dim sAngle As String |
|
400 |
Dim sOriginalPoint As String = "" |
|
401 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
|
402 |
sUid = oEleObj.Value |
|
403 |
oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
|
404 |
sName = oEleObj.Value |
|
405 |
oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
|
406 |
sLocation = oEleObj.Value |
|
407 |
oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
|
408 |
sSize = oEleObj.Value |
|
409 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
|
410 |
sAngle = oEleObj.Value |
|
484 |
Next |
|
485 |
|
|
486 |
Next |
|
487 |
'Line No Attribute |
|
488 |
For Each oAtrribute As Object In oLineNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
411 | 489 |
Try |
412 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
413 |
sOriginalPoint = oEleObj.Value |
|
490 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
491 |
Dim oEleObj As XElement |
|
492 |
Dim sUid As String |
|
493 |
Dim sName As String |
|
494 |
Dim sValue As String |
|
495 |
|
|
496 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
497 |
sUid = oEleObj.Value |
|
498 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
499 |
sName = oEleObj.Value |
|
500 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
501 |
sValue = oEleObj.Value |
|
502 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
503 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
504 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
505 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
414 | 506 |
Catch ex As Exception |
415 | 507 |
|
416 | 508 |
End Try |
417 | 509 |
|
418 |
oAddrow(_XML_SYMBOL_UID) = sUid |
|
419 |
oAddrow(_XML_SYMBOL_NAME) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME) |
|
420 |
oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
|
421 |
oAddrow(_XML_SYMBOL_SIZE) = sSize |
|
422 |
oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
|
423 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
424 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
425 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
426 |
|
|
427 |
oSymbol_Dt.Rows.Add(oAddrow) |
|
428 | 510 |
Next |
511 |
CLineNo.Dt_Line = oLine_Dt |
|
512 |
CLineNo.Dt_Symbol = oSymbol_Dt |
|
513 |
CLineNo.Dt_Attribute = oAttribute_Dt |
|
514 |
oLineno_list.Add(CLineNo) |
|
515 |
'For Each oSymbol As Object In oElement.Elements(_XML_CATEGORY_SYMBOL) |
|
516 |
' Dim oAddrow As DataRow = _TempSymbolDt.NewRow() |
|
517 |
' Dim oEleObj As XElement |
|
518 |
' Dim sUid As String |
|
519 |
' Dim sName As String |
|
520 |
' Dim sLocation As String |
|
521 |
' Dim sSize As String |
|
522 |
' Dim sAngle As String |
|
523 |
' Dim sOriginalPoint As String = "" |
|
524 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
|
525 |
' sUid = oEleObj.Value |
|
526 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
|
527 |
' sName = oEleObj.Value |
|
528 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
|
529 |
' sLocation = oEleObj.Value |
|
530 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
|
531 |
' sSize = oEleObj.Value |
|
532 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
|
533 |
' sAngle = oEleObj.Value |
|
534 |
' Try |
|
535 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
536 |
' sOriginalPoint = oEleObj.Value |
|
537 |
' Catch ex As Exception |
|
538 |
|
|
539 |
' End Try |
|
540 |
' oAddrow(_XML_SYMBOL_UID) = sUid |
|
541 |
' oAddrow(_XML_SYMBOL_NAME) = sName |
|
542 |
' oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
|
543 |
' oAddrow(_XML_SYMBOL_SIZE) = sSize |
|
544 |
' oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
|
545 |
' oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
546 |
' oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
547 |
' oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
548 |
' _TempSymbolDt.Rows.Add(oAddrow) |
|
549 |
'Next |
|
550 |
Next |
|
551 |
For Each oEqpNo As Object In oElement.Elements(_XML_CATEGORY_EQUIPMENT) |
|
552 |
Dim CEqp_no As Eqp_no = New Eqp_no() |
|
553 |
'CEqp_no.Uid = oEqpNo.Element(_XML_EQP_UID).Value |
|
554 |
'CEqp_no.Text = oEqpNo.Element(_XML_EQP_TEXT).Value |
|
555 |
'CEqp_no.Location = oEqpNo.Element(_XML_EQP_LOCATION).Value |
|
556 |
'CEqp_no.Angle = oEqpNo.Element(_XML_EQP_ANGLE).Value |
|
557 |
'CEqp_no.SystemPath = GetDataFromMappingDB(_XML_CATEGORY_EQUIPMENT, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
558 |
Dim oSymbol_Dt As DataTable = Symbol_Dt() |
|
559 |
Dim oAttribute_Dt As DataTable = Attribute_Dt() |
|
560 |
|
|
561 |
For Each oSymbol As Object In oEqpNo.Elements(_XML_CATEGORY_SYMBOL) |
|
562 |
Try |
|
563 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
|
564 |
Dim oEleObj As XElement |
|
565 |
Dim sUid As String |
|
566 |
Dim sName As String |
|
567 |
Dim sLocation As String |
|
568 |
Dim sSize As String |
|
569 |
Dim sAngle As String |
|
570 |
Dim sOriginalPoint As String = "" |
|
571 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
|
572 |
sUid = oEleObj.Value |
|
573 |
oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
|
574 |
sName = oEleObj.Value |
|
575 |
oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
|
576 |
sLocation = oEleObj.Value |
|
577 |
oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
|
578 |
sSize = oEleObj.Value |
|
579 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
|
580 |
sAngle = oEleObj.Value |
|
581 |
Try |
|
582 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
583 |
sOriginalPoint = oEleObj.Value |
|
584 |
Catch ex As Exception |
|
585 |
End Try |
|
586 |
oAddrow(_XML_SYMBOL_UID) = sUid |
|
587 |
oAddrow(_XML_SYMBOL_NAME) = sName |
|
588 |
oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
|
589 |
oAddrow(_XML_SYMBOL_SIZE) = sSize |
|
590 |
oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
|
591 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
592 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
593 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
594 |
oSymbol_Dt.Rows.Add(oAddrow) |
|
595 |
Catch ex As Exception |
|
596 |
|
|
597 |
End Try |
|
429 | 598 |
|
430 |
For Each oAtrribute As Object In oRun.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
431 |
|
|
432 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
433 |
Dim oEleObj As XElement |
|
434 |
Dim sUid As String |
|
435 |
Dim sName As String |
|
436 |
Dim sValue As String |
|
437 |
|
|
438 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
439 |
sUid = oEleObj.Value |
|
440 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
441 |
sName = oEleObj.Value |
|
442 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
443 |
sValue = oEleObj.Value |
|
444 |
|
|
445 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
446 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
447 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
448 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
449 | 599 |
Next |
600 |
For Each oAtrribute As Object In oEqpNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
601 |
Try |
|
602 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
603 |
Dim oEleObj As XElement |
|
604 |
Dim sUid As String |
|
605 |
Dim sName As String |
|
606 |
Dim sValue As String |
|
607 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
608 |
sUid = oEleObj.Value |
|
609 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
610 |
sName = oEleObj.Value |
|
611 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
612 |
sValue = oEleObj.Value |
|
613 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
614 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
615 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
616 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
617 |
Catch ex As Exception |
|
450 | 618 |
|
619 |
End Try |
|
620 |
|
|
621 |
Next |
|
622 |
CEqp_no.Dt_Equipment = oSymbol_Dt |
|
623 |
CEqp_no.Dt_Attribute = oAttribute_Dt |
|
624 |
oEqp_list.Add(CEqp_no) |
|
451 | 625 |
Next |
452 |
'Line No Attribute |
|
453 |
For Each oAtrribute As Object In oLineNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
454 |
|
|
455 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
456 |
Dim oEleObj As XElement |
|
457 |
Dim sUid As String |
|
458 |
Dim sName As String |
|
459 |
Dim sValue As String |
|
460 |
|
|
461 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
462 |
sUid = oEleObj.Value |
|
463 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
464 |
sName = oEleObj.Value |
|
465 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
466 |
sValue = oEleObj.Value |
|
467 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
468 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
469 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
470 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
471 |
Next |
|
472 |
CLineNo.Dt_Line = oLine_Dt |
|
473 |
CLineNo.Dt_Symbol = oSymbol_Dt |
|
474 |
CLineNo.Dt_Attribute = oAttribute_Dt |
|
475 |
oLineno_list.Add(CLineNo) |
|
476 |
'For Each oSymbol As Object In oElement.Elements(_XML_CATEGORY_SYMBOL) |
|
477 |
' Dim oAddrow As DataRow = _TempSymbolDt.NewRow() |
|
478 |
' Dim oEleObj As XElement |
|
479 |
' Dim sUid As String |
|
480 |
' Dim sName As String |
|
481 |
' Dim sLocation As String |
|
482 |
' Dim sSize As String |
|
483 |
' Dim sAngle As String |
|
484 |
' Dim sOriginalPoint As String = "" |
|
485 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
|
486 |
' sUid = oEleObj.Value |
|
487 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
|
488 |
' sName = oEleObj.Value |
|
489 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
|
490 |
' sLocation = oEleObj.Value |
|
491 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
|
492 |
' sSize = oEleObj.Value |
|
493 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
|
494 |
' sAngle = oEleObj.Value |
|
495 |
' Try |
|
496 |
' oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
497 |
' sOriginalPoint = oEleObj.Value |
|
498 |
' Catch ex As Exception |
|
499 |
|
|
500 |
' End Try |
|
501 |
' oAddrow(_XML_SYMBOL_UID) = sUid |
|
502 |
' oAddrow(_XML_SYMBOL_NAME) = sName |
|
503 |
' oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
|
504 |
' oAddrow(_XML_SYMBOL_SIZE) = sSize |
|
505 |
' oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
|
506 |
' oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
507 |
' oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
508 |
' oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
509 |
' _TempSymbolDt.Rows.Add(oAddrow) |
|
510 |
'Next |
|
511 |
Next |
|
512 |
For Each oEqpNo As Object In oElement.Elements(_XML_CATEGORY_EQUIPMENT) |
|
513 |
Dim CEqp_no As Eqp_no = New Eqp_no() |
|
514 |
'CEqp_no.Uid = oEqpNo.Element(_XML_EQP_UID).Value |
|
515 |
'CEqp_no.Text = oEqpNo.Element(_XML_EQP_TEXT).Value |
|
516 |
'CEqp_no.Location = oEqpNo.Element(_XML_EQP_LOCATION).Value |
|
517 |
'CEqp_no.Angle = oEqpNo.Element(_XML_EQP_ANGLE).Value |
|
518 |
'CEqp_no.SystemPath = GetDataFromMappingDB(_XML_CATEGORY_EQUIPMENT, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
519 |
Dim oSymbol_Dt As DataTable = Symbol_Dt() |
|
520 |
Dim oAttribute_Dt As DataTable = Attribute_Dt() |
|
521 |
For Each oSymbol As Object In oEqpNo.Elements(_XML_CATEGORY_SYMBOL) |
|
522 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
|
523 |
Dim oEleObj As XElement |
|
524 |
Dim sUid As String |
|
525 |
Dim sName As String |
|
526 |
Dim sLocation As String |
|
527 |
Dim sSize As String |
|
528 |
Dim sAngle As String |
|
529 |
Dim sOriginalPoint As String = "" |
|
530 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
|
531 |
sUid = oEleObj.Value |
|
532 |
oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
|
533 |
sName = oEleObj.Value |
|
534 |
oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
|
535 |
sLocation = oEleObj.Value |
|
536 |
oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
|
537 |
sSize = oEleObj.Value |
|
538 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
|
539 |
sAngle = oEleObj.Value |
|
540 |
Try |
|
541 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
542 |
sOriginalPoint = oEleObj.Value |
|
543 |
Catch ex As Exception |
|
544 |
End Try |
|
545 |
oAddrow(_XML_SYMBOL_UID) = sUid |
|
546 |
oAddrow(_XML_SYMBOL_NAME) = sName |
|
547 |
oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
|
548 |
oAddrow(_XML_SYMBOL_SIZE) = sSize |
|
549 |
oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
|
550 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
551 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
552 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
553 |
oSymbol_Dt.Rows.Add(oAddrow) |
|
554 |
Next |
|
555 |
For Each oAtrribute As Object In oEqpNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
|
556 |
Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
|
557 |
Dim oEleObj As XElement |
|
558 |
Dim sUid As String |
|
559 |
Dim sName As String |
|
560 |
Dim sValue As String |
|
561 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
|
562 |
sUid = oEleObj.Value |
|
563 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
|
564 |
sName = oEleObj.Value |
|
565 |
oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
|
566 |
sValue = oEleObj.Value |
|
567 |
oAddrow(_XML_ATTRIBUTE_UID) = sUid |
|
568 |
oAddrow(_XML_ATTRIBUTE_NAME) = sName |
|
569 |
oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
|
570 |
oAttribute_Dt.Rows.Add(oAddrow) |
|
571 |
Next |
|
572 |
CEqp_no.Dt_Equipment = oSymbol_Dt |
|
573 |
CEqp_no.Dt_Attribute = oAttribute_Dt |
|
574 |
oEqp_list.Add(CEqp_no) |
|
575 |
Next |
|
576 |
CDrawing.Line_nos = oLineno_list |
|
577 |
CDrawing.Eqp_nos = oEqp_list |
|
578 |
End If |
|
579 |
Return CDrawing |
|
626 |
CDrawing.Line_nos = oLineno_list |
|
627 |
CDrawing.Eqp_nos = oEqp_list |
|
628 |
End If |
|
629 |
Return CDrawing |
|
630 |
Catch ex As Exception |
|
631 |
Return Nothing |
|
632 |
End Try |
|
633 |
|
|
580 | 634 |
End Function |
581 | 635 |
|
582 | 636 |
|
... | ... | |
1116 | 1170 |
ProgressBar_Status.Maximum = 100 |
1117 | 1171 |
ProgressBar_Status.Value = 0 |
1118 | 1172 |
' _selectFolderPath = Tree_XMLFiles.SelectedNode.FullPath.Replace("\\", "\") |
1119 |
_Main_trd = New Thread(AddressOf ThreadTask)
|
|
1173 |
_Main_trd = New Thread(AddressOf ThreadConvert)
|
|
1120 | 1174 |
_Main_trd.IsBackground = True |
1121 | 1175 |
_Main_trd.Start() |
1176 |
FineOPCForm() |
|
1177 |
End Sub |
|
1122 | 1178 |
|
1179 |
Private Sub FineOPCForm() |
|
1180 |
_Opc_trd = New Thread(AddressOf ThreadOPCRemove) |
|
1181 |
_Opc_trd.IsBackground = True |
|
1182 |
_Opc_trd.Start() |
|
1123 | 1183 |
End Sub |
1184 |
|
|
1124 | 1185 |
'Private Sub ThreadTask() |
1125 | 1186 |
|
1126 | 1187 |
|
... | ... | |
1281 | 1342 |
End Try |
1282 | 1343 |
End Function |
1283 | 1344 |
|
1345 |
|
|
1346 |
Dim _DrawLine_Dt As DataTable = DrawLind_Dt() |
|
1347 |
|
|
1284 | 1348 |
Private Function DrawLine(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable) As LMPipeRun |
1285 | 1349 |
Try |
1286 | 1350 |
Dim oPipeRun As LMPipeRun |
... | ... | |
1297 | 1361 |
Dim dOriginalStart_y As Double = 0.0 |
1298 | 1362 |
Dim dOriginalEnd_x As Double = 0.0 |
1299 | 1363 |
Dim dOriginalEnd_y As Double = 0.0 |
1300 |
|
|
1301 | 1364 |
Dim dStart_x As Double = 0.0 |
1302 | 1365 |
Dim dStart_y As Double = 0.0 |
1303 | 1366 |
Dim dEnd_x As Double = 0.0 |
1304 | 1367 |
Dim dEnd_y As Double = 0.0 |
1305 |
Dim sSystempath As String = oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
|
1368 |
Dim sSystempath As String = "\Piping\Routing\Process Lines\Primary Piping.sym" ' oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString()
|
|
1306 | 1369 |
Dim sStartpoint As String = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
1307 | 1370 |
Dim sEndpoint As String = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
1308 | 1371 |
Dim sPipeUid As String = oPipeRow(0)(_XML_LINE_UID).ToString() |
... | ... | |
1314 | 1377 |
If ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) Then |
1315 | 1378 |
dEnd_x = dOriginalEnd_x |
1316 | 1379 |
dEnd_y = dOriginalEnd_y |
1380 |
|
|
1381 |
' 라인보정(oLine_Dt, sPipeUid, dStart_x, dStart_y, dEnd_x, dEnd_y) |
|
1317 | 1382 |
'//Overlap 보정 |
1318 |
If FindOverlapLine(oLine_Dt, sPipeUid, dStart_x, dStart_y, dEnd_x, dEnd_y) = False Then |
|
1319 |
'//떨어진 라인 보정 |
|
1320 |
Dim dSeperate_start_x As Double = dStart_x |
|
1321 |
Dim dSeperate_start_y As Double = dStart_y |
|
1322 |
Dim dSeperate_end_x As Double = dEnd_x |
|
1323 |
Dim dSeperate_end_y As Double = dEnd_y |
|
1324 |
CalcSperateLine(dSeperate_start_x, dSeperate_start_y, dSeperate_end_x, dSeperate_end_y) |
|
1325 |
If (FindOverlapLine(oLine_Dt, sPipeUid, dSeperate_start_x, dSeperate_start_y, dSeperate_end_x, dSeperate_end_y)) Then |
|
1326 |
dStart_x = dSeperate_start_x |
|
1327 |
dStart_y = dSeperate_start_y |
|
1328 |
dEnd_x = dSeperate_end_x |
|
1329 |
dEnd_y = dSeperate_end_y |
|
1330 |
End If |
|
1383 |
'If FindOverlapLine(oLine_Dt, sPipeUid, dStart_x, dStart_y, dEnd_x, dEnd_y) = False Then |
|
1384 |
' '//떨어진 라인 보정 |
|
1385 |
' Dim dSeperate_start_x As Double = dStart_x |
|
1386 |
' Dim dSeperate_start_y As Double = dStart_y |
|
1387 |
' Dim dSeperate_end_x As Double = dEnd_x |
|
1388 |
' Dim dSeperate_end_y As Double = dEnd_y |
|
1389 |
' CalcSperateLine(dSeperate_start_x, dSeperate_start_y, dSeperate_end_x, dSeperate_end_y) |
|
1390 |
' If (FindOverlapLine(oLine_Dt, sPipeUid, dSeperate_start_x, dSeperate_start_y, dSeperate_end_x, dSeperate_end_y)) Then |
|
1391 |
' dStart_x = dSeperate_start_x |
|
1392 |
' dStart_y = dSeperate_start_y |
|
1393 |
' dEnd_x = dSeperate_end_x |
|
1394 |
' dEnd_y = dSeperate_end_y |
|
1395 |
' End If |
|
1396 |
'End If |
|
1331 | 1397 |
|
1332 |
End If |
|
1333 | 1398 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
1334 | 1399 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
1335 | 1400 |
If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
1336 | 1401 |
|
1402 |
'Dim iConnType As Integer = ModelingLine(dStart_x, dStart_y, dEnd_x, dEnd_y) |
|
1403 |
'If iConnType = 1 Then |
|
1404 |
' objInputs.AddLocatedTarget(dStart_x, dStart_y) |
|
1405 |
' objInputs.AddPoint(dEnd_x, dEnd_y) |
|
1406 |
'ElseIf iConnType = 2 Then |
|
1407 |
' objInputs.AddLocatedTarget(dEnd_x, dEnd_y) |
|
1408 |
' objInputs.AddPoint(dStart_x, dStart_y) |
|
1409 |
'ElseIf iConnType = 3 Then |
|
1410 |
' objInputs.AddLocatedTarget(dEnd_x, dEnd_y) |
|
1411 |
' objInputs.AddPoint(dStart_x, dStart_y) |
|
1412 |
'ElseIf iConnType = 4 Then |
|
1413 |
' objInputs.AddLocatedTarget(dStart_x, dStart_y) |
|
1414 |
' objInputs.AddPoint(dEnd_x, dEnd_y) |
|
1415 |
'Else |
|
1416 |
' objInputs.AddPoint(dStart_x, dStart_y) |
|
1417 |
' objInputs.AddPoint(dEnd_x, dEnd_y) |
|
1418 |
'End If |
|
1337 | 1419 |
objInputs.AddPoint(dStart_x, dStart_y) |
1338 | 1420 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
1421 |
AddModelingLine(dStart_x, dStart_y, dEnd_x, dEnd_y) |
|
1339 | 1422 |
objItem = _Placement.PIDCreateItem(sSystempath) |
1340 | 1423 |
_iPipecnt = _iPipecnt + 1 |
1341 | 1424 |
SetListBoxItems(ListBox_Result, "Place PipeLine..(" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ").." & _iPipecnt & " count ") |
... | ... | |
1344 | 1427 |
oPipeRun.Attributes("FlowDirection").Value = "End 1 is upstream (Inlet)" |
1345 | 1428 |
If oAttributeRow.Length > 0 Then |
1346 | 1429 |
For Each oAttribute In oAttributeRow |
1347 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
1348 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
1349 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
1350 |
oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
1430 |
Try |
|
1431 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
1432 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
1433 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
1434 |
oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
1435 |
Catch ex As Exception |
|
1436 |
|
|
1437 |
End Try |
|
1438 |
|
|
1351 | 1439 |
|
1352 | 1440 |
Next |
1353 | 1441 |
oPipeRun.Commit() |
... | ... | |
1382 | 1470 |
End Try |
1383 | 1471 |
End Function |
1384 | 1472 |
|
1385 |
Private Function DrawSymbol(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable) As Boolean |
|
1473 |
Private Sub AddModelingLine(ByVal dStart_x As Double, ByVal dStart_y As Double, ByVal dEnd_x As Double, ByVal dEnd_y As Double) |
|
1474 |
Dim oAddRow = _DrawLine_Dt.NewRow() |
|
1475 |
oAddRow(_XML_LINE_STARTPOINT_X) = dStart_x |
|
1476 |
oAddRow(_XML_LINE_STARTPOINT_Y) = dStart_y |
|
1477 |
oAddRow(_XML_LINE_ENDPOINT_X) = dEnd_x |
|
1478 |
oAddRow(_XML_LINE_ENDPOINT_Y) = dEnd_y |
|
1479 |
_DrawLine_Dt.Rows.Add(oAddRow) |
|
1480 |
End Sub |
|
1481 |
|
|
1482 |
|
|
1483 |
Private Function ModelingLine(ByVal dStart_x As Double, ByVal dStart_y As Double, ByVal dEnd_x As Double, ByVal dEnd_y As Double) As Integer |
|
1484 |
Dim oFindRows_1 As DataRow() = _DrawLine_Dt.Select("start_x = '" & dStart_x & "' and start_y = '" & dStart_y & "'") |
|
1485 |
|
|
1486 |
Dim oFindRows_2 As DataRow() = _DrawLine_Dt.Select("end_x = '" & dEnd_x & "' and end_y = '" & dEnd_y & "'") |
|
1487 |
|
|
1488 |
Dim oFindRows_3 As DataRow() = _DrawLine_Dt.Select("start_x = '" & dEnd_x & "' and start_y = '" & dEnd_y & "'") |
|
1489 |
|
|
1490 |
Dim oFindRows_4 As DataRow() = _DrawLine_Dt.Select("end_x = '" & dStart_x & "' and end_y = '" & dStart_y & "'") |
|
1491 |
|
|
1492 |
If oFindRows_1.Length > 0 Then |
|
1493 |
Return 1 |
|
1494 |
ElseIf oFindRows_2.Length > 0 Then |
|
1495 |
Return 2 |
|
1496 |
ElseIf oFindRows_3.Length > 0 Then |
|
1497 |
Return 3 |
|
1498 |
ElseIf oFindRows_4.Length > 0 Then |
|
1499 |
Return 4 |
|
1500 |
Else |
|
1501 |
Return 0 |
|
1502 |
End If |
|
1503 |
End Function |
|
1504 |
|
|
1505 |
Private Function FindConnectionPoint(ByVal dX As Double, ByVal dY As Double) |
|
1506 |
|
|
1507 |
|
|
1508 |
End Function |
|
1509 |
|
|
1510 |
|
|
1511 |
Private Function DrawSymbol(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oLine_Dt As DataTable) As Boolean |
|
1386 | 1512 |
Try |
1387 | 1513 |
|
1388 | 1514 |
Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
... | ... | |
1395 | 1521 |
Dim oDatasource As Object = _Placement.PIDDataSource |
1396 | 1522 |
Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
1397 | 1523 |
Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
1524 |
Dim sClass As String = oSymbolRow(0)(_XML_SYMBOL_CLASS).ToString() |
|
1398 | 1525 |
Dim sLocation As String = oSymbolRow(0)(_XML_SYMBOL_LOCATION).ToString() |
1399 | 1526 |
Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
1400 | 1527 |
Dim dAngle As Double = 0.0 |
... | ... | |
1411 | 1538 |
If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
1412 | 1539 |
dX = dLocationX |
1413 | 1540 |
dY = dLocationY |
1541 |
If sSymbolCompType = "" Or sSymbolCompType = "Piping OPC's" Then |
|
1542 |
FindConnectionLine(oLine_Dt, dX, dY) |
|
1543 |
End If |
|
1544 |
|
|
1414 | 1545 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
1415 |
Dim oInstrument As LMInstrument |
|
1416 |
If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT Then |
|
1546 |
Dim oInstrument As LMInstrument
|
|
1547 |
If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then
|
|
1417 | 1548 |
_iInstrumentcnt = _iInstrumentcnt + 1 |
1418 | 1549 |
objSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1419 | 1550 |
SetListBoxItems(ListBox_Result, "Place Instrument..(" & dLocationX & "," & dLocationY & ")..." & _iInstrumentcnt & " count ") |
... | ... | |
1421 | 1552 |
Try |
1422 | 1553 |
If oAttributeRow.Length > 0 Then |
1423 | 1554 |
For Each oAttribute In oAttributeRow |
1424 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
1425 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
1426 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
1427 |
oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
1555 |
Try |
|
1556 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
1557 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
1558 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
1559 |
oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
1560 |
Catch ex As Exception |
|
1561 |
|
|
1562 |
End Try |
|
1563 |
|
|
1428 | 1564 |
Next |
1429 | 1565 |
oInstrument.Commit() |
1430 | 1566 |
End If |
1431 | 1567 |
Catch ex As Exception |
1432 |
|
|
1433 | 1568 |
End Try |
1434 |
|
|
1435 |
|
|
1436 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_VALVES Then |
|
1569 |
ElseIf sSymbolCompType.ToUpper() = _DB_FITTINGS.ToUpper() Then |
|
1437 | 1570 |
_iValvecnt = _iValvecnt + 1 |
1438 | 1571 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1439 | 1572 |
SetListBoxItems(ListBox_Result, "Place Valve..(" & dLocationX & "," & dLocationY & ")..." & _iValvecnt & " count ") |
1440 | 1573 |
|
1441 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_FITTINGS Then |
|
1574 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_FITTINGS.ToUpper() Then
|
|
1442 | 1575 |
_iFittingcnt = _iFittingcnt + 1 |
1443 | 1576 |
If sSystemPath.Contains(",") Then |
1444 | 1577 |
|
... | ... | |
1465 | 1598 |
|
1466 | 1599 |
|
1467 | 1600 |
SetListBoxItems(ListBox_Result, "Place Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
1468 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_ACTUATORS Then
|
|
1601 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() And sClass.ToUpper() = _SYMBOL_ACTUATORS.ToUpper() Then
|
|
1469 | 1602 |
_iFittingcnt = _iFittingcnt + 1 |
1470 | 1603 |
Dim sDuplicatePath As String() = sSystemPath.Split(",") |
1471 | 1604 |
Dim sMainSymbol As String = "" |
... | ... | |
1486 | 1619 |
_iFittingcnt = _iFittingcnt + 1 |
1487 | 1620 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1488 | 1621 |
SetListBoxItems(ListBox_Result, "Place Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
1622 |
End If |
|
1623 |
|
|
1489 | 1624 |
End If |
1490 | 1625 |
|
1491 | 1626 |
End If |
1492 | 1627 |
|
1628 |
Catch ex As Exception |
|
1629 |
Return False |
|
1630 |
End Try |
|
1631 |
End Function |
|
1632 |
|
|
1633 |
|
|
1634 |
Private Sub FindConnectionLine(ByVal oLine_Dt As DataTable, ByRef dx As Double, ByRef dy As Double) |
|
1635 |
|
|
1636 |
Try |
|
1637 |
For Each oRow In oLine_Dt.Rows |
|
1638 |
Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
|
1639 |
Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
|
1640 |
Dim d기준s_x As Double = 0 |
|
1641 |
Dim d기준s_y As Double = 0 |
|
1642 |
Dim d기준e_x As Double = 0 |
|
1643 |
Dim d기준e_y As Double = 0 |
|
1644 |
ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
|
1645 |
ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
|
1646 |
If dx + 300 > d기준s_x And dx - 300 < d기준s_x And dy + 300 > d기준s_y And dy - 300 < d기준s_y Then |
|
1647 |
dx = d기준s_x |
|
1648 |
dy = d기준s_y |
|
1649 |
ElseIf dx + 300 > d기준e_x And dx - 300 < d기준e_x And dy + 300 > d기준e_y And dy - 300 < d기준e_y Then |
|
1650 |
dx = d기준e_x |
|
1651 |
dy = d기준e_y |
|
1652 |
End If |
|
1653 |
Next |
|
1654 |
Catch ex As Exception |
|
1655 |
End Try |
|
1656 |
End Sub |
|
1657 |
|
|
1658 |
|
|
1659 |
Dim _라인보정기준값 As Integer = 10 |
|
1660 |
|
|
1661 |
Private Function 라인보정(ByRef oLine_Dt As DataTable, ByVal sUid As String, ByRef dsx As Double, ByRef dsy As Double, |
|
1662 |
ByRef dex As Double, ByRef dey As Double) |
|
1663 |
Try |
|
1664 |
Dim bCheck라인 As Boolean = False |
|
1665 |
'일치하는 Line 찾기 |
|
1666 |
For Each oRow In oLine_Dt.Rows |
|
1667 |
Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
|
1668 |
Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
|
1669 |
Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
|
1670 |
If sBUid <> sUid Then |
|
1671 |
Dim d기준s_x As Double = 0 |
|
1672 |
Dim d기준s_y As Double = 0 |
|
1673 |
Dim d기준e_x As Double = 0 |
|
1674 |
Dim d기준e_y As Double = 0 |
|
1675 |
ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
|
1676 |
ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
|
1677 |
|
|
1678 |
If (dsx = d기준s_x And dsy = d기준s_y) Or (dsx = d기준e_x And dsy = d기준e_y) Or |
|
1679 |
(dex = d기준s_x And dey = d기준s_y) Or (dex = d기준e_x And dey = d기준e_y) Then |
|
1680 |
bCheck라인 = True |
|
1681 |
End If |
|
1682 |
End If |
|
1683 |
Next |
|
1684 |
|
|
1685 |
If bCheck라인 = False Then |
|
1686 |
For Each oRow In oLine_Dt.Rows |
|
1687 |
Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
|
1688 |
Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
|
1689 |
Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
|
1690 |
If sBUid <> sUid Then |
|
1691 |
Dim d기준s_x As Double = 0 |
|
1692 |
Dim d기준s_y As Double = 0 |
|
1693 |
Dim d기준e_x As Double = 0 |
|
1694 |
Dim d기준e_y As Double = 0 |
|
1695 |
ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
|
1696 |
ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
|
1697 |
If ((dsx - _라인보정기준값 <= d기준s_x And dsx + _라인보정기준값 >= d기준s_x) And (dsy - _라인보정기준값 <= d기준s_y And dsy + _라인보정기준값 >= d기준s_y)) Then |
|
1698 |
oRow(_XML_LINE_STARTPOINT) = dsx & "," & dsy |
|
1699 |
bCheck라인 = True |
|
1700 |
Exit For |
|
1701 |
ElseIf ((dsx - _라인보정기준값 <= d기준e_x And dsx + _라인보정기준값 >= d기준e_x) And (dsy - _라인보정기준값 <= d기준e_y And dsy + _라인보정기준값 >= d기준e_y)) Then |
|
1702 |
oRow(_XML_LINE_ENDPOINT) = dsx & "," & dsy |
|
1703 |
bCheck라인 = True |
|
1704 |
Exit For |
|
1705 |
ElseIf ((dex - _라인보정기준값 <= d기준s_x And dex + _라인보정기준값 >= d기준s_x) And (dey - _라인보정기준값 <= d기준s_y And dey + _라인보정기준값 >= d기준s_y)) Then |
|
1706 |
oRow(_XML_LINE_STARTPOINT) = dex & "," & dey |
|
1707 |
bCheck라인 = True |
|
1708 |
Exit For |
|
1709 |
ElseIf ((dex - _라인보정기준값 <= d기준e_x And dex + _라인보정기준값 >= d기준e_x) And (dey - _라인보정기준값 <= d기준e_y And dey + _라인보정기준값 >= d기준e_y)) Then |
|
1710 |
oRow(_XML_LINE_ENDPOINT) = dex & "," & dey |
|
1711 |
bCheck라인 = True |
|
1712 |
Exit For |
|
1713 |
End If |
|
1714 |
|
|
1715 |
End If |
|
1716 |
Next |
|
1493 | 1717 |
End If |
1494 | 1718 |
|
1719 |
Return bCheck라인 |
|
1495 | 1720 |
Catch ex As Exception |
1496 | 1721 |
Return False |
1497 | 1722 |
End Try |
1723 |
|
|
1724 |
|
|
1498 | 1725 |
End Function |
1499 | 1726 |
|
1500 | 1727 |
Private Function FindOverlapLine(ByVal oLine_Dt As DataTable, ByVal sUid As String, ByRef dsx As Double, ByRef dsy As Double, |
1501 | 1728 |
ByRef dex As Double, ByRef dey As Double) |
1502 | 1729 |
Try |
1503 | 1730 |
Dim bCheckOverlap As Boolean = False |
1504 |
|
|
1505 | 1731 |
For Each oRow In oLine_Dt.Rows |
1506 |
|
|
1507 | 1732 |
Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
1508 | 1733 |
Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
1509 | 1734 |
Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
... | ... | |
1514 | 1739 |
Dim d기준e_y As Double = 0 |
1515 | 1740 |
ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
1516 | 1741 |
ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
1517 |
|
|
1518 |
|
|
1519 |
|
|
1520 |
If (d기준s_x <= dsx And d기준e_x >= dex) And |
|
1521 |
d기준s_y <= dsy And d기준e_y >= dey Then |
|
1742 |
If (d기준s_x <= dsx And d기준e_x >= dex And |
|
1743 |
d기준s_y <= dsy And d기준e_y >= dey) Then |
|
1522 | 1744 |
'겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
1523 | 1745 |
If dsy - d기준s_y > d기준e_y - dey Then |
1524 | 1746 |
Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
... | ... | |
1532 | 1754 |
Else |
1533 | 1755 |
dey = dCalcStartY |
1534 | 1756 |
End If |
1535 |
|
|
1536 | 1757 |
End If |
1537 |
|
|
1538 | 1758 |
Else |
1539 | 1759 |
' Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
1540 | 1760 |
Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
... | ... | |
1543 | 1763 |
Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
1544 | 1764 |
Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
1545 | 1765 |
Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
1546 |
|
|
1547 | 1766 |
If dCalcStartY = 0 Then |
1548 | 1767 |
dsy = d기준s_y |
1549 | 1768 |
Else |
1550 | 1769 |
dsy = dCalcStartY |
1551 | 1770 |
End If |
1552 |
|
|
1553 | 1771 |
End If |
1554 |
|
|
1555 | 1772 |
End If |
1556 | 1773 |
bCheckOverlap = True |
1557 | 1774 |
ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
... | ... | |
1571 | 1788 |
End If |
1572 | 1789 |
|
1573 | 1790 |
End If |
1574 |
|
|
1575 | 1791 |
'겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
1576 |
|
|
1577 | 1792 |
Else |
1578 | 1793 |
' Dim dResultCalc As Double = (Math.Abs((dsy - d기준s_y)) / Math.Abs((d기준e_y - dey))) * 100 |
1579 | 1794 |
Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
... | ... | |
1588 | 1803 |
dey = dCalcStartY |
1589 | 1804 |
End If |
1590 | 1805 |
End If |
1591 |
|
|
1592 | 1806 |
End If |
1593 | 1807 |
bCheckOverlap = True |
1594 | 1808 |
ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
... | ... | |
1621 | 1835 |
dsx = dCalcStartX |
1622 | 1836 |
End If |
1623 | 1837 |
End If |
1624 |
|
|
1625 | 1838 |
End If |
1626 |
|
|
1627 | 1839 |
bCheckOverlap = True |
1628 | 1840 |
ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
1629 | 1841 |
d기준s_y <= dey And d기준e_y >= dsy Then |
... | ... | |
1665 | 1877 |
Catch ex As Exception |
1666 | 1878 |
Return False |
1667 | 1879 |
End Try |
1668 |
|
|
1669 |
|
|
1670 | 1880 |
End Function |
1671 | 1881 |
|
1672 | 1882 |
Private Sub CalcSperateLine(ByRef dStartX As Double, ByRef dStartY As Double, |
1673 | 1883 |
ByRef dEndX As Double, ByRef dEndY As Double) |
1674 | 1884 |
Try |
1675 |
Dim dRange As Double = 1 'Line 전체 길이의 1%씩 늘이기 |
|
1885 |
Dim dRange As Double = 1 'Line 전체 길이의 10%씩 늘이기
|
|
1676 | 1886 |
If Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
1677 |
Dim dCalc_x As Double = Math.Abs(dStartX - dEndX) / 100
|
|
1887 |
Dim dCalc_x As Double = Math.Abs(dStartX - dEndX) * 0.1
|
|
1678 | 1888 |
If dStartX > dEndX Then |
1679 | 1889 |
dStartX = dStartX + dCalc_x |
1680 | 1890 |
dEndX = dEndX - dCalc_x |
... | ... | |
1683 | 1893 |
dStartX = dStartX - dCalc_x |
1684 | 1894 |
End If |
1685 | 1895 |
Else |
1686 |
Dim dCalc_y As Double = Math.Abs(dStartY - dEndY) / 100
|
|
1896 |
Dim dCalc_y As Double = Math.Abs(dStartY - dEndY) * 0.1
|
|
1687 | 1897 |
If dStartY > dEndY Then |
1688 | 1898 |
dStartY = dStartY + dCalc_y |
1689 | 1899 |
dEndY = dEndY - dCalc_y |
... | ... | |
1752 | 1962 |
_iNozzlecnt = 0 |
1753 | 1963 |
End Sub |
1754 | 1964 |
|
1965 |
|
|
1966 |
|
|
1755 | 1967 |
Private Function AutoModeling() As Boolean |
1756 | 1968 |
Try |
1757 |
|
|
1969 |
_CompleteConvert = False |
|
1758 | 1970 |
SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
1759 | 1971 |
Dim oDwg_Dt As DataTable = LoadAllDrawing() |
1760 | 1972 |
For Each oDrwing As TreeNode In Tree_Result.Nodes |
1761 | 1973 |
For Each oDwgNode As TreeNode In oDrwing.Nodes |
1762 |
|
|
1763 | 1974 |
Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
1764 |
Dim CDrawing As Drawing = GetDrawing(sDwgName)
|
|
1765 |
If CDrawing IsNot Nothing Then
|
|
1975 |
Dim CDrawing As Drawing = GetDrawing(sDwgName)
|
|
1976 |
If CDrawing IsNot Nothing Then |
|
1766 | 1977 |
If OpenSPPID(oDwg_Dt, oDwgNode.Text) Then |
1767 | 1978 |
InitItemCount() |
1768 | 1979 |
Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
1769 | 1980 |
Dim iLineNoCount As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
1770 | 1981 |
SetListBoxItems(ListBox_Result, "Place " & CDrawing.DwgName & "....") |
1771 |
|
|
1772 | 1982 |
For Each oNode As TreeNode In oDwgNode.Nodes |
1773 |
|
|
1983 |
Dim iItemcnt As Integer = 0 |
|
1774 | 1984 |
Dim sNodeUid As String = oNode.Name |
1775 | 1985 |
If sNodeUid <> "PipeLineNo" Then |
1776 | 1986 |
Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
1777 | 1987 |
If CLineNo IsNot Nothing Then |
1778 |
Dim oPipeRun As LMPipeRun |
|
1988 |
Dim oPipeRun As LMPipeRun = Nothing
|
|
1779 | 1989 |
Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
1780 | 1990 |
Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
1781 | 1991 |
Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
1782 | 1992 |
Dim oDrawLinenoLabel As Boolean = False |
1783 | 1993 |
For Each oLineNode As TreeNode In oNode.Nodes |
1994 |
iItemcnt = iItemcnt + 1 |
|
1784 | 1995 |
Dim sLineUid As String = oLineNode.Name |
1785 | 1996 |
If oLineNode.Checked Then |
1786 | 1997 |
Dim sUid As String = oLineNode.Name |
1787 | 1998 |
If oLine_Dt.Select("[" & _XML_LINE_UID & "]= '" & sUid & "'").Length = 1 Then |
1788 | 1999 |
oPipeRun = DrawLine(sUid, sNodeUid, oLine_Dt, oAttribute_Dt) |
1789 |
If oDrawLinenoLabel = False Then |
|
1790 |
DrawLineNo(oPipeRun, CLineNo) |
|
1791 |
oDrawLinenoLabel = True |
|
1792 |
End If |
|
1793 | 2000 |
End If |
1794 |
|
|
1795 |
|
|
2001 |
If oDrawLinenoLabel = False Then |
|
2002 |
DrawLineNo(oPipeRun, CLineNo) |
|
2003 |
End If |
|
2004 |
oDrawLinenoLabel = True |
|
1796 | 2005 |
End If |
2006 |
'If oNode.Nodes.Count - 1 = iItemcnt And oDrawLinenoLabel Then |
|
2007 |
' DrawLineNo(oPipeRun, CLineNo) |
|
2008 |
'End If |
|
1797 | 2009 |
Next |
1798 |
|
|
1799 | 2010 |
For Each oSymbolNode As TreeNode In oNode.Nodes |
1800 | 2011 |
If oSymbolNode.Checked Then |
1801 | 2012 |
Dim sUid As String = oSymbolNode.Name |
1802 | 2013 |
If oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sUid & "'").Length = 1 Then |
1803 |
DrawSymbol(sUid, sNodeUid, oSymbol_Dt, oAttribute_Dt) |
|
2014 |
DrawSymbol(sUid, sNodeUid, oSymbol_Dt, oAttribute_Dt, CLineNo.Dt_Line)
|
|
1804 | 2015 |
End If |
1805 |
|
|
1806 | 2016 |
End If |
1807 | 2017 |
Next |
1808 | 2018 |
iLineNoCount = iLineNoCount + 1 |
1809 | 2019 |
End If |
1810 |
|
|
1811 | 2020 |
Dim CEqpNo As Eqp_no = GetEqpNo(CDrawing, sNodeUid) |
1812 |
|
|
1813 | 2021 |
If CEqpNo IsNot Nothing Then |
1814 | 2022 |
Dim oSymbol_Dt As DataTable = CEqpNo.Dt_Equipment |
1815 | 2023 |
Dim oAttribute_Dt As DataTable = CEqpNo.Dt_Attribute |
1816 | 2024 |
For Each oSymbolNode As TreeNode In oNode.Nodes |
1817 | 2025 |
If oSymbolNode.Checked Then |
1818 | 2026 |
Dim sUid As String = oSymbolNode.Name |
1819 |
DrawSymbol(sUid, sNodeUid, oSymbol_Dt, oAttribute_Dt) |
|
2027 |
DrawSymbol(sUid, sNodeUid, oSymbol_Dt, oAttribute_Dt, CLineNo.Dt_Line)
|
|
1820 | 2028 |
End If |
1821 | 2029 |
Next |
1822 | 2030 |
End If |
1823 |
|
|
1824 |
|
|
1825 |
|
|
1826 | 2031 |
Else |
1827 |
|
|
1828 | 2032 |
Dim oDrawLinenoLabel As Boolean = False |
1829 | 2033 |
For Each oLineNode As TreeNode In oNode.Nodes |
1830 | 2034 |
Dim CLineNo As Line_no = GetOnlyPipeLineNo(CDrawing, oLineNode.Name) |
... | ... | |
1836 | 2040 |
DrawLine(sUid, sNodeUid, oLine_Dt, oAttribute_Dt) |
1837 | 2041 |
End If |
1838 | 2042 |
Next |
1839 |
|
|
1840 |
|
|
1841 |
|
|
1842 |
|
|
1843 | 2043 |
End If |
1844 |
|
|
1845 |
|
|
1846 |
' Dim dCalcProgressValue As Double = (iLineNoCount / iLineNoCount) * 100 |
|
1847 |
'SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
|
1848 | 2044 |
Next |
1849 |
|
|
1850 | 2045 |
End If |
1851 | 2046 |
End If |
1852 |
|
|
1853 | 2047 |
Next |
1854 |
|
|
1855 |
|
|
1856 |
|
|
1857 | 2048 |
Next |
1858 | 2049 |
SetProgressbar(ProgressBar_Status, 100) |
1859 | 2050 |
SetListBoxItems(ListBox_Result, " Auto converting 완료") |
2051 |
_CompleteConvert = True |
|
1860 | 2052 |
Return True |
1861 | 2053 |
Catch ex As Exception |
1862 | 2054 |
Return False |
... | ... | |
1865 | 2057 |
|
1866 | 2058 |
|
1867 | 2059 |
|
1868 |
Private Sub ThreadTask()
|
|
2060 |
Private Sub ThreadConvert()
|
|
1869 | 2061 |
If _DrawingsList IsNot Nothing Then |
1870 | 2062 |
If _DrawingsList.Count > 0 Then |
1871 | 2063 |
AutoModeling() |
1872 | 2064 |
End If |
1873 | 2065 |
End If |
1874 |
|
|
1875 |
|
|
1876 | 2066 |
End Sub |
1877 | 2067 |
|
2068 |
Private Sub ThreadOPCRemove() |
|
2069 |
While _CompleteConvert = False |
|
2070 |
Dim oFindOPC As New FindOpc |
|
2071 |
oFindOPC.RemoveOPCDlg() |
|
2072 |
End While |
|
1878 | 2073 |
|
2074 |
End Sub |
|
1879 | 2075 |
|
1880 | 2076 |
|
1881 | 2077 |
Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
... | ... | |
1889 | 2085 |
|
1890 | 2086 |
Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
1891 | 2087 |
If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
2088 |
LoadDB() |
|
1892 | 2089 |
LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
1893 | 2090 |
End If |
1894 | 2091 |
End Sub |
... | ... | |
1918 | 2115 |
''' <param name="sDwgPath"></param> |
1919 | 2116 |
Private Function AddSymbolItem(ByVal sDwgPath As String, ByVal oParentNode As TreeNode) As Drawing |
1920 | 2117 |
Dim oDwg_Ds As Drawing = LoadSymbolInXml(sDwgPath) |
2118 |
If oDwg_Ds IsNot Nothing Then |
|
2119 |
Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
|
2120 |
|
|
2121 |
Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
|
2122 |
Dim oPipe As Boolean = False |
|
2123 |
Dim oFitting As Boolean = False |
|
2124 |
Dim oOnlyPipesNode As TreeNode |
|
2125 |
Dim oOnlyFittingsNode As TreeNode |
|
2126 |
'PipeLine 구분 |
|
2127 |
|
|
2128 |
For Each oLinelist In oLineLists |
|
2129 |
Dim sLineNoUid As String = oLinelist.Uid |
|
2130 |
Dim sLineNo As String = oLinelist.Text |
|
2131 |
Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
|
2132 |
For Each oLineRow In oLinelist.Dt_Line.Rows |
|
2133 |
Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
|
2134 |
Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
|
2135 |
oPipeNode.Tag = sLineNoUid |
|
2136 |
Next |
|
2137 |
For Each oSymbolRow In oLinelist.Dt_Symbol.Rows |
|
2138 |
Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
|
2139 |
Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
|
2140 |
Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
|
2141 |
oSymbolNode.Tag = sLineNoUid |
|
2142 |
Next |
|
2143 |
'If sLineNo <> "PipeLineNo" Then |
|
1921 | 2144 |
|
1922 |
Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
|
1923 |
|
|
1924 |
Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
|
1925 |
Dim oPipe As Boolean = False |
|
1926 |
Dim oFitting As Boolean = False |
|
1927 |
Dim oOnlyPipesNode As TreeNode |
|
1928 |
Dim oOnlyFittingsNode As TreeNode |
|
1929 |
'PipeLine 구분 |
|
1930 |
|
|
1931 |
For Each oLinelist In oLineLists |
|
1932 |
Dim sLineNoUid As String = oLinelist.Uid |
|
1933 |
Dim sLineNo As String = oLinelist.Text |
|
1934 |
Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
|
1935 |
For Each oLineRow In oLinelist.Dt_Line.Rows |
|
1936 |
Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
|
1937 |
Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
|
1938 |
oPipeNode.Tag = sLineNoUid |
|
1939 |
Next |
|
1940 |
For Each oSymbolRow In oLinelist.Dt_Symbol.Rows |
|
1941 |
Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
|
1942 |
Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
|
1943 |
Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
|
1944 |
oSymbolNode.Tag = sLineNoUid |
|
1945 |
Next |
|
1946 |
'If sLineNo <> "PipeLineNo" Then |
|
2145 |
'Else |
|
2146 |
' 'If oPipe = False Then |
|
2147 |
' ' oOnlyPipesNode = oParentNode.Nodes.Add("PipeLineNo", "PipeLineNo") |
|
2148 |
' ' oPipe = True |
|
2149 |
' 'End If |
|
2150 |
' 'For Each oLineRow In oLinelist.Dt_Line.Rows |
|
2151 |
' ' Dim sLineUid As String = oLineRow(_XML_SYMBOL_UID) |
|
2152 |
' ' Dim oPipeNode As TreeNode = oOnlyPipesNode.Nodes.Add(sLineUid, "Pipe") |
|
2153 |
' ' oPipeNode.Tag = sLineNoUid |
|
2154 |
' 'Next |
|
1947 | 2155 |
|
1948 |
'Else |
|
1949 |
' 'If oPipe = False Then |
|
1950 |
' ' oOnlyPipesNode = oParentNode.Nodes.Add("PipeLineNo", "PipeLineNo") |
|
1951 |
' ' oPipe = True |
|
1952 |
' 'End If |
|
1953 |
' 'For Each oLineRow In oLinelist.Dt_Line.Rows |
|
1954 |
' ' Dim sLineUid As String = oLineRow(_XML_SYMBOL_UID) |
|
1955 |
' ' Dim oPipeNode As TreeNode = oOnlyPipesNode.Nodes.Add(sLineUid, "Pipe") |
|
1956 |
' ' oPipeNode.Tag = sLineNoUid |
|
1957 |
' 'Next |
|
1958 | 2156 |
|
1959 | 2157 |
|
1960 | 2158 |
|
2159 |
'End If |
|
2160 |
Next |
|
2161 |
'For Each oSymbolRow In _TempSymbolDt.Rows |
|
2162 |
' If oFitting = False Then |
|
2163 |
' oOnlyFittingsNode = oParentNode.Nodes.Add("Symbols", "Symbols") |
|
2164 |
' oFitting = True |
|
2165 |
' End If |
|
2166 |
' Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
|
2167 |
' Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
|
2168 |
' Dim oSymbolNode As TreeNode = oOnlyFittingsNode.Nodes.Add(sSymbolUid, sSymbolName) |
|
2169 |
' oSymbolNode.Tag = sSymbolUid |
|
2170 |
'Next |
|
2171 |
For Each oEqplist In oEqpLists |
|
2172 |
Dim sEqpUid As String = oEqplist.Uid |
|
2173 |
Dim sEqpNo As String = "EQUIPMENT" |
|
2174 |
Dim oEqpNode As TreeNode = oParentNode.Nodes.Add(sEqpUid, sEqpNo) |
|
1961 | 2175 |
|
1962 |
'End If |
|
1963 |
Next |
|
1964 |
'For Each oSymbolRow In _TempSymbolDt.Rows |
|
1965 |
' If oFitting = False Then |
|
1966 |
' oOnlyFittingsNode = oParentNode.Nodes.Add("Symbols", "Symbols") |
|
1967 |
' oFitting = True |
|
1968 |
' End If |
|
1969 |
' Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
|
1970 |
' Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
|
1971 |
' Dim oSymbolNode As TreeNode = oOnlyFittingsNode.Nodes.Add(sSymbolUid, sSymbolName) |
|
1972 |
' oSymbolNode.Tag = sSymbolUid |
|
1973 |
'Next |
|
1974 |
For Each oEqplist In oEqpLists |
|
1975 |
Dim sEqpUid As String = oEqplist.Uid |
|
1976 |
Dim sEqpNo As String = "EQUIPMENT" |
|
1977 |
Dim oEqpNode As TreeNode = oParentNode.Nodes.Add(sEqpUid, sEqpNo) |
|
1978 |
|
|
1979 |
|
|
1980 |
For Each oSymbolRow In oEqplist.Dt_Equipment.Rows |
|
1981 |
Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
|
1982 |
Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
|
1983 |
Dim oSymbolNode As TreeNode = oEqpNode.Nodes.Add(sSymbolUid, sSymbolName) |
|
1984 |
oSymbolNode.Tag = sEqpUid |
|
2176 |
|
|
2177 |
For Each oSymbolRow In oEqplist.Dt_Equipment.Rows |
|
2178 |
Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
|
2179 |
Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
|
2180 |
Dim oSymbolNode As TreeNode = oEqpNode.Nodes.Add(sSymbolUid, sSymbolName) |
|
2181 |
oSymbolNode.Tag = sEqpUid |
|
2182 |
Next |
|
1985 | 2183 |
Next |
1986 |
Next |
|
2184 |
End If |
|
2185 |
|
|
1987 | 2186 |
Return oDwg_Ds |
1988 | 2187 |
End Function |
1989 | 2188 |
Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
내보내기 Unified diff