개정판 bb2a0c79
reducer 수정
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
386 | 386 |
Dim sUid As String |
387 | 387 |
For Each oSymbol As Object In oEqpNo.Elements(_XML_CATEGORY_SYMBOL) |
388 | 388 |
Try |
389 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
|
389 |
Dim oAddrow As DataRow = oSymbol_Dt.NewRow()
|
|
390 | 390 |
Dim oEleObj As XElement |
391 | 391 |
Dim sName As String |
392 | 392 |
Dim sLocation As String |
393 | 393 |
Dim sSize As String |
394 | 394 |
Dim sAngle As String |
395 |
Dim sOriginalPoint As String = "" |
|
395 |
Dim sOriginalPoint As String = ""
|
|
396 | 396 |
Dim sConnectionPoint As String = "" |
397 | 397 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
398 | 398 |
sUid = oEleObj.Value |
... | ... | |
533 | 533 |
Dim sSize As String |
534 | 534 |
Dim sAngle As String |
535 | 535 |
Dim sOriginalPoint As String = "" |
536 |
Dim sConnectionPoint As String = "" |
|
536 | 537 |
oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
537 | 538 |
sUid = oEleObj.Value |
538 | 539 |
oEleObj = oSymbol.Element(_XML_SYMBOL_PARENT) |
... | ... | |
543 | 544 |
sSize = oEleObj.Value |
544 | 545 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
545 | 546 |
sAngle = oEleObj.Value |
547 |
oEleObj = oSymbol.Element(_XML_SYMBOL_CONNECTIONPOINT) |
|
548 |
sConnectionPoint = oEleObj.Value |
|
546 | 549 |
Try |
547 | 550 |
oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
548 | 551 |
sOriginalPoint = oEleObj.Value |
... | ... | |
559 | 562 |
oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
560 | 563 |
oAddrow(_XML_SYMBOL_CLASS) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_CLASS) |
561 | 564 |
oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
565 |
oAddrow(_XML_SYMBOL_CONNECTIONPOINT) = sConnectionPoint |
|
562 | 566 |
oAddrow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
563 | 567 |
oSymbol_Dt.Rows.Add(oAddrow) |
564 | 568 |
Catch ex As Exception |
... | ... | |
1301 | 1305 |
End Function |
1302 | 1306 |
|
1303 | 1307 |
|
1304 |
Private Function GetOnlyPipeLineNo(ByVal CDrawing As Drawing, ByVal sPipeUid As String) As Line_no |
|
1308 |
|
|
1309 |
Private Function GetPipeFromConnection(ByVal CDrawing As Drawing, ByVal sSymbolUid As String, ByRef sConnTypeNo As String) As DataTable |
|
1305 | 1310 |
For Each CLineNo In CDrawing.Line_nos |
1306 | 1311 |
Dim odt As DataTable = CLineNo.Dt_Line |
1307 | 1312 |
If odt.Rows.Count > 0 Then |
1308 |
If odt.Rows(0)(_XML_LINE_UID).ToString = sPipeUid Then |
|
1309 |
Return CLineNo |
|
1313 |
If odt.Rows(0)(_XML_LINE_Conn1_Uid).ToString = sSymbolUid Then |
|
1314 |
sConnTypeNo = "1" |
|
1315 |
Return odt |
|
1316 |
ElseIf odt.Rows(0)(_XML_LINE_Conn2_Uid).ToString() = sSymbolUid Then |
|
1317 |
sConnTypeNo = "2" |
|
1318 |
Return odt |
|
1310 | 1319 |
End If |
1311 | 1320 |
End If |
1312 | 1321 |
Next |
1313 |
Return Nothing
|
|
1322 |
Return New DataTable
|
|
1314 | 1323 |
End Function |
1315 | 1324 |
|
1325 |
Private Function GetSymbolFromConnection(ByVal CDrawing As Drawing, ByVal sSymbolUid As String, ByRef sConnTypeNo As String) As DataTable |
|
1326 |
For Each CLineNo In CDrawing.Line_nos |
|
1327 |
Dim odt As DataTable = CLineNo.Dt_Symbol |
|
1328 |
If odt.Rows.Count > 0 Then |
|
1329 |
If odt.Rows(0)(_XML_SYMBOL_Conn1_Uid).ToString = sSymbolUid Then |
|
1330 |
sConnTypeNo = "1" |
|
1331 |
Return odt |
|
1332 |
ElseIf odt.Rows(0)(_XML_SYMBOL_Conn2_Uid).ToString() = sSymbolUid Then |
|
1333 |
sConnTypeNo = "2" |
|
1334 |
Return odt |
|
1335 |
ElseIf odt.Rows(0)(_XML_SYMBOL_Conn3_Uid).ToString() = sSymbolUid Then |
|
1336 |
sConnTypeNo = "3" |
|
1337 |
Return odt |
|
1338 |
ElseIf odt.Rows(0)(_XML_SYMBOL_Conn4_Uid).ToString() = sSymbolUid Then |
|
1339 |
sConnTypeNo = "4" |
|
1340 |
Return odt |
|
1341 |
End If |
|
1342 |
End If |
|
1343 |
Next |
|
1344 |
Return New DataTable |
|
1345 |
End Function |
|
1316 | 1346 |
|
1317 | 1347 |
Private Function GetEqpNo(ByVal CDrawing As Drawing, ByVal sEqpUid As String) As Eqp_no |
1318 | 1348 |
For Each CEqpNo In CDrawing.Eqp_nos |
... | ... | |
1572 | 1602 |
|
1573 | 1603 |
End Sub |
1574 | 1604 |
|
1575 |
Private Sub PlacePipingOPC(ByVal sUid As String, ByVal sLineUid As String, ByVal oOPCRow As DataRow, ByVal oAttribute_Dt As DataTable)
|
|
1605 |
Private Function PlacePipingOPC(ByVal sUid As String, ByVal sLineUid As String, ByVal oOPCRow As DataRow, ByVal oAttribute_Dt As DataTable) As LMSymbol
|
|
1576 | 1606 |
Try |
1577 | 1607 |
Dim oAttributeRow() As DataRow |
1578 | 1608 |
If oAttribute_Dt.Rows.Count > 0 Then |
... | ... | |
1593 | 1623 |
Dim dLocationY As Double = 0.0 |
1594 | 1624 |
Dim dX As Double = 0.0 |
1595 | 1625 |
Dim dY As Double = 0.0 |
1596 |
|
|
1626 |
Dim oLMSymbol As LMSymbol = Nothing |
|
1597 | 1627 |
If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
1598 | 1628 |
dX = dLocationX |
1599 | 1629 |
dY = dLocationY |
1600 | 1630 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
1601 | 1631 |
_iPipintOpccnt = _iPipintOpccnt + 1 |
1602 |
Dim oLMSymbol As LMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle)
|
|
1632 |
oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle)
|
|
1603 | 1633 |
'모델링된 형상은 Drawing True 로 처리 |
1604 |
oOPCRow(_XML_SYMBOL_DRAWING_TF) = "True"
|
|
1634 |
oOPCRow(_XML_SYMBOL_DRAWING_TF) = "TRUE"
|
|
1605 | 1635 |
SetListBoxItems(ListBox_Result, "Place Piping OPC..(" & dLocationX & "," & dLocationY & ")..." & _iPipintOpccnt & " count ") |
1606 | 1636 |
|
1607 | 1637 |
Dim dConn_X1 As Double, dConn_Y1 As Double, dConn_X2 As Double, dConn_Y2 As Double |
1608 | 1638 |
_Placement.PIDConnectPointLocation(oLMSymbol, 1, dConn_X1, dConn_Y1) |
1609 | 1639 |
_Placement.PIDConnectPointLocation(oLMSymbol, 2, dConn_X2, dConn_Y2) |
1610 | 1640 |
|
1611 |
Dim oAddrow As DataRow = _ResultModeling_DT.NewRow() |
|
1612 |
oAddrow(_Modeling_Uid) = sUid |
|
1613 |
oAddrow(_Modeling_Location_X) = dLocationX |
|
1614 |
oAddrow(_Modeling_Location_Y) = dLocationY |
|
1615 |
oAddrow(_Modeling_LineNoUid) = sLineUid |
|
1616 |
oAddrow(_Modeling_Type) = sSymbolCompType |
|
1617 |
oAddrow(_Modeling_Connection1_X) = dConn_X1 |
|
1618 |
oAddrow(_Modeling_Connection1_Y) = dConn_Y1 |
|
1619 |
oAddrow(_Modeling_Connection2_X) = dConn_X2 |
|
1620 |
oAddrow(_Modeling_Connection2_X) = dConn_Y2 |
|
1621 |
oAddrow(_Modeling_LMSymbol) = oLMSymbol |
|
1622 |
_ResultModeling_DT.Rows.Add(oAddrow) |
|
1641 |
'Dim oAddrow As DataRow = _ResultModeling_DT.NewRow() |
|
1642 |
'oAddrow(_Modeling_Uid) = sUid |
|
1643 |
'oAddrow(_Modeling_Location_X) = dLocationX |
|
1644 |
'oAddrow(_Modeling_Location_Y) = dLocationY |
|
1645 |
'oAddrow(_Modeling_LineNoUid) = sLineUid |
|
1646 |
'oAddrow(_Modeling_Type) = sSymbolCompType |
|
1647 |
'oAddrow(_Modeling_Connection1_X) = dConn_X1 |
|
1648 |
'oAddrow(_Modeling_Connection1_Y) = dConn_Y1 |
|
1649 |
'oAddrow(_Modeling_Connection2_X) = dConn_X2 |
|
1650 |
'oAddrow(_Modeling_Connection2_X) = dConn_Y2 |
|
1651 |
'oAddrow(_Modeling_LMSymbol) = oLMSymbol |
|
1652 |
|
|
1653 |
'_ResultModeling_DT.Rows.Add(oAddrow) |
|
1623 | 1654 |
End If |
1624 | 1655 |
_Itemcnt = _Itemcnt + 1 |
1625 | 1656 |
Dim dCalcProgressValue As Double = (_Itemcnt / _allItem) * 100 |
1626 | 1657 |
SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
1627 | 1658 |
Label_Progress.Text = Math.Round(dCalcProgressValue, 0) & "%" |
1628 |
|
|
1659 |
Return oLMSymbol |
|
1629 | 1660 |
Catch ex As Exception |
1630 | 1661 |
|
1631 | 1662 |
End Try |
1663 |
Return Nothing |
|
1632 | 1664 |
|
1633 |
|
|
1634 |
End Sub |
|
1665 |
End Function |
|
1635 | 1666 |
|
1636 | 1667 |
|
1637 | 1668 |
Private Function DrawSymbol(ByVal sUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oLine_Dt As DataTable) As Boolean |
... | ... | |
2178 | 2209 |
Next |
2179 | 2210 |
End Sub |
2180 | 2211 |
|
2181 |
Private Sub PipingOPCModeling(ByVal oDwg_Dt As DataTable) |
|
2212 |
Private Sub ManualCheckNode(ByRef oDt As DataTable) |
|
2213 |
For Each oDrwing As TreeNode In Tree_Result.Nodes |
|
2214 |
For Each oDwgNode As TreeNode In oDrwing.Nodes |
|
2215 |
For Each oNode As TreeNode In oDwgNode.Nodes |
|
2216 |
For Each oSymbolNode As TreeNode In oNode.Nodes |
|
2217 |
Dim sUid As String = oSymbolNode.Name |
|
2218 |
Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & "'") |
|
2219 |
If oSelectRows.Length = 1 Then |
|
2220 |
If oSymbolNode.Checked Then |
|
2221 |
oSelectRows(0)(_XML_SYMBOL_Check) = "TRUE" |
|
2222 |
Else |
|
2223 |
oSelectRows(0)(_XML_SYMBOL_Check) = "FALSE" |
|
2224 |
End If |
|
2225 |
End If |
|
2226 |
|
|
2227 |
Next |
|
2228 |
Next |
|
2229 |
Next |
|
2230 |
Next |
|
2231 |
|
|
2232 |
End Sub |
|
2233 |
|
|
2234 |
Private Sub PipingModeling() |
|
2182 | 2235 |
|
2183 | 2236 |
Try |
2184 | 2237 |
For Each oDrwing As TreeNode In Tree_Result.Nodes |
... | ... | |
2205 | 2258 |
Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
2206 | 2259 |
Dim oDrawLinenoLabel As Boolean = False |
2207 | 2260 |
|
2261 |
ManualCheckNode(oLine_Dt) |
|
2262 |
ManualCheckNode(oSymbol_Dt) |
|
2263 |
|
|
2208 | 2264 |
For Each oSymbolNode As TreeNode In oNode.Nodes |
2209 | 2265 |
If oSymbolNode.Checked Then |
2210 | 2266 |
Dim sUid As String = oSymbolNode.Name |
2211 |
Dim oOpc_Rows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sUid & "'") |
|
2267 |
Dim oOpc_Rows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sUid & "' And [" & |
|
2268 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2212 | 2269 |
If oOpc_Rows.Length = 1 Then |
2213 | 2270 |
If oOpc_Rows(0)(_XML_SYMBOL_TYPE) = _XML_PIPINGOPC Then |
2214 |
PlacePipingOPC(sUid, CLineNo.Uid, oOpc_Rows(0), oAttribute_Dt) |
|
2271 |
Dim oOPCSymbol As LMSymbol = PlacePipingOPC(sUid, CLineNo.Uid, oOpc_Rows(0), oAttribute_Dt)
|
|
2215 | 2272 |
iPipingOPC_count = iPipingOPC_count + 1 |
2273 |
OPCTOLineRouting(oLine_Dt, oAttribute_Dt, oOPCSymbol, sUid, CLineNo.Uid) |
|
2274 |
' LineRouting(oLine_Dt, oAttribute_Dt, CLineNo.Uid) |
|
2275 |
' SymbolModeling(oSymbol_Dt, oAttribute_Dt, CLineNo.Uid) |
|
2216 | 2276 |
End If |
2217 |
|
|
2218 | 2277 |
End If |
2219 | 2278 |
End If |
2220 | 2279 |
Next |
2221 |
|
|
2280 |
For Each oSymbolNode As TreeNode In oNode.Nodes |
|
2281 |
If oSymbolNode.Checked Then |
|
2282 |
Dim sUid As String = oSymbolNode.Name |
|
2283 |
LineRouting(oLine_Dt, oAttribute_Dt, CLineNo.Uid) |
|
2284 |
End If |
|
2285 |
Next |
|
2286 |
For Each oSymbolNode As TreeNode In oNode.Nodes |
|
2287 |
If oSymbolNode.Checked Then |
|
2288 |
Dim sUid As String = oSymbolNode.Name |
|
2289 |
Dim oSymbolRow As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
|
2290 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2291 |
If oSymbolRow.Length = 1 Then |
|
2292 |
' SymbolModeling(oSymbol_Dt, oAttribute_Dt, CLineNo.Uid, oSymbolRow(0)) |
|
2293 |
SymbolModeling(CDrawing, oSymbolRow(0), oAttribute_Dt) |
|
2294 |
End If |
|
2295 |
End If |
|
2296 |
Next |
|
2222 | 2297 |
End If |
2223 | 2298 |
Next |
2224 | 2299 |
End If |
... | ... | |
2229 | 2304 |
End Try |
2230 | 2305 |
End Sub |
2231 | 2306 |
|
2232 |
Private Function CheckOPCConnectionLine(ByVal oOpcRow As DataRow, ByVal oLine_Dt As DataTable) As String |
|
2233 |
Dim sLineUid As String = "" |
|
2307 |
|
|
2308 |
Private Sub FindNearPoint(ByVal oOPCSymbol As LMSymbol, ByRef dNear_x As Double, ByRef dNear_y As Double) |
|
2309 |
Dim oConnectionPoints_x(4) As Double |
|
2310 |
Dim oConnectionPoints_y(4) As Double |
|
2311 |
|
|
2234 | 2312 |
Try |
2313 |
_Placement.PIDConnectPointLocation(oOPCSymbol, 1, oConnectionPoints_x(0), oConnectionPoints_y(0)) |
|
2314 |
_Placement.PIDConnectPointLocation(oOPCSymbol, 2, oConnectionPoints_x(1), oConnectionPoints_y(1)) |
|
2315 |
_Placement.PIDConnectPointLocation(oOPCSymbol, 3, oConnectionPoints_x(2), oConnectionPoints_y(2)) |
|
2316 |
_Placement.PIDConnectPointLocation(oOPCSymbol, 4, oConnectionPoints_x(3), oConnectionPoints_y(3)) |
|
2317 |
Dim iNearPoint As Integer = 0 |
|
2318 |
Dim dGap As Double = 0 |
|
2319 |
For i = 0 To 3 |
|
2320 |
If dGap = 0 Then |
|
2321 |
iNearPoint = i |
|
2322 |
dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
|
2323 |
Else |
|
2324 |
If dGap >= Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) Then |
|
2325 |
iNearPoint = i |
|
2326 |
dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
|
2327 |
End If |
|
2328 |
End If |
|
2329 |
Next |
|
2330 |
dNear_x = oConnectionPoints_x(iNearPoint) |
|
2331 |
dNear_y = oConnectionPoints_y(iNearPoint) |
|
2332 |
Catch ex As Exception |
|
2235 | 2333 |
|
2236 |
For Each oLinerow In oLine_Dt.Rows
|
|
2334 |
End Try
|
|
2237 | 2335 |
|
2238 |
Dim oOpcConn_x1 As Double = oOpcRow(_Modeling_Connection1_X) |
|
2239 |
Dim oOpcConn_y1 As Double = oOpcRow(_Modeling_Connection1_Y) |
|
2240 |
Dim oOpcConn_x2 As Double = oOpcRow(_Modeling_Connection2_X) |
|
2241 |
Dim oOpcConn_y2 As Double = oOpcRow(_Modeling_Connection2_Y) |
|
2242 |
Dim oAngle As Double = oOpcRow(_Modeling_Angle) |
|
2243 |
Dim dOriginalStart_x As Double = 0.0 |
|
2244 |
Dim dOriginalStart_y As Double = 0.0 |
|
2245 |
Dim dOriginalEnd_x As Double = 0.0 |
|
2246 |
Dim dOriginalEnd_y As Double = 0.0 |
|
2247 |
Dim dStart_x As Double = 0.0 |
|
2248 |
Dim dStart_y As Double = 0.0 |
|
2249 |
Dim dEnd_x As Double = 0.0 |
|
2250 |
Dim dEnd_y As Double = 0.0 |
|
2251 |
Dim sStartpoint As String = oLinerow(_XML_LINE_STARTPOINT).ToString() |
|
2252 |
Dim sEndpoint As String = oLinerow(_XML_LINE_ENDPOINT).ToString() |
|
2253 |
Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
|
2336 |
End Sub |
|
2337 |
|
|
2338 |
Private Function GetPipeType(ByVal sType As String) As String |
|
2339 |
Dim sSystempath As String = "\Piping\Routing\Process Lines\Primary Piping.sym" ' oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
|
2340 |
If sType.ToUpper() = "ELECTRIC" Then |
|
2341 |
sSystempath = "\Instrumentation\Signal Line\Electric.sym" |
|
2342 |
ElseIf sType.ToUpper() = "CONNECT TO PROCESS" Then |
|
2343 |
sSystempath = "\Instrumentation\Signal Line\Connect to Process.sym" |
|
2344 |
Else |
|
2345 |
End If |
|
2346 |
Return sSystempath |
|
2347 |
End Function |
|
2348 |
|
|
2349 |
Private Sub InitAutoRouting() |
|
2350 |
For Each oDrwing As TreeNode In Tree_Result.Nodes |
|
2351 |
For Each oDwgNode As TreeNode In oDrwing.Nodes |
|
2352 |
Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
|
2353 |
Dim CDrawing As Drawing = GetDrawing(sDwgName) |
|
2354 |
If CDrawing IsNot Nothing Then |
|
2355 |
Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
|
2356 |
Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
|
2357 |
SetListBoxItems(ListBox_Result, "Place " & CDrawing.DwgName & "....") |
|
2358 |
For Each oNode As TreeNode In oDwgNode.Nodes |
|
2359 |
Dim iItemcnt As Integer = 0 |
|
2360 |
Dim sNodeUid As String = oNode.Name |
|
2361 |
Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
|
2362 |
Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
|
2363 |
If CLineNo IsNot Nothing Then |
|
2364 |
Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
|
2365 |
Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
|
2366 |
|
|
2367 |
For Each oLineRow In oLine_Dt.Rows |
|
2368 |
oLineRow(_XML_LINE_SPID) = "" |
|
2369 |
oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
|
2370 |
Next |
|
2371 |
For Each oSymbolRow In oSymbol_Dt.Rows |
|
2372 |
oSymbolRow(_XML_SYMBOL_SPID) = "" |
|
2373 |
oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
|
2374 |
Next |
|
2375 |
|
|
2376 |
End If |
|
2377 |
Next |
|
2378 |
End If |
|
2379 |
Next |
|
2380 |
Next |
|
2381 |
End Sub |
|
2382 |
|
|
2383 |
|
|
2384 |
|
|
2385 |
|
|
2386 |
|
|
2387 |
|
|
2388 |
Private Function CheckBranchLine(ByVal oLine_Dt As DataTable, ByVal dStartX As Double, ByVal dStartY As Double, |
|
2389 |
ByRef dEndX As Double, ByRef dEndY As Double, ByRef sBranchType As String, ByRef oLMConnector As LMConnector) As Boolean |
|
2390 |
|
|
2391 |
Try |
|
2392 |
Dim oModelingLineRows() As DataRow = oLine_Dt.Select("[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And [" & _XML_LINE_SPID & "] <> ''") |
|
2393 |
For Each oModelrow In oModelingLineRows |
|
2394 |
Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
|
2395 |
Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
|
2396 |
Dim dModelStartX As Double |
|
2397 |
Dim dModelStartY As Double |
|
2398 |
Dim dModelEndX As Double |
|
2399 |
Dim dModelEndY As Double |
|
2400 |
ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
|
2401 |
ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
|
2402 |
ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
|
2403 |
ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
|
2404 |
Dim dGap As Double = 0.0002 |
|
2405 |
Dim d기준x As Double = (dModelStartX + dModelEndX) / 2 |
|
2406 |
Dim d기준y As Double = (dModelStartY + dModelEndY) / 2 |
|
2407 |
Try |
|
2408 |
oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
|
2409 |
Catch ex As Exception |
|
2410 |
|
|
2411 |
End Try |
|
2412 |
Dim oRun As LMPipeRun = Nothing |
|
2413 |
Try |
|
2414 |
|
|
2415 |
oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
|
2416 |
Dim dResultCalc As Double = -1 |
|
2417 |
For Each objRep In oRun.Representations |
|
2418 |
If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
|
2419 |
Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
|
2420 |
For Each objConnectorVertex In objConnector.ConnectorVertices |
|
2421 |
Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
|
2422 |
Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
|
2423 |
Dim dStartCalc As Double = Math.Abs(dStartX - dConn_X) + Math.Abs(dStartY - dConn_Y) |
|
2424 |
|
|
2425 |
If dResultCalc > dStartCalc Or dResultCalc = -1 Then |
|
2426 |
dResultCalc = dStartCalc |
|
2427 |
oLMConnector = objConnector |
|
2428 |
d기준x = dConn_X |
|
2429 |
d기준y = dConn_Y |
|
2430 |
End If |
|
2431 |
Dim dEndCalc As Double = Math.Abs(dEndX - dConn_X) + Math.Abs(dEndY - dConn_Y) |
|
2432 |
If dResultCalc > dEndCalc Then |
|
2433 |
dResultCalc = dEndCalc |
|
2434 |
oLMConnector = objConnector |
|
2435 |
d기준x = dConn_X |
|
2436 |
d기준y = dConn_Y |
|
2437 |
End If |
|
2438 |
Next |
|
2439 |
End If |
|
2440 |
Next |
|
2441 |
' _Placement.PIDConnectPointLocation(oRun, 1, dModelStartX, dModelEndX) |
|
2442 |
' _Placement.PIDConnectPointLocation(oRun, 2, dModelEndX, dModelEndY) |
|
2443 |
Catch ex As Exception |
|
2444 |
End Try |
|
2445 |
|
|
2446 |
|
|
2447 |
'Dim sSPID As String = oModelrow(_XML_LINE_SPID).ToString() |
|
2448 |
'Dim oPipeRun As LMPipeRun = _Placement.PIDDataSource.Get PipeRun(sSPID) |
|
2449 |
'If dModelStartX + dGap > dStartX And dModelStartX - dGap < dStartX And |
|
2450 |
' dModelStartY + dGap > dStartY And dModelStartY - dGap < dStartY Then |
|
2451 |
' dStartX = dModelStartX |
|
2452 |
' dStartY = dModelStartY |
|
2453 |
'ElseIf dModelEndX + dGap > dStartX And dModelEndX - dGap < dStartX And |
|
2454 |
' dModelEndY + dGap > dStartY And dModelEndY - dGap < dStartY Then |
|
2455 |
' dStartX = dModelEndX |
|
2456 |
' dStartY = dModelEndY |
|
2457 |
'End If |
|
2458 |
|
|
2459 |
'Vetical |
|
2460 |
If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
|
2461 |
If Math.Abs(dStartX - dEndX) >= Math.Abs(dStartY - dEndY) Then |
|
2462 |
'Horizontal |
|
2463 |
' dGap = 0.0002 'Math.Abs(dStartX - dEndX) / 20 |
|
2464 |
'기준선의 Y범위안에 가로선이 포함되어야됨 |
|
2465 |
If (dModelStartY + dGap >= dStartY And dModelEndY - dGap <= dStartY) Or |
|
2466 |
(dModelStartY - dGap <= dStartY And dModelEndY + dGap >= dStartY) And |
|
2467 |
(dModelStartY + dGap >= dEndY And dModelEndY - dGap <= dEndY) Or |
|
2468 |
(dModelStartY - dGap <= dEndY And dModelEndY + dGap >= dEndY) Then |
|
2469 |
'기준선보다 왼쪽에 가로선이 있을때 |
|
2470 |
If d기준x >= dStartX And d기준x >= dEndX Then |
|
2471 |
If dStartX >= dEndX Then |
|
2472 |
'dStartX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
|
2473 |
If dStartX + dGap >= d기준x Then |
|
2474 |
dStartX = d기준x |
|
2475 |
sBranchType = "1" |
|
2476 |
Return True |
|
2477 |
End If |
|
2478 |
Else |
|
2479 |
'dEndX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
|
2480 |
If dEndX + dGap >= d기준x Then |
|
2481 |
dEndX = d기준x |
|
2482 |
sBranchType = "2" |
|
2483 |
Return True |
|
2484 |
End If |
|
2485 |
End If |
|
2486 |
'기준선보다 오른쪽에 가로선이 있을때 |
|
2487 |
ElseIf d기준x <= dStartX And d기준x <= dEndX Then |
|
2488 |
If dStartX >= dEndX Then |
|
2489 |
'dEndX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
|
2490 |
If dEndX - dGap <= d기준x Then |
|
2491 |
dEndX = d기준x |
|
2492 |
sBranchType = "2" |
|
2493 |
Return True |
|
2494 |
End If |
|
2495 |
Else |
|
2496 |
'dStartX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
|
2497 |
If dStartX - dGap <= d기준x Then |
|
2498 |
dStartX = d기준x |
|
2499 |
sBranchType = "1" |
|
2500 |
Return True |
|
2501 |
End If |
|
2502 |
End If |
|
2503 |
Else |
|
2504 |
'기준선과 세로선이 겹칠때 |
|
2505 |
If (d기준x >= dStartX And d기준x <= dEndX) Or |
|
2506 |
(d기준x <= dStartX And d기준x >= dEndX) Then |
|
2507 |
If (dModelStartY <= dStartY And dModelEndY >= dEndY) Or |
|
2508 |
(dModelStartY >= dStartY And dModelEndY <= dEndY) Then |
|
2509 |
'기준선이 dStartX와 dEndX중 어느쪽에 가까운지 확인 |
|
2510 |
'가로선의 왼쪽점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
|
2511 |
'가로선의 오른쪽점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
|
2512 |
If Math.Abs(d기준x - dStartX) >= Math.Abs(d기준x - dEndX) Then |
|
2513 |
'EndX점이 기준선과 더 가까이 있음 |
|
2514 |
If dStartX >= dEndX Then |
|
2515 |
'가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
|
2516 |
If dEndX - dGap <= d기준x Then |
|
2517 |
dEndX = d기준x |
|
2518 |
sBranchType = "4" |
|
2519 |
Return True |
|
2520 |
End If |
|
2521 |
Else |
|
2522 |
'가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
|
2523 |
If dEndX + dGap >= d기준x Then |
|
2524 |
dEndX = d기준x |
|
2525 |
sBranchType = "4" |
|
2526 |
Return True |
|
2527 |
End If |
|
2528 |
|
|
2529 |
End If |
|
2530 |
Else |
|
2531 |
'dStartX점이 기준선과 더 가까이 있음 |
|
2532 |
If dStartX >= dEndX Then |
|
2533 |
'가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
|
2534 |
If dStartX + dGap >= d기준x Then |
|
2535 |
dStartX = d기준x |
|
2536 |
sBranchType = "3" |
|
2537 |
Return True |
|
2538 |
End If |
|
2539 |
|
|
2540 |
Else |
|
2541 |
'가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
|
2542 |
If dStartX - dGap <= d기준x Then |
|
2543 |
dStartX = d기준x |
|
2544 |
sBranchType = "3" |
|
2545 |
Return True |
|
2546 |
End If |
|
2547 |
End If |
|
2548 |
End If |
|
2549 |
End If |
|
2550 |
|
|
2551 |
End If |
|
2552 |
End If |
|
2553 |
End If |
|
2554 |
|
|
2555 |
End If |
|
2556 |
Else |
|
2557 |
'Horizontal |
|
2558 |
If Math.Abs(dModelStartX - dModelEndX) >= Math.Abs(dModelStartY - dModelEndY) Then |
|
2559 |
'Vertical |
|
2560 |
If Math.Abs(dStartX - dEndX) <= Math.Abs(dStartY - dEndY) Then |
|
2561 |
' dGap = 0.0015 'Math.Abs(dStartY - dEndY) / 80 |
|
2562 |
|
|
2563 |
'기준선의 X범위안에 세로선이 포함되어야됨 |
|
2564 |
If ((dModelStartX + dGap >= dStartX And dModelEndX - dGap <= dStartX) Or |
|
2565 |
(dModelStartX - dGap <= dStartX And dModelEndX + dGap >= dStartX)) And |
|
2566 |
((dModelStartX + dGap >= dEndX And dModelEndX - dGap <= dEndX) Or |
|
2567 |
(dModelStartX - dGap <= dEndX And dModelEndX + dGap >= dEndX)) Then |
|
2568 |
|
|
2569 |
|
|
2570 |
'가로선보다 아래에 세로선이 있을때 |
|
2571 |
If d기준y >= dStartY And d기준y >= dEndY Then |
|
2572 |
If dStartY >= dEndY Then |
|
2573 |
'dStartY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
|
2574 |
If dStartY + dGap >= d기준y Then |
|
2575 |
dStartY = d기준y |
|
2576 |
sBranchType = "3" |
|
2577 |
Return True |
|
2578 |
End If |
|
2579 |
Else |
|
2580 |
'dEndY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
|
2581 |
If dEndY + dGap >= d기준y Then |
|
2582 |
dEndY = d기준y |
|
2583 |
|
|
2584 |
If Math.Abs(dEndX - dModelStartX) > Math.Abs(dEndX - dModelEndX) Then |
|
2585 |
dEndX = dModelEndX |
|
2586 |
Else |
|
2587 |
dEndX = dModelStartX |
|
2588 |
End If |
|
2589 |
|
|
2590 |
sBranchType = "4" |
|
2591 |
Return True |
|
2592 |
End If |
|
2593 |
End If |
|
2594 |
'기준선보다 위에 세로선이 있을때 |
|
2595 |
ElseIf d기준y <= dStartY And d기준y <= dEndY Then |
|
2596 |
If dStartY >= dEndY Then |
|
2597 |
'dEndY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
|
2598 |
If dEndY - dGap <= d기준y Then |
|
2599 |
dEndY = d기준y |
|
2600 |
sBranchType = "4" |
|
2601 |
Return True |
|
2602 |
End If |
|
2603 |
Else |
|
2604 |
'dStartY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
|
2605 |
If dStartY - dGap <= d기준y Then |
|
2606 |
dStartY = d기준y |
|
2607 |
sBranchType = "3" |
|
2608 |
Return True |
|
2609 |
End If |
|
2610 |
End If |
|
2611 |
Else |
|
2612 |
'기준선과 세로선이 겹칠때 |
|
2613 |
If (d기준y >= dStartY And d기준y <= dEndY) Or |
|
2614 |
(d기준y <= dStartY And d기준y >= dEndY) Then |
|
2615 |
'기준선이 dStartY와 dEndY중 어느쪽에 가까운지 확인 |
|
2616 |
'세로선의 윗점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
|
2617 |
'세로선의 아래점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
|
2618 |
If (dModelStartX <= dStartX And dModelEndX >= dEndX) Or |
|
2619 |
(dModelStartX >= dStartX And dModelEndX <= dEndX) Then |
|
2620 |
If Math.Abs(d기준y - dStartY) >= Math.Abs(d기준y - dEndY) Then |
|
2621 |
'Endy점이 기준선과 더 가까이 있음 |
|
2622 |
If dStartY >= dEndY Then |
|
2623 |
'세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
|
2624 |
If dEndY + dGap >= d기준y Then |
|
2625 |
dEndY = d기준y |
|
2626 |
sBranchType = "4" |
|
2627 |
Return True |
|
2628 |
End If |
|
2629 |
Else |
|
2630 |
'세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
|
2631 |
If dEndY - dGap <= d기준y Then |
|
2632 |
dEndY = d기준y |
|
2633 |
sBranchType = "4" |
|
2634 |
Return True |
|
2635 |
End If |
|
2636 |
End If |
|
2637 |
Else |
|
2638 |
'dStartY점이 기준선과 더 가까이 있음 |
|
2639 |
If dStartY >= dEndY Then |
|
2640 |
'세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
|
2641 |
If dStartY - dGap <= d기준y Then |
|
2642 |
dStartY = d기준y |
|
2643 |
sBranchType = "3" |
|
2644 |
Return True |
|
2645 |
End If |
|
2646 |
Else |
|
2647 |
'세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
|
2648 |
If dStartY + dGap >= d기준y Then |
|
2649 |
dStartY = d기준y |
|
2650 |
sBranchType = "3" |
|
2651 |
Return True |
|
2652 |
End If |
|
2653 |
End If |
|
2654 |
End If |
|
2655 |
End If |
|
2656 |
|
|
2657 |
End If |
|
2658 |
End If |
|
2659 |
|
|
2660 |
|
|
2661 |
End If |
|
2254 | 2662 |
|
2663 |
End If |
|
2664 |
End If |
|
2665 |
End If |
|
2666 |
Next |
|
2667 |
Catch ex As Exception |
|
2668 |
|
|
2669 |
End Try |
|
2670 |
oLMConnector = Nothing |
|
2671 |
Return False |
|
2672 |
End Function |
|
2673 |
|
|
2674 |
Private Sub OPCTOLineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oOPCSymbol As LMSymbol, |
|
2675 |
ByVal sOPCUid As String, ByVal sLineNoUid As String) |
|
2676 |
Try |
|
2677 |
Dim oDatasource As Object = _Placement.PIDDataSource |
|
2678 |
Dim objItem As LMAItem |
|
2679 |
Dim objConnector As LMConnector |
|
2680 |
Dim objInputs As PlaceRunInputs |
|
2681 |
objInputs = New PlaceRunInputs |
|
2682 |
Dim dOriginalStart_x As Double = 0.0 |
|
2683 |
Dim dOriginalStart_y As Double = 0.0 |
|
2684 |
Dim dOriginalEnd_x As Double = 0.0 |
|
2685 |
Dim dOriginalEnd_y As Double = 0.0 |
|
2686 |
Dim dStart_x As Double = 0.0 |
|
2687 |
Dim dStart_y As Double = 0.0 |
|
2688 |
Dim dEnd_x As Double = 0.0 |
|
2689 |
Dim dEnd_y As Double = 0.0 |
|
2690 |
|
|
2691 |
Dim oPipeRun As LMPipeRun = Nothing |
|
2692 |
Dim sStartpoint As String = "" |
|
2693 |
Dim sEndpoint As String = "" |
|
2694 |
Dim iConnType As Integer = 0 |
|
2695 |
Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sOPCUid + "' And [" & |
|
2696 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2697 |
Dim sPipeUid As String = "" |
|
2698 |
If oPipeRow.Length = 0 Then |
|
2699 |
oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sOPCUid + "' And [" & |
|
2700 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2701 |
Else |
|
2702 |
sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
|
2703 |
iConnType = 1 |
|
2704 |
End If |
|
2705 |
Dim oAddUid_List As New List(Of String) |
|
2706 |
If oPipeRow.Length = 1 Then |
|
2707 |
If sPipeUid = "" Then |
|
2708 |
sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
|
2709 |
iConnType = 2 |
|
2710 |
End If |
|
2711 |
oAddUid_List.Add(sPipeUid) |
|
2712 |
sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
|
2713 |
sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
|
2255 | 2714 |
ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
2256 | 2715 |
dStart_x = dOriginalStart_x |
2257 | 2716 |
dStart_y = dOriginalStart_y |
2258 |
|
|
2259 | 2717 |
ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
2260 | 2718 |
dEnd_x = dOriginalEnd_x |
2261 | 2719 |
dEnd_y = dOriginalEnd_y |
2720 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
2721 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
|
2722 |
|
|
2723 |
'OPC Connection Point가져와서 연결(2018-07-12) |
|
2724 |
If iConnType = 1 Then |
|
2725 |
FindNearPoint(oOPCSymbol, dStart_x, dStart_y) |
|
2726 |
objInputs.AddSymbolTarget(oOPCSymbol, dStart_x, dStart_y) |
|
2727 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2728 |
Else |
|
2729 |
FindNearPoint(oOPCSymbol, dEnd_x, dEnd_y) |
|
2730 |
objInputs.AddSymbolTarget(oOPCSymbol, dEnd_x, dEnd_y) |
|
2731 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2732 |
End If |
|
2733 |
oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
|
2734 |
|
|
2735 |
While True |
|
2736 |
' objInputs.Clear() |
|
2737 |
Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
|
2738 |
"[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
|
2739 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2740 |
If oAddPipeRow.Length = 0 Then |
|
2741 |
oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
|
2742 |
"[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
|
2743 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2744 |
sPipeUid = "" |
|
2745 |
Else |
|
2746 |
iConnType = 1 |
|
2747 |
sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
|
2748 |
End If |
|
2749 |
If oAddPipeRow.Length = 1 Then |
|
2750 |
If sPipeUid = "" Then |
|
2751 |
sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
|
2752 |
iConnType = 2 |
|
2753 |
End If |
|
2754 |
oAddUid_List.Add(sPipeUid) |
|
2755 |
sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
|
2756 |
sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
|
2757 |
ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
|
2758 |
dStart_x = dOriginalStart_x |
|
2759 |
dStart_y = dOriginalStart_y |
|
2760 |
ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
|
2761 |
dEnd_x = dOriginalEnd_x |
|
2762 |
dEnd_y = dOriginalEnd_y |
|
2763 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
2764 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
|
2765 |
If iConnType = 1 Then |
|
2766 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2767 |
' objInputs.AddPoint(dStart_x, dStart_y) |
|
2768 |
Else |
|
2769 |
'objInputs.AddConnectorTarget(objConnector, dStart_x, dStart_y) |
|
2770 |
' objInputs.AddPoint(dStart_x, dStart_y) |
|
2771 |
' objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2772 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2773 |
End If |
|
2262 | 2774 |
|
2775 |
oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
|
2776 |
Else |
|
2777 |
Exit While |
|
2778 |
End If |
|
2263 | 2779 |
|
2264 |
If Math.Abs(oOpcConn_x1 - oOpcConn_x2) > Math.Abs(oOpcConn_y1 - oOpcConn_y2) Then |
|
2265 |
'가로 OPC |
|
2266 |
Dim dCalcY As Double = (oOpcConn_y1 + oOpcConn_y2) / 2 |
|
2267 |
If (dStart_x >= oOpcConn_x2 And dStart_x <= oOpcConn_x1 And |
|
2268 |
dStart_y < dCalcY + 100 And dStart_y > dCalcY - 100) Or |
|
2269 |
(dStart_x >= oOpcConn_x1 And dStart_x <= oOpcConn_x2 And |
|
2270 |
dStart_y < dCalcY + 100 And dStart_y > dCalcY - 100) Then |
|
2271 |
'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
2780 |
End While |
|
2781 |
Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
|
2782 |
Dim sSystemPath As String = GetPipeType(sType) |
|
2272 | 2783 |
|
2273 |
If Math.Abs(dStart_x - oOpcConn_x1) > Math.Abs(dStart_x - oOpcConn_x2) Then |
|
2274 |
dStart_x = oOpcConn_x2 |
|
2275 |
oOpcRow(_Modeling_ConnType) = "2" |
|
2276 |
Else |
|
2277 |
dStart_x = oOpcConn_x1 |
|
2278 |
oOpcRow(_Modeling_ConnType) = "1" |
|
2279 |
End If |
|
2280 |
sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
2281 |
oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
2784 |
objItem = _Placement.PIDCreateItem(sSystemPath) |
|
2785 |
objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
|
2786 |
For i = 0 To oAddUid_List.Count - 1 |
|
2787 |
Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
|
2788 |
If oUpdateRow.Length = 1 Then |
|
2789 |
oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
|
2790 |
oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
|
2791 |
End If |
|
2792 |
Next |
|
2793 |
|
|
2794 |
|
|
2795 |
oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
|
2796 |
Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
|
2797 |
If oAttributeRow.Length > 0 Then |
|
2798 |
For Each oAttribute In oAttributeRow |
|
2799 |
Try |
|
2800 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
2801 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
2802 |
If sPIDValue.Contains("'") Then |
|
2803 |
sPIDValue = sPIDValue.Replace("'", """") |
|
2804 |
End If |
|
2805 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
2806 |
oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
2807 |
Catch ex As Exception |
|
2808 |
End Try |
|
2809 |
Next |
|
2810 |
oPipeRun.Commit() |
|
2811 |
End If |
|
2812 |
|
|
2813 |
End If |
|
2814 |
|
|
2815 |
Catch ex As Exception |
|
2816 |
End Try |
|
2817 |
End Sub |
|
2818 |
|
|
2819 |
Private Function AddUidList중복체크(ByVal sUidList As List(Of String), ByVal sAddUid As String) As Boolean |
|
2282 | 2820 |
|
2283 |
If dStart_y <> dEnd_y Then |
|
2284 |
dEnd_y = dStart_y |
|
2285 |
oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
2821 |
For Each sUid In sUidList |
|
2822 |
If sUid = sAddUid Then |
|
2823 |
Return False |
|
2824 |
End If |
|
2825 |
Next |
|
2826 |
Return True |
|
2827 |
End Function |
|
2828 |
|
|
2829 |
Private Sub LineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String) |
|
2830 |
Try |
|
2831 |
Dim oDatasource As Object = _Placement.PIDDataSource |
|
2832 |
Dim objItem As LMAItem |
|
2833 |
Dim objConnector As LMConnector |
|
2834 |
Dim objInputs As PlaceRunInputs |
|
2835 |
objInputs = New PlaceRunInputs |
|
2836 |
Dim dOriginalStart_x As Double = 0.0 |
|
2837 |
Dim dOriginalStart_y As Double = 0.0 |
|
2838 |
Dim dOriginalEnd_x As Double = 0.0 |
|
2839 |
Dim dOriginalEnd_y As Double = 0.0 |
|
2840 |
Dim dStart_x As Double = 0.0 |
|
2841 |
Dim dStart_y As Double = 0.0 |
|
2842 |
Dim dEnd_x As Double = 0.0 |
|
2843 |
Dim dEnd_y As Double = 0.0 |
|
2844 |
Dim oPipeRun As LMPipeRun = Nothing |
|
2845 |
Dim sStartpoint As String = "" |
|
2846 |
Dim sEndpoint As String = "" |
|
2847 |
Dim iConnType As Integer = 0 |
|
2848 |
Dim pLMConnector As LMConnector = Nothing |
|
2849 |
For Each oLinerow In oLine_Dt.Rows |
|
2850 |
Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
|
2851 |
Dim sCheckModeling As Boolean = False |
|
2852 |
objInputs.Clear() |
|
2853 |
Dim oAddUid_List As New List(Of String) |
|
2854 |
Try |
|
2855 |
Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
|
2856 |
"[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
|
2857 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2858 |
If oAddPipeRow.Length = 0 Then |
|
2859 |
oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
|
2860 |
"[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
|
2861 |
_XML_SYMBOL_Check & "] = 'TRUE'") |
|
2862 |
sPipeUid = "" |
|
2863 |
Else |
|
2864 |
iConnType = 1 |
|
2865 |
sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
|
2866 |
End If |
|
2867 |
If oAddPipeRow.Length = 1 Then |
|
2868 |
sCheckModeling = True |
|
2869 |
If sPipeUid = "" Then |
|
2870 |
sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
|
2871 |
iConnType = 2 |
|
2872 |
End If |
|
2873 |
If AddUidList중복체크(oAddUid_List, sPipeUid) Then |
|
2874 |
oAddUid_List.Add(sPipeUid) |
|
2286 | 2875 |
End If |
2287 |
ElseIf (dEnd_x >= oOpcConn_x2 And dEnd_x <= oOpcConn_x1 And |
|
2288 |
dEnd_y < dCalcY + 100 And dEnd_y > dCalcY - 100) Or |
|
2289 |
(dEnd_x >= oOpcConn_x1 And dEnd_x <= oOpcConn_x2 And |
|
2290 |
dEnd_y < dCalcY + 100 And dEnd_y > dCalcY - 100) Then |
|
2291 |
'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
2292 |
sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
2293 |
If Math.Abs(dEnd_x - oOpcConn_x1) > Math.Abs(dEnd_x - oOpcConn_x2) Then |
|
2294 |
dEnd_x = oOpcConn_x2 |
|
2876 |
sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
|
2877 |
sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
|
2878 |
ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
|
2879 |
dStart_x = dOriginalStart_x |
|
2880 |
dStart_y = dOriginalStart_y |
|
2881 |
ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
|
2882 |
dEnd_x = dOriginalEnd_x |
|
2883 |
dEnd_y = dOriginalEnd_y |
|
2884 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
2885 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
|
2886 |
Dim sBranchType As String = "" |
|
2887 |
If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
|
2888 |
Try |
|
2889 |
If pLMConnector Is Nothing Then |
|
2890 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2891 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2892 |
Else |
|
2893 |
If sBranchType = "1" Then |
|
2894 |
objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
|
2895 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2896 |
ElseIf sBranchType = "2" Then |
|
2897 |
objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
|
2898 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2899 |
ElseIf sBranchType = "3" Then |
|
2900 |
objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
|
2901 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2902 |
ElseIf sBranchType = "4" Then |
|
2903 |
objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
|
2904 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2905 |
End If |
|
2906 |
End If |
|
2907 |
Catch ex As Exception |
|
2908 |
End Try |
|
2295 | 2909 |
Else |
2296 |
dEnd_x = oOpcConn_x1 |
|
2910 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2911 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2297 | 2912 |
End If |
2298 |
sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
2299 |
oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
2913 |
oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
|
2914 |
Else |
|
2915 |
Dim CheckTF As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
|
2916 |
Dim CheckSelect As String = oLinerow(_XML_LINE_Check).ToString() |
|
2917 |
If CheckTF = "FALSE" And CheckSelect = "TRUE" Then |
|
2918 |
sPipeUid = oLinerow(_XML_LINE_UID).ToString() |
|
2919 |
oAddUid_List.Clear() |
|
2920 |
oAddUid_List.Add(sPipeUid) |
|
2921 |
sCheckModeling = True |
|
2922 |
sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
|
2923 |
sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
|
2924 |
ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
|
2925 |
dStart_x = dOriginalStart_x |
|
2926 |
dStart_y = dOriginalStart_y |
|
2927 |
ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
|
2928 |
dEnd_x = dOriginalEnd_x |
|
2929 |
dEnd_y = dOriginalEnd_y |
|
2930 |
ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
|
2931 |
ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
|
2932 |
Dim sBranchType As String = "" |
|
2933 |
If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
|
2934 |
Try |
|
2935 |
If sBranchType = "1" Then |
|
2936 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2937 |
objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
|
2938 |
ElseIf sBranchType = "2" Then |
|
2939 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2940 |
objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
|
2941 |
ElseIf sBranchType = "3" Then |
|
2942 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2943 |
objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
|
2944 |
ElseIf sBranchType = "4" Then |
|
2945 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2946 |
objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
|
2300 | 2947 |
|
2301 |
If dStart_y <> dEnd_y Then |
|
2302 |
dStart_y = dEnd_y |
|
2303 |
oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
2948 |
|
|
2949 |
End If |
|
2950 |
Catch ex As Exception |
|
2951 |
|
|
2952 |
End Try |
|
2953 |
Else |
|
2954 |
objInputs.AddPoint(dStart_x, dStart_y) |
|
2955 |
objInputs.AddPoint(dEnd_x, dEnd_y) |
|
2956 |
End If |
|
2957 |
oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
|
2304 | 2958 |
End If |
2305 | 2959 |
End If |
2306 |
Else |
|
2307 |
'세로 OPC |
|
2308 |
Dim dCalcX As Double = (oOpcConn_x1 + oOpcConn_x2) / 2 |
|
2309 |
If (dStart_y >= oOpcConn_y2 And dStart_y <= oOpcConn_y1 And |
|
2310 |
dStart_x < dCalcX + 100 And dStart_x > dCalcX - 100) Or |
|
2311 |
(dStart_y >= oOpcConn_y1 And dStart_y <= oOpcConn_y2 And |
|
2312 |
dStart_x < dCalcX + 100 And dStart_x > dCalcX - 100) Then |
|
2313 |
'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
2314 |
If Math.Abs(dStart_y - oOpcConn_y1) > Math.Abs(dStart_y - oOpcConn_y2) Then |
|
2315 |
dStart_y = oOpcConn_y2 |
|
2316 |
oOpcRow(_Modeling_ConnType) = "2" |
|
2317 |
Else |
|
2318 |
dStart_y = oOpcConn_y1 |
|
2319 |
oOpcRow(_Modeling_ConnType) = "1" |
|
2960 |
Catch ex As Exception |
|
2961 |
End Try |
|
2962 |
If sCheckModeling Then |
|
2963 |
Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
|
2964 |
Dim sSystemPath As String = GetPipeType(sType) |
|
2965 |
objItem = _Placement.PIDCreateItem(sSystemPath) |
|
2966 |
objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
|
2967 |
For i = 0 To oAddUid_List.Count - 1 |
|
2968 |
Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
|
2969 |
If oUpdateRow.Length = 1 Then |
|
2970 |
oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
|
2971 |
oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
|
2972 |
End If |
|
2973 |
Next |
|
2974 |
|
|
2975 |
oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
|
2976 |
oAddUid_List.Clear() |
|
2977 |
|
|
2978 |
Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
|
2979 |
If oAttributeRow.Length > 0 Then |
|
2980 |
For Each oAttribute In oAttributeRow |
|
2981 |
Try |
|
2982 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
2983 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
2984 |
If sPIDValue.Contains("'") Then |
|
2985 |
sPIDValue = sPIDValue.Replace("'", """") |
|
2986 |
End If |
|
2987 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
2988 |
oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
2989 |
Catch ex As Exception |
|
2990 |
End Try |
|
2991 |
Next |
|
2992 |
oPipeRun.Commit() |
|
2993 |
End If |
|
2994 |
|
|
2995 |
If pLMConnector IsNot Nothing Then |
|
2996 |
Dim sID_1 As String = pLMConnector.ModelItemID |
|
2997 |
Dim sID_2 As String = objConnector.ModelItemID |
|
2998 |
Dim objSurvivorItem As LMAItem = Nothing |
|
2999 |
Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
|
3000 |
Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
|
3001 |
_Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
|
3002 |
' oDatasource.CommitTransaction() |
|
3003 |
'_Placement.PIDAutoJoin(oPipeRun1.AsLMAItem, AutoJoinEndConstants.autoJoin_End, objSurvivorItem) |
|
3004 |
'oPipeRun1.Commit() |
|
3005 |
'oDatasource.CommitTransaction() |
|
3006 |
'objSurvivorItem = Nothing |
|
3007 |
'_Placement.PIDAutoJoin(oPipeRun2.AsLMAItem, AutoJoinEndConstants.autoJoin_Start, objSurvivorItem) |
|
3008 |
'oPipeRun2.Commit() |
|
3009 |
'oDatasource.CommitTransaction() |
|
3010 |
End If |
|
3011 |
sCheckModeling = False |
|
3012 |
End If |
|
3013 |
Next |
|
3014 |
Catch ex As Exception |
|
3015 |
End Try |
|
3016 |
End Sub |
|
3017 |
|
|
3018 |
|
|
3019 |
Private Sub SymbolModeling(ByVal CDrawing As Drawing, ByVal oSymbolRow As DataRow, ByVal oAttribute_Dt As DataTable) |
|
3020 |
Try |
|
3021 |
Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
|
3022 |
Dim sConnTypeNo As String = "" |
|
3023 |
' Line과 연결되어있는 Symbol인지 확인 |
|
3024 |
Dim oLine_Dt As DataTable = GetPipeFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
|
3025 |
'Symbol과 연결되어 있는 Symbol인지 확인 |
|
3026 |
Dim oSymbol_Dt As DataTable = GetSymbolFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
|
3027 |
Dim oSymbol As LMSymbol = Nothing |
|
3028 |
Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
|
3029 |
Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
|
3030 |
Dim oDatasource As Object = _Placement.PIDDataSource |
|
3031 |
Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
|
3032 |
|
|
3033 |
Dim dAngle As Double = 0.0 |
|
3034 |
If IsNumeric(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) Then |
|
3035 |
dAngle = Double.Parse(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) |
|
3036 |
End If |
|
3037 |
|
|
3038 |
Dim dLocationX As Double = 0.0 |
|
3039 |
Dim dLocationY As Double = 0.0 |
|
3040 |
Dim dX As Double = 0.0 |
|
3041 |
Dim dY As Double = 0.0 |
|
3042 |
Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
|
3043 |
ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
|
3044 |
dX = dLocationX |
|
3045 |
dY = dLocationY |
|
3046 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
|
3047 |
Dim bCheckModeling As Boolean = False |
|
3048 |
|
|
3049 |
If oLine_Dt.Rows.Count > 0 Then |
|
3050 |
|
|
3051 |
If sSPID <> "" Then |
|
3052 |
Dim dX1 As Double = 0 |
|
3053 |
Dim dX2 As Double = 0 |
|
3054 |
Dim dY1 As Double = 0 |
|
3055 |
Dim dY2 As Double = 0 |
|
3056 |
Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
|
3057 |
_Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
|
3058 |
_Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
|
3059 |
|
|
3060 |
Dim dCalcPoint As Double = -1 |
|
3061 |
Dim dModeling_X As Double = 0 |
|
3062 |
Dim dModeling_Y As Double = 0 |
|
3063 |
If dX1 <> 0 And dY1 <> 0 Then |
|
3064 |
dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
|
3065 |
dModeling_X = dX1 |
|
3066 |
dModeling_Y = dY1 |
|
3067 |
End If |
|
3068 |
If dX2 <> 0 And dY2 <> 0 Then |
|
3069 |
|
|
3070 |
If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
|
3071 |
dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
|
3072 |
dModeling_X = dX2 |
|
3073 |
dModeling_Y = dY2 |
|
2320 | 3074 |
End If |
2321 |
sLineUid = oLinerow(_XML_LINE_UID).ToString()
|
|
2322 |
oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
3075 |
End If
|
|
3076 |
|
|
2323 | 3077 |
|
2324 |
If dStart_x <> dEnd_x Then |
|
2325 |
dEnd_x = dStart_x |
|
2326 |
oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
3078 |
|
|
3079 |
If dModeling_X <> 0 And dModeling_Y <> 0 Then |
|
3080 |
oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
|
3081 |
TargetItem:=oLMSymbol.AsLMRepresentation) |
|
3082 |
bCheckModeling = True |
|
3083 |
End If |
|
3084 |
|
|
3085 |
|
|
3086 |
End If |
|
3087 |
End If |
|
3088 |
If oSymbol_Dt.Rows.Count > 0 Then |
|
3089 |
If sSPID <> "" Then |
|
3090 |
Dim dX1 As Double = 0 |
|
3091 |
Dim dX2 As Double = 0 |
|
3092 |
Dim dX3 As Double = 0 |
|
3093 |
Dim dX4 As Double = 0 |
|
3094 |
Dim dY1 As Double = 0 |
|
3095 |
Dim dY2 As Double = 0 |
|
3096 |
Dim dY3 As Double = 0 |
|
3097 |
Dim dY4 As Double = 0 |
|
3098 |
Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
|
3099 |
_Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
|
3100 |
_Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
|
3101 |
_Placement.PIDConnectPointLocation(oLMSymbol, 3, dX3, dY3) |
|
3102 |
_Placement.PIDConnectPointLocation(oLMSymbol, 4, dX4, dY4) |
|
3103 |
|
|
3104 |
Dim dCalcPoint As Double = -1 |
|
3105 |
Dim dModeling_X As Double = 0 |
|
3106 |
Dim dModeling_Y As Double = 0 |
|
3107 |
If dX1 <> 0 And dY1 <> 0 Then |
|
3108 |
dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
|
3109 |
dModeling_X = dX1 |
|
3110 |
dModeling_Y = dY1 |
|
3111 |
End If |
|
3112 |
If dX2 <> 0 And dY2 <> 0 Then |
|
3113 |
|
|
3114 |
If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
|
3115 |
dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
|
3116 |
dModeling_X = dX2 |
|
3117 |
dModeling_Y = dY2 |
|
2327 | 3118 |
End If |
2328 |
ElseIf (dEnd_y >= oOpcConn_y2 And dEnd_y <= oOpcConn_y1 And |
|
2329 |
dEnd_x < dCalcX + 100 And dEnd_x > dCalcX - 100) Or |
|
2330 |
(dEnd_y >= oOpcConn_y1 And dEnd_y <= oOpcConn_y2 And |
|
2331 |
dEnd_x < dCalcX + 100 And dEnd_x > dCalcX - 100) Then |
|
2332 |
'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
2333 |
If Math.Abs(dEnd_y - oOpcConn_y1) > Math.Abs(dEnd_y - oOpcConn_y2) Then |
|
2334 |
dEnd_y = oOpcConn_y2 |
|
2335 |
Else |
|
2336 |
dEnd_y = oOpcConn_y1 |
|
3119 |
End If |
|
3120 |
If dX3 <> 0 And dY3 <> 0 Then |
|
3121 |
If (Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) > dCalcPoint) Then |
|
3122 |
dCalcPoint = Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) |
|
3123 |
dModeling_X = dX3 |
|
3124 |
dModeling_Y = dY3 |
|
2337 | 3125 |
End If |
2338 |
sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
2339 |
oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
2340 |
If dStart_x <> dEnd_x Then |
|
2341 |
dStart_x = dEnd_x |
|
2342 |
oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
3126 |
End If |
|
3127 |
If dX4 <> 0 And dY4 <> 0 Then |
|
3128 |
If (Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) > dCalcPoint) Then |
|
3129 |
dCalcPoint = Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) |
|
3130 |
dModeling_X = dX4 |
|
3131 |
dModeling_Y = dY4 |
|
2343 | 3132 |
End If |
2344 | 3133 |
End If |
2345 |
|
|
3134 |
If dModeling_X <> 0 And dModeling_Y <> 0 Then |
|
3135 |
oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
|
3136 |
TargetItem:=oLMSymbol.AsLMRepresentation) |
|
3137 |
bCheckModeling = True |
|
3138 |
End If |
|
2346 | 3139 |
|
2347 | 3140 |
|
2348 | 3141 |
End If |
2349 | 3142 |
|
3143 |
End If |
|
2350 | 3144 |
|
2351 |
Next |
|
3145 |
If (oLine_Dt.Rows.Count = 0 And oSymbol_Dt.Rows.Count = 0) Or bCheckModeling = False Then |
|
3146 |
oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
3147 |
SetListBoxItems(ListBox_Result, "Place Fittings..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
|
3148 |
_iFittingcnt = _iFittingcnt + 1 |
|
3149 |
End If |
|
3150 |
Dim oAttributeRow() As DataRow |
|
3151 |
oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
|
3152 |
If oAttribute_Dt.Rows.Count > 0 Then |
|
3153 |
|
|
3154 |
If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
|
3155 |
Dim oInstrument As LMInstrument |
|
3156 |
oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
|
3157 |
Try |
|
3158 |
If oAttributeRow.Length > 0 Then |
|
3159 |
For Each oAttribute In oAttributeRow |
|
3160 |
Try |
|
3161 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
3162 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
3163 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
3164 |
oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
3165 |
Catch ex As Exception |
|
3166 |
End Try |
|
3167 |
Next |
|
3168 |
oInstrument.Commit() |
|
3169 |
End If |
|
3170 |
Catch ex As Exception |
|
3171 |
End Try |
|
3172 |
Else |
|
3173 |
Try |
|
3174 |
If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
|
3175 |
For Each oAttribute In oAttributeRow |
|
3176 |
Try |
|
3177 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
3178 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
3179 |
|
|
3180 |
If sPIDAttribute = "SIZE" Then |
|
3181 |
|
|
3182 |
'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
|
3183 |
If sPIDValue.Contains("x") Then |
|
3184 |
Dim sSplitSize() As String = sPIDValue.Split("x") |
|
3185 |
If sSplitSize.Count > 1 Then |
|
3186 |
'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
|
3187 |
Dim oConnector_1 As LMConnector = Nothing |
|
3188 |
Dim oConnector_2 As LMConnector = Nothing |
|
3189 |
If oSymbol IsNot Nothing Then |
|
3190 |
If oSymbol.Connect1Connectors.Count >= 1 Then |
|
3191 |
For Each Tconnector In oSymbol.Connect1Connectors |
|
3192 |
If Tconnector.ItemStatus = "Active" Then |
|
3193 |
If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
|
3194 |
oConnector_1 = Tconnector |
|
3195 |
End If |
|
3196 |
End If |
|
3197 |
Next |
|
3198 |
End If |
|
3199 |
If oSymbol.Connect1Connectors.Count >= 1 Then |
|
3200 |
For Each Tconnector In oSymbol.Connect1Connectors |
|
3201 |
If Tconnector.ItemStatus = "Active" Then |
|
3202 |
If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
|
3203 |
oConnector_2 = Tconnector |
|
3204 |
End If |
|
3205 |
End If |
|
3206 |
Next |
|
3207 |
End If |
|
3208 |
End If |
|
3209 |
Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
|
3210 |
Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
|
3211 |
If dAngle = 3.14 Then |
|
3212 |
oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
|
3213 |
oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
|
3214 |
Else |
|
3215 |
oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
|
3216 |
oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
|
3217 |
End If |
|
3218 |
|
|
3219 |
|
|
3220 |
End If |
|
3221 |
|
|
3222 |
Else |
|
3223 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
3224 |
oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
3225 |
End If |
|
3226 |
Else |
|
3227 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
3228 |
oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
3229 |
End If |
|
2352 | 3230 |
|
3231 |
Catch ex As Exception |
|
3232 |
End Try |
|
3233 |
Next |
|
3234 |
oSymbol.Commit() |
|
3235 |
End If |
|
3236 |
Catch ex As Exception |
|
3237 |
End Try |
|
3238 |
End If |
|
3239 |
End If |
|
3240 |
Catch ex As Exception |
|
3241 |
End Try |
|
3242 |
End Sub |
|
2353 | 3243 |
|
3244 |
Private Function SymbolModeling(ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, ByVal oSymbolRow As DataRow) As Boolean |
|
3245 |
Try |
|
3246 |
Dim oAttributeRow() As DataRow |
|
3247 |
Dim sUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
|
3248 |
If oAttribute_Dt.Rows.Count > 0 Then |
|
3249 |
oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
|
3250 |
Dim oDatasource As Object = _Placement.PIDDataSource |
|
3251 |
Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
|
3252 |
Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
|
3253 |
Dim sClass As String = oSymbolRow(_XML_SYMBOL_CLASS).ToString() |
|
3254 |
Dim sLocation As String = oSymbolRow(_XML_SYMBOL_LOCATION).ToString() |
|
3255 |
Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
|
3256 |
Dim dAngle As Double = 0.0 |
|
3257 |
If IsNumeric(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) Then |
|
3258 |
dAngle = Double.Parse(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) |
|
3259 |
End If |
|
3260 |
Dim objSymbol As LMSymbol |
|
3261 |
Dim dLocationX As Double = 0.0 |
|
3262 |
Dim dLocationY As Double = 0.0 |
|
3263 |
Dim dX As Double = 0.0 |
|
3264 |
Dim dY As Double = 0.0 |
|
3265 |
If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
|
3266 |
dX = dLocationX |
|
3267 |
dY = dLocationY |
|
3268 |
ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
|
3269 |
Dim oInstrument As LMInstrument |
|
3270 |
If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
|
3271 |
_iInstrumentcnt = _iInstrumentcnt + 1 |
|
3272 |
objSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
3273 |
SetListBoxItems(ListBox_Result, "Place Instrument..(" & dLocationX & "," & dLocationY & ")..." & _iInstrumentcnt & " count ") |
|
3274 |
oInstrument = oDatasource.GetInstrument(objSymbol.ModelItemID) |
|
3275 |
Try |
|
3276 |
If oAttributeRow.Length > 0 Then |
|
3277 |
For Each oAttribute In oAttributeRow |
|
3278 |
Try |
|
3279 |
Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
|
3280 |
Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
|
3281 |
Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
|
3282 |
oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
|
3283 |
Catch ex As Exception |
|
3284 |
End Try |
|
3285 |
Next |
|
3286 |
oInstrument.Commit() |
|
3287 |
End If |
|
3288 |
Catch ex As Exception |
|
3289 |
End Try |
|
3290 |
ElseIf sSymbolCompType.ToUpper() = _DB_FITTINGS.ToUpper() Then |
|
3291 |
_iValvecnt = _iValvecnt + 1 |
|
3292 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
3293 |
SetListBoxItems(ListBox_Result, "Place Valve..(" & dLocationX & "," & dLocationY & ")..." & _iValvecnt & " count ") |
|
3294 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_FITTINGS.ToUpper() Then |
|
3295 |
_iFittingcnt = _iFittingcnt + 1 |
|
3296 |
If sSystemPath.Contains(",") Then |
|
3297 |
Dim sDuplicatePath As String() = sSystemPath.Split(",") |
|
3298 |
Dim sMainSymbol As String = "" |
|
3299 |
Dim sSubSymbol As String = "" |
|
3300 |
For Each sPath In sDuplicatePath |
|
3301 |
If sMainSymbol = "" Then |
|
3302 |
sMainSymbol = sPath.Replace(vbLf, "") |
|
3303 |
Else |
|
3304 |
sSubSymbol = sPath.Replace(vbLf, "") |
|
3305 |
End If |
|
3306 |
Next |
|
3307 |
Dim oSymbolObj As LMSymbol = _Placement.PIDPlaceSymbol(sMainSymbol, dX, dY, , dAngle) |
|
3308 |
Dim dConnpos_x As Double = 0.0 |
|
3309 |
Dim dConnpos_y As Double = 0.0 |
|
3310 |
_Placement.PIDConnectPointLocation(oSymbolObj, 2, dConnpos_x, dConnpos_y) |
|
3311 |
' _Placement.PIDPlaceSymbol(sSubSymbol, dConnpos_x, dConnpos_y, dAngle, TargetItem:=oSymbolObj.AsLMRepresentation) |
|
3312 |
_Placement.PIDPlaceSymbol(sSubSymbol, dConnpos_x, dConnpos_y,, dAngle) |
|
3313 |
Else |
|
3314 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
3315 |
End If |
|
3316 |
SetListBoxItems(ListBox_Result, "Place Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
|
3317 |
ElseIf sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() And sClass.ToUpper() = _SYMBOL_ACTUATORS.ToUpper() Then |
|
3318 |
_iFittingcnt = _iFittingcnt + 1 |
|
3319 |
Dim sDuplicatePath As String() = sSystemPath.Split(",") |
|
3320 |
Dim sMainSymbol As String = "" |
|
3321 |
Dim sSubSymbol As String = "" |
|
3322 |
For Each sPath In sDuplicatePath |
|
3323 |
If sMainSymbol = "" Then |
|
3324 |
sMainSymbol = sPath.Replace(vbLf, "") |
|
3325 |
Else |
|
3326 |
sSubSymbol = sPath.Replace(vbLf, "") |
|
3327 |
End If |
|
3328 |
Next |
|
3329 |
Dim oSymbolObj As LMSymbol = _Placement.PIDPlaceSymbol(sMainSymbol, dX, dY, , dAngle) |
|
3330 |
Dim dSymbolpos_x As Double = oSymbolObj.XCoordinate |
|
3331 |
Dim dSymbolpos_y As Double = oSymbolObj.YCoordinate |
|
3332 |
_Placement.PIDPlaceSymbol(sSubSymbol, dSymbolpos_x, dSymbolpos_y, , dAngle, TargetItem:=oSymbolObj.AsLMAItem) |
|
3333 |
Else |
|
3334 |
_iFittingcnt = _iFittingcnt + 1 |
|
3335 |
_Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
|
3336 |
SetListBoxItems(ListBox_Result, "Place Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
|
3337 |
End If |
|
3338 |
oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
|
3339 |
End If |
|
3340 |
_Itemcnt = _Itemcnt + 1 |
|
3341 |
Dim dCalcProgressValue As Double = (_Itemcnt / _allItem) * 100 |
|
3342 |
SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
|
3343 |
Label_Progress.Text = Math.Round(dCalcProgressValue, 0) & "%" |
|
3344 |
End If |
|
2354 | 3345 |
Catch ex As Exception |
2355 |
Return sLineUid
|
|
3346 |
Return False
|
|
2356 | 3347 |
End Try |
2357 |
Return sLineUid |
|
3348 |
End Function |
|
3349 |
|
|
3350 |
Private Function CheckOPCConnectionLine(ByVal oOpcRow As DataRow, ByVal oLine_Dt As DataTable) As String |
|
3351 |
'Dim sLineUid As String = "" |
|
3352 |
'Try |
|
3353 |
|
|
3354 |
' For Each oLinerow In oLine_Dt.Rows |
|
3355 |
|
|
3356 |
' Dim oOpcConn_x1 As Double = oOpcRow(_Modeling_Connection1_X) |
|
3357 |
' Dim oOpcConn_y1 As Double = oOpcRow(_Modeling_Connection1_Y) |
|
3358 |
' Dim oOpcConn_x2 As Double = oOpcRow(_Modeling_Connection2_X) |
|
3359 |
' Dim oOpcConn_y2 As Double = oOpcRow(_Modeling_Connection2_Y) |
|
3360 |
' Dim oAngle As Double = oOpcRow(_Modeling_Angle) |
|
3361 |
' Dim dOriginalStart_x As Double = 0.0 |
|
3362 |
' Dim dOriginalStart_y As Double = 0.0 |
|
3363 |
' Dim dOriginalEnd_x As Double = 0.0 |
|
3364 |
' Dim dOriginalEnd_y As Double = 0.0 |
|
3365 |
' Dim dStart_x As Double = 0.0 |
|
3366 |
' Dim dStart_y As Double = 0.0 |
|
3367 |
' Dim dEnd_x As Double = 0.0 |
|
3368 |
' Dim dEnd_y As Double = 0.0 |
|
3369 |
' Dim sStartpoint As String = oLinerow(_XML_LINE_STARTPOINT).ToString() |
|
3370 |
' Dim sEndpoint As String = oLinerow(_XML_LINE_ENDPOINT).ToString() |
|
3371 |
' Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
|
3372 |
|
|
3373 |
' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
|
3374 |
' dStart_x = dOriginalStart_x |
|
3375 |
' dStart_y = dOriginalStart_y |
|
3376 |
|
|
3377 |
' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
|
3378 |
' dEnd_x = dOriginalEnd_x |
|
3379 |
' dEnd_y = dOriginalEnd_y |
|
3380 |
|
|
3381 |
|
|
3382 |
' If Math.Abs(oOpcConn_x1 - oOpcConn_x2) > Math.Abs(oOpcConn_y1 - oOpcConn_y2) Then |
|
3383 |
' '가로 OPC |
|
3384 |
' Dim dCalcY As Double = (oOpcConn_y1 + oOpcConn_y2) / 2 |
|
3385 |
' If (dStart_x >= oOpcConn_x2 And dStart_x <= oOpcConn_x1 And |
|
3386 |
' dStart_y < dCalcY + 100 And dStart_y > dCalcY - 100) Or |
|
3387 |
' (dStart_x >= oOpcConn_x1 And dStart_x <= oOpcConn_x2 And |
|
3388 |
' dStart_y < dCalcY + 100 And dStart_y > dCalcY - 100) Then |
|
3389 |
' 'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
3390 |
|
|
3391 |
' If Math.Abs(dStart_x - oOpcConn_x1) > Math.Abs(dStart_x - oOpcConn_x2) Then |
|
3392 |
' dStart_x = oOpcConn_x2 |
|
3393 |
' oOpcRow(_Modeling_ConnType) = "2" |
|
3394 |
' Else |
|
3395 |
' dStart_x = oOpcConn_x1 |
|
3396 |
' oOpcRow(_Modeling_ConnType) = "1" |
|
3397 |
' End If |
|
3398 |
' sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
3399 |
' oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
3400 |
|
|
3401 |
' If dStart_y <> dEnd_y Then |
|
3402 |
' dEnd_y = dStart_y |
|
3403 |
' oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
3404 |
' End If |
|
3405 |
' ElseIf (dEnd_x >= oOpcConn_x2 And dEnd_x <= oOpcConn_x1 And |
|
3406 |
' dEnd_y < dCalcY + 100 And dEnd_y > dCalcY - 100) Or |
|
3407 |
' (dEnd_x >= oOpcConn_x1 And dEnd_x <= oOpcConn_x2 And |
|
3408 |
' dEnd_y < dCalcY + 100 And dEnd_y > dCalcY - 100) Then |
|
3409 |
' 'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
3410 |
' sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
3411 |
' If Math.Abs(dEnd_x - oOpcConn_x1) > Math.Abs(dEnd_x - oOpcConn_x2) Then |
|
3412 |
' dEnd_x = oOpcConn_x2 |
|
3413 |
' Else |
|
3414 |
' dEnd_x = oOpcConn_x1 |
|
3415 |
' End If |
|
3416 |
' sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
3417 |
' oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
3418 |
|
|
3419 |
' If dStart_y <> dEnd_y Then |
|
3420 |
' dStart_y = dEnd_y |
|
3421 |
' oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
3422 |
' End If |
|
3423 |
' End If |
|
3424 |
' Else |
|
3425 |
' '세로 OPC |
|
3426 |
' Dim dCalcX As Double = (oOpcConn_x1 + oOpcConn_x2) / 2 |
|
3427 |
' If (dStart_y >= oOpcConn_y2 And dStart_y <= oOpcConn_y1 And |
|
3428 |
' dStart_x < dCalcX + 100 And dStart_x > dCalcX - 100) Or |
|
3429 |
' (dStart_y >= oOpcConn_y1 And dStart_y <= oOpcConn_y2 And |
|
3430 |
' dStart_x < dCalcX + 100 And dStart_x > dCalcX - 100) Then |
|
3431 |
' 'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
3432 |
' If Math.Abs(dStart_y - oOpcConn_y1) > Math.Abs(dStart_y - oOpcConn_y2) Then |
|
3433 |
' dStart_y = oOpcConn_y2 |
|
3434 |
' oOpcRow(_Modeling_ConnType) = "2" |
|
3435 |
' Else |
|
3436 |
' dStart_y = oOpcConn_y1 |
|
3437 |
' oOpcRow(_Modeling_ConnType) = "1" |
|
3438 |
' End If |
|
3439 |
' sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
3440 |
' oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
|
3441 |
|
|
3442 |
' If dStart_x <> dEnd_x Then |
|
3443 |
' dEnd_x = dStart_x |
|
3444 |
' oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
3445 |
' End If |
|
3446 |
' ElseIf (dEnd_y >= oOpcConn_y2 And dEnd_y <= oOpcConn_y1 And |
|
3447 |
' dEnd_x < dCalcX + 100 And dEnd_x > dCalcX - 100) Or |
|
3448 |
' (dEnd_y >= oOpcConn_y1 And dEnd_y <= oOpcConn_y2 And |
|
3449 |
' dEnd_x < dCalcX + 100 And dEnd_x > dCalcX - 100) Then |
|
3450 |
' 'OPC기준 Start점 End 점중 가까운곳을 시작점으로 지정 |
|
3451 |
' If Math.Abs(dEnd_y - oOpcConn_y1) > Math.Abs(dEnd_y - oOpcConn_y2) Then |
|
3452 |
' dEnd_y = oOpcConn_y2 |
|
3453 |
' Else |
|
3454 |
' dEnd_y = oOpcConn_y1 |
|
3455 |
' End If |
|
3456 |
' sLineUid = oLinerow(_XML_LINE_UID).ToString() |
|
3457 |
' oLinerow(_XML_LINE_ENDPOINT) = dEnd_x & "," & dEnd_y |
|
3458 |
' If dStart_x <> dEnd_x Then |
|
3459 |
' dStart_x = dEnd_x |
|
3460 |
' oLinerow(_XML_LINE_STARTPOINT) = dStart_x & "," & dStart_y |
내보내기 Unified diff