개정판 9e1e7135
OPCUpdate
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
31 | 31 |
Private _DrawingsList As List(Of Drawing) |
32 | 32 |
|
33 | 33 |
|
34 |
Private _iPipeLineNocnt As Integer |
|
35 |
Private _iPipecnt As Integer |
|
36 |
Private _iFittingcnt As Integer |
|
37 |
Private _iValvecnt As Integer |
|
38 |
Private _iInstrumentcnt As Integer |
|
39 |
Private _iEquipmentcnt As Integer |
|
40 |
Private _iNozzlecnt As Integer |
|
41 |
|
|
34 | 42 |
|
35 | 43 |
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
36 | 44 |
|
... | ... | |
307 | 315 |
CLineNo.Uid = oLineNo.Element(_XML_LINENO_UID).Value |
308 | 316 |
CLineNo.Text = oLineNo.Element(_XML_LINENO_TEXT).Value |
309 | 317 |
CLineNo.Location = oLineNo.Element(_XML_LINENO_LOCATION).Value |
310 |
CLineNo.Angle = oLineNo.Element(_XML_LINENO_LOCATION).Value
|
|
318 |
CLineNo.Angle = oLineNo.Element(_XML_LINENO_ANGLE).Value
|
|
311 | 319 |
CLineNo.SystemPath = GetDataFromMappingDB(_XML_CATEGORY_LINENO, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
312 | 320 |
|
313 | 321 |
Dim oLine_Dt As DataTable = Line_Dt() |
... | ... | |
342 | 350 |
Dim sLocation As String |
343 | 351 |
Dim sSize As String |
344 | 352 |
Dim sAngle As String |
345 |
|
|
353 |
Dim sOriginalPoint As String |
|
346 | 354 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
347 | 355 |
sUid = oEleObj.Value |
348 | 356 |
oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
... | ... | |
353 | 361 |
sSize = oEleObj.Value |
354 | 362 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
355 | 363 |
sAngle = oEleObj.Value |
364 |
Try |
|
365 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
|
366 |
sOriginalPoint = oEleObj.Value |
|
367 |
Catch ex As Exception |
|
368 |
|
|
369 |
End Try |
|
370 |
|
|
371 |
|
|
356 | 372 |
|
357 | 373 |
oAddrow(_XML_SYMBOL_UID) = sUid |
358 | 374 |
oAddrow(_XML_SYMBOL_NAME) = sName |
... | ... | |
361 | 377 |
oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
362 | 378 |
oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
363 | 379 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
380 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
|
364 | 381 |
|
365 | 382 |
oSymbol_Dt.Rows.Add(oAddrow) |
366 | 383 |
Next |
... | ... | |
509 | 526 |
'End Function |
510 | 527 |
|
511 | 528 |
|
512 |
Private Sub ConvertPoint(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double) |
|
529 |
Private Sub ConvertPointByImage(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double)
|
|
513 | 530 |
|
514 | 531 |
Dim calcx As Double = 0 |
515 | 532 |
Dim calcy As Double = 0 |
... | ... | |
570 | 587 |
If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
571 | 588 |
Dim ox As Double = opointstr(0) |
572 | 589 |
Dim oy As Double = opointstr(1) |
573 |
ConvertPoint(ox, oy, _IMG_X, _IMG_Y) |
|
590 |
ConvertPointByImage(ox, oy, _IMG_X, _IMG_Y)
|
|
574 | 591 |
objInputs.AddPoint(ox, oy) |
575 | 592 |
End If |
576 | 593 |
End If |
... | ... | |
969 | 986 |
|
970 | 987 |
Main_Tab.SelectedIndex = 1 |
971 | 988 |
ListBox_Result.Items.Clear() |
972 |
DataGrid_Result.DataSource = New DataTable() |
|
989 |
' DataGrid_Result.DataSource = New DataTable()
|
|
973 | 990 |
Me.ProgressBar_Status.Visible = True |
974 | 991 |
ProgressBar_Status.Maximum = 100 |
975 | 992 |
ProgressBar_Status.Value = 0 |
... | ... | |
1098 | 1115 |
Return Nothing |
1099 | 1116 |
End Function |
1100 | 1117 |
|
1101 |
Private Function ConvertPoint(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean |
|
1118 |
Private Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean
|
|
1102 | 1119 |
Try |
1103 | 1120 |
Dim opointstr As String() = Split(sPoint, ",") |
1104 | 1121 |
If (opointstr.Length > 1) Then |
1105 | 1122 |
If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
1106 | 1123 |
dX = opointstr(0) |
1107 | 1124 |
dY = opointstr(1) |
1108 |
ConvertPoint(dX, dY, _IMG_X, _IMG_Y) |
|
1125 |
|
|
1109 | 1126 |
Else |
1110 | 1127 |
dX = 0 |
1111 | 1128 |
dY = 0 |
... | ... | |
1118 | 1135 |
End Try |
1119 | 1136 |
End Function |
1120 | 1137 |
|
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
|
|
1138 |
Private Function DrawLine(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable) As LMPipeRun |
|
1122 | 1139 |
Try |
1123 | 1140 |
Dim oPipeRun As LMPipeRun |
1124 | 1141 |
Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" + sUid + "'") |
... | ... | |
1130 | 1147 |
Dim objConnector As LMConnector |
1131 | 1148 |
Dim objInputs As PlaceRunInputs |
1132 | 1149 |
objInputs = New PlaceRunInputs |
1150 |
Dim dOriginalStart_x As Double = 0.0 |
|
1151 |
Dim dOriginalStart_y As Double = 0.0 |
|
1152 |
Dim dOriginalEnd_x As Double = 0.0 |
|
1153 |
Dim dOriginalEnd_y As Double = 0.0 |
|
1154 |
|
|
1133 | 1155 |
Dim dStart_x As Double = 0.0 |
1134 | 1156 |
Dim dStart_y As Double = 0.0 |
1135 | 1157 |
Dim dEnd_x As Double = 0.0 |
1136 | 1158 |
Dim dEnd_y As Double = 0.0 |
1137 |
|
|
1138 | 1159 |
Dim sSystempath As String = oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
1139 | 1160 |
Dim sStartpoint As String = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
1140 | 1161 |
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 |
|
1162 |
ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
|
1163 |
dStart_x = dOriginalStart_x |
|
1164 |
dStart_y = dOriginalStart_y |
|
1165 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
1166 |
If ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) Then |
|
1167 |
dEnd_x = dOriginalEnd_x |
|
1168 |
dEnd_y = dOriginalEnd_y |
|
1169 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
|
1143 | 1170 |
If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
1144 | 1171 |
objInputs.AddPoint(dStart_x, dStart_y) |
1145 | 1172 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
1146 | 1173 |
objItem = _Placement.PIDCreateItem(sSystempath) |
1147 |
SetListBoxItems(ListBox_Result, "Draw PipeLine.." & iPipelinecnt & " count ") |
|
1174 |
_iPipecnt = _iPipecnt + 1 |
|
1175 |
SetListBoxItems(ListBox_Result, "Draw PipeLine..(" & dOriginalStart_x & "," & dOriginalStart_y & ")..." & _iPipecnt & " count ") |
|
1148 | 1176 |
objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
1149 | 1177 |
oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
1150 | 1178 |
If oAttributeRow.Length > 0 Then |
... | ... | |
1167 | 1195 |
End Try |
1168 | 1196 |
End Function |
1169 | 1197 |
|
1170 |
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 |
|
1198 |
Private Function DrawSymbol(ByVal sUid As String, ByVal sLineNoUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable) As Boolean |
|
1172 | 1199 |
Try |
1173 | 1200 |
|
1174 | 1201 |
Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
... | ... | |
1178 | 1205 |
Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
1179 | 1206 |
Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
1180 | 1207 |
Dim sLocation As String = oSymbolRow(0)(_XML_SYMBOL_LOCATION).ToString() |
1208 |
Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
|
1181 | 1209 |
Dim dAngle As Double = 0.0 |
1182 | 1210 |
If IsNumeric(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) Then |
1183 | 1211 |
dAngle = Double.Parse(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) |
1184 | 1212 |
End If |
1185 | 1213 |
|
1186 | 1214 |
Dim objSymbol As LMSymbol |
1215 |
Dim dLocationX As Double = 0.0 |
|
1216 |
Dim dLocationY As Double = 0.0 |
|
1187 | 1217 |
Dim dX As Double = 0.0 |
1188 | 1218 |
Dim dY As Double = 0.0 |
1189 | 1219 |
|
1190 |
If ConvertPoint(sLocation, dX, dY) Then |
|
1220 |
If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
|
1221 |
dX = dLocationX |
|
1222 |
dY = dLocationY |
|
1223 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
|
1191 | 1224 |
Dim oInstrument As LMInstrument |
1192 | 1225 |
If sSymbolCompType = _SYMBOL_INSTUMENT Then |
1193 |
iInstrumentcnt = iInstrumentcnt + 1
|
|
1226 |
_iInstrumentcnt = _iInstrumentcnt + 1
|
|
1194 | 1227 |
objSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1195 |
SetListBoxItems(ListBox_Result, "Draw Instrument.." & iInstrumentcnt & " count ")
|
|
1228 |
SetListBoxItems(ListBox_Result, "Draw Instrument..(" & dLocationX & "," & dLocationY & ")..." & _iInstrumentcnt & " count ")
|
|
1196 | 1229 |
oInstrument = oDatasource.GetInstrument(objSymbol.ModelItemID) |
1197 | 1230 |
If oAttributeRow.Length > 0 Then |
1198 | 1231 |
For Each oAttribute In oAttributeRow |
... | ... | |
1205 | 1238 |
End If |
1206 | 1239 |
|
1207 | 1240 |
ElseIf sSymbolCompType = _SYMBOL_VALVES Then |
1208 |
iValvecnt = iValvecnt + 1
|
|
1241 |
_iValvecnt = _iValvecnt + 1
|
|
1209 | 1242 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1210 |
SetListBoxItems(ListBox_Result, "Draw Valve.." & iValvecnt & " count ")
|
|
1243 |
SetListBoxItems(ListBox_Result, "Draw Valve..(" & dLocationX & "," & dLocationY & ")..." & _iValvecnt & " count ")
|
|
1211 | 1244 |
|
1212 | 1245 |
ElseIf sSymbolCompType = _SYMBOL_FITTINGS Then |
1213 |
iFittingcnt = iFittingcnt + 1
|
|
1246 |
_iFittingcnt = _iFittingcnt + 1
|
|
1214 | 1247 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1215 |
SetListBoxItems(ListBox_Result, "Draw Fitting.." & iFittingcnt & " count ")
|
|
1248 |
SetListBoxItems(ListBox_Result, "Draw Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ")
|
|
1216 | 1249 |
Else |
1217 |
iFittingcnt = iFittingcnt + 1
|
|
1250 |
_iFittingcnt = _iFittingcnt + 1
|
|
1218 | 1251 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1219 |
SetListBoxItems(ListBox_Result, "Draw Fitting.." & iFittingcnt & " count ")
|
|
1252 |
SetListBoxItems(ListBox_Result, "Draw Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ")
|
|
1220 | 1253 |
|
1221 | 1254 |
End If |
1222 | 1255 |
|
... | ... | |
1233 | 1266 |
Try |
1234 | 1267 |
Dim oDatasource As Object = _Placement.PIDDataSource |
1235 | 1268 |
Dim sLocation = CLine_No.Location |
1269 |
Dim dLocationx As Double = 0.0 |
|
1270 |
Dim dLocationy As Double = 0.0 |
|
1271 |
|
|
1236 | 1272 |
Dim dX As Double = 0.0 |
1237 | 1273 |
Dim dY As Double = 0.0 |
1238 |
If ConvertPoint(sLocation, dX, dY) Then |
|
1274 |
If ConvertPointBystring(sLocation, dLocationx, dLocationy) Then |
|
1275 |
dX = dLocationx |
|
1276 |
dY = dLocationy |
|
1277 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
|
1239 | 1278 |
Dim dLineNoLocation(2) As Double |
1240 | 1279 |
dLineNoLocation(1) = dX |
1241 | 1280 |
dLineNoLocation(2) = dY |
1242 | 1281 |
'Label |
1243 | 1282 |
Dim sSystemPath As String = CLine_No.SystemPath |
1283 |
Dim dAngle As Double = CLine_No.Angle |
|
1244 | 1284 |
Dim labelpersist As LMLabelPersist |
1245 | 1285 |
|
1246 | 1286 |
For Each representation In oPiperun.Representations |
1247 | 1287 |
If representation.RepresentationType = "Connector" Then |
1248 | 1288 |
labelpersist = _Placement.PIDPlaceLabel(sSystemPath, |
1249 |
dLineNoLocation,, 0, LabeledItem:=representation) |
|
1289 |
dLineNoLocation,, dAngle, LabeledItem:=representation) |
|
1290 |
_iPipeLineNocnt = _iPipeLineNocnt + 1 |
|
1291 |
SetListBoxItems(ListBox_Result, "Draw PipeLineNo Label..(" & dLocationx & "," & dLocationy & ")..." & _iPipeLineNocnt & " count ") |
|
1250 | 1292 |
End If |
1251 | 1293 |
Next |
1252 | 1294 |
Return True |
... | ... | |
1259 | 1301 |
End Try |
1260 | 1302 |
End Function |
1261 | 1303 |
|
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 |
|
1304 |
|
|
1305 |
Private Sub InitItemCount() |
|
1306 |
_iPipeLineNocnt = 0 |
|
1307 |
_iPipecnt = 0 |
|
1308 |
_iFittingcnt = 0 |
|
1309 |
_iValvecnt = 0 |
|
1310 |
_iInstrumentcnt = 0 |
|
1311 |
_iEquipmentcnt = 0 |
|
1312 |
_iNozzlecnt = 0 |
|
1313 |
End Sub |
|
1271 | 1314 |
|
1272 | 1315 |
Private Function AutoModeling() As Boolean |
1273 | 1316 |
Try |
... | ... | |
1280 | 1323 |
Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
1281 | 1324 |
Dim CDrawing As Drawing = GetDrawing(sDwgName) |
1282 | 1325 |
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 |
|
1326 |
If OpenSPPID(oDwg_Dt, oDwgNode.Text) Then |
|
1327 |
InitItemCount() |
|
1328 |
Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
|
1329 |
Dim iLineNoCount As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
|
1330 |
SetListBoxItems(ListBox_Result, "Draw " & CDrawing.DwgName & "....") |
|
1289 | 1331 |
|
1290 |
Dim sLineNoUid As String = oLinenoNode.Name |
|
1291 |
Dim CLineNo As Line_no = GetLineNo(CDrawing, sLineNoUid) |
|
1332 |
For Each oLinenoNode As TreeNode In oDwgNode.Nodes |
|
1292 | 1333 |
|
1293 |
Dim iPipelinecnt As Integer = 0 |
|
1294 |
Dim iInstrumentcnt As Integer = 0 |
|
1295 |
Dim iFittingcnt As Integer = 0 |
|
1296 |
Dim iValvescnt As Integer = 0 |
|
1334 |
Dim sLineNoUid As String = oLinenoNode.Name |
|
1335 |
Dim CLineNo As Line_no = GetLineNo(CDrawing, sLineNoUid) |
|
1297 | 1336 |
|
1298 |
If CLineNo IsNot Nothing Then
|
|
1337 |
If CLineNo IsNot Nothing Then |
|
1299 | 1338 |
Dim oPipeRun As LMPipeRun |
1300 | 1339 |
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
|
|
1340 |
Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
|
1341 |
Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
|
1303 | 1342 |
Dim oDrawLinenoLabel As Boolean = False |
1304 | 1343 |
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) |
|
1344 |
Dim sLineUid As String = oLineNode.Name |
|
1345 |
If oLineNode.Checked Then |
|
1346 |
Dim sUid As String = oLineNode.Name |
|
1347 |
oPipeRun = DrawLine(sUid, sLineNoUid, oLine_Dt, oAttribute_Dt) |
|
1310 | 1348 |
If oDrawLinenoLabel = False Then |
1311 | 1349 |
DrawLineNo(oPipeRun, CLineNo) |
1312 | 1350 |
oDrawLinenoLabel = True |
1313 | 1351 |
End If |
1314 | 1352 |
|
1315 | 1353 |
End If |
1316 |
Next
|
|
1354 |
Next |
|
1317 | 1355 |
|
1318 | 1356 |
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)
|
|
1357 |
If oSymbolNode.Checked Then |
|
1358 |
Dim sUid As String = oSymbolNode.Name |
|
1359 |
DrawSymbol(sUid, sLineNoUid, oSymbol_Dt, oAttribute_Dt) |
|
1322 | 1360 |
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
|
|
1361 |
Next |
|
1362 |
End If |
|
1363 |
iLineNoCount = iLineNoCount + 1 |
|
1364 |
' Dim dCalcProgressValue As Double = (iLineNoCount / iLineNoCount) * 100
|
|
1365 |
'SetProgressbar(ProgressBar_Status, dCalcProgressValue)
|
|
1366 |
Next |
|
1329 | 1367 |
|
1330 |
End If |
|
1331 | 1368 |
End If |
1369 |
End If |
|
1332 | 1370 |
|
1333 | 1371 |
Next |
1334 | 1372 |
|
... | ... | |
1344 | 1382 |
End Function |
1345 | 1383 |
|
1346 | 1384 |
|
1347 |
'Private Function GetModelingTable() As DataTable |
|
1348 |
' Dim oModeling_Dt As DataTable = Modeling_Dt() |
|
1349 |
|
|
1350 |
|
|
1351 |
' 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 | 1385 |
|
1384 | 1386 |
Private Sub ThreadTask() |
1385 | 1387 |
|
... | ... | |
1390 | 1392 |
|
1391 | 1393 |
|
1392 | 1394 |
|
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 |
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 | 1395 |
|
1443 | 1396 |
Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
1444 | 1397 |
Dim oRows As DataRow() = oDt.Select("[Name] = '" & sDwgName & "'") |
... | ... | |
1449 | 1402 |
Return oPath |
1450 | 1403 |
End Function |
1451 | 1404 |
|
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 |
Try |
|
1460 |
_Main_trd.Abort() |
|
1461 |
Catch ex As Exception |
|
1462 |
|
|
1463 |
End Try |
|
1464 |
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 |
Private Sub TestLineToolStripMenuItem_Click(sender As Object, e As EventArgs) |
|
1471 |
|
|
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 |
|
|
1553 |
|
|
1554 |
'OPC |
|
1555 |
|
|
1556 |
|
|
1557 |
'Valve |
|
1558 |
|
|
1559 |
|
|
1560 |
|
|
1561 |
|
|
1562 |
|
|
1563 |
End Sub |
|
1564 |
|
|
1565 |
Private Sub ToolStripDropDownButton1_Click(sender As Object, e As EventArgs) |
|
1566 |
|
|
1567 |
End Sub |
|
1568 |
|
|
1569 | 1405 |
Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
1570 |
'Dim oOpen_Xml = New LoadXml() |
|
1571 |
'oOpen_Xml = New LoadXml() |
|
1572 |
'oOpen_Xml.ShowDialog() |
|
1573 |
'_XMLList = oOpen_Xml.GetCheckList() |
|
1574 |
'LoadXmlItem() |
|
1575 |
|
|
1576 | 1406 |
If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
1577 | 1407 |
LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
1578 | 1408 |
End If |
1579 |
|
|
1580 | 1409 |
End Sub |
1581 | 1410 |
Private Sub LoadXmlItem(ByVal sFolderPath As String) |
1582 | 1411 |
_DrawingsList = New List(Of Drawing) |
... | ... | |
1597 | 1426 |
End If |
1598 | 1427 |
End Sub |
1599 | 1428 |
|
1600 |
Private Sub LoadXmlItem() |
|
1601 |
_DrawingsList = New List(Of Drawing) |
|
1602 |
|
|
1603 |
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 |
Dim sDwgPath As String = _XMLList.CheckedItems(i).Name |
|
1609 |
Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
|
1610 |
Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
|
1611 |
_DrawingsList.Add(oDwg) |
|
1612 |
Next |
|
1613 |
Tree_Result.Nodes(0).Expand() |
|
1614 |
End If |
|
1615 |
|
|
1616 |
End Sub |
|
1617 | 1429 |
|
1618 | 1430 |
''' <summary> |
1619 | 1431 |
''' XML Tree 구조 생성 |
... | ... | |
1643 | 1455 |
Next |
1644 | 1456 |
Next |
1645 | 1457 |
|
1646 |
|
|
1647 |
'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 |
|
|
1658 |
' Dim oDistinct_Class_Dt As DataTable = oSelectNameRows.CopyToDataTable.DefaultView.ToTable(True, "Class") |
|
1659 |
' 'Class 별 |
|
1660 |
' For Each oClassRow In oDistinct_Class_Dt.Rows |
|
1661 |
|
|
1662 |
' 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 | 1458 |
Return oDwg_Ds |
1682 | 1459 |
End Function |
1683 |
|
|
1684 |
Private Sub Tree_Result_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterSelect |
|
1685 |
|
|
1686 |
End Sub |
|
1687 |
''' <summary> |
|
1688 |
''' Parent 노트 선택시 일괄 체크,해제 |
|
1689 |
''' </summary> |
|
1690 |
''' <param name="sender"></param> |
|
1691 |
''' <param name="e"></param> |
|
1692 | 1460 |
Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
1693 | 1461 |
If e.Node.Checked = True Then |
1694 | 1462 |
For Each oNode As TreeNode In e.Node.Nodes |
내보내기 Unified diff