hytos / DTI_PID / SPPIDConverter / Main.vb @ 94c7557d
이력 | 보기 | 이력해설 | 다운로드 (202 KB)
1 | 4f359afa | Gyusu | Imports System.IO |
---|---|---|---|
2 | Imports System.Data.SqlClient |
||
3 | Imports System.Data.SQLite |
||
4 | Imports Plaice |
||
5 | Imports Llama |
||
6 | b08338e3 | Gyusu | Imports ComUtil.MessageLog.CEventLog |
7 | e282643f | Gyusu | |
8 | Imports System.Threading |
||
9 | |||
10 | 4f359afa | Gyusu | Public Class Main |
11 | 54b98e09 | Gyusu | 'Dim _Mapping_DB As DataTable = New DataTable() |
12 | 94c7557d | gaqhf | Public _Mapping_DB As DataSet = New DataSet() |
13 | 171ac39d | Gyusu | Dim _Attribute_DB As DataTable = New DataTable() |
14 | 39d43554 | Gyusu | Dim _PIDSymbol_DB As DataTable = New DataTable() |
15 | e4000111 | Gyusu | Dim _ResultModeling_DT As DataTable = New DataTable() |
16 | 76f465d0 | Gyusu | Dim _AllLine_DT As New DataTable() |
17 | Dim _AllSymbol_DT As New DataTable() |
||
18 | 79326880 | Gyusu | Dim _ModelingLine_Dt As New DataTable() |
19 | e38f99a7 | Gyusu | Dim _ModelingSymbol_Dt As New DataTable() |
20 | 4f359afa | Gyusu | Dim _Placement As New Placement |
21 | e4000111 | Gyusu | Dim _DWG_X = 0.875 '0.695 '1 ' |
22 | Dim _DWG_Y = 0.617 '0.585 '0.8 ' |
||
23 | c2c36314 | Gyusu | 'Dim _DWG_X = 0.842 '0.695 '1 ' |
24 | 'Dim _DWG_Y = 0.614 '0.585 '0.8 ' |
||
25 | 7e561f5b | gaqhf | Public _IMG_X = 0 |
26 | Public _IMG_Y = 0 |
||
27 | 171ac39d | Gyusu | Dim _Unit As String |
28 | 31d47a80 | Gyusu | 'Drawing 전역변수 |
29 | Dim _objPIDADrawing As Object |
||
30 | e282643f | Gyusu | '현재선택한 폴더경로 |
31 | Dim _selectFolderPath As String |
||
32 | Private _Main_trd As Thread |
||
33 | 54b98e09 | Gyusu | Private _Opc_trd As Thread |
34 | Private _CompleteConvert As Boolean = False |
||
35 | 171ac39d | Gyusu | Private _DrawingsList As List(Of Drawing) |
36 | 9e1e7135 | Gyusu | Private _iPipeLineNocnt As Integer |
37 | Private _iPipecnt As Integer |
||
38 | Private _iFittingcnt As Integer |
||
39 | Private _iValvecnt As Integer |
||
40 | Private _iInstrumentcnt As Integer |
||
41 | Private _iEquipmentcnt As Integer |
||
42 | Private _iNozzlecnt As Integer |
||
43 | e4000111 | Gyusu | Private _iPipintOpccnt As Integer |
44 | 41e4023e | Gyusu | Private _allItem As Integer |
45 | Private _Itemcnt As Integer |
||
46 | b08338e3 | Gyusu | Dim _Gembox As New CGembox() |
47 | 1bfcc921 | Gyusu | |
48 | 1406fef4 | gaqhf | Dim PipeRunPoint As Dictionary(Of String, List(Of PointdInfo)) = New Dictionary(Of String, List(Of PointdInfo)) |
49 | |||
50 | 4f359afa | Gyusu | Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
51 | 54b98e09 | Gyusu | LoadDB() |
52 | End Sub |
||
53 | 1bfcc921 | Gyusu | ''' <summary> |
54 | ''' brief |
||
55 | ''' </summary> |
||
56 | 272662f9 | Gyusu | |
57 | 54b98e09 | Gyusu | Private Sub LoadDB() |
58 | e282643f | Gyusu | If My.Settings.DBPath <> "" And My.Settings.Plant_Hierarchy <> "" Then |
59 | Dim sDBPath As String = My.Settings.DBPath |
||
60 | 54b98e09 | Gyusu | |
61 | _Gembox.isLoadFile(My.Settings.SymbolLibrary) |
||
62 | _Mapping_DB = _Gembox.LoadFileFunc() |
||
63 | 171ac39d | Gyusu | _Attribute_DB = Load_DB(sDBPath, _DB_TABLE_ATTRIBUTE) |
64 | 39d43554 | Gyusu | _PIDSymbol_DB = Load_DB(sDBPath, _DB_TABLE_SYMBOLNAME) |
65 | e4000111 | Gyusu | _ResultModeling_DT = ModelingResult_Dt() |
66 | e282643f | Gyusu | Else |
67 | MessageBox.Show("설정값을 먼저 확인해주세요") |
||
68 | End If |
||
69 | End Sub |
||
70 | 41e4023e | Gyusu | |
71 | 94c7557d | gaqhf | Public Function GetDataFromMappingDB(ByVal sSymbolName As String, ByVal sColumn As String) As String |
72 | 171ac39d | Gyusu | Dim sValue As String = "" |
73 | 94c7557d | gaqhf | |
74 | 'Debug.WriteLine(_Mapping_DB.Tables.Count) |
||
75 | |||
76 | 54b98e09 | Gyusu | For Each oDt As DataTable In _Mapping_DB.Tables |
77 | If oDt.Rows.Count > 0 Then |
||
78 | 94c7557d | gaqhf | Dim oSelectRow() As DataRow = oDt.Select("[Img_symbolname] = '" + sSymbolName + "'") |
79 | 54b98e09 | Gyusu | If oSelectRow.Length = 1 Then |
80 | If sColumn = _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME Then |
||
81 | sValue = oSelectRow(0).Item("SYM FILE NAME").ToString() |
||
82 | ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH Then |
||
83 | sValue = "\" & oSelectRow(0).Item("SYMBOL PATH").ToString() & "\" & oSelectRow(0).Item("SYM FILE NAME").ToString() |
||
84 | ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_COMPTPYE Then |
||
85 | sValue = oSelectRow(0).Item("ITEM TYPE").ToString() |
||
86 | ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_CLASS Then |
||
87 | sValue = oSelectRow(0).Item("CLASS").ToString() |
||
88 | Else |
||
89 | sValue = oSelectRow(0).Item("SYMBOL PATH").ToString() & "\" & oSelectRow(0).Item("SYM FILE NAME").ToString() |
||
90 | End If |
||
91 | End If |
||
92 | e282643f | Gyusu | End If |
93 | 54b98e09 | Gyusu | Next |
94 | 171ac39d | Gyusu | Return sValue |
95 | 4f359afa | Gyusu | End Function |
96 | |||
97 | 171ac39d | Gyusu | Private Function GetAttributeMapping(ByVal sAttributeName As String, ByVal sColumn As String) As String |
98 | Dim sSPPIDAttribute As String = "" |
||
99 | If _Attribute_DB.Rows.Count > 0 Then |
||
100 | Dim oSelectRow() As DataRow = _Attribute_DB.Select("[pid_attribute] = '" + sAttributeName + "'") |
||
101 | If oSelectRow.Length = 1 Then |
||
102 | sSPPIDAttribute = oSelectRow(0).Item(sColumn).ToString() |
||
103 | End If |
||
104 | End If |
||
105 | Return sSPPIDAttribute |
||
106 | End Function |
||
107 | e282643f | Gyusu | |
108 | e6ef24be | gaqhf | |
109 | |||
110 | 171ac39d | Gyusu | Private Function LoadSymbolInXml(ByVal sXmlPath As String) As Drawing |
111 | 54b98e09 | Gyusu | Try |
112 | '' _TempSymbolDt = Symbol_Dt() |
||
113 | Dim CDrawing As Drawing = New Drawing() |
||
114 | f291ddcb | Gyusu | ' Dim oDt As DataTable = LoadSymbol_DT() |
115 | 54b98e09 | Gyusu | Dim oElement As XElement = XElement.Load(sXmlPath) |
116 | If oElement IsNot Nothing Then |
||
117 | CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value |
||
118 | CDrawing.Size = oElement.Element(_XML_DWGSIZE).Value |
||
119 | SplitLocation(CDrawing.Size, _IMG_X, _IMG_Y) |
||
120 | e6ef24be | gaqhf | |
121 | CDrawing.LINES = LoadLines(oElement) |
||
122 | CDrawing.SYMBOLS = LoadSymbols(oElement) |
||
123 | CDrawing.LINENUMBERS = LoadLineNumbers(oElement) |
||
124 | CDrawing.TRIMLINES = LoadTrimLines(oElement) |
||
125 | 94c7557d | gaqhf | CDrawing.TEXTS = LoadTexts(oElement) |
126 | 54b98e09 | Gyusu | End If |
127 | Return CDrawing |
||
128 | Catch ex As Exception |
||
129 | Return Nothing |
||
130 | End Try |
||
131 | |||
132 | 4f359afa | Gyusu | End Function |
133 | |||
134 | 76f465d0 | Gyusu | Private Function FindConnection(ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, ByVal sUid As String, ByVal dPos_x As Double, ByVal dPos_y As Double) As String |
135 | |||
136 | Dim sReturnUid As String = "" |
||
137 | Try |
||
138 | Dim oFindLineRow As DataRow() = oLine_Dt.Select( |
||
139 | "[" & _XML_LINE_DWG_STARTPOINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
140 | "[" & _XML_LINE_DWG_STARTPOINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
141 | "[" & _XML_LINE_DWG_STARTPOINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
142 | "[" & _XML_LINE_DWG_STARTPOINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
143 | "[" & _XML_LINE_UID & "] <> '" & sUid & "' And " & |
||
144 | "[" & _XML_LINE_Conn1_Uid & "] = ''") |
||
145 | If oFindLineRow.Length = 0 Then |
||
146 | oFindLineRow = oLine_Dt.Select( |
||
147 | "[" & _XML_LINE_DWG_ENDPOINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
148 | "[" & _XML_LINE_DWG_ENDPOINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
149 | "[" & _XML_LINE_DWG_ENDPOINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
150 | "[" & _XML_LINE_DWG_ENDPOINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
151 | "[" & _XML_LINE_UID & "] <> '" & sUid & "' And " & |
||
152 | "[" & _XML_LINE_Conn2_Uid & "] = ''") |
||
153 | If oFindLineRow.Length = 0 Then |
||
154 | oFindLineRow = oSymbol_Dt.Select( |
||
155 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
156 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
157 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
158 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
159 | "[" & _XML_SYMBOL_UID & "] <> '" & sUid & "' And " & |
||
160 | "[" & _XML_SYMBOL_Conn1_Uid & "] = ''") |
||
161 | If oFindLineRow.Length = 0 Then |
||
162 | oFindLineRow = oSymbol_Dt.Select( |
||
163 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
164 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
165 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
166 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
167 | "[" & _XML_SYMBOL_UID & "] <> '" & sUid & "' And " & |
||
168 | "[" & _XML_SYMBOL_Conn2_Uid & "] = ''") |
||
169 | If oFindLineRow.Length = 0 Then |
||
170 | Else |
||
171 | oFindLineRow(0)(_XML_SYMBOL_Conn2_Uid) = sUid |
||
172 | sReturnUid = oFindLineRow(0)(_XML_SYMBOL_UID).ToString() |
||
173 | End If |
||
174 | Else |
||
175 | oFindLineRow(0)(_XML_SYMBOL_Conn1_Uid) = sUid |
||
176 | sReturnUid = oFindLineRow(0)(_XML_SYMBOL_UID).ToString() |
||
177 | End If |
||
178 | Else |
||
179 | oFindLineRow(0)(_XML_LINE_Conn2_Uid) = sUid |
||
180 | sReturnUid = oFindLineRow(0)(_XML_LINE_UID).ToString() |
||
181 | End If |
||
182 | Else |
||
183 | oFindLineRow(0)(_XML_LINE_Conn1_Uid) = sUid |
||
184 | sReturnUid = oFindLineRow(0)(_XML_LINE_UID).ToString() |
||
185 | End If |
||
186 | Catch ex As Exception |
||
187 | |||
188 | End Try |
||
189 | |||
190 | Return sReturnUid |
||
191 | End Function |
||
192 | |||
193 | |||
194 | Private Function SetConnectionInfo(ByRef oLine_Dt As DataTable, ByRef oSymbol_Dt As DataTable) |
||
195 | Try |
||
196 | For Each oLineInfo In oLine_Dt.Rows |
||
197 | Dim sLineUid As String = oLineInfo(_XML_LINE_UID).ToString() |
||
198 | Dim dStartPos_x As Double = oLineInfo(_XML_LINE_DWG_STARTPOINT_X) |
||
199 | Dim dStartPos_y As Double = oLineInfo(_XML_LINE_DWG_STARTPOINT_Y) |
||
200 | Dim dEndPos_x As Double = oLineInfo(_XML_LINE_DWG_ENDPOINT_X) |
||
201 | Dim dEndPos_y As Double = oLineInfo(_XML_LINE_DWG_ENDPOINT_Y) |
||
202 | Dim sConn1Uid As String = "" |
||
203 | Dim sConn2Uid As String = "" |
||
204 | sConn1Uid = FindConnection(oLine_Dt, oSymbol_Dt, sLineUid, dStartPos_x, dStartPos_y) |
||
205 | If sConn1Uid <> "" Then |
||
206 | oLineInfo(_XML_LINE_Conn1_Uid) = sConn1Uid |
||
207 | End If |
||
208 | sConn2Uid = FindConnection(oLine_Dt, oSymbol_Dt, sLineUid, dEndPos_x, dEndPos_y) |
||
209 | If sConn2Uid <> "" Then |
||
210 | oLineInfo(_XML_LINE_Conn2_Uid) = sConn2Uid |
||
211 | End If |
||
212 | Next |
||
213 | For Each oSymbolInfo In oSymbol_Dt.Rows |
||
214 | Dim sSymbolUid As String = oSymbolInfo(_XML_SYMBOL_UID).ToString() |
||
215 | Dim dConn1Pos_x As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN1_POINT_X) |
||
216 | Dim dConn1Pos_y As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN1_POINT_Y) |
||
217 | Dim sConn1Uid As String = "" |
||
218 | Dim sConn2Uid As String = "" |
||
219 | sConn1Uid = FindConnection(oLine_Dt, oSymbol_Dt, sSymbolUid, dConn1Pos_x, dConn1Pos_y) |
||
220 | If sConn1Uid <> "" Then |
||
221 | oSymbolInfo(_XML_SYMBOL_Conn1_Uid) = sConn1Uid |
||
222 | End If |
||
223 | Try |
||
224 | Dim dConn2Pos_x As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN2_POINT_X) |
||
225 | Dim dConn2Pos_y As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN2_POINT_Y) |
||
226 | sConn2Uid = FindConnection(oLine_Dt, oSymbol_Dt, sSymbolUid, dConn2Pos_x, dConn2Pos_y) |
||
227 | If sConn2Uid <> "" Then |
||
228 | oSymbolInfo(_XML_SYMBOL_Conn2_Uid) = sConn2Uid |
||
229 | End If |
||
230 | Catch ex As Exception |
||
231 | End Try |
||
232 | Next |
||
233 | Catch ex As Exception |
||
234 | End Try |
||
235 | End Function |
||
236 | |||
237 | 76f5e1a8 | Gyusu | Private Function GetFlowDirection(ByRef dStart_x As Double, ByRef dStart_y As Double, ByRef dEnd_x As Double, ByRef dEnd_y As Double, ByRef sDirection As String, ByRef sFlowdirection As String) As Boolean |
238 | Dim bValidLine As Boolean = True |
||
239 | 76f465d0 | Gyusu | If Math.Abs(dStart_x - dEnd_x) > Math.Abs(dStart_y - dEnd_y) Then |
240 | If dStart_x > dEnd_x Then |
||
241 | sDirection = "X" |
||
242 | sFlowdirection = "Left_x" |
||
243 | If Math.Abs(dStart_y - dEnd_y) < 5 Then |
||
244 | dEnd_y = dStart_y |
||
245 | End If |
||
246 | Else |
||
247 | sDirection = "X" |
||
248 | sFlowdirection = "Right_x" |
||
249 | If Math.Abs(dStart_y - dEnd_y) < 5 Then |
||
250 | dEnd_y = dStart_y |
||
251 | End If |
||
252 | End If |
||
253 | 79326880 | Gyusu | If Math.Abs(dStart_x - dEnd_x) <= 15 Then |
254 | 76f5e1a8 | Gyusu | bValidLine = False |
255 | End If |
||
256 | 76f465d0 | Gyusu | Else |
257 | If dStart_y > dEnd_y Then |
||
258 | sDirection = "Y" |
||
259 | sFlowdirection = "Down_y" |
||
260 | If Math.Abs(dStart_x - dEnd_x) < 5 Then |
||
261 | dEnd_x = dStart_x |
||
262 | End If |
||
263 | |||
264 | Else |
||
265 | sDirection = "Y" |
||
266 | sFlowdirection = "Up_y" |
||
267 | If Math.Abs(dStart_x - dEnd_x) < 5 Then |
||
268 | dEnd_x = dStart_x |
||
269 | End If |
||
270 | End If |
||
271 | 79326880 | Gyusu | If Math.Abs(dStart_y - dEnd_y) <= 20 Then |
272 | 76f5e1a8 | Gyusu | bValidLine = False |
273 | End If |
||
274 | 76f465d0 | Gyusu | End If |
275 | 76f5e1a8 | Gyusu | Return bValidLine |
276 | 76f465d0 | Gyusu | End Function |
277 | 4f359afa | Gyusu | |
278 | e6ef24be | gaqhf | Private Function LoadLines(ByVal oElement As XElement) As List(Of Line) |
279 | Dim result As List(Of Line) = New List(Of Line) |
||
280 | |||
281 | Dim lineInfos As XElement = oElement.Element(_XML_LINEINFOS) |
||
282 | |||
283 | For Each oLine As XElement In lineInfos.Elements(_XML_LINEINFOS_LINE) |
||
284 | Dim _line As Line = New Line() |
||
285 | Try |
||
286 | _line.UID = oLine.Element(_XML_LINEINFOS_LINE_UID).Value |
||
287 | _line.STARTPOINT = oLine.Element(_XML_LINEINFOS_LINE_STARTPOINT).Value |
||
288 | _line.ENDPOINT = oLine.Element(_XML_LINEINFOS_LINE_ENDPOINT).Value |
||
289 | _line.TYPE = oLine.Element(_XML_LINEINFOS_LINE_TYPE).Value |
||
290 | _line.AREA = oLine.Element(_XML_LINEINFOS_LINE_AREA).Value |
||
291 | _line.CONNECTORS = GetConnector(oLine) |
||
292 | 94c7557d | gaqhf | _line.SPPIDMAPPINGNAME = GetPipeType(_line.TYPE) |
293 | |||
294 | _line.AfterSetting() |
||
295 | |||
296 | e6ef24be | gaqhf | result.Add(_line) |
297 | Catch ex As Exception |
||
298 | 94c7557d | gaqhf | Console.WriteLine(ex.Message) |
299 | e6ef24be | gaqhf | End Try |
300 | Next |
||
301 | |||
302 | Return result |
||
303 | End Function |
||
304 | |||
305 | Private Function LoadSymbols(ByVal oElement As XElement) As List(Of Symbol) |
||
306 | Dim result As List(Of Symbol) = New List(Of Symbol) |
||
307 | |||
308 | Dim symbols As XElement = oElement.Element(_XML_SYMBOLS) |
||
309 | |||
310 | For Each oSymbol As XElement In symbols.Elements(_XML_SYMBOLS_SYMBOL) |
||
311 | Dim _symbol As Symbol = New Symbol() |
||
312 | Try |
||
313 | 94c7557d | gaqhf | _symbol.ANGLE = oSymbol.Element(_XML_SYMBOLS_SYMBOL_ANGLE).Value |
314 | e6ef24be | gaqhf | _symbol.UID = oSymbol.Element(_XML_SYMBOLS_SYMBOL_UID).Value |
315 | _symbol.NAME = oSymbol.Element(_XML_SYMBOLS_SYMBOL_NAME).Value |
||
316 | _symbol.TYPE = oSymbol.Element(_XML_SYMBOLS_SYMBOL_TYPE).Value |
||
317 | _symbol.ORIGINALPOINT = oSymbol.Element(_XML_SYMBOLS_SYMBOL_ORIGINALPOINT).Value |
||
318 | _symbol.CONNECTORS = GetConnector(oSymbol) |
||
319 | _symbol.LOCATION = oSymbol.Element(_XML_SYMBOLS_SYMBOL_LOCATION).Value |
||
320 | _symbol.SIZE = oSymbol.Element(_XML_SYMBOLS_SYMBOL_SIZE).Value |
||
321 | _symbol.PARENT = oSymbol.Element(_XML_SYMBOLS_SYMBOL_PARENT).Value |
||
322 | _symbol.CHILD = oSymbol.Element(_XML_SYMBOLS_SYMBOL_CHILD).Value |
||
323 | _symbol.HASINSTRUMENTLABEL = oSymbol.Element(_XML_SYMBOLS_SYMBOL_HASINSTRUMENTLABEL).Value |
||
324 | _symbol.AREA = oSymbol.Element(_XML_SYMBOLS_SYMBOL_AREA).Value |
||
325 | _symbol.CURRENTPOINTMODEINDEX = oSymbol.Element(_XML_SYMBOLS_SYMBOL_CURRENTPOINTMODEINDEX).Value |
||
326 | 94c7557d | gaqhf | _symbol.SPPIDMAPPINGNAME = GetDataFromMappingDB(_symbol.PARENT, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
327 | |||
328 | _symbol.AfterSetting() |
||
329 | e6ef24be | gaqhf | |
330 | result.Add(_symbol) |
||
331 | Catch ex As Exception |
||
332 | 94c7557d | gaqhf | Console.WriteLine(ex.Message) |
333 | e6ef24be | gaqhf | End Try |
334 | Next |
||
335 | |||
336 | Return result |
||
337 | End Function |
||
338 | |||
339 | Private Function LoadLineNumbers(ByVal oElement As XElement) As List(Of LineNumber) |
||
340 | Dim result As List(Of LineNumber) = New List(Of LineNumber) |
||
341 | |||
342 | Dim lineNos As XElement = oElement.Element(_XML_LINENOS) |
||
343 | |||
344 | For Each oLineNo As XElement In lineNos.Elements(_XML_LINENOS_LINENO) |
||
345 | Dim _lineNo As LineNumber = New LineNumber() |
||
346 | Try |
||
347 | _lineNo.UID = oLineNo.Element(_XML_LINEINFOS_LINE_UID).Value |
||
348 | 94c7557d | gaqhf | _lineNo.ANGLE = oLineNo.Element("ANGLE").Value |
349 | _lineNo.TEXT = oLineNo.Element("TEXT").Value |
||
350 | e6ef24be | gaqhf | _lineNo.SYMBOLRUNITEMS = GetSymbolRunItems(oLineNo) |
351 | _lineNo.LINERUNITEMS = GetLineRunItems(oLineNo) |
||
352 | 94c7557d | gaqhf | If oLineNo.Element("CONNLINE") IsNot Nothing Then |
353 | _lineNo.CONNECTLINE = oLineNo.Element("CONNLINE").Value |
||
354 | End If |
||
355 | _lineNo.LOCATION = oLineNo.Element("LOCATION").Value |
||
356 | |||
357 | Console.WriteLine("임시 Line Number Labeling and Attribute") |
||
358 | _lineNo.SPPIDMAPPINGNAME = "\Piping\Labels - Piping Segments\Line Number.sym" |
||
359 | |||
360 | For Each attrElement As XElement In oLineNo.Elements("ATTRIBUTE") |
||
361 | Dim attr As Attribute = New Attribute() |
||
362 | attr.UID = attrElement.Attribute("UID").Value |
||
363 | attr.NAME = attrElement.Attribute("DisplayAttribute").Value.Replace(" ", "") |
||
364 | If attrElement.Value <> "None" Then |
||
365 | attr.VALUE = attrElement.Value |
||
366 | Else |
||
367 | attr.VALUE = "" |
||
368 | End If |
||
369 | _lineNo.ATTRIBUTES.Add(attr) |
||
370 | Next |
||
371 | |||
372 | _lineNo.AfterSetting() |
||
373 | e6ef24be | gaqhf | |
374 | result.Add(_lineNo) |
||
375 | Catch ex As Exception |
||
376 | 94c7557d | gaqhf | Console.WriteLine(ex.Message) |
377 | e6ef24be | gaqhf | End Try |
378 | Next |
||
379 | |||
380 | Return result |
||
381 | End Function |
||
382 | |||
383 | Private Function LoadTrimLines(ByVal oElement As XElement) As List(Of LineNumber) |
||
384 | Dim result As List(Of LineNumber) = New List(Of LineNumber) |
||
385 | |||
386 | Dim trimNos As XElement = oElement.Element(_XML_TRIMLINENOS) |
||
387 | |||
388 | For Each oTrimLine As XElement In trimNos.Elements(_XML_TRIMLINENOS_TRIM_LINE_NO) |
||
389 | Dim _lineNo As LineNumber = New LineNumber() |
||
390 | Try |
||
391 | _lineNo.UID = oTrimLine.Element(_XML_LINEINFOS_LINE_UID).Value |
||
392 | |||
393 | _lineNo.SYMBOLRUNITEMS = GetSymbolRunItems(oTrimLine) |
||
394 | _lineNo.LINERUNITEMS = GetLineRunItems(oTrimLine) |
||
395 | |||
396 | result.Add(_lineNo) |
||
397 | Catch ex As Exception |
||
398 | |||
399 | End Try |
||
400 | Next |
||
401 | |||
402 | Return result |
||
403 | End Function |
||
404 | |||
405 | 94c7557d | gaqhf | Private Function LoadTexts(ByVal oElement As XElement) As List(Of Text) |
406 | Dim result As List(Of Text) = New List(Of Text) |
||
407 | |||
408 | Dim textInfos As XElement = oElement.Element(_XML_TEXTINFOS) |
||
409 | |||
410 | For Each oText As XElement In textInfos.Elements("ATTRIBUTE") |
||
411 | Dim _text As Text = New Text() |
||
412 | Try |
||
413 | _text.UID = oText.Element("UID").Value |
||
414 | _text.NAME = oText.Element("NAME").Value |
||
415 | _text.LOCATION = oText.Element("LOCATION").Value |
||
416 | _text.TEXT = oText.Element("VALUE").Value |
||
417 | _text.ANGLE = oText.Element("ANGLE").Value |
||
418 | _text.AREA = oText.Element("AREA").Value |
||
419 | |||
420 | If oText.Element("OWNER") IsNot Nothing Then |
||
421 | _text.OWNER = oText.Element("OWNER").Value |
||
422 | End If |
||
423 | |||
424 | Console.WriteLine("임시 Text Labeling") |
||
425 | If _text.NAME = "TEXT" Then |
||
426 | _text.SPPIDMAPPINGNAME = "\Design\Annotation\Labels\Drawing Notes Label.sym" |
||
427 | ElseIf _text.NAME = "SIZE" Then |
||
428 | '_text.SPPIDMAPPINGNAME = "\Piping\Labels - Piping Components\Nominal Diameter.sym" |
||
429 | End If |
||
430 | e6ef24be | gaqhf | |
431 | |||
432 | 94c7557d | gaqhf | _text.AfterSetting() |
433 | |||
434 | result.Add(_text) |
||
435 | Catch ex As Exception |
||
436 | Console.WriteLine(ex.Message) |
||
437 | End Try |
||
438 | e6ef24be | gaqhf | Next |
439 | |||
440 | Return result |
||
441 | End Function |
||
442 | |||
443 | 94c7557d | gaqhf | Private Function GetSymbolRunItems(ByVal oElement As XElement) As List(Of String) |
444 | e6ef24be | gaqhf | Dim result As List(Of String) = New List(Of String) |
445 | Dim oRun As XElement = oElement.Element(_XML_RUN) |
||
446 | 94c7557d | gaqhf | If oRun IsNot Nothing Then |
447 | For Each oSymbol As XElement In oRun.Elements(_XML_RUN_SYMBOL) |
||
448 | result.Add(oSymbol.Element(_XML_SYMBOLS_SYMBOL_UID)) |
||
449 | Next |
||
450 | End If |
||
451 | Return result |
||
452 | End Function |
||
453 | e6ef24be | gaqhf | |
454 | 94c7557d | gaqhf | Private Function GetLineRunItems(ByVal oElement As XElement) As List(Of String) |
455 | Dim result As List(Of String) = New List(Of String) |
||
456 | Dim oRun As XElement = oElement.Element(_XML_RUN) |
||
457 | If oRun IsNot Nothing Then |
||
458 | For Each oLine As XElement In oRun.Elements(_XML_RUN_LINE) |
||
459 | result.Add(oLine.Element(_XML_LINEINFOS_LINE_UID)) |
||
460 | Next |
||
461 | End If |
||
462 | e6ef24be | gaqhf | Return result |
463 | End Function |
||
464 | |||
465 | |||
466 | |||
467 | Private Function GetConnector(ByVal oElement As XElement) As List(Of Connector) |
||
468 | Dim result As List(Of Connector) = New List(Of Connector) |
||
469 | Dim oElementConnectors As XElement = oElement.Element(_XML_CONNECTORS) |
||
470 | For Each oConnector As XElement In oElementConnectors.Elements(_XML_CONNECTORS_CONNECTOR) |
||
471 | Dim _connector As Connector = New Connector() |
||
472 | Try |
||
473 | _connector.CONNECTEDITEM = oConnector.Element(_XML_CONNECTORS_CONNECTOR_CONNECTEDITEM).Value |
||
474 | _connector.CONNECTPOINT = oConnector.Element(_XML_CONNECTORS_CONNECTOR_CONNECTPOINT).Value |
||
475 | _connector.SCENECONNECTPOINT = oConnector.Element(_XML_CONNECTORS_CONNECTOR_SCENECONNECTPOINT).Value |
||
476 | result.Add(_connector) |
||
477 | Catch ex As Exception |
||
478 | End Try |
||
479 | Next |
||
480 | |||
481 | Return result |
||
482 | End Function |
||
483 | |||
484 | 3acffcee | Gyusu | Private Function LoadLineNo(ByVal oElement As XElement, ByVal sLineType As String) As List(Of Line_no) |
485 | |||
486 | Dim oLineno_list As New List(Of Line_no) |
||
487 | For Each oLineNo As Object In oElement.Elements(sLineType) |
||
488 | Dim CLineNo As Line_no = New Line_no() |
||
489 | Try |
||
490 | CLineNo.Uid = oLineNo.Element(_XML_LINENO_UID).Value |
||
491 | CLineNo.Text = oLineNo.Element(_XML_LINENO_TEXT).Value |
||
492 | CLineNo.Location = oLineNo.Element(_XML_LINENO_LOCATION).Value |
||
493 | CLineNo.Angle = oLineNo.Element(_XML_LINENO_ANGLE).Value |
||
494 | CLineNo.SystemPath = "\Piping\Labels - Piping Segments\Kemya Line Number.sym" 'GetDataFromMappingDB(_XML_CATEGORY_LINENO, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
495 | Catch ex As Exception |
||
496 | End Try |
||
497 | Dim oLine_Dt As DataTable = Line_Dt() |
||
498 | Dim oSymbol_Dt As DataTable = Symbol_Dt() |
||
499 | Dim oAttribute_Dt As DataTable = Attribute_Dt() |
||
500 | 76f465d0 | Gyusu | Dim iRunCnt As Integer = 0 |
501 | 3acffcee | Gyusu | For Each oRun As Object In oLineNo.Elements(_XML_CATEGORY_RUN) |
502 | 76f465d0 | Gyusu | iRunCnt = iRunCnt + 1 |
503 | Dim sRunName As String = CLineNo.Text & "_" & iRunCnt |
||
504 | For Each oMERGEDLine As Object In oRun.Elements(_XML_CATEGORY_MERGEDLINE) |
||
505 | For Each oLine As Object In oMERGEDLine.Elements(_XML_CATEGORY_LINE) |
||
506 | Try |
||
507 | Dim oAddrow As DataRow = oLine_Dt.NewRow() |
||
508 | Dim oEleObj As XElement |
||
509 | Dim sUid As String |
||
510 | Dim sStartpoint As String |
||
511 | Dim sEndpoint As String |
||
512 | Dim sType As String |
||
513 | Dim sConnectionUids As String = "" |
||
514 | Dim dStartPos_x As Double = 0.0 |
||
515 | Dim dStartPos_y As Double = 0.0 |
||
516 | Dim dEndPos_x As Double = 0.0 |
||
517 | Dim dEndPos_y As Double = 0.0 |
||
518 | Dim dDWG_StartPos_x As Double = 0.0 |
||
519 | Dim dDWG_StartPos_y As Double = 0.0 |
||
520 | Dim dDWG_EndPos_x As Double = 0.0 |
||
521 | Dim dDWG_EndPos_y As Double = 0.0 |
||
522 | oEleObj = oLine.Element(_XML_LINE_UID) |
||
523 | sUid = oEleObj.Value |
||
524 | b08338e3 | Gyusu | |
525 | 76f465d0 | Gyusu | If oLine_Dt.Select(_XML_LINE_UID & "='" & sUid & "'").Length = 0 Then |
526 | oEleObj = oLine.Element(_XML_LINE_STARTPOINT) |
||
527 | sStartpoint = oEleObj.Value |
||
528 | oEleObj = oLine.Element(_XML_LINE_ENDPOINT) |
||
529 | sEndpoint = oEleObj.Value |
||
530 | oEleObj = oLine.Element(_XML_LINE_TYPE) |
||
531 | sType = oEleObj.Value |
||
532 | f291ddcb | Gyusu | |
533 | 76f465d0 | Gyusu | oAddrow(_XML_LINE_Conn1_Uid) = "" |
534 | oAddrow(_XML_LINE_Conn2_Uid) = "" |
||
535 | oAddrow(_XML_LINE_UID) = sUid |
||
536 | oAddrow(_XML_LINE_RUNNAME) = sRunName |
||
537 | oAddrow(_XML_LINE_LINENOUID) = CLineNo.Uid |
||
538 | oAddrow(_XML_LINENO_TEXT) = CLineNo.Text |
||
539 | oAddrow(_XML_LINE_STARTPOINT) = sStartpoint |
||
540 | oAddrow(_XML_LINE_ENDPOINT) = sEndpoint |
||
541 | f291ddcb | Gyusu | If sUid = "0bda520b-9c01-4dc1-9ddd-73adb5f7a871" Then |
542 | MsgBox("") |
||
543 | End If |
||
544 | 76f465d0 | Gyusu | ConvertPointBystring(sStartpoint, dStartPos_x, dStartPos_y) |
545 | ConvertPointBystring(sEndpoint, dEndPos_x, dEndPos_y) |
||
546 | Dim sDirection As String = "" |
||
547 | 76f5e1a8 | Gyusu | Dim sFlowDirection As String = "" |
548 | Dim bValidLine As Boolean = GetFlowDirection(dStartPos_x, dStartPos_y, dEndPos_x, dEndPos_y, sDirection, sFlowDirection) |
||
549 | oAddrow(_XML_LINE_FlowDirection) = sFlowDirection |
||
550 | 76f465d0 | Gyusu | oAddrow(_XML_LINE_Direction) = sDirection |
551 | 76f5e1a8 | Gyusu | oAddrow(_XML_LINE_ValieLine) = bValidLine |
552 | 76f465d0 | Gyusu | dDWG_StartPos_x = dStartPos_x |
553 | dDWG_StartPos_y = dStartPos_y |
||
554 | ConvertPointByImage(dDWG_StartPos_x, dDWG_StartPos_y, _IMG_X, _IMG_Y) |
||
555 | dDWG_EndPos_x = dEndPos_x |
||
556 | dDWG_EndPos_y = dEndPos_y |
||
557 | ConvertPointByImage(dDWG_EndPos_x, dDWG_EndPos_y, _IMG_X, _IMG_Y) |
||
558 | |||
559 | oAddrow(_XML_LINE_STARTPOINT_X) = dStartPos_x |
||
560 | oAddrow(_XML_LINE_STARTPOINT_Y) = dStartPos_y |
||
561 | oAddrow(_XML_LINE_ENDPOINT_X) = dEndPos_x |
||
562 | oAddrow(_XML_LINE_ENDPOINT_Y) = dEndPos_y |
||
563 | |||
564 | oAddrow(_XML_LINE_DWG_STARTPOINT_X) = dDWG_StartPos_x |
||
565 | oAddrow(_XML_LINE_DWG_STARTPOINT_Y) = dDWG_StartPos_y |
||
566 | oAddrow(_XML_LINE_DWG_ENDPOINT_X) = dDWG_EndPos_x |
||
567 | oAddrow(_XML_LINE_DWG_ENDPOINT_Y) = dDWG_EndPos_y |
||
568 | |||
569 | oAddrow(_XML_LINE_SYSTEMPATH) = GetDataFromMappingDB(_XML_CATEGORY_LINE, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
570 | If oAddrow(_XML_LINE_SYSTEMPATH) = "" Then |
||
571 | MessageBox.Show("") |
||
572 | b08338e3 | Gyusu | End If |
573 | 76f465d0 | Gyusu | oAddrow(_XML_LINE_DRAWING_TF) = "FALSE" |
574 | oAddrow(_XML_LINE_TYPE) = sType |
||
575 | ' _AllLine_DT.Rows.Add(oAddrow) |
||
576 | oLine_Dt.Rows.Add(oAddrow) |
||
577 | Else |
||
578 | b08338e3 | Gyusu | End If |
579 | 76f465d0 | Gyusu | Catch ex As Exception |
580 | End Try |
||
581 | Next |
||
582 | 3acffcee | Gyusu | Next |
583 | |||
584 | For Each oSymbol As Object In oRun.Elements(_XML_CATEGORY_SYMBOL) |
||
585 | Try |
||
586 | 76f465d0 | Gyusu | |
587 | 3acffcee | Gyusu | Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
588 | Dim oEleObj As XElement |
||
589 | Dim sUid As String |
||
590 | Dim sName As String |
||
591 | Dim sLocation As String |
||
592 | Dim sSize As String |
||
593 | Dim sAngle As String |
||
594 | Dim sOriginalPoint As String = "" |
||
595 | bb2a0c79 | Gyusu | Dim sConnectionPoint As String = "" |
596 | b08338e3 | Gyusu | Dim sConnectionUids As String = "" |
597 | Dim sConnArray As String() |
||
598 | e38f99a7 | Gyusu | Dim sSizeArray As String() |
599 | Dim sLocationArray As String() |
||
600 | 9c86a823 | Gyusu | Dim sChild As String = "" |
601 | 76f465d0 | Gyusu | Dim dCenterPos_x As Double = 0.0 |
602 | Dim dCenterPos_y As Double = 0.0 |
||
603 | Dim dDwgCenterPos_x As Double = 0.0 |
||
604 | Dim dDwgCenterPos_y As Double = 0.0 |
||
605 | |||
606 | Dim dConn1Pos_x As Double = 0.0 |
||
607 | Dim dConn1Pos_y As Double = 0.0 |
||
608 | Dim dConn2Pos_x As Double = 0.0 |
||
609 | Dim dConn2Pos_y As Double = 0.0 |
||
610 | Dim dConn3Pos_x As Double = 0.0 |
||
611 | Dim dConn3Pos_y As Double = 0.0 |
||
612 | Dim dConn4Pos_x As Double = 0.0 |
||
613 | Dim dConn4Pos_y As Double = 0.0 |
||
614 | |||
615 | Dim dDwg_Conn1Pos_x As Double = 0.0 |
||
616 | Dim dDwg_Conn1Pos_y As Double = 0.0 |
||
617 | Dim dDwg_Conn2Pos_x As Double = 0.0 |
||
618 | Dim dDwg_Conn2Pos_y As Double = 0.0 |
||
619 | Dim dDwg_Conn3Pos_x As Double = 0.0 |
||
620 | Dim dDwg_Conn3Pos_y As Double = 0.0 |
||
621 | Dim dDwg_Conn4Pos_x As Double = 0.0 |
||
622 | Dim dDwg_Conn4Pos_y As Double = 0.0 |
||
623 | |||
624 | 3acffcee | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
625 | sUid = oEleObj.Value |
||
626 | oEleObj = oSymbol.Element(_XML_SYMBOL_PARENT) |
||
627 | sName = oEleObj.Value |
||
628 | oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
||
629 | sLocation = oEleObj.Value |
||
630 | oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
||
631 | sSize = oEleObj.Value |
||
632 | oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
||
633 | sAngle = oEleObj.Value |
||
634 | bb2a0c79 | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_CONNECTIONPOINT) |
635 | sConnectionPoint = oEleObj.Value |
||
636 | 9c86a823 | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_CHILD) |
637 | sChild = oEleObj.Value |
||
638 | 3acffcee | Gyusu | Try |
639 | oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
||
640 | sOriginalPoint = oEleObj.Value |
||
641 | Catch ex As Exception |
||
642 | |||
643 | End Try |
||
644 | 76f465d0 | Gyusu | 'oEleObj = oSymbol.Element(_XML_LINE_CONNS) |
645 | 'sConnectionUids = oEleObj.Value |
||
646 | 'sConnArray = sConnectionUids.Split(",") |
||
647 | 'If sConnArray.Length > 4 Then |
||
648 | ' MessageBox.Show(sConnArray.Length) |
||
649 | 'End If |
||
650 | 'For i = 0 To sConnArray.Length - 1 |
||
651 | ' If i = 0 Then |
||
652 | ' oAddrow(_XML_SYMBOL_Conn1_Uid) = sConnArray(i) |
||
653 | ' ElseIf i = 1 Then |
||
654 | ' oAddrow(_XML_SYMBOL_Conn2_Uid) = sConnArray(i) |
||
655 | ' ElseIf i = 2 Then |
||
656 | ' oAddrow(_XML_SYMBOL_Conn3_Uid) = sConnArray(i) |
||
657 | ' ElseIf i = 3 Then |
||
658 | ' oAddrow(_XML_SYMBOL_Conn4_Uid) = sConnArray(i) |
||
659 | ' End If |
||
660 | 'Next |
||
661 | oAddrow(_XML_SYMBOL_Conn1_Uid) = "" |
||
662 | oAddrow(_XML_SYMBOL_Conn2_Uid) = "" |
||
663 | oAddrow(_XML_SYMBOL_Conn3_Uid) = "" |
||
664 | oAddrow(_XML_SYMBOL_Conn4_Uid) = "" |
||
665 | ConvertPointBystring(sOriginalPoint, dCenterPos_x, dCenterPos_y) |
||
666 | dDwgCenterPos_x = dCenterPos_x |
||
667 | dDwgCenterPos_y = dCenterPos_y |
||
668 | ConvertPointByImage(dDwgCenterPos_x, dDwgCenterPos_y, _IMG_X, _IMG_Y) |
||
669 | |||
670 | oAddrow(_XML_SYMBOL_CENTERPOINT_X) = dCenterPos_x |
||
671 | oAddrow(_XML_SYMBOL_CENTERPOINT_Y) = dCenterPos_y |
||
672 | oAddrow(_XML_SYMBOL_DWG_CENTERPOINT_X) = dDwgCenterPos_x |
||
673 | oAddrow(_XML_SYMBOL_DWG_CENTERPOINT_Y) = dDwgCenterPos_y |
||
674 | sConnArray = sConnectionPoint.Split("/") |
||
675 | e38f99a7 | Gyusu | sSizeArray = sSize.Split(",") |
676 | sLocationArray = sLocation.Split(",") |
||
677 | b08338e3 | Gyusu | If sConnArray.Length > 4 Then |
678 | MessageBox.Show(sConnArray.Length) |
||
679 | End If |
||
680 | For i = 0 To sConnArray.Length - 1 |
||
681 | If i = 0 Then |
||
682 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn1_Point) = sConnArray(i) |
683 | ConvertPointBystring(sConnArray(i), dConn1Pos_x, dConn1Pos_y) |
||
684 | dDwg_Conn1Pos_x = dConn1Pos_x |
||
685 | dDwg_Conn1Pos_y = dConn1Pos_y |
||
686 | ConvertPointByImage(dDwg_Conn1Pos_x, dDwg_Conn1Pos_y, _IMG_X, _IMG_Y) |
||
687 | |||
688 | oAddrow(_XML_SYMBOL_CONN1_POINT_X) = dConn1Pos_x |
||
689 | oAddrow(_XML_SYMBOL_CONN1_POINT_Y) = dConn1Pos_y |
||
690 | oAddrow(_XML_SYMBOL_DWG_CONN1_POINT_X) = dDwg_Conn1Pos_x |
||
691 | oAddrow(_XML_SYMBOL_DWG_CONN1_POINT_Y) = dDwg_Conn1Pos_y |
||
692 | b08338e3 | Gyusu | ElseIf i = 1 Then |
693 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn2_Point) = sConnArray(i) |
694 | ConvertPointBystring(sConnArray(i), dConn2Pos_x, dConn2Pos_y) |
||
695 | dDwg_Conn2Pos_x = dConn2Pos_x |
||
696 | dDwg_Conn2Pos_y = dConn2Pos_y |
||
697 | ConvertPointByImage(dDwg_Conn2Pos_x, dDwg_Conn2Pos_y, _IMG_X, _IMG_Y) |
||
698 | oAddrow(_XML_SYMBOL_CONN2_POINT_X) = dConn2Pos_x |
||
699 | oAddrow(_XML_SYMBOL_CONN2_POINT_Y) = dConn2Pos_y |
||
700 | oAddrow(_XML_SYMBOL_DWG_CONN2_POINT_X) = dDwg_Conn2Pos_x |
||
701 | oAddrow(_XML_SYMBOL_DWG_CONN2_POINT_Y) = dDwg_Conn2Pos_y |
||
702 | b08338e3 | Gyusu | ElseIf i = 2 Then |
703 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn3_Point) = sConnArray(i) |
704 | ConvertPointBystring(sConnArray(i), dConn3Pos_x, dConn3Pos_y) |
||
705 | dDwg_Conn3Pos_x = dConn3Pos_x |
||
706 | dDwg_Conn3Pos_y = dConn3Pos_y |
||
707 | ConvertPointByImage(dDwg_Conn3Pos_x, dDwg_Conn3Pos_y, _IMG_X, _IMG_Y) |
||
708 | oAddrow(_XML_SYMBOL_CONN3_POINT_X) = dConn3Pos_x |
||
709 | oAddrow(_XML_SYMBOL_CONN3_POINT_Y) = dConn3Pos_y |
||
710 | oAddrow(_XML_SYMBOL_DWG_CONN3_POINT_X) = dDwg_Conn3Pos_x |
||
711 | oAddrow(_XML_SYMBOL_DWG_CONN3_POINT_Y) = dDwg_Conn3Pos_y |
||
712 | b08338e3 | Gyusu | ElseIf i = 3 Then |
713 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn4_Point) = sConnArray(i) |
714 | ConvertPointBystring(sConnArray(i), dConn4Pos_x, dConn4Pos_y) |
||
715 | dDwg_Conn4Pos_x = dConn4Pos_x |
||
716 | dDwg_Conn4Pos_y = dConn4Pos_y |
||
717 | ConvertPointByImage(dDwg_Conn4Pos_x, dDwg_Conn4Pos_y, _IMG_X, _IMG_Y) |
||
718 | oAddrow(_XML_SYMBOL_CONN4_POINT_X) = dConn4Pos_x |
||
719 | oAddrow(_XML_SYMBOL_CONN4_POINT_Y) = dConn4Pos_y |
||
720 | oAddrow(_XML_SYMBOL_DWG_CONN4_POINT_X) = dDwg_Conn4Pos_x |
||
721 | oAddrow(_XML_SYMBOL_DWG_CONN4_POINT_Y) = dDwg_Conn4Pos_y |
||
722 | b08338e3 | Gyusu | End If |
723 | Next |
||
724 | |||
725 | e38f99a7 | Gyusu | Dim sXLength As String = "" |
726 | Dim sYLength As String = "" |
||
727 | |||
728 | Dim dMin_x As Double = 0 |
||
729 | Dim dMax_x As Double = 0 |
||
730 | Dim dMin_y As Double = 0 |
||
731 | Dim dMax_y As Double = 0 |
||
732 | |||
733 | For i = 0 To sSizeArray.Length - 1 |
||
734 | If i = 0 Then |
||
735 | sXLength = sSizeArray(i) |
||
736 | ElseIf i = 1 Then |
||
737 | sYLength = sSizeArray(i) |
||
738 | End If |
||
739 | Next |
||
740 | |||
741 | For i = 0 To sLocationArray.Length - 1 |
||
742 | If i = 0 Then |
||
743 | dMin_x = sLocationArray(i) |
||
744 | dMax_x = dMin_x + sXLength |
||
745 | ElseIf i = 1 Then |
||
746 | 'Y축은 반전 |
||
747 | dMax_y = sLocationArray(i) |
||
748 | dMin_y = dMax_y + sYLength |
||
749 | End If |
||
750 | Next |
||
751 | ConvertPointByImage(dMin_x, dMin_y, _IMG_X, _IMG_Y) |
||
752 | ConvertPointByImage(dMax_x, dMax_y, _IMG_X, _IMG_Y) |
||
753 | |||
754 | oAddrow(_XML_SYMBOL_MIN_X) = dMin_x |
||
755 | oAddrow(_XML_SYMBOL_MAX_X) = dMax_x |
||
756 | oAddrow(_XML_SYMBOL_MIN_Y) = dMin_y |
||
757 | oAddrow(_XML_SYMBOL_MAX_Y) = dMax_y |
||
758 | 3acffcee | Gyusu | oAddrow(_XML_SYMBOL_UID) = sUid |
759 | b08338e3 | Gyusu | oAddrow(_XML_LINE_LINENOUID) = CLineNo.Uid |
760 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_RUNNAME) = sRunName |
761 | b08338e3 | Gyusu | oAddrow(_XML_LINENO_TEXT) = CLineNo.Text |
762 | 3acffcee | Gyusu | oAddrow(_XML_SYMBOL_NAME) = IO.Path.GetFileNameWithoutExtension(GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME)) |
763 | oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
||
764 | oAddrow(_XML_SYMBOL_SIZE) = sSize |
||
765 | oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
||
766 | oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
767 | oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
||
768 | oAddrow(_XML_SYMBOL_CLASS) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_CLASS) |
||
769 | oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
||
770 | 76f465d0 | Gyusu | |
771 | bb2a0c79 | Gyusu | oAddrow(_XML_SYMBOL_CONNECTIONPOINT) = sConnectionPoint |
772 | e4000111 | Gyusu | oAddrow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
773 | 9c86a823 | Gyusu | oAddrow(_XML_SYMBOL_CHILD) = sChild |
774 | 76f465d0 | Gyusu | ' _AllSymbol_DT.Rows.Add(oAddrow) |
775 | 3acffcee | Gyusu | oSymbol_Dt.Rows.Add(oAddrow) |
776 | Catch ex As Exception |
||
777 | End Try |
||
778 | Next |
||
779 | |||
780 | For Each oAtrribute As Object In oRun.Elements(_XML_CATEGORY_ATTRIBUTE) |
||
781 | Try |
||
782 | Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
||
783 | Dim oEleObj As XElement |
||
784 | Dim sUid As String |
||
785 | Dim sName As String |
||
786 | Dim sValue As String |
||
787 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
||
788 | sUid = oEleObj.Value |
||
789 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
||
790 | sName = oEleObj.Value |
||
791 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
||
792 | sValue = oEleObj.Value |
||
793 | oAddrow(_XML_ATTRIBUTE_UID) = sUid |
||
794 | oAddrow(_XML_ATTRIBUTE_NAME) = sName |
||
795 | oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
||
796 | oAttribute_Dt.Rows.Add(oAddrow) |
||
797 | Catch ex As Exception |
||
798 | End Try |
||
799 | Next |
||
800 | Next |
||
801 | 'Line No Attribute |
||
802 | For Each oAtrribute As Object In oLineNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
||
803 | Try |
||
804 | Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
||
805 | Dim oEleObj As XElement |
||
806 | Dim sUid As String = "" |
||
807 | Dim sName As String |
||
808 | Dim sValue As String |
||
809 | |||
810 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
||
811 | sUid = oEleObj.Value |
||
812 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
||
813 | sName = oEleObj.Value |
||
814 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
||
815 | sValue = oEleObj.Value |
||
816 | oAddrow(_XML_ATTRIBUTE_UID) = sUid |
||
817 | oAddrow(_XML_ATTRIBUTE_NAME) = sName |
||
818 | oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
||
819 | oAttribute_Dt.Rows.Add(oAddrow) |
||
820 | Catch ex As Exception |
||
821 | End Try |
||
822 | Next |
||
823 | 76f465d0 | Gyusu | SetConnectionInfo(oLine_Dt, oSymbol_Dt) |
824 | _AllLine_DT.Merge(oLine_Dt) |
||
825 | _AllSymbol_DT.Merge(oSymbol_Dt) |
||
826 | 3acffcee | Gyusu | CLineNo.Dt_Line = oLine_Dt |
827 | CLineNo.Dt_Symbol = oSymbol_Dt |
||
828 | CLineNo.Dt_Attribute = oAttribute_Dt |
||
829 | oLineno_list.Add(CLineNo) |
||
830 | Next |
||
831 | Return oLineno_list |
||
832 | End Function |
||
833 | |||
834 | 7e561f5b | gaqhf | Public Sub ConvertPointByImage(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double) |
835 | 4f359afa | Gyusu | |
836 | Dim calcx As Double = 0 |
||
837 | Dim calcy As Double = 0 |
||
838 | calcx = (dX * _DWG_X) / dDwgX 'Math.Round((dX * _DWG_X) / dDwgX, 2) |
||
839 | 76f465d0 | Gyusu | calcx = Math.Truncate(calcx * 1000) / 1000 |
840 | 171ac39d | Gyusu | calcy = _DWG_Y - ((dY * _DWG_Y) / dDwgY) '_DWG_Y - Math.Round((dY * _DWG_Y) / dDwgY, 2) |
841 | 76f465d0 | Gyusu | calcy = Math.Truncate(calcy * 1000) / 1000 |
842 | 4f359afa | Gyusu | dX = calcx |
843 | dY = calcy |
||
844 | End Sub |
||
845 | e1cde8f2 | Gyusu | '@brief Convert To SPPID |
846 | '@author : Gyusu Park |
||
847 | '@date : 2018-04-10 |
||
848 | '@history: |
||
849 | 171ac39d | Gyusu | Private Sub SplitLocation(ByVal sLocation As String, ByRef dX As Double, ByRef dY As Double) |
850 | |||
851 | Dim opointstr As String() = Split(sLocation, ",") |
||
852 | If (opointstr.Length > 1) Then |
||
853 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
854 | dX = opointstr(0) |
||
855 | dY = opointstr(1) |
||
856 | End If |
||
857 | End If |
||
858 | |||
859 | End Sub |
||
860 | |||
861 | Private Function Load_DB(ByVal sDBPath As String, ByVal sTableName As String) As DataTable |
||
862 | 4f359afa | Gyusu | |
863 | Try |
||
864 | 171ac39d | Gyusu | Dim oDt As New DataTable |
865 | 4f359afa | Gyusu | Dim sConnectionstring As String = "Data Source=" & sDBPath & ";Version=3;Synchronous=Off;UTF8Encoding=True;" |
866 | Dim conn As SQLiteConnection = New SQLiteConnection(sConnectionstring) |
||
867 | conn.Open() |
||
868 | 171ac39d | Gyusu | Dim sQuery As String = "Select * from " & sTableName |
869 | 4f359afa | Gyusu | Dim cmd As SQLiteCommand = conn.CreateCommand() |
870 | Dim adapter As SQLiteDataAdapter = New SQLiteDataAdapter(sQuery, conn) |
||
871 | Dim oDataSet As DataSet = New DataSet() |
||
872 | adapter.Fill(oDataSet) |
||
873 | 171ac39d | Gyusu | oDt = oDataSet.Tables(0) |
874 | Return oDt |
||
875 | 4f359afa | Gyusu | Catch ex As Exception |
876 | 171ac39d | Gyusu | Return Nothing |
877 | 4f359afa | Gyusu | End Try |
878 | 171ac39d | Gyusu | End Function |
879 | 4f359afa | Gyusu | |
880 | 31d47a80 | Gyusu | Private Function LoadAllDrawing() As DataTable |
881 | e1cde8f2 | Gyusu | SetListBoxItems(ListBox_Result, "도면정보 로드중....") |
882 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "도면정보 로드중....") |
883 | 31d47a80 | Gyusu | Dim oDt As DataTable = Drawing_Dt() |
884 | e282643f | Gyusu | Dim sHierarchy As String = My.Settings.Plant_Hierarchy |
885 | Dim files() As String |
||
886 | files = Directory.GetFiles(sHierarchy, "*.pid", SearchOption.AllDirectories) |
||
887 | For Each FileName As String In files |
||
888 | Dim sName As String = FileName |
||
889 | 31d47a80 | Gyusu | Dim oAddRow As DataRow = oDt.NewRow() |
890 | e282643f | Gyusu | oAddRow("Name") = Path.GetFileNameWithoutExtension(sName) |
891 | oAddRow("Path") = FileName |
||
892 | 31d47a80 | Gyusu | oDt.Rows.Add(oAddRow) |
893 | Next |
||
894 | Return oDt |
||
895 | End Function |
||
896 | |||
897 | 272662f9 | Gyusu | Dim _XMLList As ListView = New ListView() |
898 | e282643f | Gyusu | |
899 | 171ac39d | Gyusu | Private Function CheckOpenDrawing() As Boolean |
900 | Try |
||
901 | |||
902 | Dim lobjDatasource As Object |
||
903 | _Placement = CreateObject("Plaice.Placement", "") |
||
904 | lobjDatasource = _Placement.PIDDataSource |
||
905 | Return True |
||
906 | Catch ex As Exception |
||
907 | Return False |
||
908 | End Try |
||
909 | |||
910 | End Function |
||
911 | |||
912 | |||
913 | Private Sub Btn_Convert_Click(sender As Object, e As EventArgs) Handles Btn_Convert.Click |
||
914 | Main_Tab.SelectedIndex = 1 |
||
915 | ListBox_Result.Items.Clear() |
||
916 | Me.ProgressBar_Status.Visible = True |
||
917 | ProgressBar_Status.Maximum = 100 |
||
918 | ProgressBar_Status.Value = 0 |
||
919 | 94c7557d | gaqhf | |
920 | 54b98e09 | Gyusu | _Main_trd = New Thread(AddressOf ThreadConvert) |
921 | 171ac39d | Gyusu | _Main_trd.IsBackground = True |
922 | _Main_trd.Start() |
||
923 | 54b98e09 | Gyusu | FineOPCForm() |
924 | End Sub |
||
925 | 171ac39d | Gyusu | |
926 | 54b98e09 | Gyusu | Private Sub FineOPCForm() |
927 | _Opc_trd = New Thread(AddressOf ThreadOPCRemove) |
||
928 | _Opc_trd.IsBackground = True |
||
929 | _Opc_trd.Start() |
||
930 | 171ac39d | Gyusu | End Sub |
931 | 54b98e09 | Gyusu | |
932 | 31d47a80 | Gyusu | |
933 | b08338e3 | Gyusu | Dim _objPIDAutoApp As Object |
934 | e282643f | Gyusu | |
935 | b08338e3 | Gyusu | Private Function OpenSPPID(ByVal oDwg_Dt As DataTable, ByVal sDwgName As String) As Boolean |
936 | Dim bCheckOpen As Boolean = False |
||
937 | ' Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgPath) |
||
938 | SetListBoxItems(ListBox_Result, sDwgName & " 도면 Open....") |
||
939 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, sDwgName & " 도면 Open....") |
||
940 | _objPIDAutoApp = CreateObject("PIDAutomation.Application") |
||
941 | e1cde8f2 | Gyusu | |
942 | b08338e3 | Gyusu | Dim sPath As String = OpenDrawing(oDwg_Dt, sDwgName) |
943 | If sPath <> "" Then |
||
944 | Process.Start(sPath) |
||
945 | Else |
||
946 | Return bCheckOpen |
||
947 | End If |
||
948 | 171ac39d | Gyusu | |
949 | 1bfcc921 | Gyusu | Dim bCheckOpenDrawing As Boolean = False |
950 | While (True) |
||
951 | bCheckOpenDrawing = CheckOpenDrawing() |
||
952 | If bCheckOpenDrawing = True Then |
||
953 | bCheckOpen = True |
||
954 | Exit While |
||
955 | Else |
||
956 | Thread.Sleep(2000) |
||
957 | End If |
||
958 | End While |
||
959 | 171ac39d | Gyusu | |
960 | |||
961 | 1bfcc921 | Gyusu | Return bCheckOpen |
962 | 171ac39d | Gyusu | End Function |
963 | |||
964 | Private Function GetDrawing(ByVal sDwgName As String) As Drawing |
||
965 | For Each CDrawing In _DrawingsList |
||
966 | 559daf6d | Gyusu | If CDrawing.DwgName.ToUpper() = sDwgName.ToUpper() Then |
967 | 171ac39d | Gyusu | Return CDrawing |
968 | End If |
||
969 | Next |
||
970 | Return Nothing |
||
971 | End Function |
||
972 | |||
973 | Private Function GetLineNo(ByVal CDrawing As Drawing, ByVal sLineNoUid As String) As Line_no |
||
974 | For Each CLineNo In CDrawing.Line_nos |
||
975 | If CLineNo.Uid = sLineNoUid Then |
||
976 | Return CLineNo |
||
977 | End If |
||
978 | Next |
||
979 | Return Nothing |
||
980 | End Function |
||
981 | |||
982 | 3acffcee | Gyusu | Private Function GetTrimLineNo(ByVal CDrawing As Drawing, ByVal sLineNoUid As String) As Line_no |
983 | For Each CLineNo In CDrawing.TrimLine_nos |
||
984 | If CLineNo.Uid = sLineNoUid Then |
||
985 | Return CLineNo |
||
986 | End If |
||
987 | Next |
||
988 | Return Nothing |
||
989 | End Function |
||
990 | |||
991 | |||
992 | bb2a0c79 | Gyusu | |
993 | Private Function GetPipeFromConnection(ByVal CDrawing As Drawing, ByVal sSymbolUid As String, ByRef sConnTypeNo As String) As DataTable |
||
994 | 6a6d8ab4 | Gyusu | For Each CLineNo In CDrawing.Line_nos |
995 | Dim odt As DataTable = CLineNo.Dt_Line |
||
996 | If odt.Rows.Count > 0 Then |
||
997 | bb2a0c79 | Gyusu | If odt.Rows(0)(_XML_LINE_Conn1_Uid).ToString = sSymbolUid Then |
998 | sConnTypeNo = "1" |
||
999 | Return odt |
||
1000 | ElseIf odt.Rows(0)(_XML_LINE_Conn2_Uid).ToString() = sSymbolUid Then |
||
1001 | sConnTypeNo = "2" |
||
1002 | Return odt |
||
1003 | 6a6d8ab4 | Gyusu | End If |
1004 | End If |
||
1005 | Next |
||
1006 | bb2a0c79 | Gyusu | Return New DataTable |
1007 | 6a6d8ab4 | Gyusu | End Function |
1008 | |||
1009 | bb2a0c79 | Gyusu | Private Function GetSymbolFromConnection(ByVal CDrawing As Drawing, ByVal sSymbolUid As String, ByRef sConnTypeNo As String) As DataTable |
1010 | For Each CLineNo In CDrawing.Line_nos |
||
1011 | Dim odt As DataTable = CLineNo.Dt_Symbol |
||
1012 | If odt.Rows.Count > 0 Then |
||
1013 | If odt.Rows(0)(_XML_SYMBOL_Conn1_Uid).ToString = sSymbolUid Then |
||
1014 | sConnTypeNo = "1" |
||
1015 | Return odt |
||
1016 | ElseIf odt.Rows(0)(_XML_SYMBOL_Conn2_Uid).ToString() = sSymbolUid Then |
||
1017 | sConnTypeNo = "2" |
||
1018 | Return odt |
||
1019 | ElseIf odt.Rows(0)(_XML_SYMBOL_Conn3_Uid).ToString() = sSymbolUid Then |
||
1020 | sConnTypeNo = "3" |
||
1021 | Return odt |
||
1022 | ElseIf odt.Rows(0)(_XML_SYMBOL_Conn4_Uid).ToString() = sSymbolUid Then |
||
1023 | sConnTypeNo = "4" |
||
1024 | Return odt |
||
1025 | End If |
||
1026 | End If |
||
1027 | Next |
||
1028 | Return New DataTable |
||
1029 | End Function |
||
1030 | 6a6d8ab4 | Gyusu | |
1031 | Private Function GetEqpNo(ByVal CDrawing As Drawing, ByVal sEqpUid As String) As Eqp_no |
||
1032 | For Each CEqpNo In CDrawing.Eqp_nos |
||
1033 | If CEqpNo.Uid = sEqpUid Then |
||
1034 | Return CEqpNo |
||
1035 | End If |
||
1036 | Next |
||
1037 | Return Nothing |
||
1038 | End Function |
||
1039 | 7e561f5b | gaqhf | Public Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean |
1040 | 171ac39d | Gyusu | Try |
1041 | Dim opointstr As String() = Split(sPoint, ",") |
||
1042 | If (opointstr.Length > 1) Then |
||
1043 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
1044 | dX = opointstr(0) |
||
1045 | dY = opointstr(1) |
||
1046 | 9e1e7135 | Gyusu | |
1047 | 171ac39d | Gyusu | Else |
1048 | dX = 0 |
||
1049 | dY = 0 |
||
1050 | Return False |
||
1051 | End If |
||
1052 | End If |
||
1053 | e1cde8f2 | Gyusu | Return True |
1054 | Catch ex As Exception |
||
1055 | Return False |
||
1056 | End Try |
||
1057 | 171ac39d | Gyusu | End Function |
1058 | |||
1059 | 54b98e09 | Gyusu | |
1060 | Dim _DrawLine_Dt As DataTable = DrawLind_Dt() |
||
1061 | |||
1062 | e1cde8f2 | Gyusu | |
1063 | b08338e3 | Gyusu | Private Sub PlaceEquipment(ByVal sUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sEqpName As String) |
1064 | 41e4023e | Gyusu | Try |
1065 | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
||
1066 | Dim oAttributeRow() As DataRow |
||
1067 | If oAttribute_Dt.Rows.Count > 0 Then |
||
1068 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
||
1069 | End If |
||
1070 | If oSymbolRow.Length > 0 Then |
||
1071 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1072 | f291ddcb | Gyusu | Dim sSymbolName As String = oSymbolRow(0)(_XML_SYMBOL_NAME).ToString() |
1073 | 41e4023e | Gyusu | Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
1074 | Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
1075 | Dim sClass As String = oSymbolRow(0)(_XML_SYMBOL_CLASS).ToString() |
||
1076 | Dim sLocation As String = oSymbolRow(0)(_XML_SYMBOL_LOCATION).ToString() |
||
1077 | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
1078 | Dim dAngle As Double = 0.0 |
||
1079 | If IsNumeric(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) Then |
||
1080 | dAngle = Double.Parse(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) |
||
1081 | End If |
||
1082 | Dim dLocationX As Double = 0.0 |
||
1083 | Dim dLocationY As Double = 0.0 |
||
1084 | f291ddcb | Gyusu | ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
1085 | Dim dX As Double = dLocationX |
||
1086 | Dim dY As Double = dLocationY |
||
1087 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
1088 | Dim oReturnSymbol As LMSymbol = Nothing |
||
1089 | If sSymbolCompType.ToUpper() = "NOZZLE" Then |
||
1090 | Dim sOwnerUid As String = oSymbolRow(0)(_XML_SYMBOL_OWNER).ToString() |
||
1091 | Dim oFineRow() As DataRow = _ModelingSymbol_Dt.Select("Uid = '" & sOwnerUid & "'") |
||
1092 | If oFineRow.Length = 1 Then |
||
1093 | Dim sEqpModelID As String = oFineRow(0)(_XML_SYMBOL_SPID).ToString() |
||
1094 | |||
1095 | Dim objVessel As LMVessel |
||
1096 | objVessel = _Placement.PIDDataSource.GetVessel(sEqpModelID) |
||
1097 | Dim oVesselLocation As LMLocations = objVessel.Locations |
||
1098 | Dim oEqpSymbol As LMSymbol = _Placement.PIDDataSource.GetSymbol(objVessel.Representations.Nth(1).Id) |
||
1099 | |||
1100 | Dim objNozzle As LMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, |
||
1101 | TargetItem:=oEqpSymbol.AsLMRepresentation) |
||
1102 | SetListBoxItems(ListBox_Result, "Place Nozzle.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iEquipmentcnt & " count ") |
||
1103 | _iNozzlecnt = _iNozzlecnt + 1 |
||
1104 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Nozzle : " & sUid) |
||
1105 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Nozzle Name : " & sSymbolName) |
||
1106 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
1107 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
1108 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Nozzle Count : " & _iNozzlecnt) |
||
1109 | End If |
||
1110 | Else |
||
1111 | oReturnSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1112 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Equipment.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iEquipmentcnt & " count ") |
1113 | _iEquipmentcnt = _iEquipmentcnt + 1 |
||
1114 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Equipment : " & sUid) |
||
1115 | f291ddcb | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Name : " & sSymbolName) |
1116 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
1117 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
1118 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Count : " & _iEquipmentcnt) |
||
1119 | 41e4023e | Gyusu | End If |
1120 | f291ddcb | Gyusu | '모델링 된 Symbol 데이터 테이블 저장 |
1121 | Dim oAddRow As DataRow = _ModelingSymbol_Dt.NewRow |
||
1122 | oAddRow(_XML_SYMBOL_UID) = sUid |
||
1123 | oAddRow(_XML_SYMBOL_SPID) = oReturnSymbol.ModelItemID |
||
1124 | oAddRow(_XML_SYMBOL_LMSYMBOL) = oReturnSymbol |
||
1125 | oAddRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
1126 | oAddRow(_XML_SYMBOL_CENTERPOINT_X) = dLocationX |
||
1127 | oAddRow(_XML_SYMBOL_CENTERPOINT_Y) = dLocationY |
||
1128 | _ModelingSymbol_Dt.Rows.Add(oAddRow) |
||
1129 | 41e4023e | Gyusu | End If |
1130 | Catch ex As Exception |
||
1131 | End Try |
||
1132 | End Sub |
||
1133 | 54b98e09 | Gyusu | |
1134 | 76f465d0 | Gyusu | Private Sub AddProgress() |
1135 | _Itemcnt = _Itemcnt + 1 |
||
1136 | Dim dCalcProgressValue As Double = (_Itemcnt / _allItem) * 100 |
||
1137 | SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
||
1138 | Label_Progress.Text = Math.Round(dCalcProgressValue, 0) & "%" |
||
1139 | End Sub |
||
1140 | 6a6d8ab4 | Gyusu | |
1141 | 171ac39d | Gyusu | |
1142 | 94c7557d | gaqhf | Dim _라인보정기준값 As Integer = 10 |
1143 | 171ac39d | Gyusu | |
1144 | 54b98e09 | Gyusu | |
1145 | 94c7557d | gaqhf | Private Function GetAllCheckNodeCount() As Integer |
1146 | _allItem = 0 |
||
1147 | For i = 0 To Tree_Result.Nodes.Count - 1 |
||
1148 | For j = 0 To Tree_Result.Nodes(i).Nodes.Count - 1 |
||
1149 | For k = 0 To Tree_Result.Nodes(i).Nodes(j).Nodes.Count - 1 |
||
1150 | For l = 0 To Tree_Result.Nodes(i).Nodes(j).Nodes(k).Nodes.Count - 1 |
||
1151 | If Tree_Result.Nodes(i).Nodes(j).Nodes(k).Nodes(l).Checked = True Then |
||
1152 | _allItem = _allItem + 1 |
||
1153 | End If |
||
1154 | Next |
||
1155 | Next |
||
1156 | Next |
||
1157 | Next |
||
1158 | Return _allItem |
||
1159 | End Function |
||
1160 | 54b98e09 | Gyusu | |
1161 | |||
1162 | 94c7557d | gaqhf | Private Sub ManualCheckNode(ByRef oDt As DataTable) |
1163 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
1164 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
1165 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
1166 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
1167 | Dim sUid As String = oSymbolNode.Name |
||
1168 | 'Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & |
||
1169 | ' "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'") |
||
1170 | If oSymbolNode.Checked Then |
||
1171 | Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & "'") |
||
1172 | If oSelectRows.Length = 1 Then |
||
1173 | oSelectRows(0)(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
||
1174 | If oSymbolNode.Checked Then |
||
1175 | oSelectRows(0)(_XML_SYMBOL_Check) = "TRUE" |
||
1176 | d039e347 | Gyusu | Else |
1177 | 94c7557d | gaqhf | oSelectRows(0)(_XML_SYMBOL_Check) = "FALSE" |
1178 | d039e347 | Gyusu | End If |
1179 | 94c7557d | gaqhf | End If |
1180 | d039e347 | Gyusu | End If |
1181 | 94c7557d | gaqhf | Next |
1182 | Next |
||
1183 | Next |
||
1184 | Next |
||
1185 | d039e347 | Gyusu | |
1186 | 94c7557d | gaqhf | End Sub |
1187 | d039e347 | Gyusu | |
1188 | 94c7557d | gaqhf | Private Function GetChildSymbolDirection(ByVal sDirection As String) As Double |
1189 | Dim sReturnDirection As String = "" |
||
1190 | If sDirection.ToUpper() = "RIGHT" Then |
||
1191 | Return 3.14 |
||
1192 | ElseIf sDirection.ToUpper() = "LEFT" Then |
||
1193 | Return 0 |
||
1194 | ElseIf sDirection.ToUpper = "DOWN" Then |
||
1195 | Return 1.57 |
||
1196 | ElseIf sDirection.ToUpper() = "UP" Then |
||
1197 | Return 4.71 |
||
1198 | Else |
||
1199 | Return 0 |
||
1200 | End If |
||
1201 | End Function |
||
1202 | d039e347 | Gyusu | |
1203 | 94c7557d | gaqhf | Private Function CheckExistModeling(ByVal oRow As DataRow) As String |
1204 | If oRow(_XML_LINE_DRAWING_TF).ToString() = "FALSE" And oRow(_XML_LINE_Check).ToString() = "TRUE" Then |
||
1205 | Return oRow(_XML_LINE_UID).ToString() |
||
1206 | End If |
||
1207 | Return String.Empty |
||
1208 | End Function |
||
1209 | |||
1210 | |||
1211 | Private Sub AddLog(ByVal sUid As String, ByVal sSystemPath As String, |
||
1212 | ByVal dStart_Dwg_x As Double, ByVal dStart_Dwg_y As Double, ByVal dEnd_Dwg_x As Double, ByVal dEnd_Dwg_y As Double, |
||
1213 | ByVal sLineNoText As String, ByVal sConn1Uid As String, ByVal sConn2Uid As String) |
||
1214 | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dStart_Dwg_x & "," & dStart_Dwg_y & ") - (" & dEnd_Dwg_x & "," & dEnd_Dwg_y & ")..." & _iPipecnt & " count ") |
||
1215 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
1216 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
1217 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & sConn1Uid) |
||
1218 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & sConn2Uid) |
||
1219 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
1220 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dStart_Dwg_x & "," & dStart_Dwg_y) |
||
1221 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dEnd_Dwg_x & "," & dEnd_Dwg_y) |
||
1222 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
1223 | End Sub |
||
1224 | |||
1225 | Private Sub AddAttribute(ByVal oPipeRun As LMPipeRun, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String) |
||
1226 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
1227 | If oAttributeRow.Length > 0 Then |
||
1228 | For Each oAttribute In oAttributeRow |
||
1229 | Try |
||
1230 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
1231 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
1232 | If sPIDValue.Contains("'") Then |
||
1233 | sPIDValue = sPIDValue.Replace("'", """") |
||
1234 | 171ac39d | Gyusu | End If |
1235 | 94c7557d | gaqhf | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
1236 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
1237 | Catch ex As Exception |
||
1238 | End Try |
||
1239 | Next |
||
1240 | oPipeRun.Commit() |
||
1241 | End If |
||
1242 | End Sub |
||
1243 | e4000111 | Gyusu | |
1244 | 94c7557d | gaqhf | Private Sub AddModelingDT(ByVal sUid As String, ByVal sModelID As String, ByVal oCurrentConnector As LMConnector, |
1245 | ByVal dStart_Dwg_x As Double, ByVal dStart_Dwg_y As Double, |
||
1246 | ByVal dEnd_Dwg_x As Double, ByVal dEnd_Dwg_y As Double) |
||
1247 | Dim oAddRow As DataRow = _ModelingLine_Dt.NewRow |
||
1248 | oAddRow(_XML_LINE_UID) = sUid |
||
1249 | oAddRow(_XML_LINE_SPID) = sModelID |
||
1250 | oAddRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector |
||
1251 | oAddRow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
1252 | oAddRow(_XML_LINE_DWG_STARTPOINT_X) = dStart_Dwg_x |
||
1253 | oAddRow(_XML_LINE_DWG_STARTPOINT_Y) = dStart_Dwg_y |
||
1254 | oAddRow(_XML_LINE_DWG_ENDPOINT_X) = dEnd_Dwg_x |
||
1255 | oAddRow(_XML_LINE_DWG_ENDPOINT_Y) = dEnd_Dwg_y |
||
1256 | _ModelingLine_Dt.Rows.Add(oAddRow) |
||
1257 | End Sub |
||
1258 | 171ac39d | Gyusu | |
1259 | 94c7557d | gaqhf | Private Function JoinPipeRun(ByVal sID_1 As String, ByVal sID_2 As String) As Boolean |
1260 | Try |
||
1261 | Dim objSurvivorItem As LMAItem = Nothing |
||
1262 | Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1) |
||
1263 | Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2) |
||
1264 | _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
1265 | Return True |
||
1266 | 54b98e09 | Gyusu | Catch ex As Exception |
1267 | Return False |
||
1268 | End Try |
||
1269 | End Function |
||
1270 | |||
1271 | |||
1272 | 94c7557d | gaqhf | Private Function LineModeling(ByVal objInputs As PlaceRunInputs, ByVal sSystemPath As String) As LMConnector |
1273 | Dim oCurrentConnector As LMConnector = Nothing |
||
1274 | Dim objItem As LMAItem |
||
1275 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
1276 | 54b98e09 | Gyusu | Try |
1277 | 94c7557d | gaqhf | oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
1278 | AddProgress() |
||
1279 | 54b98e09 | Gyusu | Catch ex As Exception |
1280 | End Try |
||
1281 | 94c7557d | gaqhf | Return oCurrentConnector |
1282 | End Function |
||
1283 | 54b98e09 | Gyusu | |
1284 | 94c7557d | gaqhf | Private Sub GetPrimaryLineInNode(ByVal list As List(Of Line), ByVal node As TreeNode) |
1285 | 7e561f5b | gaqhf | |
1286 | If node.Tag IsNot Nothing Then |
||
1287 | If TypeOf node.Tag Is Line Then |
||
1288 | Dim line As Line = node.Tag |
||
1289 | If line.TYPE = "Primary" And node.Checked Then |
||
1290 | list.Add(line) |
||
1291 | End If |
||
1292 | End If |
||
1293 | End If |
||
1294 | |||
1295 | For Each child As TreeNode In node.Nodes() |
||
1296 | GetPrimaryLineInNode(list, child) |
||
1297 | Next |
||
1298 | End Sub |
||
1299 | |||
1300 | 94c7557d | gaqhf | Private Sub GetSymbolInNode(ByVal list As List(Of Symbol), ByVal node As TreeNode) |
1301 | |||
1302 | If node.Tag IsNot Nothing Then |
||
1303 | If TypeOf node.Tag Is Symbol Then |
||
1304 | Dim symbol As Symbol = node.Tag |
||
1305 | list.Add(symbol) |
||
1306 | End If |
||
1307 | End If |
||
1308 | |||
1309 | For Each child As TreeNode In node.Nodes() |
||
1310 | GetSymbolInNode(list, child) |
||
1311 | Next |
||
1312 | End Sub |
||
1313 | |||
1314 | 7e561f5b | gaqhf | Private Function FindBranchLine(ByVal lines As List(Of Line)) As List(Of Line) |
1315 | Dim branchLines As List(Of Line) = New List(Of Line) |
||
1316 | |||
1317 | For Each line As Line In lines |
||
1318 | For Each conn As Connector In line.CONNECTORS |
||
1319 | If String.IsNullOrEmpty(conn.CONNECTEDITEM) = False Then |
||
1320 | 1406fef4 | gaqhf | If IsBranchLine(conn.CONNECTEDITEM, line.UID, lines) Then |
1321 | branchLines.Add(line) |
||
1322 | 7e561f5b | gaqhf | End If |
1323 | End If |
||
1324 | Next |
||
1325 | Next |
||
1326 | |||
1327 | Return branchLines |
||
1328 | End Function |
||
1329 | |||
1330 | 1406fef4 | gaqhf | Private Function IsBranchLine(ByVal connectedUID As String, ByVal UID As String, ByVal lines As List(Of Line)) As Boolean |
1331 | Dim connLine = FindLineByUID(lines, connectedUID) |
||
1332 | If connLine IsNot Nothing Then |
||
1333 | If connLine.CONNECTORS(0).CONNECTEDITEM <> UID And connLine.CONNECTORS(1).CONNECTEDITEM <> UID Then |
||
1334 | Return True |
||
1335 | End If |
||
1336 | End If |
||
1337 | |||
1338 | Return False |
||
1339 | End Function |
||
1340 | |||
1341 | 7e561f5b | gaqhf | Private Function FindLineByUID(ByVal lines As List(Of Line), ByVal uid As String) As Line |
1342 | For Each line As Line In lines |
||
1343 | If line.UID = uid Then |
||
1344 | Return line |
||
1345 | End If |
||
1346 | Next |
||
1347 | |||
1348 | Return Nothing |
||
1349 | End Function |
||
1350 | |||
1351 | |||
1352 | Private Function FindSymbolByUID(ByVal symbols As List(Of Symbol), ByVal uid As String) As Symbol |
||
1353 | For Each symbol As Symbol In symbols |
||
1354 | If symbol.UID = uid Then |
||
1355 | Return symbol |
||
1356 | End If |
||
1357 | Next |
||
1358 | |||
1359 | Return Nothing |
||
1360 | End Function |
||
1361 | |||
1362 | Private Function IsHorizontal(ByVal line As Line) |
||
1363 | If line.END_X - line.START_X = 0 Then |
||
1364 | Return False |
||
1365 | Else |
||
1366 | Dim angle = Math.Atan(Math.Abs(line.END_Y - line.START_Y) / Math.Abs(line.END_X - line.START_X)) * 180 / Math.PI |
||
1367 | If angle < 10 Then |
||
1368 | Return True |
||
1369 | Else |
||
1370 | Return False |
||
1371 | End If |
||
1372 | End If |
||
1373 | End Function |
||
1374 | |||
1375 | 1406fef4 | gaqhf | Private Function IsHorizontal(ByVal point1 As Pointd, ByVal point2 As Pointd) |
1376 | If point1.X - point2.X = 0 Then |
||
1377 | Return False |
||
1378 | Else |
||
1379 | Dim angle = Math.Atan(Math.Abs(point2.Y - point1.Y) / Math.Abs(point2.X - point1.X)) * 180 / Math.PI |
||
1380 | 94c7557d | gaqhf | If angle < 10 Then |
1381 | Return True |
||
1382 | Else |
||
1383 | Return False |
||
1384 | 1406fef4 | gaqhf | End If |
1385 | 94c7557d | gaqhf | End If |
1386 | 1406fef4 | gaqhf | End Function |
1387 | |||
1388 | Private Function GetLMConnectorByPoint(ByVal ModelId As String, ByVal point As Pointd) As LMConnector |
||
1389 | Dim objPlacement As Placement = New Placement |
||
1390 | Dim objConnector As LMConnector = Nothing |
||
1391 | |||
1392 | Dim distance As Double = Double.MaxValue |
||
1393 | Dim lmPipeRun As LMPipeRun = objPlacement.PIDDataSource.GetPipeRun(ModelId) |
||
1394 | For Each oRep As LMRepresentation In lmPipeRun.Representations |
||
1395 | If oRep.Attributes("RepresentationType").Value = "Connector" And oRep.Attributes("ItemStatus").Value = "Active" Then |
||
1396 | Dim _conn As LMConnector = objPlacement.PIDDataSource.GetConnector(oRep.Id) |
||
1397 | For Each vertex As LMConnectorVertex In _conn.ConnectorVertices |
||
1398 | Dim _distance As Double = CalcPointToPointdDistance(point, New Pointd(vertex.XCoordinate, vertex.YCoordinate)) |
||
1399 | |||
1400 | If _distance < distance Then |
||
1401 | distance = _distance |
||
1402 | objConnector = _conn |
||
1403 | End If |
||
1404 | Next |
||
1405 | End If |
||
1406 | Next |
||
1407 | |||
1408 | Return objConnector |
||
1409 | End Function |
||
1410 | |||
1411 | Private Function GetLMConnectorBySP_ID(ByVal ModelId As String, ByVal SP_ID1 As String, ByVal SP_ID2 As String) As LMConnector |
||
1412 | Dim objPlacement As Placement = New Placement |
||
1413 | Dim objConnector As LMConnector = Nothing |
||
1414 | |||
1415 | Dim distance As Double = Double.MaxValue |
||
1416 | Dim lmPipeRun As LMPipeRun = objPlacement.PIDDataSource.GetPipeRun(ModelId) |
||
1417 | For Each oRep As LMRepresentation In lmPipeRun.Representations |
||
1418 | If oRep.Attributes("RepresentationType").Value = "Connector" And oRep.Attributes("ItemStatus").Value = "Active" Then |
||
1419 | Dim _conn As LMConnector = objPlacement.PIDDataSource.GetConnector(oRep.Id) |
||
1420 | |||
1421 | Dim find1 As Boolean = False |
||
1422 | Dim find2 As Boolean = False |
||
1423 | |||
1424 | If _conn.ConnectItem1SymbolID IsNot Nothing Then |
||
1425 | If _conn.ConnectItem1SymbolID.ToString = SP_ID1 Or _conn.ConnectItem1SymbolID.ToString = SP_ID2 Then |
||
1426 | find1 = True |
||
1427 | End If |
||
1428 | End If |
||
1429 | |||
1430 | If _conn.ConnectItem2SymbolID IsNot Nothing Then |
||
1431 | If _conn.ConnectItem2SymbolID.ToString = SP_ID1 Or _conn.ConnectItem2SymbolID.ToString = SP_ID2 Then |
||
1432 | find2 = True |
||
1433 | End If |
||
1434 | End If |
||
1435 | |||
1436 | If find1 And find2 Then |
||
1437 | Return _conn |
||
1438 | End If |
||
1439 | End If |
||
1440 | Next |
||
1441 | |||
1442 | If objConnector Is Nothing Then |
||
1443 | Debug.WriteLine("Error At GetLMConnectorBySP_ID") |
||
1444 | End If |
||
1445 | |||
1446 | Return objConnector |
||
1447 | End Function |
||
1448 | |||
1449 | cb364170 | gaqhf | Private Function CalcLineToPointdDistance(ByVal point1 As Pointd, ByVal point2 As Pointd, ByVal targetPointd As Pointd) As Double |
1450 | If point1.X = point2.X Then |
||
1451 | Return Math.Abs(targetPointd.X - point1.X) |
||
1452 | ElseIf point1.Y = point2.Y Then |
||
1453 | Return Math.Abs(targetPointd.Y - point1.Y) |
||
1454 | Else |
||
1455 | ' y = ax + c |
||
1456 | Dim a As Double = (point2.Y - point1.Y) / (point2.X - point1.X) |
||
1457 | Dim c As Double = point2.Y - a * point2.X |
||
1458 | |||
1459 | ' ax + by + c = 0 |
||
1460 | Dim b As Double = -1 |
||
1461 | Return Math.Abs(a * targetPointd.X + b * targetPointd.Y + c) / Math.Pow(a * a + b * b, 0.5) |
||
1462 | End If |
||
1463 | End Function |
||
1464 | |||
1465 | 1406fef4 | gaqhf | Private Function CalcPointToPointdDistance(ByVal point1 As Pointd, ByVal point2 As Pointd) As Double |
1466 | |||
1467 | Return Math.Pow(Math.Pow(point1.X - point2.X, 2) + Math.Pow(point1.Y - point2.Y, 2), 0.5) |
||
1468 | |||
1469 | End Function |
||
1470 | |||
1471 | cb364170 | gaqhf | Private Function GetConnectorTarget(ByVal Connector_ModelID As String, ByVal targetPoint As Pointd) As LMConnector |
1472 | Dim objPlacement As Placement = New Placement |
||
1473 | |||
1474 | Dim lmPipeRun As LMPipeRun = objPlacement.PIDDataSource.GetPipeRun(Connector_ModelID) |
||
1475 | |||
1476 | Dim connList As List(Of LMConnector) = New List(Of LMConnector) |
||
1477 | Dim oConnector As LMConnector = Nothing |
||
1478 | |||
1479 | For Each oRep As LMRepresentation In lmPipeRun.Representations |
||
1480 | If oRep.Attributes("RepresentationType").Value = "Connector" And oRep.Attributes("ItemStatus").Value = "Active" Then |
||
1481 | connList.Add(objPlacement.PIDDataSource.GetConnector(oRep.Id)) |
||
1482 | End If |
||
1483 | Next |
||
1484 | |||
1485 | '' 자기 자신의 Line 찾기 |
||
1486 | Dim distance As Double = Double.MaxValue |
||
1487 | For Each lmLine As LMConnector In connList |
||
1488 | '' Connector의 포인트 정리 |
||
1489 | |||
1490 | '' 임시 |
||
1491 | oConnector = lmLine |
||
1492 | '_Placement.PIDDataSource.GetPipingPoint() |
||
1493 | |||
1494 | Dim pointList As List(Of Pointd) = New List(Of Pointd) |
||
1495 | |||
1496 | For index = 1 To Integer.MaxValue |
||
1497 | Dim point As LMConnectorVertex = lmLine.ConnectorVertices.Nth(index) |
||
1498 | If point IsNot Nothing Then |
||
1499 | Dim _pointd As Pointd = New Pointd() |
||
1500 | _pointd.X = point.XCoordinate |
||
1501 | _pointd.Y = point.YCoordinate |
||
1502 | pointList.Add(_pointd) |
||
1503 | Else |
||
1504 | Exit For |
||
1505 | End If |
||
1506 | Next |
||
1507 | |||
1508 | For index = 0 To pointList.Count - 1 |
||
1509 | If pointList.Count > index + 1 Then |
||
1510 | Dim _tempDistance As Double = CalcLineToPointdDistance(pointList(index), pointList(index + 1), targetPoint) |
||
1511 | If _tempDistance < distance Then |
||
1512 | oConnector = lmLine |
||
1513 | distance = _tempDistance |
||
1514 | End If |
||
1515 | End If |
||
1516 | Next |
||
1517 | Next |
||
1518 | |||
1519 | Return oConnector |
||
1520 | End Function |
||
1521 | |||
1522 | Private Function FindFirstLine(ByVal primaryLineList As List(Of Line), ByVal symbols As List(Of Symbol), ByVal symbol As Symbol, ByVal UID As String) As Line |
||
1523 | |||
1524 | For Each conn As Connector In symbol.CONNECTORS |
||
1525 | '' 자기 자신일 경우 제외 |
||
1526 | If conn.CONNECTEDITEM = UID Then |
||
1527 | Continue For |
||
1528 | End If |
||
1529 | |||
1530 | Dim _symbol As Symbol = FindSymbolByUID(symbols, conn.CONNECTEDITEM) |
||
1531 | Dim _line As Line = FindLineByUID(primaryLineList, conn.CONNECTEDITEM) |
||
1532 | 94c7557d | gaqhf | |
1533 | If _line IsNot Nothing Then |
||
1534 | If _line.GROUPING = False Then |
||
1535 | Return _line |
||
1536 | 7e561f5b | gaqhf | End If |
1537 | 94c7557d | gaqhf | ElseIf _symbol IsNot Nothing Then |
1538 | Return FindFirstLine(primaryLineList, symbols, _symbol, symbol.UID) |
||
1539 | 7e561f5b | gaqhf | End If |
1540 | Next |
||
1541 | |||
1542 | 94c7557d | gaqhf | Return Nothing |
1543 | 7e561f5b | gaqhf | |
1544 | End Function |
||
1545 | |||
1546 | 94c7557d | gaqhf | Structure Pointd |
1547 | Public Sub New(ByVal X As Double, ByVal Y As Double) |
||
1548 | Me.X = X |
||
1549 | Me.Y = Y |
||
1550 | End Sub |
||
1551 | Public X As Double |
||
1552 | Public Y As Double |
||
1553 | End Structure |
||
1554 | 7e561f5b | gaqhf | |
1555 | 94c7557d | gaqhf | Class PointdInfo |
1556 | Public Sub New(ByVal Pointd As Pointd, ByVal Type As String) |
||
1557 | Me.Pointd = Pointd |
||
1558 | Me.Type = Type |
||
1559 | End Sub |
||
1560 | 7e561f5b | gaqhf | |
1561 | 94c7557d | gaqhf | Public Sub New(ByVal Pointd As Pointd, ByVal Type As String, ByVal SP_ID As String) |
1562 | Me.Pointd = Pointd |
||
1563 | Me.Type = Type |
||
1564 | Me.SP_ID = SP_ID |
||
1565 | End Sub |
||
1566 | 7e561f5b | gaqhf | |
1567 | 94c7557d | gaqhf | Public Pointd As Pointd |
1568 | Public Type As String |
||
1569 | Public SP_ID As String |
||
1570 | End Class |
||
1571 | 7e561f5b | gaqhf | |
1572 | 94c7557d | gaqhf | Private Function CalcDistance(ByVal point1 As Pointd, ByVal point2 As Pointd) As Double |
1573 | Return Math.Pow(Math.Sqrt(Math.Abs(point1.X - point2.X)) + Math.Sqrt(Math.Abs(point1.Y - point2.Y)), 0.5) |
||
1574 | 7e561f5b | gaqhf | End Function |
1575 | b08338e3 | Gyusu | |
1576 | Private Sub FindNearPoint(ByVal oOPCSymbol As LMSymbol, ByRef dNear_x As Double, ByRef dNear_y As Double) |
||
1577 | Dim oConnectionPoints_x(4) As Double |
||
1578 | Dim oConnectionPoints_y(4) As Double |
||
1579 | |||
1580 | Try |
||
1581 | _Placement.PIDConnectPointLocation(oOPCSymbol, 1, oConnectionPoints_x(0), oConnectionPoints_y(0)) |
||
1582 | _Placement.PIDConnectPointLocation(oOPCSymbol, 2, oConnectionPoints_x(1), oConnectionPoints_y(1)) |
||
1583 | _Placement.PIDConnectPointLocation(oOPCSymbol, 3, oConnectionPoints_x(2), oConnectionPoints_y(2)) |
||
1584 | _Placement.PIDConnectPointLocation(oOPCSymbol, 4, oConnectionPoints_x(3), oConnectionPoints_y(3)) |
||
1585 | Dim iNearPoint As Integer = 0 |
||
1586 | Dim dGap As Double = 0 |
||
1587 | For i = 0 To 3 |
||
1588 | If dGap = 0 Then |
||
1589 | iNearPoint = i |
||
1590 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
1591 | Else |
||
1592 | If dGap >= Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) Then |
||
1593 | iNearPoint = i |
||
1594 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
1595 | End If |
||
1596 | End If |
||
1597 | Next |
||
1598 | dNear_x = oConnectionPoints_x(iNearPoint) |
||
1599 | dNear_y = oConnectionPoints_y(iNearPoint) |
||
1600 | Catch ex As Exception |
||
1601 | e4000111 | Gyusu | |
1602 | bb2a0c79 | Gyusu | End Try |
1603 | e4000111 | Gyusu | |
1604 | bb2a0c79 | Gyusu | End Sub |
1605 | |||
1606 | Private Function GetPipeType(ByVal sType As String) As String |
||
1607 | Dim sSystempath As String = "\Piping\Routing\Process Lines\Primary Piping.sym" ' oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
||
1608 | If sType.ToUpper() = "ELECTRIC" Then |
||
1609 | sSystempath = "\Instrumentation\Signal Line\Electric.sym" |
||
1610 | ElseIf sType.ToUpper() = "CONNECT TO PROCESS" Then |
||
1611 | 94c7557d | gaqhf | sSystempath = "\Instrumentation\Signal Line\Connect To Process.sym" |
1612 | 9c86a823 | Gyusu | ElseIf sType.ToUpper() = "SOFTWARE" Then |
1613 | sSystempath = "\Instrumentation\Signal Line\Software Link.sym" |
||
1614 | ElseIf sType.ToUpper() = "PNEUMATIC" Then |
||
1615 | sSystempath = "\Instrumentation\Signal Line\Pneumatic.sym" |
||
1616 | bb2a0c79 | Gyusu | End If |
1617 | Return sSystempath |
||
1618 | End Function |
||
1619 | |||
1620 | Private Sub InitAutoRouting() |
||
1621 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
1622 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
1623 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
1624 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
1625 | If CDrawing IsNot Nothing Then |
||
1626 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
1627 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
1628 | SetListBoxItems(ListBox_Result, "Place " & CDrawing.DwgName & "....") |
||
1629 | b08338e3 | Gyusu | |
1630 | bb2a0c79 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
1631 | Dim iItemcnt As Integer = 0 |
||
1632 | Dim sNodeUid As String = oNode.Name |
||
1633 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
1634 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
1635 | If CLineNo IsNot Nothing Then |
||
1636 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
1637 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
1638 | |||
1639 | For Each oLineRow In oLine_Dt.Rows |
||
1640 | 76f465d0 | Gyusu | ' oLineRow(_XML_LINE_UID) = "" |
1641 | oLineRow(_XML_LINE_SPID) = "" |
||
1642 | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
||
1643 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
1644 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
1645 | 94c7557d | gaqhf | oLineRow(_XML_LINE_DRAWING_TF) = "False" |
1646 | oLineRow(_XML_LINE_Check) = "False" |
||
1647 | 76f465d0 | Gyusu | Next |
1648 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
1649 | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
||
1650 | oSymbolRow(_XML_SYMBOL_SPID) = "" |
||
1651 | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
||
1652 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
1653 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
1654 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
1655 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
1656 | 94c7557d | gaqhf | oSymbolRow(_XML_SYMBOL_Check) = "False" |
1657 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "False" |
||
1658 | 76f465d0 | Gyusu | |
1659 | Next |
||
1660 | |||
1661 | End If |
||
1662 | |||
1663 | Dim CTRIMLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
1664 | If CTRIMLineNo IsNot Nothing Then |
||
1665 | Dim oLine_Dt As DataTable = CTRIMLineNo.Dt_Line |
||
1666 | Dim oSymbol_Dt As DataTable = CTRIMLineNo.Dt_Symbol |
||
1667 | |||
1668 | For Each oLineRow In oLine_Dt.Rows |
||
1669 | ' oLineRow(_XML_LINE_UID) = "" |
||
1670 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_SPID) = "" |
1671 | 76f465d0 | Gyusu | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
1672 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
1673 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
1674 | 94c7557d | gaqhf | oLineRow(_XML_LINE_DRAWING_TF) = "False" |
1675 | oLineRow(_XML_LINE_Check) = "False" |
||
1676 | bb2a0c79 | Gyusu | Next |
1677 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
1678 | 76f465d0 | Gyusu | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
1679 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_SPID) = "" |
1680 | 76f465d0 | Gyusu | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
1681 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
1682 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
1683 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
1684 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
1685 | 94c7557d | gaqhf | oSymbolRow(_XML_SYMBOL_Check) = "False" |
1686 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "False" |
||
1687 | 76f465d0 | Gyusu | |
1688 | bb2a0c79 | Gyusu | Next |
1689 | |||
1690 | End If |
||
1691 | Next |
||
1692 | End If |
||
1693 | Next |
||
1694 | Next |
||
1695 | End Sub |
||
1696 | |||
1697 | |||
1698 | |||
1699 | |||
1700 | |||
1701 | 79326880 | Gyusu | Private Function UpdateCheckBranchLine(ByRef dX As Double, ByRef dY As Double, |
1702 | 1bfcc921 | Gyusu | ByRef oLMConnector As LMConnector, ByRef sUid As String) As Boolean |
1703 | dd46ca83 | Gyusu | Dim oDataSource As LMADataSource = _Placement.PIDDataSource |
1704 | 1bfcc921 | Gyusu | Dim bCheckBranchItem As Boolean = False |
1705 | 79326880 | Gyusu | Dim iGapCheck As Integer = 0 |
1706 | Try |
||
1707 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
1708 | Dim d기준x As Double = dX |
||
1709 | Dim d기준y As Double = dY |
||
1710 | Dim dGap As Double = 0.001 |
||
1711 | Dim oRun As LMPipeRun = Nothing |
||
1712 | Dim dModelStartX As Double |
||
1713 | Dim dModelStartY As Double |
||
1714 | Dim dModelEndX As Double |
||
1715 | Dim dModelEndY As Double |
||
1716 | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
1717 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
1718 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
1719 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
1720 | d기준x = (dModelStartX + dModelEndX) / 2 |
||
1721 | d기준y = (dModelStartY + dModelEndY) / 2 |
||
1722 | |||
1723 | Dim dMax_X As Double = 0.0 |
||
1724 | Dim dMax_Y As Double = 0.0 |
||
1725 | Dim dMin_X As Double = 0.0 |
||
1726 | Dim dMin_Y As Double = 0.0 |
||
1727 | If dModelEndX > dModelStartX Then |
||
1728 | dMax_X = dModelEndX |
||
1729 | dMin_X = dModelStartX |
||
1730 | Else |
||
1731 | dMax_X = dModelStartX |
||
1732 | dMin_X = dModelEndX |
||
1733 | End If |
||
1734 | |||
1735 | If dModelEndY > dModelStartY Then |
||
1736 | dMax_Y = dModelEndY |
||
1737 | dMin_Y = dModelStartY |
||
1738 | Else |
||
1739 | dMax_Y = dModelStartY |
||
1740 | dMin_Y = dModelEndY |
||
1741 | End If |
||
1742 | |||
1743 | If dX <= dMax_X + dGap And dX >= dMin_X - dGap And |
||
1744 | dY <= dMax_Y + dGap And dY >= dMin_Y - dGap Then |
||
1745 | If Math.Abs(dMax_X - dMin_X) > Math.Abs(dMax_Y - dMin_Y) Then |
||
1746 | dY = dMax_Y |
||
1747 | Else |
||
1748 | dX = dMax_X |
||
1749 | End If |
||
1750 | 1bfcc921 | Gyusu | |
1751 | Try |
||
1752 | Dim sModelItemID As String = oModelrow(_XML_LINE_SPID).ToString() |
||
1753 | sUid = oModelrow(_XML_LINE_UID).ToString() |
||
1754 | dd46ca83 | Gyusu | oRun = oDataSource.GetPipeRun(sModelItemID) |
1755 | 1bfcc921 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
1756 | Catch ex As Exception |
||
1757 | End Try |
||
1758 | Try |
||
1759 | If oRun IsNot Nothing Then |
||
1760 | Dim dResultCalc As Double = -1 |
||
1761 | dd46ca83 | Gyusu | Dim bBranchFlag As Boolean = False |
1762 | Dim dBranchX As Double = 0 |
||
1763 | Dim dBranchY As Double = 0 |
||
1764 | 1bfcc921 | Gyusu | For Each objRep In oRun.Representations |
1765 | dd46ca83 | Gyusu | ' Dim sAttriName As String |
1766 | 'For Each objAttr In objRep.Attributes |
||
1767 | ' sAttriName = objAttr.name |
||
1768 | 'Next |
||
1769 | 'MsgBox(objRep.RepresentationType) |
||
1770 | 1bfcc921 | Gyusu | If objRep.RepresentationType = "Connector" Then |
1771 | dd46ca83 | Gyusu | Dim objConnector As LMConnector = oDataSource.GetConnector(objRep.ID) |
1772 | ' Dim sItemStatus As String = objConnector.Attributes("ItemStatus").Value |
||
1773 | ' Dim sModelTypeName As String = objConnector.ModelItemObject.Attributes("ItemTypeName").Value |
||
1774 | 1bfcc921 | Gyusu | |
1775 | 'Dim dConn_SX As Double = 0 |
||
1776 | 'Dim dConn_SY As Double = 0 |
||
1777 | 'Dim dConn_EX As Double = 0 |
||
1778 | 'Dim dConn_EY As Double = 0 |
||
1779 | Dim dConn_X As Double = 0 |
||
1780 | Dim dConn_Y As Double = 0 |
||
1781 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
1782 | dConn_X = objConnectorVertex.Attributes("XCoordinate").Value |
||
1783 | dConn_Y = objConnectorVertex.Attributes("YCoordinate").Value |
||
1784 | 'If dConn_SX = 0 Then |
||
1785 | ' dConn_SX = objConnectorVertex.Attributes("XCoordinate").Value |
||
1786 | ' dConn_SY = objConnectorVertex.Attributes("YCoordinate").Value |
||
1787 | 'Else |
||
1788 | ' dConn_EX = objConnectorVertex.Attributes("XCoordinate").Value |
||
1789 | ' dConn_EY = objConnectorVertex.Attributes("YCoordinate").Value |
||
1790 | 'End If |
||
1791 | Dim dCalc As Double = Math.Abs(dConn_X - dX) + Math.Abs(dConn_Y - dY) |
||
1792 | dd46ca83 | Gyusu | If bBranchFlag = False Then |
1793 | If dResultCalc = -1 Or dResultCalc > dCalc Then |
||
1794 | dResultCalc = dCalc |
||
1795 | oLMConnector = objConnector |
||
1796 | bCheckBranchItem = True |
||
1797 | End If |
||
1798 | Else |
||
1799 | If (dConn_X >= dX And dBranchX <= dX And dConn_Y >= dY And dBranchY <= dY) Or |
||
1800 | (dConn_X <= dX And dBranchX >= dX And dConn_Y <= dY And dBranchY >= dY) Then |
||
1801 | If dResultCalc = -1 Or dResultCalc > dCalc Then |
||
1802 | dResultCalc = dCalc |
||
1803 | oLMConnector = objConnector |
||
1804 | bCheckBranchItem = True |
||
1805 | End If |
||
1806 | End If |
||
1807 | 1bfcc921 | Gyusu | End If |
1808 | |||
1809 | dd46ca83 | Gyusu | |
1810 | 1bfcc921 | Gyusu | 'If dConn_EX <> 0 And dConn_EY <> 0 Then |
1811 | ' If dConn_SX >= dX And dConn_EX <= dX And dConn_SY >= dY And dConn_EY <= dY Then |
||
1812 | ' oLMConnector = objConnector |
||
1813 | ' Exit For |
||
1814 | ' ElseIf dConn_SX <= dX And dConn_EX >= dX And dConn_SY <= dY And dConn_EY >= dY Then |
||
1815 | ' oLMConnector = objConnector |
||
1816 | ' Exit For |
||
1817 | ' Else |
||
1818 | ' If dConn_EX > 0 Then |
||
1819 | ' dConn_SX = dConn_EX |
||
1820 | ' dConn_SY = dConn_EY |
||
1821 | ' End If |
||
1822 | ' End If |
||
1823 | 'End If |
||
1824 | |||
1825 | Next |
||
1826 | 'If oLMConnector IsNot Nothing Then |
||
1827 | ' Exit For |
||
1828 | 'End If |
||
1829 | dd46ca83 | Gyusu | ElseIf objRep.RepresentationType = "Branch" Then |
1830 | Dim objConnector As LMSymbol = oDataSource.GetSymbol(objRep.ID) |
||
1831 | dBranchX = objConnector.Attributes("XCoordinate").Value |
||
1832 | dBranchY = objConnector.Attributes("YCoordinate").Value |
||
1833 | bBranchFlag = True |
||
1834 | 1bfcc921 | Gyusu | End If |
1835 | 'If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
1836 | ' Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
1837 | ' For Each objConnectorVertex In objConnector.ConnectorVertices |
||
1838 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
1839 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
1840 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
1841 | ' oLMConnector = objConnector |
||
1842 | ' dX = dConn_X |
||
1843 | ' dY = dConn_Y |
||
1844 | ' bConnectionFlag = True |
||
1845 | ' End If |
||
1846 | ' Next |
||
1847 | 'End If |
||
1848 | Next |
||
1849 | End If |
||
1850 | Catch ex As Exception |
||
1851 | End Try |
||
1852 | ' oUid = oModelrow(_XML_LINE_UID).ToString() |
||
1853 | b82166d4 | Gyusu | ' Dim oID As String = oModelrow(_XML_LINE_SPID) |
1854 | 1bfcc921 | Gyusu | ' oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
1855 | b82166d4 | Gyusu | ' oID = oLMConnector.ModelItemID |
1856 | ' oLMConnector = _Placement.PIDDataSource.GetConnector(oID) |
||
1857 | 1bfcc921 | Gyusu | 'If oLMConnector IsNot Nothing Then |
1858 | ' Exit For |
||
1859 | 'End If |
||
1860 | 79326880 | Gyusu | End If |
1861 | |||
1862 | |||
1863 | Next |
||
1864 | Catch ex As Exception |
||
1865 | 1bfcc921 | Gyusu | bCheckBranchItem = False |
1866 | 79326880 | Gyusu | oLMConnector = Nothing |
1867 | End Try |
||
1868 | 1bfcc921 | Gyusu | Return bCheckBranchItem |
1869 | 79326880 | Gyusu | End Function |
1870 | |||
1871 | 3b7a4470 | Gyusu | ''' <summary> |
1872 | ''' 라인과 특정 포인트에 커넥션을 확인하는 메서드 |
||
1873 | ''' </summary> |
||
1874 | ''' <param name="oModelingLineRows"></param> |
||
1875 | ''' <param name="dX"></param> |
||
1876 | ''' <param name="dY"></param> |
||
1877 | ''' <param name="oLMConnector"></param> |
||
1878 | ''' <param name="dPreConnX"></param> |
||
1879 | ''' <param name="dPreConnY"></param> |
||
1880 | ''' <returns></returns> |
||
1881 | |||
1882 | 79326880 | Gyusu | Private Function CheckConnectionLine(ByRef dX As Double, ByRef dY As Double, |
1883 | b82166d4 | Gyusu | ByRef oLMConnector As LMConnector, ByRef sUid As String) As Boolean |
1884 | b08338e3 | Gyusu | Dim bConnectionFlag As Boolean = False |
1885 | 76f465d0 | Gyusu | Dim iGapCheck As Integer = 0 |
1886 | b08338e3 | Gyusu | Try |
1887 | 79326880 | Gyusu | For Each oModelrow In _ModelingLine_Dt.Rows |
1888 | 76f465d0 | Gyusu | Dim d기준x As Double = dX |
1889 | Dim d기준y As Double = dY |
||
1890 | 1bfcc921 | Gyusu | Dim dGap As Double = 0.001 |
1891 | 76f465d0 | Gyusu | Dim oRun As LMPipeRun = Nothing |
1892 | b08338e3 | Gyusu | Dim dModelStartX As Double |
1893 | Dim dModelStartY As Double |
||
1894 | Dim dModelEndX As Double |
||
1895 | Dim dModelEndY As Double |
||
1896 | 76f465d0 | Gyusu | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
1897 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
1898 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
1899 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
1900 | d기준x = (dModelStartX + dModelEndX) / 2 |
||
1901 | d기준y = (dModelStartY + dModelEndY) / 2 |
||
1902 | 79326880 | Gyusu | |
1903 | Dim bCheckEqual As Boolean = False |
||
1904 | If dX <= dModelStartX + dGap And dX >= dModelStartX - dGap And |
||
1905 | dY <= dModelStartY + dGap And dY >= dModelStartY - dGap Then |
||
1906 | bCheckEqual = True |
||
1907 | ElseIf dX <= dModelEndX + dGap And dX >= dModelEndX - dGap And |
||
1908 | dY <= dModelEndY + dGap And dY >= dModelEndY - dGap Then |
||
1909 | bCheckEqual = True |
||
1910 | End If |
||
1911 | If bCheckEqual Then |
||
1912 | Try |
||
1913 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
1914 | b82166d4 | Gyusu | sUid = oModelrow(_XML_LINE_UID) |
1915 | 79326880 | Gyusu | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
1916 | Catch ex As Exception |
||
1917 | End Try |
||
1918 | Try |
||
1919 | If oRun IsNot Nothing Then |
||
1920 | Dim dResultCalc As Double = -1 |
||
1921 | For Each objRep In oRun.Representations |
||
1922 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
1923 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
1924 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
1925 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
1926 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
1927 | If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
1928 | oLMConnector = objConnector |
||
1929 | dX = dConn_X |
||
1930 | dY = dConn_Y |
||
1931 | bConnectionFlag = True |
||
1932 | End If |
||
1933 | Next |
||
1934 | End If |
||
1935 | Next |
||
1936 | End If |
||
1937 | Catch ex As Exception |
||
1938 | End Try |
||
1939 | Else |
||
1940 | End If |
||
1941 | b08338e3 | Gyusu | Next |
1942 | Catch ex As Exception |
||
1943 | 76f465d0 | Gyusu | bConnectionFlag = False |
1944 | oLMConnector = Nothing |
||
1945 | b08338e3 | Gyusu | End Try |
1946 | Return bConnectionFlag |
||
1947 | End Function |
||
1948 | |||
1949 | 1bfcc921 | Gyusu | Private Function CheckAlreadyBranchLine(ByVal sSystemPath As String, ByVal dStartX As Double, ByVal dStartY As Double, ByVal dEndX As Double, ByVal dEndY As Double) As Boolean |
1950 | '현재선의 방향을 보고 상대라인이 직교되는 방향인지 체크 |
||
1951 | '오차범위를 줘서 현재선을 통과하는지 체크 |
||
1952 | '통과하는 상대라인 갯수를 먼저 구한다음 라인 갯수만큼 라인을 그린다. |
||
1953 | Dim bCheckBranchLine As Boolean = False |
||
1954 | dd46ca83 | Gyusu | Dim sCurrentDirection As String = "" |
1955 | |||
1956 | Dim oModel_Dt As New DataTable() |
||
1957 | oModel_Dt.Columns.Add("X") |
||
1958 | oModel_Dt.Columns.Add("Y") |
||
1959 | oModel_Dt.Columns.Add("Type") |
||
1960 | oModel_Dt.Columns.Add("SPID") |
||
1961 | Dim dGap = 0.001 |
||
1962 | If Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
||
1963 | sCurrentDirection = "X" |
||
1964 | If dStartX > dEndX Then |
||
1965 | Dim dTempX As Double = dEndX |
||
1966 | dEndX = dStartX |
||
1967 | dStartX = dTempX |
||
1968 | Dim dTempY As Double = dEndY |
||
1969 | dEndY = dStartY |
||
1970 | dStartY = dTempY |
||
1971 | End If |
||
1972 | '현재선이 X축방향 |
||
1973 | Try |
||
1974 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
1975 | Dim dModelStart_X As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
1976 | Dim dModelStart_Y As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
1977 | Dim dModelEnd_X As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
1978 | Dim dModelEnd_Y As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
1979 | Dim sSPID As String = oModelrow(_XML_LINE_SPID) |
||
1980 | If dStartX < dModelStart_X And dStartX < dModelEnd_X And |
||
1981 | dEndX > dModelStart_X And dEndX > dModelEnd_X Then |
||
1982 | 496a0241 | Gyusu | Dim dAddX As Double = dStartX |
1983 | dd46ca83 | Gyusu | Dim dAddY As Double = dStartY |
1984 | Dim sType As String = "" |
||
1985 | 496a0241 | Gyusu | Dim dAddLineX As Double = 0 |
1986 | Dim dAddLineY As Double = 0 |
||
1987 | dd46ca83 | Gyusu | If dStartY = dModelStart_Y Then |
1988 | 496a0241 | Gyusu | dAddX = 0 |
1989 | ' dAddX = dModelStart_X |
||
1990 | dd46ca83 | Gyusu | ElseIf dStartY = dModelEnd_Y Then |
1991 | 496a0241 | Gyusu | dAddX = 0 |
1992 | ' dAddX = dModelEnd_X |
||
1993 | dd46ca83 | Gyusu | ElseIf dStartY <= dModelStart_Y + dGap And dStartY >= dModelStart_Y - dGap Then |
1994 | dAddX = dModelStart_X |
||
1995 | 496a0241 | Gyusu | If dStartY <= dModelStart_Y Then |
1996 | dd46ca83 | Gyusu | sType = "AddLine" |
1997 | 496a0241 | Gyusu | dAddLineX = dModelStart_X |
1998 | dAddLineY = dModelStart_Y |
||
1999 | dd46ca83 | Gyusu | End If |
2000 | ElseIf dStartY <= dModelEnd_Y + dGap And dStartY >= dModelEnd_Y - dGap Then |
||
2001 | dAddX = dModelEnd_X |
||
2002 | 496a0241 | Gyusu | If dStartY <= dModelEnd_Y Then |
2003 | dd46ca83 | Gyusu | sType = "AddLine" |
2004 | 496a0241 | Gyusu | dAddLineX = dModelEnd_X |
2005 | dAddLineY = dModelEnd_Y |
||
2006 | dd46ca83 | Gyusu | End If |
2007 | End If |
||
2008 | 496a0241 | Gyusu | If sType = "AddLine" Then |
2009 | Dim objInputs As PlaceRunInputs |
||
2010 | objInputs = New PlaceRunInputs |
||
2011 | Dim oLMConnector As LMConnector = Nothing |
||
2012 | CheckConnectionLine(dAddLineX, dAddLineY, oLMConnector, "") |
||
2013 | objInputs.AddPoint(dAddLineX, dAddY) |
||
2014 | objInputs.AddConnectorTarget(oLMConnector, dAddLineX, dAddLineY) |
||
2015 | Dim AddLMConnector As LMConnector = LineModeling(objInputs, sSystemPath) |
||
2016 | JoinPipeRun(oLMConnector.ModelItemID, AddLMConnector.ModelItemID) |
||
2017 | dStartY = dAddY |
||
2018 | End If |
||
2019 | |||
2020 | dd46ca83 | Gyusu | If dAddX <> 0 Then |
2021 | Dim oDatarow As DataRow = oModel_Dt.NewRow() |
||
2022 | oDatarow("X") = dAddX |
||
2023 | oDatarow("Y") = dAddY |
||
2024 | oDatarow("Type") = sType |
||
2025 | oDatarow("SPID") = sSPID |
||
2026 | oModel_Dt.Rows.Add(oDatarow) |
||
2027 | End If |
||
2028 | End If |
||
2029 | Next |
||
2030 | Catch ex As Exception |
||
2031 | End Try |
||
2032 | Else |
||
2033 | '현재선이 y축방향 |
||
2034 | sCurrentDirection = "Y" |
||
2035 | Try |
||
2036 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
2037 | Dim dModelStart_X As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
2038 | Dim dModelStart_Y As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
2039 | Dim dModelEnd_X As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
2040 | Dim dModelEnd_Y As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
2041 | Dim sSPID As String = oModelrow(_XML_LINE_SPID) |
||
2042 | If dStartY < dModelStart_Y And dStartY < dModelEnd_Y And |
||
2043 | dEndY > dModelStart_Y And dEndY > dModelEnd_Y Then |
||
2044 | Dim dAddX As Double = dStartX |
||
2045 | 496a0241 | Gyusu | Dim dAddY As Double = dStartY |
2046 | dd46ca83 | Gyusu | Dim sType As String = "" |
2047 | 496a0241 | Gyusu | Dim dAddLineX As Double = 0 |
2048 | Dim dAddLineY As Double = 0 |
||
2049 | dd46ca83 | Gyusu | If dStartX = dModelStart_X Then |
2050 | 496a0241 | Gyusu | dAddY = 0 |
2051 | ' dAddY = dModelStart_Y |
||
2052 | dd46ca83 | Gyusu | ElseIf dStartX = dModelEnd_X Then |
2053 | 496a0241 | Gyusu | dAddY = 0 |
2054 | ' dAddY = dModelEnd_Y |
||
2055 | dd46ca83 | Gyusu | ElseIf dStartX <= dModelStart_X + dGap And dStartX >= dModelStart_X - dGap Then |
2056 | 496a0241 | Gyusu | ' dAddY = dModelStart_Y |
2057 | If dStartX <= dModelStart_X Then |
||
2058 | dAddLineX = dModelStart_X |
||
2059 | dAddLineY = dModelStart_Y |
||
2060 | dd46ca83 | Gyusu | sType = "AddLine" |
2061 | End If |
||
2062 | ElseIf dStartX <= dModelEnd_X + dGap And dStartX >= dModelEnd_X - dGap Then |
||
2063 | 496a0241 | Gyusu | ' dAddY = dModelEnd_Y |
2064 | If dStartX <= dModelEnd_X Then |
||
2065 | dAddLineX = dModelEnd_X |
||
2066 | dAddLineY = dModelEnd_Y |
||
2067 | dd46ca83 | Gyusu | sType = "AddLine" |
2068 | End If |
||
2069 | End If |
||
2070 | 496a0241 | Gyusu | If sType = "AddLine" Then |
2071 | Dim objInputs As PlaceRunInputs |
||
2072 | objInputs = New PlaceRunInputs |
||
2073 | Dim oLMConnector As LMConnector = Nothing |
||
2074 | CheckConnectionLine(dAddLineX, dAddLineY, oLMConnector, "") |
||
2075 | objInputs.AddPoint(dAddX, dAddLineY) |
||
2076 | objInputs.AddConnectorTarget(oLMConnector, dAddLineX, dAddLineY) |
||
2077 | Dim AddLMConnector As LMConnector = LineModeling(objInputs, sSystemPath) |
||
2078 | JoinPipeRun(oLMConnector.ModelItemID, AddLMConnector.ModelItemID) |
||
2079 | dStartX = dAddX |
||
2080 | End If |
||
2081 | |||
2082 | If dAddY <> 0 Then |
||
2083 | dd46ca83 | Gyusu | Dim oDatarow As DataRow = oModel_Dt.NewRow() |
2084 | oDatarow("X") = dAddX |
||
2085 | oDatarow("Y") = dAddY |
||
2086 | oDatarow("Type") = sType |
||
2087 | oDatarow("SPID") = sSPID |
||
2088 | oModel_Dt.Rows.Add(oDatarow) |
||
2089 | End If |
||
2090 | End If |
||
2091 | Next |
||
2092 | Catch ex As Exception |
||
2093 | End Try |
||
2094 | End If |
||
2095 | |||
2096 | '//못미치는 라인은 라인길이를 더한후 나머지 모델링(2018.09.27) |
||
2097 | |||
2098 | If oModel_Dt.Rows.Count > 0 Then |
||
2099 | If sCurrentDirection = "X" Then |
||
2100 | 'X좌표 정렬 |
||
2101 | oModel_Dt.DefaultView.Sort = "X desc" |
||
2102 | oModel_Dt = oModel_Dt.DefaultView.ToTable(True) |
||
2103 | Else |
||
2104 | 'Y좌표 정렬 |
||
2105 | oModel_Dt.DefaultView.Sort = "Y desc" |
||
2106 | oModel_Dt = oModel_Dt.DefaultView.ToTable(True) |
||
2107 | End If |
||
2108 | Dim oLMConnector As LMConnector = Nothing |
||
2109 | Dim oPreLMConnector As LMConnector = Nothing |
||
2110 | Dim dStartFlag As Boolean = True |
||
2111 | For Each oModelRow In oModel_Dt.Rows |
||
2112 | Dim objInputs As PlaceRunInputs |
||
2113 | objInputs = New PlaceRunInputs |
||
2114 | Dim dX As Double = oModelRow("X") |
||
2115 | Dim dY As Double = oModelRow("Y") |
||
2116 | Dim sType As String = oModelRow("Type") |
||
2117 | Dim sUid As String = "" |
||
2118 | 496a0241 | Gyusu | |
2119 | |||
2120 | dd46ca83 | Gyusu | CheckConnectionLine(dX, dY, oLMConnector, sUid) |
2121 | If oLMConnector IsNot Nothing Then |
||
2122 | If dStartFlag Then |
||
2123 | objInputs.AddPoint(dStartX, dStartY) |
||
2124 | objInputs.AddConnectorTarget(oLMConnector, dX, dY) |
||
2125 | Else |
||
2126 | objInputs.AddConnectorTarget(oPreLMConnector, dStartX, dStartY) |
||
2127 | objInputs.AddConnectorTarget(oLMConnector, dX, dY) |
||
2128 | End If |
||
2129 | oPreLMConnector = LineModeling(objInputs, sSystemPath) |
||
2130 | '모델링후 StartX를 현재 X로 변경 |
||
2131 | dStartX = dX |
||
2132 | dStartY = dY |
||
2133 | End If |
||
2134 | Next |
||
2135 | If oPreLMConnector IsNot Nothing Then |
||
2136 | Dim objInputs As PlaceRunInputs |
||
2137 | objInputs = New PlaceRunInputs |
||
2138 | objInputs.AddConnectorTarget(oPreLMConnector, dStartX, dStartY) |
||
2139 | objInputs.AddPoint(dEndX, dEndY) |
||
2140 | LineModeling(objInputs, sSystemPath) |
||
2141 | End If |
||
2142 | End If |
||
2143 | 1bfcc921 | Gyusu | Return bCheckBranchLine |
2144 | End Function |
||
2145 | |||
2146 | |||
2147 | b08338e3 | Gyusu | Private Function CheckLineBranch(ByVal oLine_Dt As DataTable, ByRef dX As Double, ByRef dY As Double, |
2148 | ByVal sDirection As String, ByRef oLMConnector As LMConnector) As Boolean |
||
2149 | |||
2150 | 496a0241 | Gyusu | Dim oModelingLineRows() As DataRow = oLine_Dt.Select(" Then[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And " & |
2151 | b08338e3 | Gyusu | "[" & _XML_LINE_SPID & "] <> ''") |
2152 | |||
2153 | Dim bConnectionFlag As Boolean = False |
||
2154 | Try |
||
2155 | For Each oModelrow In oModelingLineRows |
||
2156 | Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
2157 | Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
2158 | Dim dModelStartX As Double |
||
2159 | Dim dModelStartY As Double |
||
2160 | Dim dModelEndX As Double |
||
2161 | Dim dModelEndY As Double |
||
2162 | ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
2163 | ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
2164 | ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
2165 | ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
2166 | Dim dGap As Double = 0.0002 |
||
2167 | |||
2168 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
2169 | 'Vertical |
||
2170 | If sDirection = "X" Then |
||
2171 | 'x Direction Line |
||
2172 | If (dModelStartY + dGap >= dY And dModelEndY - dGap <= dY) Or |
||
2173 | (dModelStartY - dGap <= dY And dModelEndY + dGap >= dY) Then |
||
2174 | If (dX > dModelStartX And dX < dModelEndX) Or (dX > dModelEndX And dX < dModelStartX) Then |
||
2175 | If Math.Abs(dX - dModelStartX) > Math.Abs(dX - dModelEndX) Then |
||
2176 | dX = dModelEndX |
||
2177 | Else |
||
2178 | dX = dModelStartX |
||
2179 | End If |
||
2180 | Try |
||
2181 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
2182 | Catch ex As Exception |
||
2183 | |||
2184 | End Try |
||
2185 | bConnectionFlag = True |
||
2186 | End If |
||
2187 | End If |
||
2188 | End If |
||
2189 | Else |
||
2190 | 'Horizontal |
||
2191 | If sDirection = "Y" Then |
||
2192 | If (dModelStartX + dGap >= dX And dModelEndX - dGap <= dX) Or |
||
2193 | (dModelStartX - dGap <= dX And dModelEndX + dGap >= dX) Then |
||
2194 | If (dY > dModelStartY And dY < dModelEndY) Or (dY > dModelEndY And dY < dModelStartY) Then |
||
2195 | If Math.Abs(dY - dModelStartY) > Math.Abs(dY - dModelEndY) Then |
||
2196 | dY = dModelEndY |
||
2197 | Else |
||
2198 | dY = dModelStartY |
||
2199 | End If |
||
2200 | Try |
||
2201 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
2202 | Catch ex As Exception |
||
2203 | End Try |
||
2204 | bConnectionFlag = True |
||
2205 | End If |
||
2206 | End If |
||
2207 | End If |
||
2208 | End If |
||
2209 | Next |
||
2210 | Catch ex As Exception |
||
2211 | End Try |
||
2212 | Return bConnectionFlag |
||
2213 | End Function |
||
2214 | Private Function LineModeling(ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sStartLineUid As String, ByVal sEndLineUid As String, ByVal dStart_x As Double, ByVal dStart_y As Double, ByVal dEnd_x As Double, ByVal dEnd_y As Double, |
||
2215 | ByVal sLineNoUid As String, ByVal sLineUid As String, ByVal sSystemPath As String, ByRef oLMConnector As LMConnector) As Boolean |
||
2216 | 76f465d0 | Gyusu | 'Try |
2217 | ' Dim oDatasource As Object = _Placement.PIDDataSource |
||
2218 | ' Dim oPipeRun As LMPipeRun = Nothing |
||
2219 | ' Dim objInputs As PlaceRunInputs |
||
2220 | ' objInputs = New PlaceRunInputs |
||
2221 | ' Dim objItem As LMAItem |
||
2222 | ' ' Dim objConnector As LMConnector |
||
2223 | |||
2224 | ' Dim oStartLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sStartLineUid & "' And " & |
||
2225 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
2226 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
2227 | ' If oStartLineRow.Length = 0 Then |
||
2228 | ' oStartLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sStartLineUid & "' And " & |
||
2229 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
2230 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
2231 | ' End If |
||
2232 | ' Dim oEndLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sEndLineUid & "' And " & |
||
2233 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
2234 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
2235 | |||
2236 | ' oEndLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sEndLineUid & "' And " & |
||
2237 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
2238 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
2239 | ' Dim sStartConnectionType As String = "" |
||
2240 | ' Dim sEndConnectionType As String = "" |
||
2241 | |||
2242 | ' Dim oStartLMConnector As LMConnector = Nothing |
||
2243 | ' Dim oEndLMConnector As LMConnector = Nothing |
||
2244 | ' Dim oDirectionLine As String = "" |
||
2245 | |||
2246 | ' If Math.Abs(dStart_x - dEnd_x) > Math.Abs(dStart_y - dEnd_y) Then |
||
2247 | ' oDirectionLine = "X" |
||
2248 | ' Else |
||
2249 | ' oDirectionLine = "Y" |
||
2250 | ' End If |
||
2251 | b08338e3 | Gyusu | |
2252 | 76f465d0 | Gyusu | ' Dim bCheckFlag As Boolean = False |
2253 | b08338e3 | Gyusu | |
2254 | 76f465d0 | Gyusu | ' Dim bStartCheckFlag As Boolean = CheckConnectionLine(oStartLineRow, dStart_x, dStart_y, oStartLMConnector) |
2255 | ' If bStartCheckFlag = False Then |
||
2256 | ' bStartCheckFlag = CheckConnectionLine(oStartLineRow, dEnd_x, dEnd_y, oStartLMConnector) |
||
2257 | ' bCheckFlag = True |
||
2258 | ' End If |
||
2259 | ' Dim bEndCheckFlag As Boolean = CheckConnectionLine(oEndLineRow, dEnd_x, dEnd_y, oEndLMConnector) |
||
2260 | b08338e3 | Gyusu | |
2261 | 76f465d0 | Gyusu | ' If bEndCheckFlag = False Then |
2262 | b08338e3 | Gyusu | |
2263 | 76f465d0 | Gyusu | ' bEndCheckFlag = CheckConnectionLine(oEndLineRow, dStart_x, dStart_y, oEndLMConnector) |
2264 | ' bCheckFlag = True |
||
2265 | ' End If |
||
2266 | b08338e3 | Gyusu | |
2267 | 76f465d0 | Gyusu | ' If bStartCheckFlag = True And bEndCheckFlag = False Then |
2268 | ' If bCheckFlag Then |
||
2269 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
2270 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
2271 | ' Else |
||
2272 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
2273 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2274 | ' End If |
||
2275 | |||
2276 | ' ElseIf bStartCheckFlag = False And bEndCheckFlag = True Then |
||
2277 | ' If bCheckFlag Then |
||
2278 | |||
2279 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
2280 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2281 | ' Else |
||
2282 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
2283 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
2284 | ' End If |
||
2285 | |||
2286 | ' ElseIf bStartCheckFlag = True And bEndCheckFlag = True Then |
||
2287 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
2288 | ' objInputs.AddConnectorTarget(oEndLMConnector, dEnd_x, dEnd_y) |
||
2289 | ' Else |
||
2290 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
2291 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2292 | ' End If |
||
2293 | ' SetListBoxItems(ListBox_Result, "Place Pipe..(" & dStart_x & "," & dStart_y & ") - (" & dEnd_x & "," & dEnd_y & ")..." & _iPipecnt & " count ") |
||
2294 | ' _iPipecnt = _iPipecnt + 1 |
||
2295 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
2296 | ' oLMConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2297 | b08338e3 | Gyusu | |
2298 | 76f465d0 | Gyusu | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + sLineUid + "'") |
2299 | ' If oUpdateRow.Length = 1 Then |
||
2300 | ' oUpdateRow(0)(_XML_LINE_SPID) = oLMConnector.ModelItemID |
||
2301 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = oLMConnector |
||
2302 | b08338e3 | Gyusu | |
2303 | 76f465d0 | Gyusu | ' oUpdateRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
2304 | ' End If |
||
2305 | b08338e3 | Gyusu | |
2306 | 76f465d0 | Gyusu | ' oPipeRun = oDatasource.GetPipeRun(oLMConnector.ModelItemID) |
2307 | |||
2308 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2309 | ' If oAttributeRow.Length > 0 Then |
||
2310 | ' For Each oAttribute In oAttributeRow |
||
2311 | ' Try |
||
2312 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2313 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2314 | ' If sPIDValue.Contains("'") Then |
||
2315 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
2316 | ' End If |
||
2317 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2318 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2319 | ' Catch ex As Exception |
||
2320 | ' End Try |
||
2321 | ' Next |
||
2322 | ' oPipeRun.Commit() |
||
2323 | ' End If |
||
2324 | ' Dim sID_1 As String = "" |
||
2325 | ' Dim sID_2 As String = "" |
||
2326 | ' If oStartLMConnector IsNot Nothing Then |
||
2327 | ' sID_1 = oStartLMConnector.ModelItemID |
||
2328 | ' sID_2 = oLMConnector.ModelItemID |
||
2329 | ' ElseIf oEndLMConnector IsNot Nothing Then |
||
2330 | ' sID_1 = oEndLMConnector.ModelItemID |
||
2331 | ' sID_2 = oLMConnector.ModelItemID |
||
2332 | ' End If |
||
2333 | ' If sID_1 <> "" And sID_2 <> "" Then |
||
2334 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
2335 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
2336 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
2337 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
2338 | ' End If |
||
2339 | ' Return True |
||
2340 | 'Catch ex As Exception |
||
2341 | ' Return False |
||
2342 | 'End Try |
||
2343 | b08338e3 | Gyusu | |
2344 | End Function |
||
2345 | |||
2346 | Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
2347 | ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String, |
||
2348 | ByRef oLMConnector As LMConnector) As String |
||
2349 | Dim sReturnUid As String = "" |
||
2350 | Try |
||
2351 | Dim sLineUid As String = "" |
||
2352 | |||
2353 | Dim iConnType As Integer = 0 |
||
2354 | |||
2355 | Dim sStartpoint As String = "" |
||
2356 | Dim sEndpoint As String = "" |
||
2357 | bb2a0c79 | Gyusu | Dim dOriginalStart_x As Double = 0.0 |
2358 | Dim dOriginalStart_y As Double = 0.0 |
||
2359 | Dim dOriginalEnd_x As Double = 0.0 |
||
2360 | Dim dOriginalEnd_y As Double = 0.0 |
||
2361 | |||
2362 | b08338e3 | Gyusu | Dim dStart_x As Double = 0 |
2363 | Dim dStart_y As Double = 0 |
||
2364 | Dim dEnd_x As Double = 0 |
||
2365 | Dim dEnd_y As Double = 0 |
||
2366 | Dim sStartLineUid As String = sConnLineUid |
||
2367 | Dim sEndLineUid As String = "" |
||
2368 | Dim sDirection As String = "" |
||
2369 | Dim sSystemPath As String = GetPipeType(sType) |
||
2370 | |||
2371 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
2372 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
2373 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
2374 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
2375 | If oPipeRow.Length > 0 Then |
||
2376 | bb2a0c79 | Gyusu | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
2377 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2378 | e4000111 | Gyusu | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
2379 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2380 | b08338e3 | Gyusu | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
2381 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
2382 | If dStart_x = 0 And dStart_y = 0 Then |
||
2383 | dStart_x = dOriginalStart_x |
||
2384 | dStart_y = dOriginalStart_y |
||
2385 | dEnd_x = dOriginalEnd_x |
||
2386 | dEnd_y = dOriginalEnd_y |
||
2387 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2388 | sDirection = "X" |
||
2389 | Else |
||
2390 | sDirection = "Y" |
||
2391 | End If |
||
2392 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2393 | sLineUid = sConnLineUid |
||
2394 | End If |
||
2395 | End If |
||
2396 | bb2a0c79 | Gyusu | |
2397 | b08338e3 | Gyusu | While True |
2398 | sLineUid = "" |
||
2399 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
2400 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
2401 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
2402 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
2403 | b08338e3 | Gyusu | |
2404 | If oPipeRow.Length = 0 Then |
||
2405 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
2406 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
2407 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
2408 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
2409 | bb2a0c79 | Gyusu | Else |
2410 | b08338e3 | Gyusu | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
2411 | 'sConnLineUid = sLineUid |
||
2412 | sLineUid = sConnLineUid |
||
2413 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2414 | iConnType = 1 |
||
2415 | End If |
||
2416 | |||
2417 | If oPipeRow.Length > 0 Then |
||
2418 | If sLineUid = "" Then |
||
2419 | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2420 | 'sConnLineUid = sLineUid |
||
2421 | sLineUid = sConnLineUid |
||
2422 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2423 | iConnType = 2 |
||
2424 | End If |
||
2425 | If iConnType = 1 Then |
||
2426 | |||
2427 | ElseIf iConnType = 2 Then |
||
2428 | |||
2429 | End If |
||
2430 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
2431 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2432 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2433 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2434 | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
2435 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
2436 | |||
2437 | If dStart_x = 0 And dStart_y = 0 Then |
||
2438 | dStart_x = dOriginalStart_x |
||
2439 | dStart_y = dOriginalStart_y |
||
2440 | dEnd_x = dOriginalEnd_x |
||
2441 | dEnd_y = dOriginalEnd_y |
||
2442 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2443 | sDirection = "X" |
||
2444 | Else |
||
2445 | sDirection = "Y" |
||
2446 | End If |
||
2447 | sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
2448 | sSystemPath = GetPipeType(sType) |
||
2449 | Else |
||
2450 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2451 | If sDirection = "Y" Then |
||
2452 | '방향이 바꼈음 Y - > X |
||
2453 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2454 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
2455 | dStart_x = dOriginalStart_x |
||
2456 | dStart_y = dOriginalStart_y |
||
2457 | dEnd_x = dOriginalEnd_x |
||
2458 | dEnd_y = dOriginalEnd_y |
||
2459 | sStartLineUid = sConnLineUid |
||
2460 | Else |
||
2461 | dEnd_x = dOriginalEnd_x |
||
2462 | dEnd_y = dOriginalEnd_y |
||
2463 | End If |
||
2464 | sDirection = "X" |
||
2465 | Else |
||
2466 | If sDirection = "X" Then |
||
2467 | '방향이 바꼈음 X - > Y |
||
2468 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2469 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
2470 | dStart_x = dOriginalStart_x |
||
2471 | dStart_y = dOriginalStart_y |
||
2472 | dEnd_x = dOriginalEnd_x |
||
2473 | dEnd_y = dOriginalEnd_y |
||
2474 | sStartLineUid = sConnLineUid |
||
2475 | Else |
||
2476 | |||
2477 | dEnd_x = dOriginalEnd_x |
||
2478 | dEnd_y = dOriginalEnd_y |
||
2479 | End If |
||
2480 | sDirection = "Y" |
||
2481 | End If |
||
2482 | End If |
||
2483 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2484 | Else |
||
2485 | If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
2486 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2487 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
2488 | End If |
||
2489 | sReturnUid = sConnLineUid |
||
2490 | Exit While |
||
2491 | End If |
||
2492 | End While |
||
2493 | |||
2494 | If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
2495 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2496 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
2497 | dStart_x = 0 |
||
2498 | dStart_y = 0 |
||
2499 | dEnd_x = 0 |
||
2500 | dEnd_y = 0 |
||
2501 | End If |
||
2502 | Catch ex As Exception |
||
2503 | |||
2504 | End Try |
||
2505 | |||
2506 | Return sReturnUid |
||
2507 | End Function |
||
2508 | |||
2509 | |||
2510 | 'Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
2511 | ' ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String) As String |
||
2512 | ' Dim sReturnUid As String = "" |
||
2513 | ' Try |
||
2514 | ' Dim sLineUid As String = "" |
||
2515 | |||
2516 | ' Dim iConnType As Integer = 0 |
||
2517 | |||
2518 | ' Dim sStartpoint As String = "" |
||
2519 | ' Dim sEndpoint As String = "" |
||
2520 | ' Dim dOriginalStart_x As Double = 0.0 |
||
2521 | ' Dim dOriginalStart_y As Double = 0.0 |
||
2522 | ' Dim dOriginalEnd_x As Double = 0.0 |
||
2523 | ' Dim dOriginalEnd_y As Double = 0.0 |
||
2524 | |||
2525 | ' Dim dStart_x As Double = 0 |
||
2526 | ' Dim dStart_y As Double = 0 |
||
2527 | ' Dim dEnd_x As Double = 0 |
||
2528 | ' Dim dEnd_y As Double = 0 |
||
2529 | ' Dim sStartLineUid As String = sConnLineUid |
||
2530 | ' Dim sEndLineUid As String = "" |
||
2531 | ' Dim sDirection As String = "" |
||
2532 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
2533 | |||
2534 | ' Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
2535 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
2536 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
2537 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
2538 | ' If oPipeRow.Length > 0 Then |
||
2539 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
2540 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2541 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2542 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2543 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
2544 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
2545 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
2546 | ' dStart_x = dOriginalStart_x |
||
2547 | ' dStart_y = dOriginalStart_y |
||
2548 | ' dEnd_x = dOriginalEnd_x |
||
2549 | ' dEnd_y = dOriginalEnd_y |
||
2550 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2551 | ' sDirection = "X" |
||
2552 | ' Else |
||
2553 | ' sDirection = "Y" |
||
2554 | ' End If |
||
2555 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2556 | ' sLineUid = sConnLineUid |
||
2557 | ' End If |
||
2558 | ' End If |
||
2559 | |||
2560 | ' While True |
||
2561 | ' sLineUid = "" |
||
2562 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
2563 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
2564 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
2565 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
2566 | |||
2567 | ' If oPipeRow.Length = 0 Then |
||
2568 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
2569 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
2570 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
2571 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
2572 | ' Else |
||
2573 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2574 | ' 'sConnLineUid = sLineUid |
||
2575 | ' sLineUid = sConnLineUid |
||
2576 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2577 | ' iConnType = 1 |
||
2578 | ' End If |
||
2579 | |||
2580 | ' If oPipeRow.Length > 0 Then |
||
2581 | ' If sLineUid = "" Then |
||
2582 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2583 | ' 'sConnLineUid = sLineUid |
||
2584 | ' sLineUid = sConnLineUid |
||
2585 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2586 | ' iConnType = 2 |
||
2587 | ' End If |
||
2588 | ' If iConnType = 1 Then |
||
2589 | |||
2590 | ' ElseIf iConnType = 2 Then |
||
2591 | |||
2592 | ' End If |
||
2593 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
2594 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2595 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2596 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2597 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
2598 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
2599 | |||
2600 | |||
2601 | |||
2602 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
2603 | ' dStart_x = dOriginalStart_x |
||
2604 | ' dStart_y = dOriginalStart_y |
||
2605 | ' dEnd_x = dOriginalEnd_x |
||
2606 | ' dEnd_y = dOriginalEnd_y |
||
2607 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2608 | ' sDirection = "X" |
||
2609 | ' Else |
||
2610 | ' sDirection = "Y" |
||
2611 | ' End If |
||
2612 | ' sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
2613 | ' sSystemPath = GetPipeType(sType) |
||
2614 | ' Else |
||
2615 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2616 | ' If sDirection = "Y" Then |
||
2617 | ' '방향이 바꼈음 Y - > X |
||
2618 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2619 | ' sLineNoUid, sLineUid, sSystemPath) |
||
2620 | ' dStart_x = dOriginalStart_x |
||
2621 | ' dStart_y = dOriginalStart_y |
||
2622 | ' dEnd_x = dOriginalEnd_x |
||
2623 | ' dEnd_y = dOriginalEnd_y |
||
2624 | ' sStartLineUid = sConnLineUid |
||
2625 | ' Else |
||
2626 | ' dEnd_x = dOriginalEnd_x |
||
2627 | ' dEnd_y = dOriginalEnd_y |
||
2628 | ' End If |
||
2629 | ' sDirection = "X" |
||
2630 | ' Else |
||
2631 | ' If sDirection = "X" Then |
||
2632 | ' '방향이 바꼈음 X - > Y |
||
2633 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2634 | ' sLineNoUid, sLineUid, sSystemPath) |
||
2635 | ' dStart_x = dOriginalStart_x |
||
2636 | ' dStart_y = dOriginalStart_y |
||
2637 | ' dEnd_x = dOriginalEnd_x |
||
2638 | ' dEnd_y = dOriginalEnd_y |
||
2639 | ' sStartLineUid = sConnLineUid |
||
2640 | ' Else |
||
2641 | |||
2642 | ' dEnd_x = dOriginalEnd_x |
||
2643 | ' dEnd_y = dOriginalEnd_y |
||
2644 | ' End If |
||
2645 | ' sDirection = "Y" |
||
2646 | ' End If |
||
2647 | ' End If |
||
2648 | ' ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2649 | ' Else |
||
2650 | ' If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
2651 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2652 | ' sLineNoUid, sLineUid, sSystemPath) |
||
2653 | ' End If |
||
2654 | |||
2655 | |||
2656 | ' sReturnUid = sConnLineUid |
||
2657 | ' Exit While |
||
2658 | ' End If |
||
2659 | ' End While |
||
2660 | |||
2661 | ' If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
2662 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
2663 | ' sLineNoUid, sLineUid, sSystemPath) |
||
2664 | ' dStart_x = 0 |
||
2665 | ' dStart_y = 0 |
||
2666 | ' dEnd_x = 0 |
||
2667 | ' dEnd_y = 0 |
||
2668 | ' End If |
||
2669 | ' Catch ex As Exception |
||
2670 | |||
2671 | ' End Try |
||
2672 | |||
2673 | ' Return sReturnUid |
||
2674 | 'End Function |
||
2675 | |||
2676 | |||
2677 | Private Function SymbolToLine_Modeling(ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
2678 | ByVal sSymbolUid As String, ByVal oLMSymbol As LMSymbol) As String |
||
2679 | |||
2680 | |||
2681 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
2682 | Dim oPipeRun As LMPipeRun = Nothing |
||
2683 | Dim objItem As LMAItem |
||
2684 | Dim objConnector As LMConnector |
||
2685 | Dim objInputs As PlaceRunInputs |
||
2686 | objInputs = New PlaceRunInputs |
||
2687 | |||
2688 | |||
2689 | Dim sPipeUid As String = "" |
||
2690 | Dim iConnType As Integer = 0 |
||
2691 | Dim sStartpoint As String = "" |
||
2692 | Dim sEndpoint As String = "" |
||
2693 | Dim dOriginalStart_x As Double = 0.0 |
||
2694 | Dim dOriginalStart_y As Double = 0.0 |
||
2695 | Dim dOriginalEnd_x As Double = 0.0 |
||
2696 | Dim dOriginalEnd_y As Double = 0.0 |
||
2697 | Dim dStart_x As Double = 0.0 |
||
2698 | Dim dStart_y As Double = 0.0 |
||
2699 | Dim dEnd_x As Double = 0.0 |
||
2700 | Dim dEnd_y As Double = 0.0 |
||
2701 | |||
2702 | Dim sReturnUid As String = "" |
||
2703 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sSymbolUid + "' And " & |
||
2704 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
2705 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2706 | If oPipeRow.Length = 0 Then |
||
2707 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sSymbolUid + "' And " & |
||
2708 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
2709 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2710 | Else |
||
2711 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2712 | iConnType = 1 |
||
2713 | End If |
||
2714 | |||
2715 | If oPipeRow.Length = 1 Then |
||
2716 | If sPipeUid = "" Then |
||
2717 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2718 | iConnType = 2 |
||
2719 | End If |
||
2720 | sReturnUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2721 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
2722 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2723 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2724 | dStart_x = dOriginalStart_x |
||
2725 | dStart_y = dOriginalStart_y |
||
2726 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2727 | dEnd_x = dOriginalEnd_x |
||
2728 | dEnd_y = dOriginalEnd_y |
||
2729 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
2730 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
2731 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
2732 | If iConnType = 1 Then |
||
2733 | FindNearPoint(oLMSymbol, dStart_x, dStart_y) |
||
2734 | objInputs.AddSymbolTarget(oLMSymbol, dStart_x, dStart_y) |
||
2735 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2736 | Else |
||
2737 | FindNearPoint(oLMSymbol, dEnd_x, dEnd_y) |
||
2738 | objInputs.AddSymbolTarget(oLMSymbol, dEnd_x, dEnd_y) |
||
2739 | objInputs.AddPoint(dStart_x, dStart_y) |
||
2740 | End If |
||
2741 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2742 | |||
2743 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
2744 | Dim sSystemPath As String = GetPipeType(sType) |
||
2745 | |||
2746 | |||
2747 | |||
2748 | |||
2749 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
2750 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2751 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
2752 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2753 | If oAttributeRow.Length > 0 Then |
||
2754 | For Each oAttribute In oAttributeRow |
||
2755 | Try |
||
2756 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2757 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2758 | If sPIDValue.Contains("'") Then |
||
2759 | sPIDValue = sPIDValue.Replace("'", """") |
||
2760 | End If |
||
2761 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2762 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2763 | Catch ex As Exception |
||
2764 | End Try |
||
2765 | Next |
||
2766 | oPipeRun.Commit() |
||
2767 | End If |
||
2768 | End If |
||
2769 | Return sReturnUid |
||
2770 | End Function |
||
2771 | |||
2772 | Private Function LineToSymbol_Modeling(ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
2773 | ByVal sLineUid As String, ByVal oLMConnector As LMConnector, ByRef oLMSymbol As LMSymbol) As String |
||
2774 | |||
2775 | |||
2776 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
2777 | Dim objItem As LMAItem |
||
2778 | Dim objConnector As LMConnector |
||
2779 | Dim objInputs As PlaceRunInputs |
||
2780 | objInputs = New PlaceRunInputs |
||
2781 | |||
2782 | |||
2783 | Dim sSymbolUid As String = "" |
||
2784 | Dim iConnType As Integer = 0 |
||
2785 | Dim dOriginalPoint_x As Double = 0.0 |
||
2786 | Dim dORiginalPoint_y As Double = 0.0 |
||
2787 | Dim dX As Double = 0.0 |
||
2788 | Dim dY As Double = 0.0 |
||
2789 | Dim sReturnUid As String = "" |
||
2790 | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn1_Uid & " = '" + sLineUid + "' And " & |
||
2791 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
2792 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2793 | If oSymbolRow.Length = 0 Then |
||
2794 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
2795 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
2796 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2797 | If oSymbolRow.Length = 0 Then |
||
2798 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
2799 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
2800 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2801 | If oSymbolRow.Length = 0 Then |
||
2802 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
2803 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
2804 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2805 | If oSymbolRow.Length = 0 Then |
||
2806 | |||
2807 | Else |
||
2808 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
2809 | iConnType = 4 |
||
2810 | End If |
||
2811 | Else |
||
2812 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
2813 | iConnType = 3 |
||
2814 | End If |
||
2815 | Else |
||
2816 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
2817 | iConnType = 2 |
||
2818 | End If |
||
2819 | |||
2820 | Else |
||
2821 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
2822 | iConnType = 1 |
||
2823 | End If |
||
2824 | |||
2825 | If oSymbolRow.Length = 1 Then |
||
2826 | If sSymbolUid = "" Then |
||
2827 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
2828 | iConnType = 2 |
||
2829 | End If |
||
2830 | sReturnUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
2831 | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
2832 | ConvertPointBystring(sOriginalPoint, dOriginalPoint_x, dORiginalPoint_y) |
||
2833 | dX = dOriginalPoint_x |
||
2834 | dY = dORiginalPoint_y |
||
2835 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
2836 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
2837 | |||
2838 | oSymbolRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2839 | |||
2840 | Dim sType As String = oSymbolRow(0)(_XML_LINE_TYPE).ToString() |
||
2841 | Dim sSystemPath As String = GetPipeType(sType) |
||
2842 | |||
2843 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, ExistingItem:=oLMConnector.AsLMAItem, |
||
2844 | TargetItem:=oLMSymbol.AsLMAItem) |
||
2845 | |||
2846 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2847 | If oAttributeRow.Length > 0 Then |
||
2848 | For Each oAttribute In oAttributeRow |
||
2849 | Try |
||
2850 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2851 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2852 | If sPIDValue.Contains("'") Then |
||
2853 | sPIDValue = sPIDValue.Replace("'", """") |
||
2854 | End If |
||
2855 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2856 | oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2857 | Catch ex As Exception |
||
2858 | End Try |
||
2859 | Next |
||
2860 | End If |
||
2861 | End If |
||
2862 | Return sReturnUid |
||
2863 | End Function |
||
2864 | |||
2865 | |||
2866 | Private Sub OPCTOLineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oOPCSymbol As LMSymbol, |
||
2867 | ByVal sOPCUid As String, ByVal sLineNoUid As String) |
||
2868 | Try |
||
2869 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
2870 | Dim objItem As LMAItem |
||
2871 | Dim objConnector As LMConnector |
||
2872 | Dim objInputs As PlaceRunInputs |
||
2873 | objInputs = New PlaceRunInputs |
||
2874 | Dim dOriginalStart_x As Double = 0.0 |
||
2875 | Dim dOriginalStart_y As Double = 0.0 |
||
2876 | Dim dOriginalEnd_x As Double = 0.0 |
||
2877 | Dim dOriginalEnd_y As Double = 0.0 |
||
2878 | Dim dStart_x As Double = 0.0 |
||
2879 | Dim dStart_y As Double = 0.0 |
||
2880 | Dim dEnd_x As Double = 0.0 |
||
2881 | Dim dEnd_y As Double = 0.0 |
||
2882 | |||
2883 | Dim oPipeRun As LMPipeRun = Nothing |
||
2884 | Dim sStartpoint As String = "" |
||
2885 | Dim sEndpoint As String = "" |
||
2886 | Dim iConnType As Integer = 0 |
||
2887 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sOPCUid + "' And [" & |
||
2888 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2889 | Dim sPipeUid As String = "" |
||
2890 | If oPipeRow.Length = 0 Then |
||
2891 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sOPCUid + "' And [" & |
||
2892 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2893 | Else |
||
2894 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2895 | iConnType = 1 |
||
2896 | End If |
||
2897 | Dim oAddUid_List As New List(Of String) |
||
2898 | If oPipeRow.Length = 1 Then |
||
2899 | If sPipeUid = "" Then |
||
2900 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
2901 | iConnType = 2 |
||
2902 | End If |
||
2903 | oAddUid_List.Add(sPipeUid) |
||
2904 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
2905 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2906 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2907 | dStart_x = dOriginalStart_x |
||
2908 | dStart_y = dOriginalStart_y |
||
2909 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2910 | dEnd_x = dOriginalEnd_x |
||
2911 | dEnd_y = dOriginalEnd_y |
||
2912 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
2913 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
2914 | |||
2915 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
2916 | If iConnType = 1 Then |
||
2917 | FindNearPoint(oOPCSymbol, dStart_x, dStart_y) |
||
2918 | objInputs.AddSymbolTarget(oOPCSymbol, dStart_x, dStart_y) |
||
2919 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2920 | Else |
||
2921 | FindNearPoint(oOPCSymbol, dEnd_x, dEnd_y) |
||
2922 | objInputs.AddSymbolTarget(oOPCSymbol, dEnd_x, dEnd_y) |
||
2923 | bb2a0c79 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
2924 | End If |
||
2925 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2926 | |||
2927 | While True |
||
2928 | ' objInputs.Clear() |
||
2929 | Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
2930 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
2931 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2932 | If oAddPipeRow.Length = 0 Then |
||
2933 | oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
2934 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
2935 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2936 | sPipeUid = "" |
||
2937 | Else |
||
2938 | iConnType = 1 |
||
2939 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
2940 | End If |
||
2941 | If oAddPipeRow.Length = 1 Then |
||
2942 | If sPipeUid = "" Then |
||
2943 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
2944 | iConnType = 2 |
||
2945 | End If |
||
2946 | oAddUid_List.Add(sPipeUid) |
||
2947 | sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
2948 | sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
2949 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2950 | dStart_x = dOriginalStart_x |
||
2951 | dStart_y = dOriginalStart_y |
||
2952 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2953 | dEnd_x = dOriginalEnd_x |
||
2954 | dEnd_y = dOriginalEnd_y |
||
2955 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
2956 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
2957 | If iConnType = 1 Then |
||
2958 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2959 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
2960 | Else |
||
2961 | 'objInputs.AddConnectorTarget(objConnector, dStart_x, dStart_y) |
||
2962 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
2963 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
2964 | objInputs.AddPoint(dStart_x, dStart_y) |
||
2965 | End If |
||
2966 | e4000111 | Gyusu | |
2967 | bb2a0c79 | Gyusu | oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
2968 | Else |
||
2969 | Exit While |
||
2970 | End If |
||
2971 | e4000111 | Gyusu | |
2972 | bb2a0c79 | Gyusu | End While |
2973 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
2974 | Dim sSystemPath As String = GetPipeType(sType) |
||
2975 | e4000111 | Gyusu | |
2976 | bb2a0c79 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
2977 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2978 | For i = 0 To oAddUid_List.Count - 1 |
||
2979 | Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
2980 | If oUpdateRow.Length = 1 Then |
||
2981 | oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
2982 | oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
2983 | End If |
||
2984 | Next |
||
2985 | |||
2986 | |||
2987 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
2988 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2989 | If oAttributeRow.Length > 0 Then |
||
2990 | For Each oAttribute In oAttributeRow |
||
2991 | Try |
||
2992 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2993 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2994 | If sPIDValue.Contains("'") Then |
||
2995 | sPIDValue = sPIDValue.Replace("'", """") |
||
2996 | End If |
||
2997 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2998 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2999 | Catch ex As Exception |
||
3000 | End Try |
||
3001 | Next |
||
3002 | oPipeRun.Commit() |
||
3003 | End If |
||
3004 | |||
3005 | End If |
||
3006 | |||
3007 | Catch ex As Exception |
||
3008 | End Try |
||
3009 | End Sub |
||
3010 | |||
3011 | Private Function AddUidList중복체크(ByVal sUidList As List(Of String), ByVal sAddUid As String) As Boolean |
||
3012 | e4000111 | Gyusu | |
3013 | bb2a0c79 | Gyusu | For Each sUid In sUidList |
3014 | If sUid = sAddUid Then |
||
3015 | Return False |
||
3016 | End If |
||
3017 | Next |
||
3018 | Return True |
||
3019 | End Function |
||
3020 | |||
3021 | b08338e3 | Gyusu | Private Sub LineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, ByVal sLineNoText As String) |
3022 | bb2a0c79 | Gyusu | Try |
3023 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
3024 | Dim objItem As LMAItem |
||
3025 | Dim objConnector As LMConnector |
||
3026 | Dim objInputs As PlaceRunInputs |
||
3027 | objInputs = New PlaceRunInputs |
||
3028 | Dim dOriginalStart_x As Double = 0.0 |
||
3029 | Dim dOriginalStart_y As Double = 0.0 |
||
3030 | Dim dOriginalEnd_x As Double = 0.0 |
||
3031 | Dim dOriginalEnd_y As Double = 0.0 |
||
3032 | Dim dStart_x As Double = 0.0 |
||
3033 | Dim dStart_y As Double = 0.0 |
||
3034 | Dim dEnd_x As Double = 0.0 |
||
3035 | Dim dEnd_y As Double = 0.0 |
||
3036 | Dim oPipeRun As LMPipeRun = Nothing |
||
3037 | Dim sStartpoint As String = "" |
||
3038 | Dim sEndpoint As String = "" |
||
3039 | Dim iConnType As Integer = 0 |
||
3040 | Dim pLMConnector As LMConnector = Nothing |
||
3041 | For Each oLinerow In oLine_Dt.Rows |
||
3042 | objInputs.Clear() |
||
3043 | b08338e3 | Gyusu | Dim sCheck As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
3044 | If sCheck = "FALSE" Then |
||
3045 | Dim sUid As String = oLinerow(_XML_LINE_UID).ToString() |
||
3046 | sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
3047 | sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
3048 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
3049 | dStart_x = dOriginalStart_x |
||
3050 | dStart_y = dOriginalStart_y |
||
3051 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
3052 | dEnd_x = dOriginalEnd_x |
||
3053 | dEnd_y = dOriginalEnd_y |
||
3054 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
3055 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
3056 | bb2a0c79 | Gyusu | |
3057 | b08338e3 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
3058 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3059 | bb2a0c79 | Gyusu | Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
3060 | Dim sSystemPath As String = GetPipeType(sType) |
||
3061 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
3062 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
3063 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ")..." & _iPipecnt & " count ") |
3064 | |||
3065 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
3066 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
3067 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oLinerow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
3068 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oLinerow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
3069 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
3070 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dOriginalStart_x & "," & dOriginalStart_y) |
||
3071 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dOriginalEnd_x & "," & dOriginalEnd_y) |
||
3072 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
3073 | |||
3074 | _iPipecnt = _iPipecnt + 1 |
||
3075 | oLinerow(_XML_LINE_SPID) = objConnector.ModelItemID |
||
3076 | oLinerow(_XML_LINE_LMCONNECTOR) = objConnector |
||
3077 | |||
3078 | oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
3079 | bb2a0c79 | Gyusu | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
3080 | |||
3081 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
3082 | If oAttributeRow.Length > 0 Then |
||
3083 | For Each oAttribute In oAttributeRow |
||
3084 | Try |
||
3085 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3086 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3087 | If sPIDValue.Contains("'") Then |
||
3088 | sPIDValue = sPIDValue.Replace("'", """") |
||
3089 | End If |
||
3090 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3091 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3092 | Catch ex As Exception |
||
3093 | End Try |
||
3094 | Next |
||
3095 | oPipeRun.Commit() |
||
3096 | End If |
||
3097 | End If |
||
3098 | |||
3099 | |||
3100 | |||
3101 | |||
3102 | |||
3103 | b08338e3 | Gyusu | 'Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
3104 | 'Dim sCheckModeling As Boolean = False |
||
3105 | 'objInputs.Clear() |
||
3106 | 'Dim oAddUid_List As New List(Of String) |
||
3107 | 'Try |
||
3108 | ' Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
3109 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
3110 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
3111 | ' If oAddPipeRow.Length = 0 Then |
||
3112 | ' oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
3113 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
3114 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
3115 | ' sPipeUid = "" |
||
3116 | ' Else |
||
3117 | ' iConnType = 1 |
||
3118 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
3119 | ' End If |
||
3120 | ' If oAddPipeRow.Length = 1 Then |
||
3121 | ' sCheckModeling = True |
||
3122 | ' If sPipeUid = "" Then |
||
3123 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
3124 | ' iConnType = 2 |
||
3125 | ' End If |
||
3126 | ' If AddUidList중복체크(oAddUid_List, sPipeUid) Then |
||
3127 | ' oAddUid_List.Add(sPipeUid) |
||
3128 | ' End If |
||
3129 | ' sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
3130 | ' sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
3131 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
3132 | ' dStart_x = dOriginalStart_x |
||
3133 | ' dStart_y = dOriginalStart_y |
||
3134 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
3135 | ' dEnd_x = dOriginalEnd_x |
||
3136 | ' dEnd_y = dOriginalEnd_y |
||
3137 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
3138 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
3139 | ' Dim sBranchType As String = "" |
||
3140 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
3141 | ' Try |
||
3142 | ' If pLMConnector Is Nothing Then |
||
3143 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3144 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3145 | ' Else |
||
3146 | ' If sBranchType = "1" Then |
||
3147 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
3148 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3149 | ' ElseIf sBranchType = "2" Then |
||
3150 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
3151 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3152 | ' ElseIf sBranchType = "3" Then |
||
3153 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
3154 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3155 | ' ElseIf sBranchType = "4" Then |
||
3156 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
3157 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3158 | ' End If |
||
3159 | ' End If |
||
3160 | ' Catch ex As Exception |
||
3161 | ' End Try |
||
3162 | ' Else |
||
3163 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3164 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3165 | ' End If |
||
3166 | ' oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
3167 | ' Else |
||
3168 | ' Dim CheckTF As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
||
3169 | ' Dim CheckSelect As String = oLinerow(_XML_LINE_Check).ToString() |
||
3170 | ' If CheckTF = "FALSE" And CheckSelect = "TRUE" Then |
||
3171 | ' sPipeUid = oLinerow(_XML_LINE_UID).ToString() |
||
3172 | ' oAddUid_List.Clear() |
||
3173 | ' oAddUid_List.Add(sPipeUid) |
||
3174 | ' sCheckModeling = True |
||
3175 | ' sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
3176 | ' sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
3177 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
3178 | ' dStart_x = dOriginalStart_x |
||
3179 | ' dStart_y = dOriginalStart_y |
||
3180 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
3181 | ' dEnd_x = dOriginalEnd_x |
||
3182 | ' dEnd_y = dOriginalEnd_y |
||
3183 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
3184 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
3185 | ' Dim sBranchType As String = "" |
||
3186 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
3187 | ' Try |
||
3188 | ' If sBranchType = "1" Then |
||
3189 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3190 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
3191 | ' ElseIf sBranchType = "2" Then |
||
3192 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3193 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
3194 | ' ElseIf sBranchType = "3" Then |
||
3195 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3196 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
3197 | ' ElseIf sBranchType = "4" Then |
||
3198 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3199 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
3200 | ' End If |
||
3201 | ' Catch ex As Exception |
||
3202 | |||
3203 | ' End Try |
||
3204 | ' Else |
||
3205 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3206 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3207 | ' End If |
||
3208 | ' oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
3209 | ' End If |
||
3210 | ' End If |
||
3211 | 'Catch ex As Exception |
||
3212 | 'End Try |
||
3213 | 'If sCheckModeling Then |
||
3214 | ' Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
||
3215 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
3216 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
3217 | ' objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
3218 | ' For i = 0 To oAddUid_List.Count - 1 |
||
3219 | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
3220 | ' If oUpdateRow.Length = 1 Then |
||
3221 | ' oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
3222 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
3223 | ' End If |
||
3224 | ' Next |
||
3225 | |||
3226 | ' oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
3227 | ' oAddUid_List.Clear() |
||
3228 | |||
3229 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
3230 | ' If oAttributeRow.Length > 0 Then |
||
3231 | ' For Each oAttribute In oAttributeRow |
||
3232 | ' Try |
||
3233 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3234 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3235 | ' If sPIDValue.Contains("'") Then |
||
3236 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
3237 | ' End If |
||
3238 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3239 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3240 | ' Catch ex As Exception |
||
3241 | ' End Try |
||
3242 | ' Next |
||
3243 | ' oPipeRun.Commit() |
||
3244 | ' End If |
||
3245 | |||
3246 | ' If pLMConnector IsNot Nothing Then |
||
3247 | ' Dim sID_1 As String = pLMConnector.ModelItemID |
||
3248 | ' Dim sID_2 As String = objConnector.ModelItemID |
||
3249 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
3250 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
3251 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
3252 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
3253 | ' ' oDatasource.CommitTransaction() |
||
3254 | ' '_Placement.PIDAutoJoin(oPipeRun1.AsLMAItem, AutoJoinEndConstants.autoJoin_End, objSurvivorItem) |
||
3255 | ' 'oPipeRun1.Commit() |
||
3256 | ' 'oDatasource.CommitTransaction() |
||
3257 | ' 'objSurvivorItem = Nothing |
||
3258 | ' '_Placement.PIDAutoJoin(oPipeRun2.AsLMAItem, AutoJoinEndConstants.autoJoin_Start, objSurvivorItem) |
||
3259 | ' 'oPipeRun2.Commit() |
||
3260 | ' 'oDatasource.CommitTransaction() |
||
3261 | ' End If |
||
3262 | ' sCheckModeling = False |
||
3263 | ' End If |
||
3264 | Next |
||
3265 | bb2a0c79 | Gyusu | Catch ex As Exception |
3266 | End Try |
||
3267 | End Sub |
||
3268 | e4000111 | Gyusu | |
3269 | b08338e3 | Gyusu | |
3270 | Private Sub SymbolModeling(ByVal CDrawing As Drawing, ByVal oLine_DT As DataTable, ByVal oSymbolRow As DataRow, ByVal oAttribute_Dt As DataTable, |
||
3271 | ByVal sLineNoText As String) |
||
3272 | bb2a0c79 | Gyusu | Try |
3273 | b08338e3 | Gyusu | |
3274 | Dim sCheckModeling As String = oSymbolRow(_XML_SYMBOL_DRAWING_TF).ToString() |
||
3275 | If sCheckModeling = "FALSE" Then |
||
3276 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
3277 | Dim oSymbol As LMSymbol = Nothing |
||
3278 | Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
3279 | Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
3280 | bb2a0c79 | Gyusu | Dim oDatasource As Object = _Placement.PIDDataSource |
3281 | Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
3282 | Dim dLocationX As Double = 0.0 |
||
3283 | Dim dLocationY As Double = 0.0 |
||
3284 | Dim dX As Double = 0.0 |
||
3285 | Dim dY As Double = 0.0 |
||
3286 | b08338e3 | Gyusu | Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
3287 | ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
3288 | dX = dLocationX |
||
3289 | dY = dLocationY |
||
3290 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
3291 | |||
3292 | Dim dAngle As Double = oSymbolRow(_XML_SYMBOL_ANGLE) |
||
3293 | |||
3294 | |||
3295 | 'Dim oDatarow() As DataRow = oLine_DT.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sSymbolUid & "'") |
||
3296 | 'If oDatarow.Length = 0 Then |
||
3297 | ' oDatarow = oLine_DT.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sSymbolUid & "'") |
||
3298 | 'End If |
||
3299 | 'Dim dFix_X As Double = 0.0 |
||
3300 | 'Dim dFix_Y As Double = 0.0 |
||
3301 | 'If oDatarow.Length > 0 Then |
||
3302 | ' If dAngle <> 0 Then |
||
3303 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
3304 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
3305 | |||
3306 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
3307 | ' dX = dLocationX |
||
3308 | ' Else |
||
3309 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
3310 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
3311 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
3312 | ' dY = dLocationY |
||
3313 | ' End If |
||
3314 | |||
3315 | 'End If |
||
3316 | |||
3317 | |||
3318 | |||
3319 | oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY,, dAngle) |
||
3320 | SetListBoxItems(ListBox_Result, "Place Fitting.." & sSymbolUid & " (" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
3321 | |||
3322 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Fitting : " & sSymbolUid) |
||
3323 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
3324 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
3325 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
3326 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection3 : " & oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()) |
||
3327 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection4 : " & oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()) |
||
3328 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
3329 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
3330 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Fitting Count : " & _iFittingcnt) |
||
3331 | |||
3332 | |||
3333 | _iFittingcnt = _iFittingcnt + 1 |
||
3334 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
3335 | Dim oAttributeRow() As DataRow |
||
3336 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
3337 | If oAttribute_Dt.Rows.Count > 0 Then |
||
3338 | |||
3339 | bb2a0c79 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
3340 | b08338e3 | Gyusu | Dim oInstrument As LMInstrument |
3341 | oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
3342 | bb2a0c79 | Gyusu | Try |
3343 | If oAttributeRow.Length > 0 Then |
||
3344 | For Each oAttribute In oAttributeRow |
||
3345 | Try |
||
3346 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3347 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3348 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3349 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3350 | Catch ex As Exception |
||
3351 | End Try |
||
3352 | Next |
||
3353 | oInstrument.Commit() |
||
3354 | End If |
||
3355 | Catch ex As Exception |
||
3356 | End Try |
||
3357 | Else |
||
3358 | b08338e3 | Gyusu | Try |
3359 | If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
3360 | For Each oAttribute In oAttributeRow |
||
3361 | Try |
||
3362 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3363 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3364 | e4000111 | Gyusu | |
3365 | b08338e3 | Gyusu | If sPIDAttribute = "SIZE" Then |
3366 | |||
3367 | 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
3368 | If sPIDValue.Contains("x") Then |
||
3369 | Dim sSplitSize() As String = sPIDValue.Split("x") |
||
3370 | If sSplitSize.Count > 1 Then |
||
3371 | 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
3372 | Dim oConnector_1 As LMConnector = Nothing |
||
3373 | Dim oConnector_2 As LMConnector = Nothing |
||
3374 | If oSymbol IsNot Nothing Then |
||
3375 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
3376 | For Each Tconnector In oSymbol.Connect1Connectors |
||
3377 | If Tconnector.ItemStatus = "Active" Then |
||
3378 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
3379 | oConnector_1 = Tconnector |
||
3380 | End If |
||
3381 | End If |
||
3382 | Next |
||
3383 | End If |
||
3384 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
3385 | For Each Tconnector In oSymbol.Connect1Connectors |
||
3386 | If Tconnector.ItemStatus = "Active" Then |
||
3387 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
3388 | oConnector_2 = Tconnector |
||
3389 | End If |
||
3390 | End If |
||
3391 | Next |
||
3392 | End If |
||
3393 | End If |
||
3394 | Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
3395 | Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
3396 | If dAngle = 3.14 Then |
||
3397 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
3398 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
3399 | Else |
||
3400 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
3401 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
3402 | End If |
||
3403 | e4000111 | Gyusu | |
3404 | |||
3405 | b08338e3 | Gyusu | End If |
3406 | e4000111 | Gyusu | |
3407 | b08338e3 | Gyusu | Else |
3408 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3409 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3410 | End If |
||
3411 | Else |
||
3412 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3413 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3414 | End If |
||
3415 | e4000111 | Gyusu | |
3416 | b08338e3 | Gyusu | Catch ex As Exception |
3417 | End Try |
||
3418 | Next |
||
3419 | oSymbol.Commit() |
||
3420 | End If |
||
3421 | Catch ex As Exception |
||
3422 | End Try |
||
3423 | End If |
||
3424 | End If |
||
3425 | e4000111 | Gyusu | |
3426 | |||
3427 | |||
3428 | b08338e3 | Gyusu | End If |
3429 | e4000111 | Gyusu | |
3430 | |||
3431 | |||
3432 | b08338e3 | Gyusu | 'Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
3433 | 'Dim sConnTypeNo As String = "" |
||
3434 | '' Line과 연결되어있는 Symbol인지 확인 |
||
3435 | 'Dim oLine_Dt As DataTable = GetPipeFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
3436 | ''Symbol과 연결되어 있는 Symbol인지 확인 |
||
3437 | 'Dim oSymbol_Dt As DataTable = GetSymbolFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
3438 | 'Dim oSymbol As LMSymbol = Nothing |
||
3439 | 'Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
3440 | 'Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
3441 | 'Dim oDatasource As Object = _Placement.PIDDataSource |
||
3442 | 'Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
3443 | e4000111 | Gyusu | |
3444 | b08338e3 | Gyusu | 'Dim dAngle As Double = 0.0 |
3445 | 'If IsNumeric(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) Then |
||
3446 | ' dAngle = Double.Parse(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) |
||
3447 | 'End If |
||
3448 | e4000111 | Gyusu | |
3449 | b08338e3 | Gyusu | 'Dim dLocationX As Double = 0.0 |
3450 | 'Dim dLocationY As Double = 0.0 |
||
3451 | 'Dim dX As Double = 0.0 |
||
3452 | 'Dim dY As Double = 0.0 |
||
3453 | 'Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
3454 | 'ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
3455 | 'dX = dLocationX |
||
3456 | 'dY = dLocationY |
||
3457 | 'ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
3458 | 'Dim bCheckModeling As Boolean = False |
||
3459 | |||
3460 | 'If oLine_Dt.Rows.Count > 0 Then |
||
3461 | |||
3462 | ' If sSPID <> "" Then |
||
3463 | ' Dim dX1 As Double = 0 |
||
3464 | ' Dim dX2 As Double = 0 |
||
3465 | ' Dim dY1 As Double = 0 |
||
3466 | ' Dim dY2 As Double = 0 |
||
3467 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
3468 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3469 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3470 | |||
3471 | ' Dim dCalcPoint As Double = -1 |
||
3472 | ' Dim dModeling_X As Double = 0 |
||
3473 | ' Dim dModeling_Y As Double = 0 |
||
3474 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
3475 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
3476 | ' dModeling_X = dX1 |
||
3477 | ' dModeling_Y = dY1 |
||
3478 | ' End If |
||
3479 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
3480 | e4000111 | Gyusu | |
3481 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
3482 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
3483 | ' dModeling_X = dX2 |
||
3484 | ' dModeling_Y = dY2 |
||
3485 | ' End If |
||
3486 | ' End If |
||
3487 | e4000111 | Gyusu | |
3488 | |||
3489 | |||
3490 | b08338e3 | Gyusu | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
3491 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
3492 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
3493 | ' bCheckModeling = True |
||
3494 | ' End If |
||
3495 | e4000111 | Gyusu | |
3496 | |||
3497 | b08338e3 | Gyusu | ' End If |
3498 | 'End If |
||
3499 | 'If oSymbol_Dt.Rows.Count > 0 Then |
||
3500 | ' If sSPID <> "" Then |
||
3501 | ' Dim dX1 As Double = 0 |
||
3502 | ' Dim dX2 As Double = 0 |
||
3503 | ' Dim dX3 As Double = 0 |
||
3504 | ' Dim dX4 As Double = 0 |
||
3505 | ' Dim dY1 As Double = 0 |
||
3506 | ' Dim dY2 As Double = 0 |
||
3507 | ' Dim dY3 As Double = 0 |
||
3508 | ' Dim dY4 As Double = 0 |
||
3509 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
3510 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3511 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3512 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 3, dX3, dY3) |
||
3513 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 4, dX4, dY4) |
||
3514 | |||
3515 | ' Dim dCalcPoint As Double = -1 |
||
3516 | ' Dim dModeling_X As Double = 0 |
||
3517 | ' Dim dModeling_Y As Double = 0 |
||
3518 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
3519 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
3520 | ' dModeling_X = dX1 |
||
3521 | ' dModeling_Y = dY1 |
||
3522 | ' End If |
||
3523 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
3524 | 41e4023e | Gyusu | |
3525 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
3526 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
3527 | ' dModeling_X = dX2 |
||
3528 | ' dModeling_Y = dY2 |
||
3529 | ' End If |
||
3530 | ' End If |
||
3531 | ' If dX3 <> 0 And dY3 <> 0 Then |
||
3532 | ' If (Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) > dCalcPoint) Then |
||
3533 | ' dCalcPoint = Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) |
||
3534 | ' dModeling_X = dX3 |
||
3535 | ' dModeling_Y = dY3 |
||
3536 | ' End If |
||
3537 | ' End If |
||
3538 | ' If dX4 <> 0 And dY4 <> 0 Then |
||
3539 | ' If (Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) > dCalcPoint) Then |
||
3540 | ' dCalcPoint = Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) |
||
3541 | ' dModeling_X = dX4 |
||
3542 | ' dModeling_Y = dY4 |
||
3543 | ' End If |
||
3544 | ' End If |
||
3545 | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
||
3546 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
3547 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
3548 | ' bCheckModeling = True |
||
3549 | ' End If |
||
3550 | 41e4023e | Gyusu | |
3551 | e4000111 | Gyusu | |
3552 | b08338e3 | Gyusu | ' End If |
3553 | e4000111 | Gyusu | |
3554 | b08338e3 | Gyusu | 'End If |
3555 | e4000111 | Gyusu | |
3556 | b08338e3 | Gyusu | 'If (oLine_Dt.Rows.Count = 0 And oSymbol_Dt.Rows.Count = 0) Or bCheckModeling = False Then |
3557 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
3558 | ' SetListBoxItems(ListBox_Result, "Place Fittings..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
3559 | ' _iFittingcnt = _iFittingcnt + 1 |
||
3560 | 'End If |
||
3561 | 'Dim oAttributeRow() As DataRow |
||
3562 | 'oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
3563 | 'If oAttribute_Dt.Rows.Count > 0 Then |
||
3564 | |||
3565 | ' If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
||
3566 | ' Dim oInstrument As LMInstrument |
||
3567 | ' oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
3568 | ' Try |
||
3569 | ' If oAttributeRow.Length > 0 Then |
||
3570 | ' For Each oAttribute In oAttributeRow |
||
3571 | ' Try |
||
3572 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3573 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3574 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3575 | ' oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3576 | ' Catch ex As Exception |
||
3577 | ' End Try |
||
3578 | ' Next |
||
3579 | ' oInstrument.Commit() |
||
3580 | ' End If |
||
3581 | ' Catch ex As Exception |
||
3582 | ' End Try |
||
3583 | ' Else |
||
3584 | ' Try |
||
3585 | ' If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
3586 | ' For Each oAttribute In oAttributeRow |
||
3587 | ' Try |
||
3588 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3589 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3590 | |||
3591 | ' If sPIDAttribute = "SIZE" Then |
||
3592 | |||
3593 | ' 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
3594 | ' If sPIDValue.Contains("x") Then |
||
3595 | ' Dim sSplitSize() As String = sPIDValue.Split("x") |
||
3596 | ' If sSplitSize.Count > 1 Then |
||
3597 | ' 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
3598 | ' Dim oConnector_1 As LMConnector = Nothing |
||
3599 | ' Dim oConnector_2 As LMConnector = Nothing |
||
3600 | ' If oSymbol IsNot Nothing Then |
||
3601 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
3602 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
3603 | ' If Tconnector.ItemStatus = "Active" Then |
||
3604 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
3605 | ' oConnector_1 = Tconnector |
||
3606 | ' End If |
||
3607 | ' End If |
||
3608 | ' Next |
||
3609 | ' End If |
||
3610 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
3611 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
3612 | ' If Tconnector.ItemStatus = "Active" Then |
||
3613 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
3614 | ' oConnector_2 = Tconnector |
||
3615 | ' End If |
||
3616 | ' End If |
||
3617 | ' Next |
||
3618 | ' End If |
||
3619 | ' End If |
||
3620 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
3621 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
3622 | ' If dAngle = 3.14 Then |
||
3623 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
3624 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
3625 | ' Else |
||
3626 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
3627 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
3628 | ' End If |
||
3629 | |||
3630 | |||
3631 | ' End If |
||
3632 | |||
3633 | ' Else |
||
3634 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3635 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3636 | ' End If |
||
3637 | ' Else |
||
3638 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3639 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3640 | ' End If |
||
3641 | |||
3642 | ' Catch ex As Exception |
||
3643 | ' End Try |
||
3644 | ' Next |
||
3645 | ' oSymbol.Commit() |
||
3646 | ' End If |
||
3647 | ' Catch ex As Exception |
||
3648 | ' End Try |
||
3649 | ' End If |
||
3650 | 'End If |
||
3651 | Catch ex As Exception |
||
3652 | End Try |
||
3653 | End Sub |
||
3654 | e4000111 | Gyusu | |
3655 | Private Function AutoModeling() As Boolean |
||
3656 | Try |
||
3657 | e38f99a7 | Gyusu | '_AllLine_DT = Line_Dt() |
3658 | '_AllSymbol_DT = Symbol_Dt() |
||
3659 | 79326880 | Gyusu | _ModelingLine_Dt = Line_Dt() |
3660 | e38f99a7 | Gyusu | _ModelingSymbol_Dt = Symbol_Dt() |
3661 | e4000111 | Gyusu | _CompleteConvert = False |
3662 | Label_Progress.Text = "0%" |
||
3663 | SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
||
3664 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 시작....") |
3665 | e4000111 | Gyusu | Dim oDwg_Dt As DataTable = LoadAllDrawing() |
3666 | b08338e3 | Gyusu | _Log_File = "AutoConverting_" + DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("HHmmss") |
3667 | e4000111 | Gyusu | _allItem = GetAllCheckNodeCount() |
3668 | 76f465d0 | Gyusu | _Itemcnt = 0 |
3669 | e4000111 | Gyusu | '1.Equipment |
3670 | '2.Piping OPC |
||
3671 | '3.OPC 시작되는 Line |
||
3672 | e6ef24be | gaqhf | |
3673 | 7e561f5b | gaqhf | 'InitAutoRouting() |
3674 | 'EquipmentModeling(oDwg_Dt) |
||
3675 | 'PipingModeling() |
||
3676 | |||
3677 | 1406fef4 | gaqhf | '' 1. Primary Line만 먼저 그림 |
3678 | 94c7557d | gaqhf | 'PrimaryPipeModeling() |
3679 | 1406fef4 | gaqhf | '' 2. Draw Symbols Prinmary에 붙는 Symbol만 / Reducer 제외 |
3680 | 94c7557d | gaqhf | 'PrimarySymbolModeling() |
3681 | 1406fef4 | gaqhf | |
3682 | 94c7557d | gaqhf | '' |
3683 | Dim auto As AutoModeling = New AutoModeling(_DrawingsList(0), ListBox_Result) |
||
3684 | auto.StartModeling() |
||
3685 | 1406fef4 | gaqhf | |
3686 | |||
3687 | |||
3688 | bb2a0c79 | Gyusu | |
3689 | ' PipeLine_Fitting_Modeling() |
||
3690 | e4000111 | Gyusu | |
3691 | 171ac39d | Gyusu | SetProgressbar(ProgressBar_Status, 100) |
3692 | 41e4023e | Gyusu | Label_Progress.Text = "100%" |
3693 | 171ac39d | Gyusu | SetListBoxItems(ListBox_Result, " Auto converting 완료") |
3694 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 완료") |
3695 | 54b98e09 | Gyusu | _CompleteConvert = True |
3696 | 171ac39d | Gyusu | Return True |
3697 | Catch ex As Exception |
||
3698 | Return False |
||
3699 | End Try |
||
3700 | End Function |
||
3701 | |||
3702 | 54b98e09 | Gyusu | Private Sub ThreadConvert() |
3703 | 559daf6d | Gyusu | If _DrawingsList IsNot Nothing Then |
3704 | If _DrawingsList.Count > 0 Then |
||
3705 | b82166d4 | Gyusu | 'TestBranchLine() |
3706 | 559daf6d | Gyusu | AutoModeling() |
3707 | End If |
||
3708 | 171ac39d | Gyusu | End If |
3709 | e282643f | Gyusu | End Sub |
3710 | |||
3711 | 54b98e09 | Gyusu | Private Sub ThreadOPCRemove() |
3712 | While _CompleteConvert = False |
||
3713 | Dim oFindOPC As New FindOpc |
||
3714 | oFindOPC.RemoveOPCDlg() |
||
3715 | End While |
||
3716 | e282643f | Gyusu | |
3717 | 54b98e09 | Gyusu | End Sub |
3718 | 171ac39d | Gyusu | |
3719 | e282643f | Gyusu | Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
3720 | Dim oRows As DataRow() = oDt.Select("[Name] = '" & sDwgName & "'") |
||
3721 | Dim oPath As String = "" |
||
3722 | If oRows.Length > 0 Then |
||
3723 | oPath = oRows(0).Item("Path").ToString() |
||
3724 | End If |
||
3725 | Return oPath |
||
3726 | End Function |
||
3727 | |||
3728 | 272662f9 | Gyusu | Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
3729 | 3b7a4470 | Gyusu | |
3730 | 171ac39d | Gyusu | If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
3731 | 54b98e09 | Gyusu | LoadDB() |
3732 | 171ac39d | Gyusu | LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
3733 | End If |
||
3734 | End Sub |
||
3735 | Private Sub LoadXmlItem(ByVal sFolderPath As String) |
||
3736 | _DrawingsList = New List(Of Drawing) |
||
3737 | Dim sfileEntries As String() = Directory.GetFiles(sFolderPath) |
||
3738 | If Tree_Result.Nodes.Count > 0 Then |
||
3739 | Tree_Result.Nodes(0).Nodes.Clear() |
||
3740 | For Each sfileName In sfileEntries |
||
3741 | Dim sExtension As String = Path.GetExtension(sfileName) |
||
3742 | If sExtension = ".xml" Then |
||
3743 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(sfileName) |
||
3744 | Dim sDwgPath As String = sfileName |
||
3745 | Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
||
3746 | Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
||
3747 | bb2a0c79 | Gyusu | |
3748 | 171ac39d | Gyusu | _DrawingsList.Add(oDwg) |
3749 | End If |
||
3750 | Next |
||
3751 | Tree_Result.Nodes(0).Expand() |
||
3752 | End If |
||
3753 | End Sub |
||
3754 | 272662f9 | Gyusu | |
3755 | e4000111 | Gyusu | Private Sub GenerateRelation(ByRef oDwg_Ds As Drawing) |
3756 | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
||
3757 | Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
||
3758 | Dim oTrimLineLists As List(Of Line_no) = oDwg_Ds.TrimLine_nos |
||
3759 | Dim oRelation As New GenerateRelation() |
||
3760 | For Each oLinelist In oLineLists |
||
3761 | bb2a0c79 | Gyusu | oRelation.CalcLineConnectionItem_Equal(oLinelist.Dt_Line, oLineLists) |
3762 | oRelation.CalcLineConnectionItem_NonEqual(oLinelist.Dt_Line, oLineLists) |
||
3763 | oRelation.CalcSymbolConnectionItem_Equal(oLinelist.Dt_Symbol, oLineLists) |
||
3764 | oRelation.CalcSymbolConnectionItem_NonEqual(oLinelist.Dt_Symbol, oLineLists) |
||
3765 | e4000111 | Gyusu | Next |
3766 | End Sub |
||
3767 | |||
3768 | e6ef24be | gaqhf | Private Sub SetSymbol_LineNumberByUID(ByVal symbols As List(Of Symbol), ByVal lineNumber As LineNumber, ByVal uid As String) |
3769 | For Each symbol As Symbol In symbols |
||
3770 | If symbol.UID = uid Then |
||
3771 | symbol.LINENUMBER = lineNumber |
||
3772 | Exit For |
||
3773 | End If |
||
3774 | Next |
||
3775 | End Sub |
||
3776 | |||
3777 | Private Sub SetLine_LineNumberByUID(ByVal lines As List(Of Line), ByVal lineNumber As LineNumber, ByVal uid As String) |
||
3778 | For Each line As Line In lines |
||
3779 | If line.UID = uid Then |
||
3780 | line.LINENUMBER = lineNumber |
||
3781 | Exit For |
||
3782 | End If |
||
3783 | Next |
||
3784 | End Sub |
||
3785 | e4000111 | Gyusu | |
3786 | 20c84e05 | Gyusu | ''' <summary> |
3787 | ''' XML Tree 구조 생성 |
||
3788 | ''' </summary> |
||
3789 | ''' <param name="sDwgPath"></param> |
||
3790 | 171ac39d | Gyusu | Private Function AddSymbolItem(ByVal sDwgPath As String, ByVal oParentNode As TreeNode) As Drawing |
3791 | Dim oDwg_Ds As Drawing = LoadSymbolInXml(sDwgPath) |
||
3792 | e4000111 | Gyusu | |
3793 | 54b98e09 | Gyusu | If oDwg_Ds IsNot Nothing Then |
3794 | |||
3795 | e6ef24be | gaqhf | Dim oLineNos As List(Of LineNumber) = oDwg_Ds.LINENUMBERS |
3796 | 3acffcee | Gyusu | |
3797 | e6ef24be | gaqhf | Dim oTrimLines As List(Of LineNumber) = oDwg_Ds.TRIMLINES |
3798 | 3acffcee | Gyusu | |
3799 | e6ef24be | gaqhf | Dim oSymbols As List(Of Symbol) = oDwg_Ds.SYMBOLS |
3800 | 54b98e09 | Gyusu | |
3801 | e6ef24be | gaqhf | Dim oLines As List(Of Line) = oDwg_Ds.LINES |
3802 | 9c86a823 | Gyusu | |
3803 | e6ef24be | gaqhf | '' TreeView 구성 및 하위 아이템 상위 구성 |
3804 | ' LIne Number |
||
3805 | For Each lineNo As LineNumber In oLineNos |
||
3806 | 94c7557d | gaqhf | Dim node As TreeNode = New TreeNode(lineNo.TEXT) |
3807 | 7e561f5b | gaqhf | node.Name = lineNo.UID |
3808 | node.Tag = lineNo |
||
3809 | |||
3810 | oParentNode.Nodes.Add(node) |
||
3811 | 9c86a823 | Gyusu | |
3812 | e6ef24be | gaqhf | For Each uid In lineNo.SYMBOLRUNITEMS |
3813 | SetSymbol_LineNumberByUID(oSymbols, lineNo, uid) |
||
3814 | 54b98e09 | Gyusu | Next |
3815 | 9c86a823 | Gyusu | |
3816 | e6ef24be | gaqhf | For Each uid In lineNo.LINERUNITEMS |
3817 | SetLine_LineNumberByUID(oLines, lineNo, uid) |
||
3818 | 54b98e09 | Gyusu | Next |
3819 | Next |
||
3820 | 3acffcee | Gyusu | |
3821 | e6ef24be | gaqhf | ' Trim Line |
3822 | For index = 0 To oTrimLines.Count - 1 |
||
3823 | Dim trimLine As LineNumber = oTrimLines(index) |
||
3824 | 7e561f5b | gaqhf | |
3825 | Dim node As TreeNode = New TreeNode("TrimLine" + index.ToString) |
||
3826 | node.Name = trimLine.UID |
||
3827 | node.Tag = trimLine |
||
3828 | |||
3829 | oParentNode.Nodes.Add(node) |
||
3830 | d039e347 | Gyusu | |
3831 | e6ef24be | gaqhf | For Each uid In trimLine.SYMBOLRUNITEMS |
3832 | SetSymbol_LineNumberByUID(oSymbols, trimLine, uid) |
||
3833 | Next |
||
3834 | 54b98e09 | Gyusu | |
3835 | e6ef24be | gaqhf | For Each uid In trimLine.LINERUNITEMS |
3836 | SetLine_LineNumberByUID(oLines, trimLine, uid) |
||
3837 | 54b98e09 | Gyusu | Next |
3838 | 171ac39d | Gyusu | Next |
3839 | e6ef24be | gaqhf | ' symbol |
3840 | For Each symbol As Symbol In oSymbols |
||
3841 | 7e561f5b | gaqhf | |
3842 | 94c7557d | gaqhf | Dim node As TreeNode = New TreeNode(symbol.PARENT) |
3843 | 7e561f5b | gaqhf | node.Name = symbol.UID |
3844 | node.Tag = symbol |
||
3845 | |||
3846 | 94c7557d | gaqhf | If symbol.SPPIDMAPPINGNAME = "" Then |
3847 | node.ForeColor = Color.Red |
||
3848 | End If |
||
3849 | |||
3850 | e6ef24be | gaqhf | If symbol.LINENUMBER IsNot Nothing Then |
3851 | Dim nodeIndex As Integer = oParentNode.Nodes.IndexOfKey(symbol.LINENUMBER.UID) |
||
3852 | 7e561f5b | gaqhf | oParentNode.Nodes.Item(nodeIndex).Nodes.Add(node) |
3853 | e6ef24be | gaqhf | Else |
3854 | 7e561f5b | gaqhf | oParentNode.Nodes.Add(node) |
3855 | e6ef24be | gaqhf | End If |
3856 | Next |
||
3857 | ' line |
||
3858 | For Each line As Line In oLines |
||
3859 | 7e561f5b | gaqhf | |
3860 | Dim node As TreeNode = New TreeNode(line.TYPE) |
||
3861 | node.Name = line.UID |
||
3862 | node.Tag = line |
||
3863 | |||
3864 | e6ef24be | gaqhf | If line.LINENUMBER IsNot Nothing Then |
3865 | Dim nodeIndex As Integer = oParentNode.Nodes.IndexOfKey(line.LINENUMBER.UID) |
||
3866 | 7e561f5b | gaqhf | oParentNode.Nodes.Item(nodeIndex).Nodes.Add(node) |
3867 | e6ef24be | gaqhf | Else |
3868 | 7e561f5b | gaqhf | oParentNode.Nodes.Add(node) |
3869 | e6ef24be | gaqhf | End If |
3870 | 94c7557d | gaqhf | |
3871 | For index = 0 To 1 |
||
3872 | If line.CONNECTORS(index).CONNECTEDITEM = line.UID Then |
||
3873 | Console.WriteLine("") |
||
3874 | End If |
||
3875 | Next |
||
3876 | 3acffcee | Gyusu | Next |
3877 | |||
3878 | 54b98e09 | Gyusu | End If |
3879 | |||
3880 | 171ac39d | Gyusu | Return oDwg_Ds |
3881 | End Function |
||
3882 | 272662f9 | Gyusu | Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
3883 | If e.Node.Checked = True Then |
||
3884 | For Each oNode As TreeNode In e.Node.Nodes |
||
3885 | oNode.Checked = True |
||
3886 | Next |
||
3887 | Else |
||
3888 | For Each oNode As TreeNode In e.Node.Nodes |
||
3889 | oNode.Checked = False |
||
3890 | Next |
||
3891 | End If |
||
3892 | End Sub |
||
3893 | 171ac39d | Gyusu | |
3894 | 559daf6d | Gyusu | Private Sub Btn_Setting_Click(sender As Object, e As EventArgs) Handles Btn_Setting.Click |
3895 | Dim oSettings As Settings = New Settings() |
||
3896 | oSettings.ShowDialog() |
||
3897 | End Sub |
||
3898 | 42c0013c | Gyusu | |
3899 | b82166d4 | Gyusu | |
3900 | Private Sub TestBranchLine() |
||
3901 | Dim objPlacement As Placement |
||
3902 | objPlacement = New Placement |
||
3903 | Dim PipeRunLocation As String |
||
3904 | Dim objItem As LMAItem |
||
3905 | Dim objConnector As LMConnector |
||
3906 | Dim objInputs As PlaceRunInputs |
||
3907 | Dim objSymbol As LMSymbol |
||
3908 | Dim ValveLocation As String |
||
3909 | PipeRunLocation = "\Piping\Routing\Process Lines\Primary Piping.sym" |
||
3910 | objInputs = New PlaceRunInputs |
||
3911 | objInputs.AddPoint(0.1, 0.1) |
||
3912 | objInputs.AddPoint(0.2, 0.1) |
||
3913 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
3914 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
3915 | ValveLocation = "\Piping\Valves\2 Way Common\Ball Valve.sym" |
||
3916 | objSymbol = objPlacement.PIDPlaceSymbol(ValveLocation, 0.15, 0.3, , 1.57) |
||
3917 | objInputs = New PlaceRunInputs |
||
3918 | objInputs.AddConnectorTarget(objConnector, 0.15, 0.1) |
||
3919 | ' objInputs.AddConnectorTarget(objConnector, 0.12, 0.1) |
||
3920 | objInputs.AddPoint(0.15, 0.15) |
||
3921 | objInputs.AddPoint(0.12, 0.15) |
||
3922 | objInputs.AddPoint(0.12, 0.2) |
||
3923 | objInputs.AddPoint(0.15, 0.2) |
||
3924 | objInputs.AddSymbolTarget(objSymbol, 0.15, 0.3) |
||
3925 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
3926 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
3927 | |||
3928 | objInputs = New PlaceRunInputs |
||
3929 | objInputs.AddConnectorTarget(objConnector, 0.17, 0.1) |
||
3930 | objInputs.AddPoint(0.17, 0.15) |
||
3931 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
3932 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
3933 | |||
3934 | objInputs = New PlaceRunInputs |
||
3935 | objInputs.AddConnectorTarget(objConnector, 0.19, 0.1) |
||
3936 | objInputs.AddPoint(0.19, 0.15) |
||
3937 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
3938 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
3939 | |||
3940 | objInputs = New PlaceRunInputs |
||
3941 | objInputs.AddConnectorTarget(objConnector, 0.12, 0.1) |
||
3942 | objInputs.AddPoint(0.12, 0.15) |
||
3943 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
3944 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
3945 | End Sub |
||
3946 | |||
3947 | 42c0013c | Gyusu | Private Sub Btn_TestNozzle_Click(sender As Object, e As EventArgs) Handles Btn_TestNozzle.Click |
3948 | |||
3949 | Dim sVessel_ID As String = "841D5E640AE5421B9A017DDC2E87FF11" |
||
3950 | Dim objVessel As LMVessel |
||
3951 | objVessel = _Placement.PIDDataSource.GetVessel(sVessel_ID) |
||
3952 | Dim oVesselLocation As LMLocations = objVessel.Locations |
||
3953 | Dim symVessel As LMSymbol = _Placement.PIDDataSource.GetSymbol(objVessel.Representations.Nth(1).Id) |
||
3954 | Dim XCoordinate As String = symVessel.Attributes("XCoordinate").Value |
||
3955 | Dim YCoordinate As String = symVessel.Attributes("YCoordinate").Value |
||
3956 | symVessel.Attributes("XCoordinate").Value = XCoordinate + 0.01 |
||
3957 | symVessel.Attributes("YCoordinate").Value = YCoordinate + 0.01 |
||
3958 | symVessel.Commit() |
||
3959 | Dim sValve_ID As String = "DB7B0CA8A2664A6BA7A9615764BA62B0" |
||
3960 | Dim objValve As LMSymbol |
||
3961 | Dim objValves As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(sValve_ID) |
||
3962 | objValve = _Placement.PIDDataSource.GetSymbol(objValves.Representations.Nth(1).Id) |
||
3963 | objValve.Commit() |
||
3964 | Dim dVesselX As Double = XCoordinate |
||
3965 | Dim dVesselY As Double = YCoordinate |
||
3966 | Dim X1 As Double, Y1 As Double, X2 As Double, Y2 As Double |
||
3967 | |||
3968 | _Placement.PIDConnectPointLocation(objValve, 1, X1, Y1) |
||
3969 | |||
3970 | _Placement.PIDConnectPointLocation(objValve, 2, X2, Y2) |
||
3971 | |||
3972 | Dim nozzlename As String = "\Equipment Components\Nozzles\Flanged Nozzle.sym" |
||
3973 | Dim dCalc_x As Double = 0 |
||
3974 | Dim dCalc_y As Double = 0 |
||
3975 | |||
3976 | If dVesselX - X2 > 0 Then |
||
3977 | dCalc_x = dVesselX - (dVesselX - X2) |
||
3978 | Else |
||
3979 | dCalc_x = dVesselX + (X2 - dVesselX) |
||
3980 | End If |
||
3981 | If dVesselY - Y2 > 0 Then |
||
3982 | dCalc_y = dVesselY - (dVesselY - Y2) |
||
3983 | Else |
||
3984 | dCalc_y = dVesselY + (Y2 - dVesselY) |
||
3985 | End If |
||
3986 | |||
3987 | Dim objNozzle As LMSymbol = _Placement.PIDPlaceSymbol(nozzlename, dCalc_x, dCalc_y, |
||
3988 | TargetItem:=symVessel.AsLMRepresentation) |
||
3989 | |||
3990 | Dim blnSuccess As Boolean = _Placement.PIDConnectPointLocation(objNozzle, 1, X1, Y1) |
||
3991 | blnSuccess = _Placement.PIDConnectPointLocation(objNozzle, 2, X1, Y1) |
||
3992 | |||
3993 | objValve = _Placement.PIDPlaceSymbol(objValve.FileName, X1, Y1, ExistingItem:=objValve.AsLMAItem, |
||
3994 | TargetItem:=objNozzle.AsLMRepresentation) |
||
3995 | |||
3996 | |||
3997 | |||
3998 | End Sub |
||
3999 | 39d43554 | Gyusu | |
4000 | Private Sub Btn_SymbolLibrary_Click(sender As Object, e As EventArgs) Handles Btn_SymbolLibrary.Click |
||
4001 | Dim oMapping As New Mapping(_PIDSymbol_DB) |
||
4002 | oMapping.Show() |
||
4003 | End Sub |
||
4004 | 41e4023e | Gyusu | |
4005 | Private Sub Btn_Stop_Click(sender As Object, e As EventArgs) Handles Btn_Stop.Click |
||
4006 | Try |
||
4007 | SetListBoxItems(ListBox_Result, " Auto converting 중지....") |
||
4008 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 중지....") |
4009 | 41e4023e | Gyusu | _Main_trd.Abort() |
4010 | _Opc_trd.Abort() |
||
4011 | Catch ex As Exception |
||
4012 | |||
4013 | End Try |
||
4014 | End Sub |
||
4015 | b08338e3 | Gyusu | |
4016 | Private Sub AutoCheckTreeNode(ByVal iType As Integer, ByVal bCheck As Boolean) |
||
4017 | |||
4018 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
4019 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
4020 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
4021 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
4022 | If CDrawing IsNot Nothing Then |
||
4023 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
4024 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
4025 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
4026 | Dim iItemcnt As Integer = 0 |
||
4027 | Dim sNodeUid As String = oNode.Name |
||
4028 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
4029 | |||
4030 | If iType = 0 Then 'Symbol |
||
4031 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
4032 | If CLineNo IsNot Nothing Then |
||
4033 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
4034 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
4035 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
4036 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
4037 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
4038 | If sSymbolNodeUid = sSymbolUid Then |
||
4039 | oSymbolNode.Checked = bCheck |
||
4040 | Exit For |
||
4041 | End If |
||
4042 | Next |
||
4043 | Next |
||
4044 | End If |
||
4045 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
4046 | If TrimLineNo IsNot Nothing Then |
||
4047 | Dim oSymbol_Dt As DataTable = TrimLineNo.Dt_Symbol |
||
4048 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
4049 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
4050 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
4051 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
4052 | If sSymbolNodeUid = sSymbolUid Then |
||
4053 | oSymbolNode.Checked = bCheck |
||
4054 | Exit For |
||
4055 | End If |
||
4056 | Next |
||
4057 | Next |
||
4058 | End If |
||
4059 | End If |
||
4060 | If iType = 1 Then 'Line |
||
4061 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
4062 | If CLineNo IsNot Nothing Then |
||
4063 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
4064 | For Each oLineRow In oLine_Dt.Rows |
||
4065 | Dim sLineUid As String = oLineRow(_XML_LINE_UID).ToString() |
||
4066 | For Each oLineNode As TreeNode In oNode.Nodes |
||
4067 | Dim sLineNodeUid As String = oLineNode.Name |
||
4068 | If sLineNodeUid = sLineUid Then |
||
4069 | oLineNode.Checked = bCheck |
||
4070 | Exit For |
||
4071 | End If |
||
4072 | Next |
||
4073 | Next |
||
4074 | End If |
||
4075 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
4076 | If TrimLineNo IsNot Nothing Then |
||
4077 | Dim oLine_Dt As DataTable = TrimLineNo.Dt_Line |
||
4078 | For Each oLineRow In oLine_Dt.Rows |
||
4079 | Dim sLineUid As String = oLineRow(_XML_SYMBOL_UID).ToString() |
||
4080 | For Each oLineNode As TreeNode In oNode.Nodes |
||
4081 | Dim sLineNodeUid As String = oLineNode.Name |
||
4082 | If sLineNodeUid = sLineUid Then |
||
4083 | oLineNode.Checked = bCheck |
||
4084 | Exit For |
||
4085 | End If |
||
4086 | Next |
||
4087 | Next |
||
4088 | End If |
||
4089 | End If |
||
4090 | If iType = 2 Then 'Equipment |
||
4091 | Dim CEqpNo As Eqp_no = GetEqpNo(CDrawing, sNodeUid) |
||
4092 | If CEqpNo IsNot Nothing Then |
||
4093 | Dim oEqp_Dt As DataTable = CEqpNo.Dt_Equipment |
||
4094 | For Each oEqpRow In oEqp_Dt.Rows |
||
4095 | Dim sEqpUid As String = oEqpRow(_XML_LINE_UID).ToString() |
||
4096 | For Each oEqpNode As TreeNode In oNode.Nodes |
||
4097 | Dim sEqpNodeUid As String = oEqpNode.Name |
||
4098 | If sEqpNodeUid = sEqpUid Then |
||
4099 | oEqpNode.Checked = bCheck |
||
4100 | Exit For |
||
4101 | End If |
||
4102 | Next |
||
4103 | Next |
||
4104 | End If |
||
4105 | End If |
||
4106 | Next |
||
4107 | End If |
||
4108 | Next |
||
4109 | Next |
||
4110 | |||
4111 | |||
4112 | End Sub |
||
4113 | |||
4114 | |||
4115 | |||
4116 | Private Sub Chk_Symbol_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Symbol.CheckedChanged |
||
4117 | AutoCheckTreeNode(0, Chk_Symbol.Checked) |
||
4118 | End Sub |
||
4119 | |||
4120 | Private Sub Chk_Line_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Line.CheckedChanged |
||
4121 | AutoCheckTreeNode(1, Chk_Line.Checked) |
||
4122 | End Sub |
||
4123 | |||
4124 | Private Sub Chk_Equipment_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Equipment.CheckedChanged |
||
4125 | AutoCheckTreeNode(2, Chk_Equipment.Checked) |
||
4126 | End Sub |
||
4127 | e282643f | Gyusu | End Class |
4128 | |||
4129 | |||
4130 | Public Class DrawingInfo |
||
4131 | Public mDrawingName As String |
||
4132 | Public mSpID As String |
||
4133 | Public mPath As String |
||
4134 | 94c7557d | gaqhf | End Class |