개정판 f291ddcb
issue #591 : Nozzle모델링 완료
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
104 | 104 |
Try |
105 | 105 |
'' _TempSymbolDt = Symbol_Dt() |
106 | 106 |
Dim CDrawing As Drawing = New Drawing() |
107 |
Dim oDt As DataTable = LoadSymbol_DT() |
|
107 |
' Dim oDt As DataTable = LoadSymbol_DT()
|
|
108 | 108 |
Dim oElement As XElement = XElement.Load(sXmlPath) |
109 | 109 |
If oElement IsNot Nothing Then |
110 | 110 |
CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value |
... | ... | |
124 | 124 |
Try |
125 | 125 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
126 | 126 |
Dim oEleObj As XElement |
127 |
Dim sParentName As String |
|
127 | 128 |
Dim sName As String |
128 | 129 |
Dim sLocation As String |
129 | 130 |
Dim sSize As String |
... | ... | |
155 | 156 |
Dim dDwg_Conn3Pos_y As Double = 0.0 |
156 | 157 |
Dim dDwg_Conn4Pos_x As Double = 0.0 |
157 | 158 |
Dim dDwg_Conn4Pos_y As Double = 0.0 |
159 |
Dim sOwnerUid As String = "" |
|
158 | 160 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
159 | 161 |
sUid = oEleObj.Value |
160 | 162 |
oEleObj = oSymbol.Element(_XML_SYMBOL_PARENT) |
163 |
sParentName = oEleObj.Value |
|
164 |
oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
|
161 | 165 |
sName = oEleObj.Value |
162 | 166 |
oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
163 | 167 |
sLocation = oEleObj.Value |
... | ... | |
169 | 173 |
sConnectionPoint = oEleObj.Value |
170 | 174 |
oEleObj = oSymbol.Element(_XML_SYMBOL_CHILD) |
171 | 175 |
sChild = oEleObj.Value |
176 |
|
|
177 |
If sName = "NOZZLE" Then |
|
178 |
oEleObj = oSymbol.Element(_XML_SYMBOL_OWNER) |
|
179 |
sOwnerUid = oEleObj.Value |
|
180 |
End If |
|
172 | 181 |
Try |
173 | 182 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
174 | 183 |
sOriginalPoint = oEleObj.Value |
175 | 184 |
Catch ex As Exception |
176 | 185 |
|
177 | 186 |
End Try |
178 |
'oEleObj = oSymbol.Element(_XML_LINE_CONNS) |
|
179 |
'sConnectionUids = oEleObj.Value |
|
180 |
'sConnArray = sConnectionUids.Split(",") |
|
181 |
'If sConnArray.Length > 4 Then |
|
182 |
' MessageBox.Show(sConnArray.Length) |
|
183 |
'End If |
|
184 |
'For i = 0 To sConnArray.Length - 1 |
|
185 |
' If i = 0 Then |
|
186 |
' oAddrow(_XML_SYMBOL_Conn1_Uid) = sConnArray(i) |
|
187 |
' ElseIf i = 1 Then |
|
188 |
' oAddrow(_XML_SYMBOL_Conn2_Uid) = sConnArray(i) |
|
189 |
' ElseIf i = 2 Then |
|
190 |
' oAddrow(_XML_SYMBOL_Conn3_Uid) = sConnArray(i) |
|
191 |
' ElseIf i = 3 Then |
|
192 |
' oAddrow(_XML_SYMBOL_Conn4_Uid) = sConnArray(i) |
|
193 |
' End If |
|
194 |
'Next |
|
187 |
oAddrow(_XML_SYMBOL_OWNER) = sOwnerUid |
|
195 | 188 |
oAddrow(_XML_SYMBOL_Conn1_Uid) = "" |
196 | 189 |
oAddrow(_XML_SYMBOL_Conn2_Uid) = "" |
197 | 190 |
oAddrow(_XML_SYMBOL_Conn3_Uid) = "" |
... | ... | |
281 | 274 |
Next |
282 | 275 |
ConvertPointByImage(dMin_x, dMin_y, _IMG_X, _IMG_Y) |
283 | 276 |
ConvertPointByImage(dMax_x, dMax_y, _IMG_X, _IMG_Y) |
284 |
|
|
285 | 277 |
oAddrow(_XML_SYMBOL_MIN_X) = dMin_x |
286 | 278 |
oAddrow(_XML_SYMBOL_MAX_X) = dMax_x |
287 | 279 |
oAddrow(_XML_SYMBOL_MIN_Y) = dMin_y |
288 | 280 |
oAddrow(_XML_SYMBOL_MAX_Y) = dMax_y |
289 | 281 |
oAddrow(_XML_SYMBOL_UID) = sUid |
290 |
oAddrow(_XML_SYMBOL_NAME) = IO.Path.GetFileNameWithoutExtension(GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME)) |
|
282 |
oAddrow(_XML_SYMBOL_NAME) = IO.Path.GetFileNameWithoutExtension(GetDataFromMappingDB(sParentName, _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME))
|
|
291 | 283 |
oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
292 | 284 |
oAddrow(_XML_SYMBOL_SIZE) = sSize |
293 | 285 |
oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
294 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
|
295 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
|
296 |
oAddrow(_XML_SYMBOL_CLASS) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_CLASS) |
|
286 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sParentName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH)
|
|
287 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sParentName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE)
|
|
288 |
oAddrow(_XML_SYMBOL_CLASS) = GetDataFromMappingDB(sParentName, _DB_COLUMN_MAPPING_SPPID_CLASS)
|
|
297 | 289 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
298 |
|
|
299 | 290 |
oAddrow(_XML_SYMBOL_CONNECTIONPOINT) = sConnectionPoint |
300 | 291 |
oAddrow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
301 | 292 |
oAddrow(_XML_SYMBOL_CHILD) = sChild |
... | ... | |
313 | 304 |
CDrawing.Line_nos = oLineno_list |
314 | 305 |
CDrawing.Eqp_nos = oEqp_list |
315 | 306 |
CDrawing.TrimLine_nos = oTrim_Lineno_list |
316 |
|
|
317 | 307 |
End If |
318 | 308 |
Return CDrawing |
319 | 309 |
Catch ex As Exception |
... | ... | |
514 | 504 |
sEndpoint = oEleObj.Value |
515 | 505 |
oEleObj = oLine.Element(_XML_LINE_TYPE) |
516 | 506 |
sType = oEleObj.Value |
517 |
'oEleObj = oLine.Element(_XML_LINE_CONNS) |
|
518 |
'sConnectionUids = oEleObj.Value |
|
519 |
'sConnArray = sConnectionUids.Split(",") |
|
520 |
'For i = 0 To sConnArray.Length - 1 |
|
521 |
' If i = 0 Then |
|
522 |
' oAddrow(_XML_LINE_Conn1_Uid) = sConnArray(i) |
|
523 |
' ElseIf i = 1 Then |
|
524 |
' oAddrow(_XML_LINE_Conn2_Uid) = sConnArray(i) |
|
525 |
' End If |
|
526 |
'Next |
|
527 |
'If sConnArray.Length > 2 Then |
|
528 |
' MessageBox.Show(sConnArray.Length) |
|
529 |
'End If |
|
507 |
|
|
530 | 508 |
oAddrow(_XML_LINE_Conn1_Uid) = "" |
531 | 509 |
oAddrow(_XML_LINE_Conn2_Uid) = "" |
532 | 510 |
oAddrow(_XML_LINE_UID) = sUid |
... | ... | |
535 | 513 |
oAddrow(_XML_LINENO_TEXT) = CLineNo.Text |
536 | 514 |
oAddrow(_XML_LINE_STARTPOINT) = sStartpoint |
537 | 515 |
oAddrow(_XML_LINE_ENDPOINT) = sEndpoint |
538 |
|
|
516 |
If sUid = "0bda520b-9c01-4dc1-9ddd-73adb5f7a871" Then |
|
517 |
MsgBox("") |
|
518 |
End If |
|
539 | 519 |
ConvertPointBystring(sStartpoint, dStartPos_x, dStartPos_y) |
540 | 520 |
ConvertPointBystring(sEndpoint, dEndPos_x, dEndPos_y) |
541 | 521 |
Dim sDirection As String = "" |
... | ... | |
1076 | 1056 |
oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
1077 | 1057 |
End If |
1078 | 1058 |
If oSymbolRow.Length > 0 Then |
1059 |
|
|
1079 | 1060 |
Dim oDatasource As Object = _Placement.PIDDataSource |
1061 |
Dim sSymbolName As String = oSymbolRow(0)(_XML_SYMBOL_NAME).ToString() |
|
1080 | 1062 |
Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
1081 | 1063 |
Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
1082 | 1064 |
Dim sClass As String = oSymbolRow(0)(_XML_SYMBOL_CLASS).ToString() |
... | ... | |
1088 | 1070 |
End If |
1089 | 1071 |
Dim dLocationX As Double = 0.0 |
1090 | 1072 |
Dim dLocationY As Double = 0.0 |
1091 |
Dim dX As Double = 0.0 |
|
1092 |
Dim dY As Double = 0.0 |
|
1093 | 1073 |
|
1094 |
If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
|
1095 |
dX = dLocationX |
|
1096 |
dY = dLocationY |
|
1097 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
|
1098 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
1074 |
ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
|
1075 |
Dim dX As Double = dLocationX |
|
1076 |
Dim dY As Double = dLocationY |
|
1077 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
|
1078 |
|
|
1079 |
Dim oReturnSymbol As LMSymbol = Nothing |
|
1080 |
If sSymbolCompType.ToUpper() = "NOZZLE" Then |
|
1081 |
Dim sOwnerUid As String = oSymbolRow(0)(_XML_SYMBOL_OWNER).ToString() |
|
1082 |
Dim oFineRow() As DataRow = _ModelingSymbol_Dt.Select("Uid = '" & sOwnerUid & "'") |
|
1083 |
If oFineRow.Length = 1 Then |
|
1084 |
Dim sEqpModelID As String = oFineRow(0)(_XML_SYMBOL_SPID).ToString() |
|
1085 |
|
|
1086 |
Dim objVessel As LMVessel |
|
1087 |
objVessel = _Placement.PIDDataSource.GetVessel(sEqpModelID) |
|
1088 |
Dim oVesselLocation As LMLocations = objVessel.Locations |
|
1089 |
Dim oEqpSymbol As LMSymbol = _Placement.PIDDataSource.GetSymbol(objVessel.Representations.Nth(1).Id) |
|
1090 |
|
|
1091 |
Dim objNozzle As LMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, |
|
1092 |
TargetItem:=oEqpSymbol.AsLMRepresentation) |
|
1093 |
SetListBoxItems(ListBox_Result, "Place Nozzle.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iEquipmentcnt & " count ") |
|
1094 |
_iNozzlecnt = _iNozzlecnt + 1 |
|
1095 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Nozzle : " & sUid) |
|
1096 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Nozzle Name : " & sSymbolName) |
|
1097 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
|
1098 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
|
1099 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Nozzle Count : " & _iNozzlecnt) |
|
1100 |
End If |
|
1101 |
Else |
|
1102 |
oReturnSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
1099 | 1103 |
SetListBoxItems(ListBox_Result, "Place Equipment.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iEquipmentcnt & " count ") |
1100 | 1104 |
_iEquipmentcnt = _iEquipmentcnt + 1 |
1101 | 1105 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Equipment : " & sUid) |
1102 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Name : " & sEqpName)
|
|
1106 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Name : " & sSymbolName)
|
|
1103 | 1107 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
1104 | 1108 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
1105 | 1109 |
ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Count : " & _iEquipmentcnt) |
1106 | 1110 |
End If |
1111 |
'모델링 된 Symbol 데이터 테이블 저장 |
|
1112 |
Dim oAddRow As DataRow = _ModelingSymbol_Dt.NewRow |
|
1113 |
oAddRow(_XML_SYMBOL_UID) = sUid |
|
1114 |
oAddRow(_XML_SYMBOL_SPID) = oReturnSymbol.ModelItemID |
|
1115 |
oAddRow(_XML_SYMBOL_LMSYMBOL) = oReturnSymbol |
|
1116 |
oAddRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
|
1117 |
oAddRow(_XML_SYMBOL_CENTERPOINT_X) = dLocationX |
|
1118 |
oAddRow(_XML_SYMBOL_CENTERPOINT_Y) = dLocationY |
|
1119 |
_ModelingSymbol_Dt.Rows.Add(oAddRow) |
|
1120 |
|
|
1107 | 1121 |
End If |
1108 | 1122 |
Catch ex As Exception |
1109 | 1123 |
End Try |
... | ... | |
1960 | 1974 |
End If |
1961 | 1975 |
End If |
1962 | 1976 |
|
1963 |
'모델링 된 PipeLine 데이터 테이블 저장
|
|
1977 |
'모델링 된 Symbol 데이터 테이블 저장
|
|
1964 | 1978 |
Dim oAddRow As DataRow = _ModelingSymbol_Dt.NewRow |
1965 | 1979 |
oAddRow(_XML_SYMBOL_SPID) = oLMSymbol.ModelItemID |
1966 | 1980 |
oAddRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
내보내기 Unified diff