hytos / DTI_PID / SPPIDConverter / Main.vb @ 76f465d0
이력 | 보기 | 이력해설 | 다운로드 (283 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 | |||
12 | 54b98e09 | Gyusu | 'Dim _Mapping_DB As DataTable = New DataTable() |
13 | Dim _Mapping_DB As DataSet = New DataSet() |
||
14 | 171ac39d | Gyusu | Dim _Attribute_DB As DataTable = New DataTable() |
15 | 39d43554 | Gyusu | Dim _PIDSymbol_DB As DataTable = New DataTable() |
16 | e4000111 | Gyusu | Dim _ResultModeling_DT As DataTable = New DataTable() |
17 | |||
18 | 76f465d0 | Gyusu | Dim _AllLine_DT As New DataTable() |
19 | Dim _AllSymbol_DT As New DataTable() |
||
20 | e4000111 | Gyusu | |
21 | 4f359afa | Gyusu | Dim _Placement As New Placement |
22 | e4000111 | Gyusu | Dim _DWG_X = 0.875 '0.695 '1 ' |
23 | Dim _DWG_Y = 0.617 '0.585 '0.8 ' |
||
24 | c2c36314 | Gyusu | 'Dim _DWG_X = 0.842 '0.695 '1 ' |
25 | 'Dim _DWG_Y = 0.614 '0.585 '0.8 ' |
||
26 | 171ac39d | Gyusu | Dim _IMG_X = 0 |
27 | Dim _IMG_Y = 0 |
||
28 | |||
29 | Dim _Unit As String |
||
30 | 4f359afa | Gyusu | |
31 | 31d47a80 | Gyusu | 'Drawing 전역변수 |
32 | Dim _objPIDADrawing As Object |
||
33 | e282643f | Gyusu | '현재선택한 폴더경로 |
34 | Dim _selectFolderPath As String |
||
35 | |||
36 | Private _Main_trd As Thread |
||
37 | 54b98e09 | Gyusu | Private _Opc_trd As Thread |
38 | |||
39 | Private _CompleteConvert As Boolean = False |
||
40 | e282643f | Gyusu | |
41 | 171ac39d | Gyusu | Private _DrawingsList As List(Of Drawing) |
42 | 272662f9 | Gyusu | |
43 | |||
44 | 9e1e7135 | Gyusu | Private _iPipeLineNocnt As Integer |
45 | Private _iPipecnt As Integer |
||
46 | Private _iFittingcnt As Integer |
||
47 | Private _iValvecnt As Integer |
||
48 | Private _iInstrumentcnt As Integer |
||
49 | Private _iEquipmentcnt As Integer |
||
50 | Private _iNozzlecnt As Integer |
||
51 | e4000111 | Gyusu | Private _iPipintOpccnt As Integer |
52 | 9e1e7135 | Gyusu | |
53 | 41e4023e | Gyusu | Private _allItem As Integer |
54 | Private _Itemcnt As Integer |
||
55 | b08338e3 | Gyusu | |
56 | Dim _Gembox As New CGembox() |
||
57 | 4f359afa | Gyusu | Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
58 | 54b98e09 | Gyusu | LoadDB() |
59 | End Sub |
||
60 | 272662f9 | Gyusu | |
61 | 54b98e09 | Gyusu | Private Sub LoadDB() |
62 | e282643f | Gyusu | If My.Settings.DBPath <> "" And My.Settings.Plant_Hierarchy <> "" Then |
63 | Dim sDBPath As String = My.Settings.DBPath |
||
64 | 54b98e09 | Gyusu | |
65 | _Gembox.isLoadFile(My.Settings.SymbolLibrary) |
||
66 | _Mapping_DB = _Gembox.LoadFileFunc() |
||
67 | 171ac39d | Gyusu | _Attribute_DB = Load_DB(sDBPath, _DB_TABLE_ATTRIBUTE) |
68 | 39d43554 | Gyusu | _PIDSymbol_DB = Load_DB(sDBPath, _DB_TABLE_SYMBOLNAME) |
69 | e4000111 | Gyusu | _ResultModeling_DT = ModelingResult_Dt() |
70 | e282643f | Gyusu | Else |
71 | MessageBox.Show("설정값을 먼저 확인해주세요") |
||
72 | End If |
||
73 | End Sub |
||
74 | 41e4023e | Gyusu | |
75 | 1229ad76 | Gyusu | |
76 | 171ac39d | Gyusu | Private Function GetDataFromMappingDB(ByVal sSymbolName As String, ByVal sColumn As String) As String |
77 | Dim sValue As String = "" |
||
78 | 54b98e09 | Gyusu | For Each oDt As DataTable In _Mapping_DB.Tables |
79 | If oDt.Rows.Count > 0 Then |
||
80 | Dim oSelectRow() As DataRow = oDt.Select("[img_symbolname] = '" + sSymbolName + "'") |
||
81 | If oSelectRow.Length = 1 Then |
||
82 | If sColumn = _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME Then |
||
83 | sValue = oSelectRow(0).Item("SYM FILE NAME").ToString() |
||
84 | ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH Then |
||
85 | sValue = "\" & oSelectRow(0).Item("SYMBOL PATH").ToString() & "\" & oSelectRow(0).Item("SYM FILE NAME").ToString() |
||
86 | ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_COMPTPYE Then |
||
87 | sValue = oSelectRow(0).Item("ITEM TYPE").ToString() |
||
88 | ElseIf sColumn = _DB_COLUMN_MAPPING_SPPID_CLASS Then |
||
89 | sValue = oSelectRow(0).Item("CLASS").ToString() |
||
90 | Else |
||
91 | sValue = oSelectRow(0).Item("SYMBOL PATH").ToString() & "\" & oSelectRow(0).Item("SYM FILE NAME").ToString() |
||
92 | End If |
||
93 | End If |
||
94 | e282643f | Gyusu | End If |
95 | 54b98e09 | Gyusu | Next |
96 | 171ac39d | Gyusu | Return sValue |
97 | 4f359afa | Gyusu | End Function |
98 | |||
99 | 171ac39d | Gyusu | Private Function GetAttributeMapping(ByVal sAttributeName As String, ByVal sColumn As String) As String |
100 | Dim sSPPIDAttribute As String = "" |
||
101 | If _Attribute_DB.Rows.Count > 0 Then |
||
102 | Dim oSelectRow() As DataRow = _Attribute_DB.Select("[pid_attribute] = '" + sAttributeName + "'") |
||
103 | If oSelectRow.Length = 1 Then |
||
104 | sSPPIDAttribute = oSelectRow(0).Item(sColumn).ToString() |
||
105 | End If |
||
106 | End If |
||
107 | Return sSPPIDAttribute |
||
108 | End Function |
||
109 | e282643f | Gyusu | |
110 | 6a6d8ab4 | Gyusu | |
111 | |||
112 | 171ac39d | Gyusu | Private Function LoadSymbolInXml(ByVal sXmlPath As String) As Drawing |
113 | 54b98e09 | Gyusu | Try |
114 | '' _TempSymbolDt = Symbol_Dt() |
||
115 | Dim CDrawing As Drawing = New Drawing() |
||
116 | Dim oDt As DataTable = LoadSymbol_DT() |
||
117 | Dim oElement As XElement = XElement.Load(sXmlPath) |
||
118 | 6a6d8ab4 | Gyusu | |
119 | 54b98e09 | Gyusu | If oElement IsNot Nothing Then |
120 | CDrawing.DwgName = oElement.Element(_XML_DWGNAME).Value |
||
121 | CDrawing.Size = oElement.Element(_XML_DWGSIZE).Value |
||
122 | SplitLocation(CDrawing.Size, _IMG_X, _IMG_Y) |
||
123 | CDrawing.Unit = oElement.Element(_XML_UNIT).Value |
||
124 | 171ac39d | Gyusu | |
125 | 54b98e09 | Gyusu | Dim oLineno_list As New List(Of Line_no) |
126 | Dim oEqp_list As New List(Of Eqp_no) |
||
127 | 3acffcee | Gyusu | Dim oTrim_Lineno_list As New List(Of Line_no) |
128 | oLineno_list = LoadLineNo(oElement, _XML_CATEGORY_LINENO) |
||
129 | 54b98e09 | Gyusu | For Each oEqpNo As Object In oElement.Elements(_XML_CATEGORY_EQUIPMENT) |
130 | Dim CEqp_no As Eqp_no = New Eqp_no() |
||
131 | Dim oSymbol_Dt As DataTable = Symbol_Dt() |
||
132 | Dim oAttribute_Dt As DataTable = Attribute_Dt() |
||
133 | b08338e3 | Gyusu | Dim sUid As String = "" |
134 | 54b98e09 | Gyusu | For Each oSymbol As Object In oEqpNo.Elements(_XML_CATEGORY_SYMBOL) |
135 | Try |
||
136 | b08338e3 | Gyusu | Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
137 | 54b98e09 | Gyusu | Dim oEleObj As XElement |
138 | Dim sName As String |
||
139 | Dim sLocation As String |
||
140 | Dim sSize As String |
||
141 | Dim sAngle As String |
||
142 | b08338e3 | Gyusu | Dim sOriginalPoint As String = "" |
143 | e4000111 | Gyusu | Dim sConnectionPoint As String = "" |
144 | b08338e3 | Gyusu | Dim sConnectionUids As String = "" |
145 | Dim sConnArray As String() |
||
146 | Dim sConnPointArray As String() |
||
147 | |||
148 | 54b98e09 | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
149 | sUid = oEleObj.Value |
||
150 | oEleObj = oSymbol.Element(_XML_SYMBOL_NAME) |
||
151 | sName = oEleObj.Value |
||
152 | oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
||
153 | sLocation = oEleObj.Value |
||
154 | oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
||
155 | sSize = oEleObj.Value |
||
156 | oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
||
157 | sAngle = oEleObj.Value |
||
158 | e4000111 | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_CONNECTIONPOINT) |
159 | sConnectionPoint = oEleObj.Value |
||
160 | b08338e3 | Gyusu | sConnPointArray = sConnectionPoint.Split("/") |
161 | |||
162 | f9b63682 | Gyusu | If sConnPointArray.Length > 4 Then |
163 | MessageBox.Show(sConnPointArray.Length) |
||
164 | End If |
||
165 | For i = 0 To sConnPointArray.Length - 1 |
||
166 | If i = 0 Then |
||
167 | oAddrow(_XML_SYMBOL_Conn1_Point) = sConnPointArray(i) |
||
168 | ElseIf i = 1 Then |
||
169 | oAddrow(_XML_SYMBOL_Conn2_Point) = sConnPointArray(i) |
||
170 | ElseIf i = 2 Then |
||
171 | oAddrow(_XML_SYMBOL_Conn3_Point) = sConnPointArray(i) |
||
172 | ElseIf i = 3 Then |
||
173 | oAddrow(_XML_SYMBOL_Conn4_Point) = sConnPointArray(i) |
||
174 | End If |
||
175 | Next |
||
176 | b08338e3 | Gyusu | |
177 | oEleObj = oSymbol.Element(_XML_SYMBOL_CONNS) |
||
178 | sConnectionUids = oEleObj.Value |
||
179 | sConnArray = sConnectionUids.Split(",") |
||
180 | 54b98e09 | Gyusu | Try |
181 | oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
||
182 | sOriginalPoint = oEleObj.Value |
||
183 | Catch ex As Exception |
||
184 | End Try |
||
185 | b08338e3 | Gyusu | |
186 | |||
187 | |||
188 | 54b98e09 | Gyusu | oAddrow(_XML_SYMBOL_UID) = sUid |
189 | b08338e3 | Gyusu | oAddrow(_XML_SYMBOL_LINENOUID) = sUid |
190 | 54b98e09 | Gyusu | oAddrow(_XML_SYMBOL_NAME) = sName |
191 | oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
||
192 | oAddrow(_XML_SYMBOL_SIZE) = sSize |
||
193 | oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
||
194 | oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
195 | oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
||
196 | oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
||
197 | e4000111 | Gyusu | oAddrow(_XML_SYMBOL_CONNECTIONPOINT) = sConnectionPoint |
198 | f9b63682 | Gyusu | |
199 | b08338e3 | Gyusu | If sConnArray.Length > 4 Then |
200 | MessageBox.Show(sConnArray.Length) |
||
201 | End If |
||
202 | For i = 0 To sConnArray.Length - 1 |
||
203 | If i = 0 Then |
||
204 | oAddrow(_XML_SYMBOL_Conn1_Uid) = sConnArray(i) |
||
205 | ElseIf i = 1 Then |
||
206 | oAddrow(_XML_SYMBOL_Conn2_Uid) = sConnArray(i) |
||
207 | ElseIf i = 2 Then |
||
208 | oAddrow(_XML_SYMBOL_Conn3_Uid) = sConnArray(i) |
||
209 | ElseIf i = 3 Then |
||
210 | oAddrow(_XML_SYMBOL_Conn4_Uid) = sConnArray(i) |
||
211 | End If |
||
212 | Next |
||
213 | |||
214 | e4000111 | Gyusu | oAddrow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
215 | 54b98e09 | Gyusu | oSymbol_Dt.Rows.Add(oAddrow) |
216 | Catch ex As Exception |
||
217 | |||
218 | End Try |
||
219 | d039e347 | Gyusu | Next |
220 | 54b98e09 | Gyusu | For Each oAtrribute As Object In oEqpNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
221 | Try |
||
222 | Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
||
223 | Dim oEleObj As XElement |
||
224 | 41e4023e | Gyusu | Dim sAttUid As String |
225 | 54b98e09 | Gyusu | Dim sName As String |
226 | Dim sValue As String |
||
227 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
||
228 | 41e4023e | Gyusu | sAttUid = oEleObj.Value |
229 | 54b98e09 | Gyusu | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
230 | sName = oEleObj.Value |
||
231 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
||
232 | sValue = oEleObj.Value |
||
233 | 41e4023e | Gyusu | oAddrow(_XML_ATTRIBUTE_UID) = sAttUid |
234 | 54b98e09 | Gyusu | oAddrow(_XML_ATTRIBUTE_NAME) = sName |
235 | oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
||
236 | oAttribute_Dt.Rows.Add(oAddrow) |
||
237 | Catch ex As Exception |
||
238 | End Try |
||
239 | Next |
||
240 | 41e4023e | Gyusu | CEqp_no.Uid = sUid |
241 | 54b98e09 | Gyusu | CEqp_no.Dt_Equipment = oSymbol_Dt |
242 | CEqp_no.Dt_Attribute = oAttribute_Dt |
||
243 | oEqp_list.Add(CEqp_no) |
||
244 | 4f359afa | Gyusu | Next |
245 | 3acffcee | Gyusu | oTrim_Lineno_list = LoadLineNo(oElement, _XML_CATEGORY_TRIM_LINENO) |
246 | 54b98e09 | Gyusu | CDrawing.Line_nos = oLineno_list |
247 | CDrawing.Eqp_nos = oEqp_list |
||
248 | 3acffcee | Gyusu | CDrawing.TrimLine_nos = oTrim_Lineno_list |
249 | |||
250 | 54b98e09 | Gyusu | End If |
251 | Return CDrawing |
||
252 | Catch ex As Exception |
||
253 | Return Nothing |
||
254 | End Try |
||
255 | |||
256 | 4f359afa | Gyusu | End Function |
257 | |||
258 | 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 |
259 | |||
260 | Dim sReturnUid As String = "" |
||
261 | Try |
||
262 | Dim oFindLineRow As DataRow() = oLine_Dt.Select( |
||
263 | "[" & _XML_LINE_DWG_STARTPOINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
264 | "[" & _XML_LINE_DWG_STARTPOINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
265 | "[" & _XML_LINE_DWG_STARTPOINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
266 | "[" & _XML_LINE_DWG_STARTPOINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
267 | "[" & _XML_LINE_UID & "] <> '" & sUid & "' And " & |
||
268 | "[" & _XML_LINE_Conn1_Uid & "] = ''") |
||
269 | If oFindLineRow.Length = 0 Then |
||
270 | oFindLineRow = oLine_Dt.Select( |
||
271 | "[" & _XML_LINE_DWG_ENDPOINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
272 | "[" & _XML_LINE_DWG_ENDPOINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
273 | "[" & _XML_LINE_DWG_ENDPOINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
274 | "[" & _XML_LINE_DWG_ENDPOINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
275 | "[" & _XML_LINE_UID & "] <> '" & sUid & "' And " & |
||
276 | "[" & _XML_LINE_Conn2_Uid & "] = ''") |
||
277 | If oFindLineRow.Length = 0 Then |
||
278 | oFindLineRow = oSymbol_Dt.Select( |
||
279 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
280 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
281 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
282 | "[" & _XML_SYMBOL_DWG_CONN1_POINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
283 | "[" & _XML_SYMBOL_UID & "] <> '" & sUid & "' And " & |
||
284 | "[" & _XML_SYMBOL_Conn1_Uid & "] = ''") |
||
285 | If oFindLineRow.Length = 0 Then |
||
286 | oFindLineRow = oSymbol_Dt.Select( |
||
287 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_X & "] >= '" & dPos_x - 0.001 & "' And " & |
||
288 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_X & "] <= '" & dPos_x + 0.001 & "' And " & |
||
289 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_Y & "] >= '" & dPos_y - 0.001 & "' And " & |
||
290 | "[" & _XML_SYMBOL_DWG_CONN2_POINT_Y & "] <= '" & dPos_y + 0.001 & "' And " & |
||
291 | "[" & _XML_SYMBOL_UID & "] <> '" & sUid & "' And " & |
||
292 | "[" & _XML_SYMBOL_Conn2_Uid & "] = ''") |
||
293 | If oFindLineRow.Length = 0 Then |
||
294 | Else |
||
295 | oFindLineRow(0)(_XML_SYMBOL_Conn2_Uid) = sUid |
||
296 | sReturnUid = oFindLineRow(0)(_XML_SYMBOL_UID).ToString() |
||
297 | End If |
||
298 | Else |
||
299 | oFindLineRow(0)(_XML_SYMBOL_Conn1_Uid) = sUid |
||
300 | sReturnUid = oFindLineRow(0)(_XML_SYMBOL_UID).ToString() |
||
301 | End If |
||
302 | Else |
||
303 | oFindLineRow(0)(_XML_LINE_Conn2_Uid) = sUid |
||
304 | sReturnUid = oFindLineRow(0)(_XML_LINE_UID).ToString() |
||
305 | End If |
||
306 | Else |
||
307 | oFindLineRow(0)(_XML_LINE_Conn1_Uid) = sUid |
||
308 | sReturnUid = oFindLineRow(0)(_XML_LINE_UID).ToString() |
||
309 | End If |
||
310 | Catch ex As Exception |
||
311 | |||
312 | End Try |
||
313 | |||
314 | Return sReturnUid |
||
315 | End Function |
||
316 | |||
317 | |||
318 | Private Function SetConnectionInfo(ByRef oLine_Dt As DataTable, ByRef oSymbol_Dt As DataTable) |
||
319 | Try |
||
320 | For Each oLineInfo In oLine_Dt.Rows |
||
321 | Dim sLineUid As String = oLineInfo(_XML_LINE_UID).ToString() |
||
322 | Dim dStartPos_x As Double = oLineInfo(_XML_LINE_DWG_STARTPOINT_X) |
||
323 | Dim dStartPos_y As Double = oLineInfo(_XML_LINE_DWG_STARTPOINT_Y) |
||
324 | Dim dEndPos_x As Double = oLineInfo(_XML_LINE_DWG_ENDPOINT_X) |
||
325 | Dim dEndPos_y As Double = oLineInfo(_XML_LINE_DWG_ENDPOINT_Y) |
||
326 | Dim sConn1Uid As String = "" |
||
327 | Dim sConn2Uid As String = "" |
||
328 | sConn1Uid = FindConnection(oLine_Dt, oSymbol_Dt, sLineUid, dStartPos_x, dStartPos_y) |
||
329 | If sConn1Uid <> "" Then |
||
330 | oLineInfo(_XML_LINE_Conn1_Uid) = sConn1Uid |
||
331 | End If |
||
332 | sConn2Uid = FindConnection(oLine_Dt, oSymbol_Dt, sLineUid, dEndPos_x, dEndPos_y) |
||
333 | If sConn2Uid <> "" Then |
||
334 | oLineInfo(_XML_LINE_Conn2_Uid) = sConn2Uid |
||
335 | End If |
||
336 | Next |
||
337 | For Each oSymbolInfo In oSymbol_Dt.Rows |
||
338 | Dim sSymbolUid As String = oSymbolInfo(_XML_SYMBOL_UID).ToString() |
||
339 | Dim dConn1Pos_x As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN1_POINT_X) |
||
340 | Dim dConn1Pos_y As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN1_POINT_Y) |
||
341 | |||
342 | Dim sConn1Uid As String = "" |
||
343 | Dim sConn2Uid As String = "" |
||
344 | |||
345 | sConn1Uid = FindConnection(oLine_Dt, oSymbol_Dt, sSymbolUid, dConn1Pos_x, dConn1Pos_y) |
||
346 | If sConn1Uid <> "" Then |
||
347 | oSymbolInfo(_XML_SYMBOL_Conn1_Uid) = sConn1Uid |
||
348 | End If |
||
349 | Try |
||
350 | Dim dConn2Pos_x As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN2_POINT_X) |
||
351 | Dim dConn2Pos_y As Double = oSymbolInfo(_XML_SYMBOL_DWG_CONN2_POINT_Y) |
||
352 | sConn2Uid = FindConnection(oLine_Dt, oSymbol_Dt, sSymbolUid, dConn2Pos_x, dConn2Pos_y) |
||
353 | If sConn2Uid <> "" Then |
||
354 | oSymbolInfo(_XML_SYMBOL_Conn2_Uid) = sConn2Uid |
||
355 | End If |
||
356 | Catch ex As Exception |
||
357 | End Try |
||
358 | Next |
||
359 | Catch ex As Exception |
||
360 | End Try |
||
361 | End Function |
||
362 | |||
363 | 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) |
||
364 | Dim sFlowdirection As String = "" |
||
365 | If Math.Abs(dStart_x - dEnd_x) > Math.Abs(dStart_y - dEnd_y) Then |
||
366 | If dStart_x > dEnd_x Then |
||
367 | sDirection = "X" |
||
368 | sFlowdirection = "Left_x" |
||
369 | If Math.Abs(dStart_y - dEnd_y) < 5 Then |
||
370 | dEnd_y = dStart_y |
||
371 | End If |
||
372 | Else |
||
373 | sDirection = "X" |
||
374 | sFlowdirection = "Right_x" |
||
375 | If Math.Abs(dStart_y - dEnd_y) < 5 Then |
||
376 | dEnd_y = dStart_y |
||
377 | End If |
||
378 | End If |
||
379 | Else |
||
380 | If dStart_y > dEnd_y Then |
||
381 | sDirection = "Y" |
||
382 | sFlowdirection = "Down_y" |
||
383 | If Math.Abs(dStart_x - dEnd_x) < 5 Then |
||
384 | dEnd_x = dStart_x |
||
385 | End If |
||
386 | |||
387 | Else |
||
388 | sDirection = "Y" |
||
389 | sFlowdirection = "Up_y" |
||
390 | If Math.Abs(dStart_x - dEnd_x) < 5 Then |
||
391 | dEnd_x = dStart_x |
||
392 | End If |
||
393 | End If |
||
394 | End If |
||
395 | Return sFlowdirection |
||
396 | End Function |
||
397 | 4f359afa | Gyusu | |
398 | 3acffcee | Gyusu | Private Function LoadLineNo(ByVal oElement As XElement, ByVal sLineType As String) As List(Of Line_no) |
399 | |||
400 | Dim oLineno_list As New List(Of Line_no) |
||
401 | |||
402 | For Each oLineNo As Object In oElement.Elements(sLineType) |
||
403 | |||
404 | Dim CLineNo As Line_no = New Line_no() |
||
405 | Try |
||
406 | CLineNo.Uid = oLineNo.Element(_XML_LINENO_UID).Value |
||
407 | CLineNo.Text = oLineNo.Element(_XML_LINENO_TEXT).Value |
||
408 | CLineNo.Location = oLineNo.Element(_XML_LINENO_LOCATION).Value |
||
409 | CLineNo.Angle = oLineNo.Element(_XML_LINENO_ANGLE).Value |
||
410 | CLineNo.SystemPath = "\Piping\Labels - Piping Segments\Kemya Line Number.sym" 'GetDataFromMappingDB(_XML_CATEGORY_LINENO, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
411 | Catch ex As Exception |
||
412 | End Try |
||
413 | Dim oLine_Dt As DataTable = Line_Dt() |
||
414 | Dim oSymbol_Dt As DataTable = Symbol_Dt() |
||
415 | Dim oAttribute_Dt As DataTable = Attribute_Dt() |
||
416 | 76f465d0 | Gyusu | Dim iRunCnt As Integer = 0 |
417 | 3acffcee | Gyusu | For Each oRun As Object In oLineNo.Elements(_XML_CATEGORY_RUN) |
418 | 76f465d0 | Gyusu | iRunCnt = iRunCnt + 1 |
419 | Dim sRunName As String = CLineNo.Text & "_" & iRunCnt |
||
420 | For Each oMERGEDLine As Object In oRun.Elements(_XML_CATEGORY_MERGEDLINE) |
||
421 | For Each oLine As Object In oMERGEDLine.Elements(_XML_CATEGORY_LINE) |
||
422 | Try |
||
423 | Dim oAddrow As DataRow = oLine_Dt.NewRow() |
||
424 | Dim oEleObj As XElement |
||
425 | Dim sUid As String |
||
426 | Dim sStartpoint As String |
||
427 | Dim sEndpoint As String |
||
428 | Dim sType As String |
||
429 | Dim sConnectionUids As String = "" |
||
430 | Dim dStartPos_x As Double = 0.0 |
||
431 | Dim dStartPos_y As Double = 0.0 |
||
432 | Dim dEndPos_x As Double = 0.0 |
||
433 | Dim dEndPos_y As Double = 0.0 |
||
434 | Dim dDWG_StartPos_x As Double = 0.0 |
||
435 | Dim dDWG_StartPos_y As Double = 0.0 |
||
436 | Dim dDWG_EndPos_x As Double = 0.0 |
||
437 | Dim dDWG_EndPos_y As Double = 0.0 |
||
438 | oEleObj = oLine.Element(_XML_LINE_UID) |
||
439 | sUid = oEleObj.Value |
||
440 | b08338e3 | Gyusu | |
441 | 76f465d0 | Gyusu | If oLine_Dt.Select(_XML_LINE_UID & "='" & sUid & "'").Length = 0 Then |
442 | oEleObj = oLine.Element(_XML_LINE_STARTPOINT) |
||
443 | sStartpoint = oEleObj.Value |
||
444 | oEleObj = oLine.Element(_XML_LINE_ENDPOINT) |
||
445 | sEndpoint = oEleObj.Value |
||
446 | oEleObj = oLine.Element(_XML_LINE_TYPE) |
||
447 | sType = oEleObj.Value |
||
448 | 'oEleObj = oLine.Element(_XML_LINE_CONNS) |
||
449 | 'sConnectionUids = oEleObj.Value |
||
450 | 'sConnArray = sConnectionUids.Split(",") |
||
451 | 'For i = 0 To sConnArray.Length - 1 |
||
452 | ' If i = 0 Then |
||
453 | ' oAddrow(_XML_LINE_Conn1_Uid) = sConnArray(i) |
||
454 | ' ElseIf i = 1 Then |
||
455 | ' oAddrow(_XML_LINE_Conn2_Uid) = sConnArray(i) |
||
456 | ' End If |
||
457 | 'Next |
||
458 | 'If sConnArray.Length > 2 Then |
||
459 | ' MessageBox.Show(sConnArray.Length) |
||
460 | 'End If |
||
461 | oAddrow(_XML_LINE_Conn1_Uid) = "" |
||
462 | oAddrow(_XML_LINE_Conn2_Uid) = "" |
||
463 | oAddrow(_XML_LINE_UID) = sUid |
||
464 | oAddrow(_XML_LINE_RUNNAME) = sRunName |
||
465 | oAddrow(_XML_LINE_LINENOUID) = CLineNo.Uid |
||
466 | oAddrow(_XML_LINENO_TEXT) = CLineNo.Text |
||
467 | oAddrow(_XML_LINE_STARTPOINT) = sStartpoint |
||
468 | oAddrow(_XML_LINE_ENDPOINT) = sEndpoint |
||
469 | |||
470 | ConvertPointBystring(sStartpoint, dStartPos_x, dStartPos_y) |
||
471 | ConvertPointBystring(sEndpoint, dEndPos_x, dEndPos_y) |
||
472 | Dim sDirection As String = "" |
||
473 | oAddrow(_XML_LINE_FlowDirection) = GetFlowDirection(dStartPos_x, dStartPos_y, dEndPos_x, dEndPos_y, sDirection) |
||
474 | oAddrow(_XML_LINE_Direction) = sDirection |
||
475 | |||
476 | dDWG_StartPos_x = dStartPos_x |
||
477 | dDWG_StartPos_y = dStartPos_y |
||
478 | ConvertPointByImage(dDWG_StartPos_x, dDWG_StartPos_y, _IMG_X, _IMG_Y) |
||
479 | dDWG_EndPos_x = dEndPos_x |
||
480 | dDWG_EndPos_y = dEndPos_y |
||
481 | ConvertPointByImage(dDWG_EndPos_x, dDWG_EndPos_y, _IMG_X, _IMG_Y) |
||
482 | |||
483 | oAddrow(_XML_LINE_STARTPOINT_X) = dStartPos_x |
||
484 | oAddrow(_XML_LINE_STARTPOINT_Y) = dStartPos_y |
||
485 | oAddrow(_XML_LINE_ENDPOINT_X) = dEndPos_x |
||
486 | oAddrow(_XML_LINE_ENDPOINT_Y) = dEndPos_y |
||
487 | |||
488 | oAddrow(_XML_LINE_DWG_STARTPOINT_X) = dDWG_StartPos_x |
||
489 | oAddrow(_XML_LINE_DWG_STARTPOINT_Y) = dDWG_StartPos_y |
||
490 | oAddrow(_XML_LINE_DWG_ENDPOINT_X) = dDWG_EndPos_x |
||
491 | oAddrow(_XML_LINE_DWG_ENDPOINT_Y) = dDWG_EndPos_y |
||
492 | |||
493 | oAddrow(_XML_LINE_SYSTEMPATH) = GetDataFromMappingDB(_XML_CATEGORY_LINE, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
494 | If oAddrow(_XML_LINE_SYSTEMPATH) = "" Then |
||
495 | MessageBox.Show("") |
||
496 | b08338e3 | Gyusu | End If |
497 | 76f465d0 | Gyusu | oAddrow(_XML_LINE_DRAWING_TF) = "FALSE" |
498 | oAddrow(_XML_LINE_TYPE) = sType |
||
499 | ' _AllLine_DT.Rows.Add(oAddrow) |
||
500 | oLine_Dt.Rows.Add(oAddrow) |
||
501 | Else |
||
502 | b08338e3 | Gyusu | End If |
503 | 76f465d0 | Gyusu | Catch ex As Exception |
504 | End Try |
||
505 | Next |
||
506 | 3acffcee | Gyusu | Next |
507 | |||
508 | For Each oSymbol As Object In oRun.Elements(_XML_CATEGORY_SYMBOL) |
||
509 | Try |
||
510 | 76f465d0 | Gyusu | |
511 | 3acffcee | Gyusu | Dim oAddrow As DataRow = oSymbol_Dt.NewRow() |
512 | Dim oEleObj As XElement |
||
513 | Dim sUid As String |
||
514 | Dim sName As String |
||
515 | Dim sLocation As String |
||
516 | Dim sSize As String |
||
517 | Dim sAngle As String |
||
518 | Dim sOriginalPoint As String = "" |
||
519 | bb2a0c79 | Gyusu | Dim sConnectionPoint As String = "" |
520 | b08338e3 | Gyusu | Dim sConnectionUids As String = "" |
521 | Dim sConnArray As String() |
||
522 | |||
523 | 76f465d0 | Gyusu | Dim dCenterPos_x As Double = 0.0 |
524 | Dim dCenterPos_y As Double = 0.0 |
||
525 | Dim dDwgCenterPos_x As Double = 0.0 |
||
526 | Dim dDwgCenterPos_y As Double = 0.0 |
||
527 | |||
528 | |||
529 | Dim dConn1Pos_x As Double = 0.0 |
||
530 | Dim dConn1Pos_y As Double = 0.0 |
||
531 | Dim dConn2Pos_x As Double = 0.0 |
||
532 | Dim dConn2Pos_y As Double = 0.0 |
||
533 | Dim dConn3Pos_x As Double = 0.0 |
||
534 | Dim dConn3Pos_y As Double = 0.0 |
||
535 | Dim dConn4Pos_x As Double = 0.0 |
||
536 | Dim dConn4Pos_y As Double = 0.0 |
||
537 | |||
538 | Dim dDwg_Conn1Pos_x As Double = 0.0 |
||
539 | Dim dDwg_Conn1Pos_y As Double = 0.0 |
||
540 | Dim dDwg_Conn2Pos_x As Double = 0.0 |
||
541 | Dim dDwg_Conn2Pos_y As Double = 0.0 |
||
542 | Dim dDwg_Conn3Pos_x As Double = 0.0 |
||
543 | Dim dDwg_Conn3Pos_y As Double = 0.0 |
||
544 | Dim dDwg_Conn4Pos_x As Double = 0.0 |
||
545 | Dim dDwg_Conn4Pos_y As Double = 0.0 |
||
546 | |||
547 | 3acffcee | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_UID) |
548 | sUid = oEleObj.Value |
||
549 | oEleObj = oSymbol.Element(_XML_SYMBOL_PARENT) |
||
550 | sName = oEleObj.Value |
||
551 | oEleObj = oSymbol.Element(_XML_SYMBOL_LOCATION) |
||
552 | sLocation = oEleObj.Value |
||
553 | oEleObj = oSymbol.Element(_XML_SYMBOL_SIZE) |
||
554 | sSize = oEleObj.Value |
||
555 | oEleObj = oSymbol.Element(_XML_SYMBOL_ANGLE) |
||
556 | sAngle = oEleObj.Value |
||
557 | bb2a0c79 | Gyusu | oEleObj = oSymbol.Element(_XML_SYMBOL_CONNECTIONPOINT) |
558 | sConnectionPoint = oEleObj.Value |
||
559 | 3acffcee | Gyusu | Try |
560 | oEleObj = oSymbol.Element(_XML_SYMBOL_ORIGINALPOINT) |
||
561 | sOriginalPoint = oEleObj.Value |
||
562 | Catch ex As Exception |
||
563 | |||
564 | End Try |
||
565 | 76f465d0 | Gyusu | 'oEleObj = oSymbol.Element(_XML_LINE_CONNS) |
566 | 'sConnectionUids = oEleObj.Value |
||
567 | 'sConnArray = sConnectionUids.Split(",") |
||
568 | 'If sConnArray.Length > 4 Then |
||
569 | ' MessageBox.Show(sConnArray.Length) |
||
570 | 'End If |
||
571 | 'For i = 0 To sConnArray.Length - 1 |
||
572 | ' If i = 0 Then |
||
573 | ' oAddrow(_XML_SYMBOL_Conn1_Uid) = sConnArray(i) |
||
574 | ' ElseIf i = 1 Then |
||
575 | ' oAddrow(_XML_SYMBOL_Conn2_Uid) = sConnArray(i) |
||
576 | ' ElseIf i = 2 Then |
||
577 | ' oAddrow(_XML_SYMBOL_Conn3_Uid) = sConnArray(i) |
||
578 | ' ElseIf i = 3 Then |
||
579 | ' oAddrow(_XML_SYMBOL_Conn4_Uid) = sConnArray(i) |
||
580 | ' End If |
||
581 | 'Next |
||
582 | oAddrow(_XML_SYMBOL_Conn1_Uid) = "" |
||
583 | oAddrow(_XML_SYMBOL_Conn2_Uid) = "" |
||
584 | oAddrow(_XML_SYMBOL_Conn3_Uid) = "" |
||
585 | oAddrow(_XML_SYMBOL_Conn4_Uid) = "" |
||
586 | ConvertPointBystring(sOriginalPoint, dCenterPos_x, dCenterPos_y) |
||
587 | dDwgCenterPos_x = dCenterPos_x |
||
588 | dDwgCenterPos_y = dCenterPos_y |
||
589 | ConvertPointByImage(dDwgCenterPos_x, dDwgCenterPos_y, _IMG_X, _IMG_Y) |
||
590 | |||
591 | oAddrow(_XML_SYMBOL_CENTERPOINT_X) = dCenterPos_x |
||
592 | oAddrow(_XML_SYMBOL_CENTERPOINT_Y) = dCenterPos_y |
||
593 | oAddrow(_XML_SYMBOL_DWG_CENTERPOINT_X) = dDwgCenterPos_x |
||
594 | oAddrow(_XML_SYMBOL_DWG_CENTERPOINT_Y) = dDwgCenterPos_y |
||
595 | sConnArray = sConnectionPoint.Split("/") |
||
596 | b08338e3 | Gyusu | If sConnArray.Length > 4 Then |
597 | MessageBox.Show(sConnArray.Length) |
||
598 | End If |
||
599 | For i = 0 To sConnArray.Length - 1 |
||
600 | If i = 0 Then |
||
601 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn1_Point) = sConnArray(i) |
602 | ConvertPointBystring(sConnArray(i), dConn1Pos_x, dConn1Pos_y) |
||
603 | dDwg_Conn1Pos_x = dConn1Pos_x |
||
604 | dDwg_Conn1Pos_y = dConn1Pos_y |
||
605 | ConvertPointByImage(dDwg_Conn1Pos_x, dDwg_Conn1Pos_y, _IMG_X, _IMG_Y) |
||
606 | |||
607 | oAddrow(_XML_SYMBOL_CONN1_POINT_X) = dConn1Pos_x |
||
608 | oAddrow(_XML_SYMBOL_CONN1_POINT_Y) = dConn1Pos_y |
||
609 | oAddrow(_XML_SYMBOL_DWG_CONN1_POINT_X) = dDwg_Conn1Pos_x |
||
610 | oAddrow(_XML_SYMBOL_DWG_CONN1_POINT_Y) = dDwg_Conn1Pos_y |
||
611 | b08338e3 | Gyusu | ElseIf i = 1 Then |
612 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn2_Point) = sConnArray(i) |
613 | ConvertPointBystring(sConnArray(i), dConn2Pos_x, dConn2Pos_y) |
||
614 | dDwg_Conn2Pos_x = dConn2Pos_x |
||
615 | dDwg_Conn2Pos_y = dConn2Pos_y |
||
616 | ConvertPointByImage(dDwg_Conn2Pos_x, dDwg_Conn2Pos_y, _IMG_X, _IMG_Y) |
||
617 | oAddrow(_XML_SYMBOL_CONN2_POINT_X) = dConn2Pos_x |
||
618 | oAddrow(_XML_SYMBOL_CONN2_POINT_Y) = dConn2Pos_y |
||
619 | oAddrow(_XML_SYMBOL_DWG_CONN2_POINT_X) = dDwg_Conn2Pos_x |
||
620 | oAddrow(_XML_SYMBOL_DWG_CONN2_POINT_Y) = dDwg_Conn2Pos_y |
||
621 | b08338e3 | Gyusu | ElseIf i = 2 Then |
622 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn3_Point) = sConnArray(i) |
623 | ConvertPointBystring(sConnArray(i), dConn3Pos_x, dConn3Pos_y) |
||
624 | dDwg_Conn3Pos_x = dConn3Pos_x |
||
625 | dDwg_Conn3Pos_y = dConn3Pos_y |
||
626 | ConvertPointByImage(dDwg_Conn3Pos_x, dDwg_Conn3Pos_y, _IMG_X, _IMG_Y) |
||
627 | oAddrow(_XML_SYMBOL_CONN3_POINT_X) = dConn3Pos_x |
||
628 | oAddrow(_XML_SYMBOL_CONN3_POINT_Y) = dConn3Pos_y |
||
629 | oAddrow(_XML_SYMBOL_DWG_CONN3_POINT_X) = dDwg_Conn3Pos_x |
||
630 | oAddrow(_XML_SYMBOL_DWG_CONN3_POINT_Y) = dDwg_Conn3Pos_y |
||
631 | b08338e3 | Gyusu | ElseIf i = 3 Then |
632 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_Conn4_Point) = sConnArray(i) |
633 | ConvertPointBystring(sConnArray(i), dConn4Pos_x, dConn4Pos_y) |
||
634 | dDwg_Conn4Pos_x = dConn4Pos_x |
||
635 | dDwg_Conn4Pos_y = dConn4Pos_y |
||
636 | ConvertPointByImage(dDwg_Conn4Pos_x, dDwg_Conn4Pos_y, _IMG_X, _IMG_Y) |
||
637 | oAddrow(_XML_SYMBOL_CONN4_POINT_X) = dConn4Pos_x |
||
638 | oAddrow(_XML_SYMBOL_CONN4_POINT_Y) = dConn4Pos_y |
||
639 | oAddrow(_XML_SYMBOL_DWG_CONN4_POINT_X) = dDwg_Conn4Pos_x |
||
640 | oAddrow(_XML_SYMBOL_DWG_CONN4_POINT_Y) = dDwg_Conn4Pos_y |
||
641 | b08338e3 | Gyusu | End If |
642 | Next |
||
643 | |||
644 | 3acffcee | Gyusu | oAddrow(_XML_SYMBOL_UID) = sUid |
645 | b08338e3 | Gyusu | oAddrow(_XML_LINE_LINENOUID) = CLineNo.Uid |
646 | 76f465d0 | Gyusu | oAddrow(_XML_SYMBOL_RUNNAME) = sRunName |
647 | b08338e3 | Gyusu | oAddrow(_XML_LINENO_TEXT) = CLineNo.Text |
648 | 3acffcee | Gyusu | oAddrow(_XML_SYMBOL_NAME) = IO.Path.GetFileNameWithoutExtension(GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYMBOLNAME)) |
649 | oAddrow(_XML_SYMBOL_LOCATION) = sLocation |
||
650 | oAddrow(_XML_SYMBOL_SIZE) = sSize |
||
651 | oAddrow(_XML_SYMBOL_ANGLE) = sAngle |
||
652 | oAddrow(_XML_SYMBOL_SYSTEMPATH) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_SYSTEMPATH) |
||
653 | oAddrow(_XML_SYMBOL_TYPE) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_COMPTPYE) |
||
654 | oAddrow(_XML_SYMBOL_CLASS) = GetDataFromMappingDB(sName, _DB_COLUMN_MAPPING_SPPID_CLASS) |
||
655 | oAddrow(_XML_SYMBOL_ORIGINALPOINT) = sOriginalPoint |
||
656 | 76f465d0 | Gyusu | |
657 | bb2a0c79 | Gyusu | oAddrow(_XML_SYMBOL_CONNECTIONPOINT) = sConnectionPoint |
658 | e4000111 | Gyusu | oAddrow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
659 | 76f465d0 | Gyusu | ' _AllSymbol_DT.Rows.Add(oAddrow) |
660 | 3acffcee | Gyusu | oSymbol_Dt.Rows.Add(oAddrow) |
661 | Catch ex As Exception |
||
662 | End Try |
||
663 | Next |
||
664 | |||
665 | For Each oAtrribute As Object In oRun.Elements(_XML_CATEGORY_ATTRIBUTE) |
||
666 | Try |
||
667 | Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
||
668 | Dim oEleObj As XElement |
||
669 | Dim sUid As String |
||
670 | Dim sName As String |
||
671 | Dim sValue As String |
||
672 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
||
673 | sUid = oEleObj.Value |
||
674 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
||
675 | sName = oEleObj.Value |
||
676 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
||
677 | sValue = oEleObj.Value |
||
678 | oAddrow(_XML_ATTRIBUTE_UID) = sUid |
||
679 | oAddrow(_XML_ATTRIBUTE_NAME) = sName |
||
680 | oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
||
681 | oAttribute_Dt.Rows.Add(oAddrow) |
||
682 | Catch ex As Exception |
||
683 | End Try |
||
684 | Next |
||
685 | Next |
||
686 | 'Line No Attribute |
||
687 | For Each oAtrribute As Object In oLineNo.Elements(_XML_CATEGORY_ATTRIBUTE) |
||
688 | Try |
||
689 | Dim oAddrow As DataRow = oAttribute_Dt.NewRow() |
||
690 | Dim oEleObj As XElement |
||
691 | Dim sUid As String = "" |
||
692 | Dim sName As String |
||
693 | Dim sValue As String |
||
694 | |||
695 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_UID) |
||
696 | sUid = oEleObj.Value |
||
697 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_NAME) |
||
698 | sName = oEleObj.Value |
||
699 | oEleObj = oAtrribute.Element(_XML_ATTRIBUTE_VALUE) |
||
700 | sValue = oEleObj.Value |
||
701 | oAddrow(_XML_ATTRIBUTE_UID) = sUid |
||
702 | oAddrow(_XML_ATTRIBUTE_NAME) = sName |
||
703 | oAddrow(_XML_ATTRIBUTE_VALUE) = sValue |
||
704 | oAttribute_Dt.Rows.Add(oAddrow) |
||
705 | Catch ex As Exception |
||
706 | End Try |
||
707 | Next |
||
708 | 76f465d0 | Gyusu | |
709 | SetConnectionInfo(oLine_Dt, oSymbol_Dt) |
||
710 | _AllLine_DT.Merge(oLine_Dt) |
||
711 | _AllSymbol_DT.Merge(oSymbol_Dt) |
||
712 | 3acffcee | Gyusu | CLineNo.Dt_Line = oLine_Dt |
713 | CLineNo.Dt_Symbol = oSymbol_Dt |
||
714 | CLineNo.Dt_Attribute = oAttribute_Dt |
||
715 | oLineno_list.Add(CLineNo) |
||
716 | Next |
||
717 | Return oLineno_list |
||
718 | End Function |
||
719 | |||
720 | 4f359afa | Gyusu | |
721 | 9e1e7135 | Gyusu | Private Sub ConvertPointByImage(ByRef dX As Double, ByRef dY As Double, ByVal dDwgX As Double, ByVal dDwgY As Double) |
722 | 4f359afa | Gyusu | |
723 | Dim calcx As Double = 0 |
||
724 | Dim calcy As Double = 0 |
||
725 | calcx = (dX * _DWG_X) / dDwgX 'Math.Round((dX * _DWG_X) / dDwgX, 2) |
||
726 | 76f465d0 | Gyusu | 'calcx = Math.Round(calcx, 4, MidpointRounding.) |
727 | calcx = Math.Truncate(calcx * 1000) / 1000 |
||
728 | 171ac39d | Gyusu | calcy = _DWG_Y - ((dY * _DWG_Y) / dDwgY) '_DWG_Y - Math.Round((dY * _DWG_Y) / dDwgY, 2) |
729 | 76f465d0 | Gyusu | ' calcy = Math.Round(calcy, 4) |
730 | calcy = Math.Truncate(calcy * 1000) / 1000 |
||
731 | 4f359afa | Gyusu | dX = calcx |
732 | dY = calcy |
||
733 | End Sub |
||
734 | |||
735 | e1cde8f2 | Gyusu | |
736 | '@brief Convert To SPPID |
||
737 | '@author : Gyusu Park |
||
738 | '@date : 2018-04-10 |
||
739 | '@history: |
||
740 | |||
741 | 171ac39d | Gyusu | Private Sub SplitLocation(ByVal sLocation As String, ByRef dX As Double, ByRef dY As Double) |
742 | |||
743 | Dim opointstr As String() = Split(sLocation, ",") |
||
744 | If (opointstr.Length > 1) Then |
||
745 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
746 | dX = opointstr(0) |
||
747 | dY = opointstr(1) |
||
748 | End If |
||
749 | End If |
||
750 | |||
751 | End Sub |
||
752 | |||
753 | Private Function Load_DB(ByVal sDBPath As String, ByVal sTableName As String) As DataTable |
||
754 | 4f359afa | Gyusu | |
755 | Try |
||
756 | 171ac39d | Gyusu | Dim oDt As New DataTable |
757 | 4f359afa | Gyusu | Dim sConnectionstring As String = "Data Source=" & sDBPath & ";Version=3;Synchronous=Off;UTF8Encoding=True;" |
758 | Dim conn As SQLiteConnection = New SQLiteConnection(sConnectionstring) |
||
759 | conn.Open() |
||
760 | 171ac39d | Gyusu | Dim sQuery As String = "Select * from " & sTableName |
761 | 4f359afa | Gyusu | Dim cmd As SQLiteCommand = conn.CreateCommand() |
762 | Dim adapter As SQLiteDataAdapter = New SQLiteDataAdapter(sQuery, conn) |
||
763 | Dim oDataSet As DataSet = New DataSet() |
||
764 | adapter.Fill(oDataSet) |
||
765 | 171ac39d | Gyusu | oDt = oDataSet.Tables(0) |
766 | Return oDt |
||
767 | 4f359afa | Gyusu | Catch ex As Exception |
768 | 171ac39d | Gyusu | Return Nothing |
769 | 4f359afa | Gyusu | End Try |
770 | |||
771 | |||
772 | 171ac39d | Gyusu | End Function |
773 | 4f359afa | Gyusu | |
774 | 31d47a80 | Gyusu | Private Function LoadAllDrawing() As DataTable |
775 | e282643f | Gyusu | |
776 | |||
777 | e1cde8f2 | Gyusu | SetListBoxItems(ListBox_Result, "도면정보 로드중....") |
778 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "도면정보 로드중....") |
779 | 31d47a80 | Gyusu | Dim oDt As DataTable = Drawing_Dt() |
780 | e282643f | Gyusu | Dim sHierarchy As String = My.Settings.Plant_Hierarchy |
781 | |||
782 | |||
783 | Dim files() As String |
||
784 | files = Directory.GetFiles(sHierarchy, "*.pid", SearchOption.AllDirectories) |
||
785 | For Each FileName As String In files |
||
786 | Dim sName As String = FileName |
||
787 | 31d47a80 | Gyusu | Dim oAddRow As DataRow = oDt.NewRow() |
788 | e282643f | Gyusu | oAddRow("Name") = Path.GetFileNameWithoutExtension(sName) |
789 | oAddRow("Path") = FileName |
||
790 | 31d47a80 | Gyusu | oDt.Rows.Add(oAddRow) |
791 | Next |
||
792 | Return oDt |
||
793 | End Function |
||
794 | |||
795 | e282643f | Gyusu | |
796 | 272662f9 | Gyusu | Dim _XMLList As ListView = New ListView() |
797 | e282643f | Gyusu | |
798 | 272662f9 | Gyusu | |
799 | |||
800 | e1cde8f2 | Gyusu | |
801 | 171ac39d | Gyusu | |
802 | |||
803 | Private Function CheckOpenDrawing() As Boolean |
||
804 | Try |
||
805 | |||
806 | Dim lobjDatasource As Object |
||
807 | _Placement = CreateObject("Plaice.Placement", "") |
||
808 | lobjDatasource = _Placement.PIDDataSource |
||
809 | Return True |
||
810 | Catch ex As Exception |
||
811 | Return False |
||
812 | End Try |
||
813 | |||
814 | End Function |
||
815 | |||
816 | |||
817 | Private Sub Btn_Convert_Click(sender As Object, e As EventArgs) Handles Btn_Convert.Click |
||
818 | |||
819 | Main_Tab.SelectedIndex = 1 |
||
820 | ListBox_Result.Items.Clear() |
||
821 | 9e1e7135 | Gyusu | ' DataGrid_Result.DataSource = New DataTable() |
822 | 171ac39d | Gyusu | Me.ProgressBar_Status.Visible = True |
823 | ProgressBar_Status.Maximum = 100 |
||
824 | ProgressBar_Status.Value = 0 |
||
825 | b08338e3 | Gyusu | InitItemCount() |
826 | 171ac39d | Gyusu | ' _selectFolderPath = Tree_XMLFiles.SelectedNode.FullPath.Replace("\\", "\") |
827 | 54b98e09 | Gyusu | _Main_trd = New Thread(AddressOf ThreadConvert) |
828 | 171ac39d | Gyusu | _Main_trd.IsBackground = True |
829 | _Main_trd.Start() |
||
830 | 54b98e09 | Gyusu | FineOPCForm() |
831 | End Sub |
||
832 | 171ac39d | Gyusu | |
833 | 54b98e09 | Gyusu | Private Sub FineOPCForm() |
834 | _Opc_trd = New Thread(AddressOf ThreadOPCRemove) |
||
835 | _Opc_trd.IsBackground = True |
||
836 | _Opc_trd.Start() |
||
837 | 171ac39d | Gyusu | End Sub |
838 | 54b98e09 | Gyusu | |
839 | 31d47a80 | Gyusu | |
840 | b08338e3 | Gyusu | Dim _objPIDAutoApp As Object |
841 | e282643f | Gyusu | |
842 | b08338e3 | Gyusu | Private Function OpenSPPID(ByVal oDwg_Dt As DataTable, ByVal sDwgName As String) As Boolean |
843 | Dim bCheckOpen As Boolean = False |
||
844 | ' Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgPath) |
||
845 | SetListBoxItems(ListBox_Result, sDwgName & " 도면 Open....") |
||
846 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, sDwgName & " 도면 Open....") |
||
847 | _objPIDAutoApp = CreateObject("PIDAutomation.Application") |
||
848 | e1cde8f2 | Gyusu | |
849 | b08338e3 | Gyusu | Dim sPath As String = OpenDrawing(oDwg_Dt, sDwgName) |
850 | If sPath <> "" Then |
||
851 | Process.Start(sPath) |
||
852 | Else |
||
853 | Return bCheckOpen |
||
854 | End If |
||
855 | 171ac39d | Gyusu | |
856 | Dim bCheckOpenDrawing As Boolean = False |
||
857 | While (True) |
||
858 | bCheckOpenDrawing = CheckOpenDrawing() |
||
859 | If bCheckOpenDrawing = True Then |
||
860 | bCheckOpen = True |
||
861 | Exit While |
||
862 | Else |
||
863 | Thread.Sleep(2000) |
||
864 | End If |
||
865 | End While |
||
866 | |||
867 | |||
868 | Return bCheckOpen |
||
869 | End Function |
||
870 | |||
871 | Private Function GetDrawing(ByVal sDwgName As String) As Drawing |
||
872 | For Each CDrawing In _DrawingsList |
||
873 | 559daf6d | Gyusu | If CDrawing.DwgName.ToUpper() = sDwgName.ToUpper() Then |
874 | 171ac39d | Gyusu | Return CDrawing |
875 | End If |
||
876 | Next |
||
877 | Return Nothing |
||
878 | End Function |
||
879 | |||
880 | Private Function GetLineNo(ByVal CDrawing As Drawing, ByVal sLineNoUid As String) As Line_no |
||
881 | For Each CLineNo In CDrawing.Line_nos |
||
882 | If CLineNo.Uid = sLineNoUid Then |
||
883 | Return CLineNo |
||
884 | End If |
||
885 | Next |
||
886 | Return Nothing |
||
887 | End Function |
||
888 | |||
889 | 3acffcee | Gyusu | Private Function GetTrimLineNo(ByVal CDrawing As Drawing, ByVal sLineNoUid As String) As Line_no |
890 | For Each CLineNo In CDrawing.TrimLine_nos |
||
891 | If CLineNo.Uid = sLineNoUid Then |
||
892 | Return CLineNo |
||
893 | End If |
||
894 | Next |
||
895 | Return Nothing |
||
896 | End Function |
||
897 | |||
898 | |||
899 | bb2a0c79 | Gyusu | |
900 | Private Function GetPipeFromConnection(ByVal CDrawing As Drawing, ByVal sSymbolUid As String, ByRef sConnTypeNo As String) As DataTable |
||
901 | 6a6d8ab4 | Gyusu | For Each CLineNo In CDrawing.Line_nos |
902 | Dim odt As DataTable = CLineNo.Dt_Line |
||
903 | If odt.Rows.Count > 0 Then |
||
904 | bb2a0c79 | Gyusu | If odt.Rows(0)(_XML_LINE_Conn1_Uid).ToString = sSymbolUid Then |
905 | sConnTypeNo = "1" |
||
906 | Return odt |
||
907 | ElseIf odt.Rows(0)(_XML_LINE_Conn2_Uid).ToString() = sSymbolUid Then |
||
908 | sConnTypeNo = "2" |
||
909 | Return odt |
||
910 | 6a6d8ab4 | Gyusu | End If |
911 | End If |
||
912 | Next |
||
913 | bb2a0c79 | Gyusu | Return New DataTable |
914 | 6a6d8ab4 | Gyusu | End Function |
915 | |||
916 | bb2a0c79 | Gyusu | Private Function GetSymbolFromConnection(ByVal CDrawing As Drawing, ByVal sSymbolUid As String, ByRef sConnTypeNo As String) As DataTable |
917 | For Each CLineNo In CDrawing.Line_nos |
||
918 | Dim odt As DataTable = CLineNo.Dt_Symbol |
||
919 | If odt.Rows.Count > 0 Then |
||
920 | If odt.Rows(0)(_XML_SYMBOL_Conn1_Uid).ToString = sSymbolUid Then |
||
921 | sConnTypeNo = "1" |
||
922 | Return odt |
||
923 | ElseIf odt.Rows(0)(_XML_SYMBOL_Conn2_Uid).ToString() = sSymbolUid Then |
||
924 | sConnTypeNo = "2" |
||
925 | Return odt |
||
926 | ElseIf odt.Rows(0)(_XML_SYMBOL_Conn3_Uid).ToString() = sSymbolUid Then |
||
927 | sConnTypeNo = "3" |
||
928 | Return odt |
||
929 | ElseIf odt.Rows(0)(_XML_SYMBOL_Conn4_Uid).ToString() = sSymbolUid Then |
||
930 | sConnTypeNo = "4" |
||
931 | Return odt |
||
932 | End If |
||
933 | End If |
||
934 | Next |
||
935 | Return New DataTable |
||
936 | End Function |
||
937 | 6a6d8ab4 | Gyusu | |
938 | Private Function GetEqpNo(ByVal CDrawing As Drawing, ByVal sEqpUid As String) As Eqp_no |
||
939 | For Each CEqpNo In CDrawing.Eqp_nos |
||
940 | If CEqpNo.Uid = sEqpUid Then |
||
941 | Return CEqpNo |
||
942 | End If |
||
943 | Next |
||
944 | Return Nothing |
||
945 | End Function |
||
946 | 9e1e7135 | Gyusu | Private Function ConvertPointBystring(ByVal sPoint As String, ByRef dX As Double, ByRef dY As Double) As Boolean |
947 | 171ac39d | Gyusu | Try |
948 | Dim opointstr As String() = Split(sPoint, ",") |
||
949 | If (opointstr.Length > 1) Then |
||
950 | If IsNumeric(opointstr(0)) And IsNumeric(opointstr(1)) Then |
||
951 | dX = opointstr(0) |
||
952 | dY = opointstr(1) |
||
953 | 9e1e7135 | Gyusu | |
954 | 171ac39d | Gyusu | Else |
955 | dX = 0 |
||
956 | dY = 0 |
||
957 | Return False |
||
958 | End If |
||
959 | End If |
||
960 | e1cde8f2 | Gyusu | Return True |
961 | Catch ex As Exception |
||
962 | Return False |
||
963 | End Try |
||
964 | 171ac39d | Gyusu | End Function |
965 | |||
966 | 54b98e09 | Gyusu | |
967 | Dim _DrawLine_Dt As DataTable = DrawLind_Dt() |
||
968 | |||
969 | e1cde8f2 | Gyusu | |
970 | 41e4023e | Gyusu | Private Sub AddModelingLine(ByVal dStart_x As Double, ByVal dStart_y As Double, ByVal dEnd_x As Double, ByVal dEnd_y As Double, ByVal sUid As String) |
971 | 54b98e09 | Gyusu | Dim oAddRow = _DrawLine_Dt.NewRow() |
972 | 41e4023e | Gyusu | oAddRow(_XML_LINE_UID) = sUid |
973 | 54b98e09 | Gyusu | oAddRow(_XML_LINE_STARTPOINT_X) = dStart_x |
974 | oAddRow(_XML_LINE_STARTPOINT_Y) = dStart_y |
||
975 | oAddRow(_XML_LINE_ENDPOINT_X) = dEnd_x |
||
976 | oAddRow(_XML_LINE_ENDPOINT_Y) = dEnd_y |
||
977 | _DrawLine_Dt.Rows.Add(oAddRow) |
||
978 | End Sub |
||
979 | |||
980 | |||
981 | |||
982 | b08338e3 | Gyusu | Private Sub PlaceEquipment(ByVal sUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sEqpName As String) |
983 | 41e4023e | Gyusu | Try |
984 | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
||
985 | Dim oAttributeRow() As DataRow |
||
986 | If oAttribute_Dt.Rows.Count > 0 Then |
||
987 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
||
988 | End If |
||
989 | If oSymbolRow.Length > 0 Then |
||
990 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
991 | Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
||
992 | Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
993 | Dim sClass As String = oSymbolRow(0)(_XML_SYMBOL_CLASS).ToString() |
||
994 | Dim sLocation As String = oSymbolRow(0)(_XML_SYMBOL_LOCATION).ToString() |
||
995 | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
996 | Dim dAngle As Double = 0.0 |
||
997 | If IsNumeric(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) Then |
||
998 | dAngle = Double.Parse(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) |
||
999 | End If |
||
1000 | Dim dLocationX As Double = 0.0 |
||
1001 | Dim dLocationY As Double = 0.0 |
||
1002 | Dim dX As Double = 0.0 |
||
1003 | Dim dY As Double = 0.0 |
||
1004 | |||
1005 | If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
||
1006 | dX = dLocationX |
||
1007 | dY = dLocationY |
||
1008 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
1009 | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1010 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Equipment.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iEquipmentcnt & " count ") |
1011 | |||
1012 | _iEquipmentcnt = _iEquipmentcnt + 1 |
||
1013 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Equipment : " & sUid) |
||
1014 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Name : " & sEqpName) |
||
1015 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
1016 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
1017 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Equipment Count : " & _iEquipmentcnt) |
||
1018 | |||
1019 | |||
1020 | 41e4023e | Gyusu | End If |
1021 | End If |
||
1022 | Catch ex As Exception |
||
1023 | |||
1024 | End Try |
||
1025 | |||
1026 | |||
1027 | End Sub |
||
1028 | 54b98e09 | Gyusu | |
1029 | b08338e3 | Gyusu | Private Function PlacePipingOPC(ByVal sUid As String, ByVal oOPCRow As DataRow, ByVal oAttribute_Dt As DataTable, ByVal sLineNoText As String) As LMSymbol |
1030 | e4000111 | Gyusu | Try |
1031 | Dim oAttributeRow() As DataRow |
||
1032 | If oAttribute_Dt.Rows.Count > 0 Then |
||
1033 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
||
1034 | End If |
||
1035 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1036 | Dim sSymbolCompType As String = oOPCRow(_XML_SYMBOL_TYPE).ToString() |
||
1037 | Dim sSystemPath As String = oOPCRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
1038 | Dim sClass As String = oOPCRow(_XML_SYMBOL_CLASS).ToString() |
||
1039 | Dim sLocation As String = oOPCRow(_XML_SYMBOL_LOCATION).ToString() |
||
1040 | Dim sOriginalPoint As String = oOPCRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
1041 | Dim dAngle As Double = 0.0 |
||
1042 | If IsNumeric(oOPCRow(_XML_SYMBOL_ANGLE).ToString()) Then |
||
1043 | dAngle = Double.Parse(oOPCRow(_XML_SYMBOL_ANGLE).ToString()) |
||
1044 | End If |
||
1045 | |||
1046 | Dim dLocationX As Double = 0.0 |
||
1047 | Dim dLocationY As Double = 0.0 |
||
1048 | Dim dX As Double = 0.0 |
||
1049 | Dim dY As Double = 0.0 |
||
1050 | bb2a0c79 | Gyusu | Dim oLMSymbol As LMSymbol = Nothing |
1051 | e4000111 | Gyusu | If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
1052 | dX = dLocationX |
||
1053 | dY = dLocationY |
||
1054 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
1055 | _iPipintOpccnt = _iPipintOpccnt + 1 |
||
1056 | bb2a0c79 | Gyusu | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1057 | e4000111 | Gyusu | '모델링된 형상은 Drawing True 로 처리 |
1058 | bb2a0c79 | Gyusu | oOPCRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
1059 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Piping OPC.." & sUid & " (" & dLocationX & "," & dLocationY & ")..." & _iPipintOpccnt & " count ") |
1060 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Piping OPC : " & sUid & "") |
||
1061 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
1062 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oOPCRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
1063 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oOPCRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
1064 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
1065 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
1066 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OPC Count : " & _iPipintOpccnt) |
||
1067 | e4000111 | Gyusu | |
1068 | Dim dConn_X1 As Double, dConn_Y1 As Double, dConn_X2 As Double, dConn_Y2 As Double |
||
1069 | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dConn_X1, dConn_Y1) |
||
1070 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dConn_X2, dConn_Y2) |
||
1071 | |||
1072 | bb2a0c79 | Gyusu | 'Dim oAddrow As DataRow = _ResultModeling_DT.NewRow() |
1073 | 'oAddrow(_Modeling_Uid) = sUid |
||
1074 | 'oAddrow(_Modeling_Location_X) = dLocationX |
||
1075 | 'oAddrow(_Modeling_Location_Y) = dLocationY |
||
1076 | 'oAddrow(_Modeling_LineNoUid) = sLineUid |
||
1077 | 'oAddrow(_Modeling_Type) = sSymbolCompType |
||
1078 | 'oAddrow(_Modeling_Connection1_X) = dConn_X1 |
||
1079 | 'oAddrow(_Modeling_Connection1_Y) = dConn_Y1 |
||
1080 | 'oAddrow(_Modeling_Connection2_X) = dConn_X2 |
||
1081 | 'oAddrow(_Modeling_Connection2_X) = dConn_Y2 |
||
1082 | 'oAddrow(_Modeling_LMSymbol) = oLMSymbol |
||
1083 | |||
1084 | '_ResultModeling_DT.Rows.Add(oAddrow) |
||
1085 | e4000111 | Gyusu | End If |
1086 | _Itemcnt = _Itemcnt + 1 |
||
1087 | Dim dCalcProgressValue As Double = (_Itemcnt / _allItem) * 100 |
||
1088 | SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
||
1089 | Label_Progress.Text = Math.Round(dCalcProgressValue, 0) & "%" |
||
1090 | bb2a0c79 | Gyusu | Return oLMSymbol |
1091 | e4000111 | Gyusu | Catch ex As Exception |
1092 | |||
1093 | End Try |
||
1094 | bb2a0c79 | Gyusu | Return Nothing |
1095 | e4000111 | Gyusu | |
1096 | bb2a0c79 | Gyusu | End Function |
1097 | e4000111 | Gyusu | |
1098 | 76f465d0 | Gyusu | Private Sub AddProgress() |
1099 | _Itemcnt = _Itemcnt + 1 |
||
1100 | Dim dCalcProgressValue As Double = (_Itemcnt / _allItem) * 100 |
||
1101 | SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
||
1102 | Label_Progress.Text = Math.Round(dCalcProgressValue, 0) & "%" |
||
1103 | End Sub |
||
1104 | e4000111 | Gyusu | Private Function DrawSymbol(ByVal sUid As String, ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oLine_Dt As DataTable) As Boolean |
1105 | 171ac39d | Gyusu | Try |
1106 | e282643f | Gyusu | |
1107 | 171ac39d | Gyusu | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_UID & " = '" + sUid + "'") |
1108 | b08338e3 | Gyusu | Dim oAttributeRow() As DataRow |
1109 | 6a6d8ab4 | Gyusu | If oAttribute_Dt.Rows.Count > 0 Then |
1110 | 460d6abd | Gyusu | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
1111 | 6a6d8ab4 | Gyusu | End If |
1112 | |||
1113 | 171ac39d | Gyusu | If oSymbolRow.Length > 0 Then |
1114 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1115 | Dim sSymbolCompType As String = oSymbolRow(0)(_XML_SYMBOL_TYPE).ToString() |
||
1116 | Dim sSystemPath As String = oSymbolRow(0)(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
1117 | 54b98e09 | Gyusu | Dim sClass As String = oSymbolRow(0)(_XML_SYMBOL_CLASS).ToString() |
1118 | 171ac39d | Gyusu | Dim sLocation As String = oSymbolRow(0)(_XML_SYMBOL_LOCATION).ToString() |
1119 | 9e1e7135 | Gyusu | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
1120 | 171ac39d | Gyusu | Dim dAngle As Double = 0.0 |
1121 | If IsNumeric(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) Then |
||
1122 | dAngle = Double.Parse(oSymbolRow(0)(_XML_SYMBOL_ANGLE).ToString()) |
||
1123 | End If |
||
1124 | |||
1125 | Dim objSymbol As LMSymbol |
||
1126 | 9e1e7135 | Gyusu | Dim dLocationX As Double = 0.0 |
1127 | Dim dLocationY As Double = 0.0 |
||
1128 | 171ac39d | Gyusu | Dim dX As Double = 0.0 |
1129 | Dim dY As Double = 0.0 |
||
1130 | |||
1131 | 9e1e7135 | Gyusu | If ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) Then |
1132 | dX = dLocationX |
||
1133 | dY = dLocationY |
||
1134 | 54b98e09 | Gyusu | If sSymbolCompType = "" Or sSymbolCompType = "Piping OPC's" Then |
1135 | FindConnectionLine(oLine_Dt, dX, dY) |
||
1136 | End If |
||
1137 | |||
1138 | 9e1e7135 | Gyusu | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
1139 | e4000111 | Gyusu | Dim oInstrument As LMInstrument |
1140 | 54b98e09 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
1141 | 9e1e7135 | Gyusu | _iInstrumentcnt = _iInstrumentcnt + 1 |
1142 | 171ac39d | Gyusu | objSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1143 | 6a6d8ab4 | Gyusu | SetListBoxItems(ListBox_Result, "Place Instrument..(" & dLocationX & "," & dLocationY & ")..." & _iInstrumentcnt & " count ") |
1144 | 171ac39d | Gyusu | oInstrument = oDatasource.GetInstrument(objSymbol.ModelItemID) |
1145 | 6a6d8ab4 | Gyusu | Try |
1146 | If oAttributeRow.Length > 0 Then |
||
1147 | For Each oAttribute In oAttributeRow |
||
1148 | 54b98e09 | Gyusu | Try |
1149 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
1150 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
1151 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
1152 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
1153 | Catch ex As Exception |
||
1154 | |||
1155 | End Try |
||
1156 | |||
1157 | 6a6d8ab4 | Gyusu | Next |
1158 | oInstrument.Commit() |
||
1159 | End If |
||
1160 | Catch ex As Exception |
||
1161 | End Try |
||
1162 | 54b98e09 | Gyusu | ElseIf sSymbolCompType.ToUpper() = _DB_FITTINGS.ToUpper() Then |
1163 | 9e1e7135 | Gyusu | _iValvecnt = _iValvecnt + 1 |
1164 | 171ac39d | Gyusu | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1165 | 6a6d8ab4 | Gyusu | SetListBoxItems(ListBox_Result, "Place Valve..(" & dLocationX & "," & dLocationY & ")..." & _iValvecnt & " count ") |
1166 | 171ac39d | Gyusu | |
1167 | 54b98e09 | Gyusu | ElseIf sSymbolCompType.ToUpper() = _SYMBOL_FITTINGS.ToUpper() Then |
1168 | 9e1e7135 | Gyusu | _iFittingcnt = _iFittingcnt + 1 |
1169 | d039e347 | Gyusu | If sSystemPath.Contains(",") Then |
1170 | |||
1171 | Dim sDuplicatePath As String() = sSystemPath.Split(",") |
||
1172 | Dim sMainSymbol As String = "" |
||
1173 | Dim sSubSymbol As String = "" |
||
1174 | For Each sPath In sDuplicatePath |
||
1175 | If sMainSymbol = "" Then |
||
1176 | sMainSymbol = sPath.Replace(vbLf, "") |
||
1177 | Else |
||
1178 | sSubSymbol = sPath.Replace(vbLf, "") |
||
1179 | End If |
||
1180 | Next |
||
1181 | Dim oSymbolObj As LMSymbol = _Placement.PIDPlaceSymbol(sMainSymbol, dX, dY, , dAngle) |
||
1182 | Dim dConnpos_x As Double = 0.0 |
||
1183 | Dim dConnpos_y As Double = 0.0 |
||
1184 | _Placement.PIDConnectPointLocation(oSymbolObj, 2, dConnpos_x, dConnpos_y) |
||
1185 | ' _Placement.PIDPlaceSymbol(sSubSymbol, dConnpos_x, dConnpos_y, dAngle, TargetItem:=oSymbolObj.AsLMRepresentation) |
||
1186 | _Placement.PIDPlaceSymbol(sSubSymbol, dConnpos_x, dConnpos_y,, dAngle) |
||
1187 | |||
1188 | Else |
||
1189 | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
1190 | End If |
||
1191 | |||
1192 | |||
1193 | 6a6d8ab4 | Gyusu | SetListBoxItems(ListBox_Result, "Place Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
1194 | 54b98e09 | Gyusu | ElseIf sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() And sClass.ToUpper() = _SYMBOL_ACTUATORS.ToUpper() Then |
1195 | d039e347 | Gyusu | _iFittingcnt = _iFittingcnt + 1 |
1196 | Dim sDuplicatePath As String() = sSystemPath.Split(",") |
||
1197 | Dim sMainSymbol As String = "" |
||
1198 | Dim sSubSymbol As String = "" |
||
1199 | For Each sPath In sDuplicatePath |
||
1200 | If sMainSymbol = "" Then |
||
1201 | sMainSymbol = sPath.Replace(vbLf, "") |
||
1202 | Else |
||
1203 | sSubSymbol = sPath.Replace(vbLf, "") |
||
1204 | End If |
||
1205 | Next |
||
1206 | Dim oSymbolObj As LMSymbol = _Placement.PIDPlaceSymbol(sMainSymbol, dX, dY, , dAngle) |
||
1207 | Dim dSymbolpos_x As Double = oSymbolObj.XCoordinate |
||
1208 | Dim dSymbolpos_y As Double = oSymbolObj.YCoordinate |
||
1209 | _Placement.PIDPlaceSymbol(sSubSymbol, dSymbolpos_x, dSymbolpos_y, , dAngle, TargetItem:=oSymbolObj.AsLMAItem) |
||
1210 | |||
1211 | 171ac39d | Gyusu | Else |
1212 | 9e1e7135 | Gyusu | _iFittingcnt = _iFittingcnt + 1 |
1213 | 171ac39d | Gyusu | _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
1214 | 6a6d8ab4 | Gyusu | SetListBoxItems(ListBox_Result, "Place Fitting..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
1215 | 171ac39d | Gyusu | End If |
1216 | e4000111 | Gyusu | |
1217 | End If |
||
1218 | 41e4023e | Gyusu | _Itemcnt = _Itemcnt + 1 |
1219 | Dim dCalcProgressValue As Double = (_Itemcnt / _allItem) * 100 |
||
1220 | SetProgressbar(ProgressBar_Status, dCalcProgressValue) |
||
1221 | Label_Progress.Text = Math.Round(dCalcProgressValue, 0) & "%" |
||
1222 | End If |
||
1223 | 171ac39d | Gyusu | |
1224 | 54b98e09 | Gyusu | Catch ex As Exception |
1225 | Return False |
||
1226 | End Try |
||
1227 | End Function |
||
1228 | |||
1229 | |||
1230 | Private Sub FindConnectionLine(ByVal oLine_Dt As DataTable, ByRef dx As Double, ByRef dy As Double) |
||
1231 | |||
1232 | Try |
||
1233 | For Each oRow In oLine_Dt.Rows |
||
1234 | Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
||
1235 | Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
||
1236 | Dim d기준s_x As Double = 0 |
||
1237 | Dim d기준s_y As Double = 0 |
||
1238 | Dim d기준e_x As Double = 0 |
||
1239 | Dim d기준e_y As Double = 0 |
||
1240 | ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
||
1241 | ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
||
1242 | If dx + 300 > d기준s_x And dx - 300 < d기준s_x And dy + 300 > d기준s_y And dy - 300 < d기준s_y Then |
||
1243 | dx = d기준s_x |
||
1244 | dy = d기준s_y |
||
1245 | ElseIf dx + 300 > d기준e_x And dx - 300 < d기준e_x And dy + 300 > d기준e_y And dy - 300 < d기준e_y Then |
||
1246 | dx = d기준e_x |
||
1247 | dy = d기준e_y |
||
1248 | End If |
||
1249 | Next |
||
1250 | Catch ex As Exception |
||
1251 | End Try |
||
1252 | End Sub |
||
1253 | |||
1254 | |||
1255 | Dim _라인보정기준값 As Integer = 10 |
||
1256 | |||
1257 | Private Function 라인보정(ByRef oLine_Dt As DataTable, ByVal sUid As String, ByRef dsx As Double, ByRef dsy As Double, |
||
1258 | ByRef dex As Double, ByRef dey As Double) |
||
1259 | Try |
||
1260 | Dim bCheck라인 As Boolean = False |
||
1261 | '일치하는 Line 찾기 |
||
1262 | For Each oRow In oLine_Dt.Rows |
||
1263 | Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
||
1264 | Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
||
1265 | Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
||
1266 | If sBUid <> sUid Then |
||
1267 | Dim d기준s_x As Double = 0 |
||
1268 | Dim d기준s_y As Double = 0 |
||
1269 | Dim d기준e_x As Double = 0 |
||
1270 | Dim d기준e_y As Double = 0 |
||
1271 | ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
||
1272 | ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
||
1273 | |||
1274 | If (dsx = d기준s_x And dsy = d기준s_y) Or (dsx = d기준e_x And dsy = d기준e_y) Or |
||
1275 | (dex = d기준s_x And dey = d기준s_y) Or (dex = d기준e_x And dey = d기준e_y) Then |
||
1276 | bCheck라인 = True |
||
1277 | End If |
||
1278 | End If |
||
1279 | Next |
||
1280 | |||
1281 | If bCheck라인 = False Then |
||
1282 | For Each oRow In oLine_Dt.Rows |
||
1283 | Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
||
1284 | Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
||
1285 | Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
||
1286 | If sBUid <> sUid Then |
||
1287 | Dim d기준s_x As Double = 0 |
||
1288 | Dim d기준s_y As Double = 0 |
||
1289 | Dim d기준e_x As Double = 0 |
||
1290 | Dim d기준e_y As Double = 0 |
||
1291 | ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
||
1292 | ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
||
1293 | If ((dsx - _라인보정기준값 <= d기준s_x And dsx + _라인보정기준값 >= d기준s_x) And (dsy - _라인보정기준값 <= d기준s_y And dsy + _라인보정기준값 >= d기준s_y)) Then |
||
1294 | oRow(_XML_LINE_STARTPOINT) = dsx & "," & dsy |
||
1295 | bCheck라인 = True |
||
1296 | Exit For |
||
1297 | ElseIf ((dsx - _라인보정기준값 <= d기준e_x And dsx + _라인보정기준값 >= d기준e_x) And (dsy - _라인보정기준값 <= d기준e_y And dsy + _라인보정기준값 >= d기준e_y)) Then |
||
1298 | oRow(_XML_LINE_ENDPOINT) = dsx & "," & dsy |
||
1299 | bCheck라인 = True |
||
1300 | Exit For |
||
1301 | ElseIf ((dex - _라인보정기준값 <= d기준s_x And dex + _라인보정기준값 >= d기준s_x) And (dey - _라인보정기준값 <= d기준s_y And dey + _라인보정기준값 >= d기준s_y)) Then |
||
1302 | oRow(_XML_LINE_STARTPOINT) = dex & "," & dey |
||
1303 | bCheck라인 = True |
||
1304 | Exit For |
||
1305 | ElseIf ((dex - _라인보정기준값 <= d기준e_x And dex + _라인보정기준값 >= d기준e_x) And (dey - _라인보정기준값 <= d기준e_y And dey + _라인보정기준값 >= d기준e_y)) Then |
||
1306 | oRow(_XML_LINE_ENDPOINT) = dex & "," & dey |
||
1307 | bCheck라인 = True |
||
1308 | Exit For |
||
1309 | End If |
||
1310 | |||
1311 | End If |
||
1312 | Next |
||
1313 | 171ac39d | Gyusu | End If |
1314 | |||
1315 | 54b98e09 | Gyusu | Return bCheck라인 |
1316 | 171ac39d | Gyusu | Catch ex As Exception |
1317 | Return False |
||
1318 | End Try |
||
1319 | 54b98e09 | Gyusu | |
1320 | |||
1321 | 171ac39d | Gyusu | End Function |
1322 | |||
1323 | 460d6abd | Gyusu | Private Function FindOverlapLine(ByVal oLine_Dt As DataTable, ByVal sUid As String, ByRef dsx As Double, ByRef dsy As Double, |
1324 | ByRef dex As Double, ByRef dey As Double) |
||
1325 | Try |
||
1326 | Dim bCheckOverlap As Boolean = False |
||
1327 | For Each oRow In oLine_Dt.Rows |
||
1328 | Dim sStartpoint As String = oRow(_XML_LINE_STARTPOINT).ToString() |
||
1329 | Dim sEndpoint As String = oRow(_XML_LINE_ENDPOINT).ToString() |
||
1330 | Dim sBUid As String = oRow(_XML_LINE_UID).ToString() |
||
1331 | If sBUid <> sUid Then |
||
1332 | Dim d기준s_x As Double = 0 |
||
1333 | Dim d기준s_y As Double = 0 |
||
1334 | Dim d기준e_x As Double = 0 |
||
1335 | Dim d기준e_y As Double = 0 |
||
1336 | ConvertPointBystring(sStartpoint, d기준s_x, d기준s_y) |
||
1337 | ConvertPointBystring(sEndpoint, d기준e_x, d기준e_y) |
||
1338 | 54b98e09 | Gyusu | If (d기준s_x <= dsx And d기준e_x >= dex And |
1339 | d기준s_y <= dsy And d기준e_y >= dey) Then |
||
1340 | 460d6abd | Gyusu | '겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
1341 | If dsy - d기준s_y > d기준e_y - dey Then |
||
1342 | Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
||
1343 | If dResultCalc < 10 Then |
||
1344 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1345 | Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
||
1346 | Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
||
1347 | Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
||
1348 | If dCalcStartY = 0 Then |
||
1349 | dey = d기준e_y |
||
1350 | Else |
||
1351 | dey = dCalcStartY |
||
1352 | End If |
||
1353 | End If |
||
1354 | Else |
||
1355 | abb01e6c | Gyusu | ' Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
1356 | Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
||
1357 | 460d6abd | Gyusu | If dResultCalc < 10 Then |
1358 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1359 | Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
||
1360 | Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
||
1361 | Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
||
1362 | If dCalcStartY = 0 Then |
||
1363 | dsy = d기준s_y |
||
1364 | Else |
||
1365 | dsy = dCalcStartY |
||
1366 | End If |
||
1367 | End If |
||
1368 | End If |
||
1369 | bCheckOverlap = True |
||
1370 | ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
||
1371 | d기준s_y <= dey And d기준e_y >= dsy Then |
||
1372 | '겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
||
1373 | If dey - d기준s_y > d기준e_y - dsy Then |
||
1374 | Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
||
1375 | If dResultCalc < 10 Then |
||
1376 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1377 | Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
||
1378 | Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
||
1379 | Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
||
1380 | If dCalcStartY = 0 Then |
||
1381 | abb01e6c | Gyusu | dsy = d기준e_y |
1382 | 460d6abd | Gyusu | Else |
1383 | abb01e6c | Gyusu | dsy = dCalcStartY |
1384 | 460d6abd | Gyusu | End If |
1385 | |||
1386 | End If |
||
1387 | '겹쳐서 오버되는 길이가 오버되지 않는 길이의 10%미만일때 겹치는 y축좌표를 겹치는점까지 설정 |
||
1388 | Else |
||
1389 | abb01e6c | Gyusu | ' Dim dResultCalc As Double = (Math.Abs((dsy - d기준s_y)) / Math.Abs((d기준e_y - dey))) * 100 |
1390 | Dim dResultCalc As Double = ((d기준e_y - dey) / (dsy - d기준s_y)) * 100 |
||
1391 | 460d6abd | Gyusu | If dResultCalc < 10 Then |
1392 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1393 | Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
||
1394 | Dim dCalcStartX As Double = Math.Abs(dsx - d기준s_x) |
||
1395 | Dim dCalcStartY As Double = (dCalcY * dCalcStartX) / dCalcX |
||
1396 | If dCalcStartY = 0 Then |
||
1397 | abb01e6c | Gyusu | dey = d기준e_y |
1398 | 460d6abd | Gyusu | Else |
1399 | abb01e6c | Gyusu | dey = dCalcStartY |
1400 | 460d6abd | Gyusu | End If |
1401 | End If |
||
1402 | End If |
||
1403 | bCheckOverlap = True |
||
1404 | ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
||
1405 | d기준s_y <= dey And d기준e_y >= dsy Then |
||
1406 | |||
1407 | If dsx - d기준s_x > d기준e_x - dex Then |
||
1408 | Dim dResultCalc As Double = ((d기준e_x - dex) / (dsx - d기준s_x)) * 100 |
||
1409 | If dResultCalc < 10 Then |
||
1410 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1411 | Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
||
1412 | Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
||
1413 | Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
||
1414 | If dCalcStartX = 0 Then |
||
1415 | dex = d기준e_x |
||
1416 | Else |
||
1417 | dex = dCalcStartX |
||
1418 | End If |
||
1419 | End If |
||
1420 | Else |
||
1421 | abb01e6c | Gyusu | ' Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
1422 | Dim dResultCalc As Double = ((d기준e_x - dex) / (dsx - d기준s_x)) * 100 |
||
1423 | 460d6abd | Gyusu | If dResultCalc < 10 Then |
1424 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1425 | Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
||
1426 | Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
||
1427 | Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
||
1428 | If dCalcStartX = 0 Then |
||
1429 | dsx = d기준s_x |
||
1430 | Else |
||
1431 | dsx = dCalcStartX |
||
1432 | End If |
||
1433 | End If |
||
1434 | End If |
||
1435 | bCheckOverlap = True |
||
1436 | ElseIf (d기준s_x <= dsx And d기준e_x >= dex) And |
||
1437 | d기준s_y <= dey And d기준e_y >= dsy Then |
||
1438 | |||
1439 | If dex - d기준s_x > d기준e_x - dsx Then |
||
1440 | Dim dResultCalc As Double = ((d기준e_x - dex) / (dsx - d기준s_x)) * 100 |
||
1441 | If dResultCalc < 10 Then |
||
1442 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1443 | Dim dCalcY As Double = Math.Abs(d기준s_y - d기준e_y) |
||
1444 | Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
||
1445 | Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
||
1446 | If dCalcStartX = 0 Then |
||
1447 | abb01e6c | Gyusu | dsx = d기준e_x |
1448 | 460d6abd | Gyusu | Else |
1449 | abb01e6c | Gyusu | dsx = dCalcStartX |
1450 | 460d6abd | Gyusu | End If |
1451 | End If |
||
1452 | Else |
||
1453 | abb01e6c | Gyusu | ' Dim dResultCalc As Double = ((dsy - d기준s_y) / (d기준e_y - dey)) * 100 |
1454 | Dim dResultCalc As Double = ((d기준e_x - dex) / (dsx - d기준s_x)) * 100 |
||
1455 | 460d6abd | Gyusu | If dResultCalc < 10 Then |
1456 | Dim dCalcX As Double = Math.Abs(d기준e_x - d기준s_x) |
||
1457 | Dim dCalcY As Double = Math.Abs(d기준e_y - d기준s_y) |
||
1458 | Dim dCalcStartY As Double = Math.Abs(dsy - d기준s_y) |
||
1459 | Dim dCalcStartX As Double = (dCalcX * dCalcStartY) / dCalcY |
||
1460 | If dCalcStartX = 0 Then |
||
1461 | abb01e6c | Gyusu | dex = d기준s_x |
1462 | 460d6abd | Gyusu | Else |
1463 | abb01e6c | Gyusu | dex = dCalcStartX |
1464 | 460d6abd | Gyusu | End If |
1465 | End If |
||
1466 | |||
1467 | End If |
||
1468 | bCheckOverlap = True |
||
1469 | End If |
||
1470 | End If |
||
1471 | Next |
||
1472 | 3acffcee | Gyusu | |
1473 | 460d6abd | Gyusu | Return bCheckOverlap |
1474 | Catch ex As Exception |
||
1475 | Return False |
||
1476 | End Try |
||
1477 | End Function |
||
1478 | |||
1479 | Private Sub CalcSperateLine(ByRef dStartX As Double, ByRef dStartY As Double, |
||
1480 | ByRef dEndX As Double, ByRef dEndY As Double) |
||
1481 | Try |
||
1482 | 54b98e09 | Gyusu | Dim dRange As Double = 1 'Line 전체 길이의 10%씩 늘이기 |
1483 | 460d6abd | Gyusu | If Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
1484 | 54b98e09 | Gyusu | Dim dCalc_x As Double = Math.Abs(dStartX - dEndX) * 0.1 |
1485 | 460d6abd | Gyusu | If dStartX > dEndX Then |
1486 | dStartX = dStartX + dCalc_x |
||
1487 | dEndX = dEndX - dCalc_x |
||
1488 | Else |
||
1489 | dEndX = dEndX + dCalc_x |
||
1490 | dStartX = dStartX - dCalc_x |
||
1491 | End If |
||
1492 | Else |
||
1493 | 54b98e09 | Gyusu | Dim dCalc_y As Double = Math.Abs(dStartY - dEndY) * 0.1 |
1494 | 460d6abd | Gyusu | If dStartY > dEndY Then |
1495 | dStartY = dStartY + dCalc_y |
||
1496 | dEndY = dEndY - dCalc_y |
||
1497 | Else |
||
1498 | dEndY = dEndY + dCalc_y |
||
1499 | dStartY = dStartY - dCalc_y |
||
1500 | End If |
||
1501 | End If |
||
1502 | |||
1503 | Catch ex As Exception |
||
1504 | |||
1505 | End Try |
||
1506 | |||
1507 | |||
1508 | End Sub |
||
1509 | |||
1510 | 3acffcee | Gyusu | Private Function DrawLineNo(ByVal oPipeRun_Dt As DataTable, ByVal CLine_No As Line_no) As Boolean |
1511 | 171ac39d | Gyusu | Try |
1512 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
1513 | Dim sLocation = CLine_No.Location |
||
1514 | 9e1e7135 | Gyusu | Dim dLocationx As Double = 0.0 |
1515 | Dim dLocationy As Double = 0.0 |
||
1516 | |||
1517 | 171ac39d | Gyusu | Dim dX As Double = 0.0 |
1518 | Dim dY As Double = 0.0 |
||
1519 | 9e1e7135 | Gyusu | If ConvertPointBystring(sLocation, dLocationx, dLocationy) Then |
1520 | dX = dLocationx |
||
1521 | dY = dLocationy |
||
1522 | 3acffcee | Gyusu | |
1523 | For Each oRow In oPipeRun_Dt.Rows |
||
1524 | Dim dStartx As Double = Double.Parse(oRow("startx").ToString()) |
||
1525 | Dim dStarty As Double = Double.Parse(oRow("starty").ToString()) |
||
1526 | Dim dEndx As Double = Double.Parse(oRow("endx").ToString()) |
||
1527 | Dim dEndy As Double = Double.Parse(oRow("endy").ToString()) |
||
1528 | |||
1529 | Dim dStartSum As Double = Math.Abs(dStartx - dLocationx) + Math.Abs(dStarty - dLocationy) |
||
1530 | Dim dEndSum As Double = Math.Abs(dEndx - dLocationx) + Math.Abs(dEndy - dLocationy) |
||
1531 | If dStartSum > dEndSum Then |
||
1532 | oRow("value") = dEndSum |
||
1533 | Else |
||
1534 | oRow("value") = dStartSum |
||
1535 | 171ac39d | Gyusu | End If |
1536 | 3acffcee | Gyusu | |
1537 | 171ac39d | Gyusu | Next |
1538 | 3acffcee | Gyusu | Dim dataView As New DataView(oPipeRun_Dt) |
1539 | dataView.Sort = " value asc" |
||
1540 | Dim oDt As DataTable = dataView.ToTable() |
||
1541 | If oDt.Rows.Count > 0 Then |
||
1542 | Try |
||
1543 | Dim oPiperun As LMPipeRun = CType(oDt.Rows(0)("Piperun"), LMPipeRun) |
||
1544 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
1545 | Dim dLineNoLocation(2) As Double |
||
1546 | dLineNoLocation(1) = dX |
||
1547 | dLineNoLocation(2) = dY |
||
1548 | 'Label |
||
1549 | Dim sSystemPath As String = CLine_No.SystemPath |
||
1550 | Dim dAngle As Double = CLine_No.Angle |
||
1551 | Dim labelpersist As LMLabelPersist |
||
1552 | |||
1553 | For Each representation In oPiperun.Representations |
||
1554 | If representation.RepresentationType = "Connector" Then |
||
1555 | labelpersist = _Placement.PIDPlaceLabel(sSystemPath, |
||
1556 | dLineNoLocation,, dAngle, LabeledItem:=representation) |
||
1557 | _iPipeLineNocnt = _iPipeLineNocnt + 1 |
||
1558 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place PipeLineNo Label.." & CLine_No.Uid & " (" & dLocationx & "," & dLocationy & ")..." & _iPipeLineNocnt & " count ") |
1559 | |||
1560 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & CLine_No.Uid & "") |
||
1561 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & CLine_No.Text) |
||
1562 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
1563 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Origina lPoint : " & dLocationx & "," & dLocationy) |
||
1564 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "PipeLineNo Count : " & _iPipeLineNocnt) |
||
1565 | 3acffcee | Gyusu | End If |
1566 | Next |
||
1567 | Catch ex As Exception |
||
1568 | |||
1569 | End Try |
||
1570 | |||
1571 | |||
1572 | End If |
||
1573 | |||
1574 | |||
1575 | |||
1576 | 171ac39d | Gyusu | Return True |
1577 | Else |
||
1578 | Return False |
||
1579 | End If |
||
1580 | |||
1581 | Catch ex As Exception |
||
1582 | Return False |
||
1583 | End Try |
||
1584 | End Function |
||
1585 | |||
1586 | 9e1e7135 | Gyusu | |
1587 | Private Sub InitItemCount() |
||
1588 | _iPipeLineNocnt = 0 |
||
1589 | b08338e3 | Gyusu | _iPipecnt = 1 |
1590 | _iFittingcnt = 1 |
||
1591 | 9e1e7135 | Gyusu | _iValvecnt = 0 |
1592 | _iInstrumentcnt = 0 |
||
1593 | _iEquipmentcnt = 0 |
||
1594 | 3acffcee | Gyusu | _iNozzlecnt = 1 |
1595 | e4000111 | Gyusu | _iPipintOpccnt = 0 |
1596 | 3acffcee | Gyusu | |
1597 | 9e1e7135 | Gyusu | End Sub |
1598 | 171ac39d | Gyusu | |
1599 | 41e4023e | Gyusu | Private Function GetAllCheckNodeCount() As Integer |
1600 | _allItem = 0 |
||
1601 | For i = 0 To Tree_Result.Nodes.Count - 1 |
||
1602 | For j = 0 To Tree_Result.Nodes(i).Nodes.Count - 1 |
||
1603 | For k = 0 To Tree_Result.Nodes(i).Nodes(j).Nodes.Count - 1 |
||
1604 | For l = 0 To Tree_Result.Nodes(i).Nodes(j).Nodes(k).Nodes.Count - 1 |
||
1605 | If Tree_Result.Nodes(i).Nodes(j).Nodes(k).Nodes(l).Checked = True Then |
||
1606 | _allItem = _allItem + 1 |
||
1607 | End If |
||
1608 | Next |
||
1609 | Next |
||
1610 | Next |
||
1611 | Next |
||
1612 | Return _allItem |
||
1613 | End Function |
||
1614 | 54b98e09 | Gyusu | |
1615 | |||
1616 | e4000111 | Gyusu | ''' <summary> |
1617 | ''' Equipment 모델링 |
||
1618 | ''' </summary> |
||
1619 | Private Sub EquipmentModeling(ByVal oDwg_Dt As DataTable) |
||
1620 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
1621 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
1622 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
1623 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
1624 | If CDrawing IsNot Nothing Then |
||
1625 | If OpenSPPID(oDwg_Dt, oDwgNode.Text) Then |
||
1626 | b08338e3 | Gyusu | |
1627 | e4000111 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
1628 | Dim iItemcnt As Integer = 0 |
||
1629 | Dim sNodeUid As String = oNode.Name |
||
1630 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
1631 | '1.Equipment |
||
1632 | '2.Piping OPC |
||
1633 | '3.OPC 시작되는 Line |
||
1634 | 'Equipment 생성 |
||
1635 | Dim CEqpNo As Eqp_no = GetEqpNo(CDrawing, sNodeUid) |
||
1636 | If CEqpNo IsNot Nothing Then |
||
1637 | Dim oSymbol_Dt As DataTable = CEqpNo.Dt_Equipment |
||
1638 | Dim oAttribute_Dt As DataTable = CEqpNo.Dt_Attribute |
||
1639 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
1640 | If oSymbolNode.Checked Then |
||
1641 | Dim sUid As String = oSymbolNode.Name |
||
1642 | b08338e3 | Gyusu | PlaceEquipment(sUid, oSymbol_Dt, oAttribute_Dt, CEqpNo.Text) |
1643 | e4000111 | Gyusu | End If |
1644 | Next |
||
1645 | End If |
||
1646 | Next |
||
1647 | End If |
||
1648 | End If |
||
1649 | Next |
||
1650 | Next |
||
1651 | End Sub |
||
1652 | |||
1653 | bb2a0c79 | Gyusu | Private Sub ManualCheckNode(ByRef oDt As DataTable) |
1654 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
1655 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
1656 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
1657 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
1658 | Dim sUid As String = oSymbolNode.Name |
||
1659 | 76f465d0 | Gyusu | 'Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & |
1660 | ' "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'") |
||
1661 | Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & "'") |
||
1662 | bb2a0c79 | Gyusu | If oSelectRows.Length = 1 Then |
1663 | 76f465d0 | Gyusu | oSelectRows(0)(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
1664 | |||
1665 | bb2a0c79 | Gyusu | If oSymbolNode.Checked Then |
1666 | oSelectRows(0)(_XML_SYMBOL_Check) = "TRUE" |
||
1667 | Else |
||
1668 | oSelectRows(0)(_XML_SYMBOL_Check) = "FALSE" |
||
1669 | End If |
||
1670 | End If |
||
1671 | |||
1672 | Next |
||
1673 | Next |
||
1674 | Next |
||
1675 | Next |
||
1676 | |||
1677 | End Sub |
||
1678 | b08338e3 | Gyusu | |
1679 | f9b63682 | Gyusu | Private Function FinalSymbolModeling(ByVal oCurrentSymbolRow As DataRow, ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, |
1680 | ByVal oAttribute_Dt As DataTable) As String |
||
1681 | Dim sReturnUid As String = "" |
||
1682 | Dim sOriginalPoint As String = "" |
||
1683 | Dim dOriginal_x As Double = 0.0 |
||
1684 | Dim dOriginal_y As Double = 0.0 |
||
1685 | |||
1686 | Dim dConn1_x As Double = 0.0 |
||
1687 | Dim dConn1_y As Double = 0.0 |
||
1688 | Dim dConn2_x As Double = 0.0 |
||
1689 | Dim dConn2_y As Double = 0.0 |
||
1690 | Dim dConn3_x As Double = 0.0 |
||
1691 | Dim dConn3_y As Double = 0.0 |
||
1692 | Dim dConn4_x As Double = 0.0 |
||
1693 | Dim dConn4_y As Double = 0.0 |
||
1694 | |||
1695 | Dim sUid As String = oCurrentSymbolRow(_XML_SYMBOL_UID) |
||
1696 | Dim sSystemPath As String = oCurrentSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
1697 | Dim dAngle As Double = oCurrentSymbolRow(_XML_SYMBOL_ANGLE) |
||
1698 | Dim sLineNoText As String = oCurrentSymbolRow(_XML_LINENO_TEXT) |
||
1699 | Dim sLineNoUid As String = oCurrentSymbolRow(_XML_LINE_LINENOUID).ToString() |
||
1700 | sOriginalPoint = oCurrentSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
1701 | 76f465d0 | Gyusu | Dim sSymbolCompType As String = oCurrentSymbolRow(_XML_SYMBOL_TYPE).ToString() |
1702 | f9b63682 | Gyusu | ConvertPointBystring(sOriginalPoint, dOriginal_x, dOriginal_y) |
1703 | ConvertPointByImage(dOriginal_x, dOriginal_y, _IMG_X, _IMG_Y) |
||
1704 | |||
1705 | 'Connection 정보 체크, 모델링 되어 있는지 유무 |
||
1706 | '양 커넥션의 모델링 유무를 체크한다. |
||
1707 | Dim sConn1Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString() |
||
1708 | Dim sConn2Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString() |
||
1709 | Dim sConn3Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString() |
||
1710 | Dim sConn4Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString() |
||
1711 | |||
1712 | Dim sConn1Type As String = "" |
||
1713 | Dim sConn2Type As String = "" |
||
1714 | Dim sConn3Type As String = "" |
||
1715 | Dim sConn4Type As String = "" |
||
1716 | |||
1717 | Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'") |
||
1718 | If oConn1Rows.Length = 0 Then |
||
1719 | oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'") |
||
1720 | If oConn1Rows.Length = 1 Then |
||
1721 | sConn1Type = "Line" |
||
1722 | b08338e3 | Gyusu | End If |
1723 | f9b63682 | Gyusu | Else |
1724 | sConn1Type = "Symbol" |
||
1725 | End If |
||
1726 | b08338e3 | Gyusu | |
1727 | f9b63682 | Gyusu | Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'") |
1728 | If oConn2Rows.Length = 0 Then |
||
1729 | oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'") |
||
1730 | If oConn2Rows.Length = 1 Then |
||
1731 | sConn2Type = "Line" |
||
1732 | b08338e3 | Gyusu | End If |
1733 | f9b63682 | Gyusu | Else |
1734 | sConn2Type = "Symbol" |
||
1735 | End If |
||
1736 | b08338e3 | Gyusu | |
1737 | f9b63682 | Gyusu | Dim oConn3Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn3Uid & "'") |
1738 | If oConn3Rows.Length = 0 Then |
||
1739 | oConn3Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn3Uid & "'") |
||
1740 | If oConn3Rows.Length = 1 Then |
||
1741 | sConn3Type = "Line" |
||
1742 | b08338e3 | Gyusu | End If |
1743 | f9b63682 | Gyusu | Else |
1744 | sConn3Type = "Symbol" |
||
1745 | End If |
||
1746 | b08338e3 | Gyusu | |
1747 | f9b63682 | Gyusu | Dim oConn4Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn4Uid & "'") |
1748 | If oConn4Rows.Length = 0 Then |
||
1749 | oConn4Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn4Uid & "'") |
||
1750 | If oConn4Rows.Length = 1 Then |
||
1751 | sConn4Type = "Line" |
||
1752 | b08338e3 | Gyusu | End If |
1753 | f9b63682 | Gyusu | Else |
1754 | sConn4Type = "Symbol" |
||
1755 | End If |
||
1756 | b08338e3 | Gyusu | |
1757 | f9b63682 | Gyusu | Dim oStartLMConnector As LMConnector = Nothing |
1758 | Dim oEndLMConnector As LMConnector = Nothing |
||
1759 | Dim objInputs As PlaceRunInputs |
||
1760 | objInputs = New PlaceRunInputs |
||
1761 | Dim iModelingType As Integer = 0 |
||
1762 | 76f465d0 | Gyusu | If sConn1Type <> "" Then |
1763 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1764 | f9b63682 | Gyusu | End If |
1765 | 76f465d0 | Gyusu | If sConn2Type <> "" Then |
1766 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1767 | f9b63682 | Gyusu | End If |
1768 | 76f465d0 | Gyusu | If sConn3Type <> "" Then |
1769 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1770 | f9b63682 | Gyusu | End If |
1771 | 76f465d0 | Gyusu | If sConn4Type <> "" Then |
1772 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1773 | f9b63682 | Gyusu | End If |
1774 | b08338e3 | Gyusu | |
1775 | 76f465d0 | Gyusu | 'If sConn1Type = "Line" Then |
1776 | ' Dim sStartpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn1_Point).ToString() |
||
1777 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1778 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1779 | 'ElseIf sConn1Type = "Symbol" Then |
||
1780 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1781 | 'End If |
||
1782 | |||
1783 | 'If sConn2Type = "Line" Then |
||
1784 | ' Dim sEndpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn2_Point).ToString() |
||
1785 | ' ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y) |
||
1786 | ' ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y) |
||
1787 | 'ElseIf sConn2Type = "Symbol" Then |
||
1788 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1789 | 'End If |
||
1790 | |||
1791 | 'If sConn3Type = "Line" Then |
||
1792 | ' Dim sStartpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn3_Point).ToString() |
||
1793 | ' ConvertPointBystring(sStartpoint, dConn3_x, dConn3_y) |
||
1794 | ' ConvertPointByImage(dConn3_x, dConn3_y, _IMG_X, _IMG_Y) |
||
1795 | 'ElseIf sConn3Type = "Symbol" Then |
||
1796 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1797 | 'End If |
||
1798 | |||
1799 | 'If sConn4Type = "Line" Then |
||
1800 | ' Dim sEndpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn4_Point).ToString() |
||
1801 | ' ConvertPointBystring(sEndpoint, dConn4_x, dConn4_y) |
||
1802 | ' ConvertPointByImage(dConn4_x, dConn4_y, _IMG_X, _IMG_Y) |
||
1803 | 'ElseIf sConn4Type = "Symbol" Then |
||
1804 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1805 | 'End If |
||
1806 | |||
1807 | b08338e3 | Gyusu | |
1808 | |||
1809 | f9b63682 | Gyusu | 'If sConn1Type = "Line" And sConn2Type = "Line" Then |
1810 | ' Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString() |
||
1811 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1812 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1813 | ' Dim sEndpoint As String = oConn1Rows(_XML_LINE_ENDPOINT).ToString() |
||
1814 | ' ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y) |
||
1815 | ' ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y) |
||
1816 | |||
1817 | 'ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
1818 | ' Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString() |
||
1819 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1820 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1821 | |||
1822 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1823 | 'ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
1824 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1825 | |||
1826 | ' Dim sEndpoint As String = oConn1Rows(_XML_LINE_ENDPOINT).ToString() |
||
1827 | ' ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y) |
||
1828 | ' ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y) |
||
1829 | |||
1830 | 'ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
1831 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1832 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1833 | 'ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
1834 | ' Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString() |
||
1835 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1836 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1837 | |||
1838 | 'ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
1839 | ' iModelingType = 6 |
||
1840 | 'ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
1841 | ' iModelingType = 7 |
||
1842 | 'ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
1843 | ' iModelingType = 8 |
||
1844 | 'ElseIf sConn3Type = "Line" And sConn4Type = "Line" Then |
||
1845 | ' iModelingType = 4 |
||
1846 | ' ElseIf sConn3Type = "Line" And sConn4Type = "Symbol" Then |
||
1847 | ' iModelingType = 4 |
||
1848 | ' ElseIf sConn3Type = "Symbol" And sConn4Type = "Line" Then |
||
1849 | ' iModelingType = 4 |
||
1850 | ' ElseIf sConn3Type = "Symbol" And sConn4Type = "Symbol" Then |
||
1851 | ' iModelingType = 4 |
||
1852 | ' ElseIf sConn3Type = "Line" And sConn4Type = "" Then |
||
1853 | ' iModelingType = 5 |
||
1854 | ' ElseIf sConn3Type = "Symbol" And sConn4Type = "" Then |
||
1855 | ' iModelingType = 5 |
||
1856 | ' ElseIf sConn3Type = "" And sConn4Type = "Line" Then |
||
1857 | ' iModelingType = 6 |
||
1858 | ' ElseIf sConn3Type = "" And sConn4Type = "Symbol" Then |
||
1859 | ' iModelingType = 6 |
||
1860 | ' Else |
||
1861 | ' iModelingType = 7 |
||
1862 | ' End If |
||
1863 | |||
1864 | 'If iModelingType = 1 Then |
||
1865 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1866 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1867 | ' ElseIf iModelingType = 2 Then |
||
1868 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1869 | ' ElseIf iModelingType = 3 Then |
||
1870 | ' ConvertPoint(oConn2Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1871 | ' ElseIf iModelingType = 4 Then |
||
1872 | ' ConvertPoint(oConn3Rows(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1873 | ' ConvertPoint(oConn4Rows(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1874 | ' ElseIf iModelingType = 5 Then |
||
1875 | ' ConvertPoint(oConn3Rows(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1876 | ' ElseIf iModelingType = 6 Then |
||
1877 | ' ConvertPoint(oConn4Rows(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1878 | ' End If |
||
1879 | Dim sFirstUid As String = "" |
||
1880 | Dim sSecondUid As String = "" |
||
1881 | Dim oLMSymbol As LMSymbol = Nothing |
||
1882 | 76f465d0 | Gyusu | Dim dPreConn_x As Double = 0 |
1883 | Dim dPreConn_y As Double = 0 |
||
1884 | f9b63682 | Gyusu | If sConn1Type <> "" And sConn2Type <> "" Then |
1885 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1886 | CheckConnectionLine(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1887 | Else |
||
1888 | CheckConnectionSymbolToSymbol(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector) |
||
1889 | End If |
||
1890 | |||
1891 | If sConn2Type = "Line" Then |
||
1892 | CheckConnectionLine(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1893 | Else |
||
1894 | CheckConnectionSymbolToSymbol(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector) |
||
1895 | End If |
||
1896 | |||
1897 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
1898 | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
1899 | 76f465d0 | Gyusu | If oStartLMConnector IsNot Nothing Then |
1900 | dOriginal_x = dConn1_x |
||
1901 | dOriginal_y = dConn1_y |
||
1902 | Else |
||
1903 | dOriginal_x = dConn2_x |
||
1904 | dOriginal_y = dConn2_y |
||
1905 | End If |
||
1906 | |||
1907 | f9b63682 | Gyusu | ElseIf sConn1Type <> "" And sConn2Type = "" Then |
1908 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1909 | CheckConnectionLine(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1910 | Else |
||
1911 | CheckConnectionSymbolToSymbol(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector) |
||
1912 | End If |
||
1913 | |||
1914 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
1915 | dOriginal_x = dConn1_x |
||
1916 | dOriginal_y = dConn1_y |
||
1917 | ElseIf sConn1Type = "" And sConn2Type <> "" Then |
||
1918 | 76f465d0 | Gyusu | |
1919 | If sConn1Type = "Line" Then |
||
1920 | CheckConnectionLine(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1921 | Else |
||
1922 | CheckConnectionSymbolToSymbol(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector) |
||
1923 | End If |
||
1924 | f9b63682 | Gyusu | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
1925 | dOriginal_x = dConn2_x |
||
1926 | dOriginal_y = dConn2_y |
||
1927 | ElseIf sConn3Type <> "" And sConn4Type <> "" Then |
||
1928 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1929 | CheckConnectionLine(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1930 | Else |
||
1931 | CheckConnectionSymbolToSymbol(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector) |
||
1932 | End If |
||
1933 | |||
1934 | If sConn2Type = "Line" Then |
||
1935 | CheckConnectionLine(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1936 | Else |
||
1937 | CheckConnectionSymbolToSymbol(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector) |
||
1938 | End If |
||
1939 | |||
1940 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn3Rows(0)) |
1941 | sSecondUid = CheckExistModeling(oConn4Rows(0)) |
||
1942 | 76f465d0 | Gyusu | If oStartLMConnector IsNot Nothing Then |
1943 | dOriginal_x = dConn3_x |
||
1944 | dOriginal_y = dConn3_y |
||
1945 | Else |
||
1946 | dOriginal_x = dConn4_x |
||
1947 | dOriginal_y = dConn4_y |
||
1948 | End If |
||
1949 | |||
1950 | f9b63682 | Gyusu | ElseIf sConn3Type <> "" And sConn4Type = "" Then |
1951 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1952 | CheckConnectionLine(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1953 | Else |
||
1954 | CheckConnectionSymbolToSymbol(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector) |
||
1955 | End If |
||
1956 | |||
1957 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn3Rows(0)) |
1958 | dOriginal_x = dConn3_x |
||
1959 | dOriginal_y = dConn3_y |
||
1960 | ElseIf sConn3Type = "" And sConn4Type <> "" Then |
||
1961 | 76f465d0 | Gyusu | If sConn2Type = "Line" Then |
1962 | CheckConnectionLine(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1963 | Else |
||
1964 | CheckConnectionSymbolToSymbol(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector) |
||
1965 | End If |
||
1966 | |||
1967 | f9b63682 | Gyusu | sSecondUid = CheckExistModeling(oConn4Rows(0)) |
1968 | dOriginal_x = dConn4_x |
||
1969 | dOriginal_y = dConn4_y |
||
1970 | Else |
||
1971 | 76f465d0 | Gyusu | ' oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
1972 | f9b63682 | Gyusu | End If |
1973 | b08338e3 | Gyusu | |
1974 | f9b63682 | Gyusu | If sFirstUid <> "" And sSecondUid <> "" Then |
1975 | sReturnUid = sSecondUid |
||
1976 | ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
1977 | sReturnUid = sFirstUid |
||
1978 | ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
1979 | sReturnUid = sFirstUid |
||
1980 | 76f465d0 | Gyusu | ElseIf sSecondUid <> "" And sFirstUid = "" Then |
1981 | sReturnUid = sSecondUid |
||
1982 | ElseIf sSecondUid <> "" And sFirstUid = "" Then |
||
1983 | sReturnUid = sSecondUid |
||
1984 | f9b63682 | Gyusu | Else |
1985 | sReturnUid = "" |
||
1986 | End If |
||
1987 | b08338e3 | Gyusu | |
1988 | 76f465d0 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
1989 | f9b63682 | Gyusu | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
1990 | 76f465d0 | Gyusu | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
1991 | Else |
||
1992 | If oStartLMConnector IsNot Nothing And oEndLMConnector IsNot Nothing Then |
||
1993 | 'oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle, ExistingItem:=oStartLMConnector.AsLMAItem, |
||
1994 | ' TargetItem:=oEndLMConnector.AsLMAItem) |
||
1995 | 'oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
1996 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
||
1997 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
1998 | ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then |
||
1999 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle,, |
||
2000 | TargetItem:=oStartLMConnector.AsLMAItem) |
||
2001 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2002 | ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then |
||
2003 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle,, |
||
2004 | TargetItem:=oEndLMConnector.AsLMAItem) |
||
2005 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2006 | Else |
||
2007 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
||
2008 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2009 | End If |
||
2010 | b08338e3 | Gyusu | End If |
2011 | 76f465d0 | Gyusu | AddProgress() |
2012 | b08338e3 | Gyusu | |
2013 | f9b63682 | Gyusu | SetListBoxItems(ListBox_Result, "Place Fitting.." & sUid & " (" & dOriginal_x & "," & dOriginal_y & ")..." & _iFittingcnt & " count ") |
2014 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Fitting : " & sUid) |
||
2015 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
2016 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "ModelingType : " & iModelingType) |
||
2017 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn1_Point : " & dConn1_x & "," & dConn1_y) |
||
2018 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn2_Point : " & dConn2_x & "," & dConn2_y) |
||
2019 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn3_Point : " & dConn3_x & "," & dConn3_y) |
||
2020 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn4_Point : " & dConn4_x & "," & dConn4_y) |
||
2021 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
2022 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
2023 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection3 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()) |
||
2024 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection4 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()) |
||
2025 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
2026 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dOriginal_x & "," & dOriginal_y) |
||
2027 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Fitting Count : " & _iFittingcnt) |
||
2028 | _iFittingcnt = _iFittingcnt + 1 |
||
2029 | oCurrentSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
2030 | 76f465d0 | Gyusu | Dim oAttributeRow() As DataRow |
2031 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
||
2032 | If oAttribute_Dt.Rows.Count > 0 Then |
||
2033 | f9b63682 | Gyusu | |
2034 | 76f465d0 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
2035 | Dim oInstrument As LMInstrument |
||
2036 | oInstrument = _Placement.PIDDataSource.GetInstrument(oLMSymbol.ModelItemID) |
||
2037 | Try |
||
2038 | If oAttributeRow.Length > 0 Then |
||
2039 | For Each oAttribute In oAttributeRow |
||
2040 | Try |
||
2041 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2042 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2043 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2044 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2045 | Catch ex As Exception |
||
2046 | End Try |
||
2047 | Next |
||
2048 | oInstrument.Commit() |
||
2049 | End If |
||
2050 | Catch ex As Exception |
||
2051 | End Try |
||
2052 | Else |
||
2053 | f9b63682 | Gyusu | Try |
2054 | 76f465d0 | Gyusu | If oAttributeRow.Length > 0 And oLMSymbol IsNot Nothing Then |
2055 | For Each oAttribute In oAttributeRow |
||
2056 | Try |
||
2057 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2058 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2059 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2060 | oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2061 | |||
2062 | Catch ex As Exception |
||
2063 | End Try |
||
2064 | Next |
||
2065 | oLMSymbol.Commit() |
||
2066 | f9b63682 | Gyusu | End If |
2067 | Catch ex As Exception |
||
2068 | End Try |
||
2069 | 76f465d0 | Gyusu | End If |
2070 | f9b63682 | Gyusu | End If |
2071 | 76f465d0 | Gyusu | 'Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
2072 | 'If oAttributeRow.Length > 0 Then |
||
2073 | ' For Each oAttribute In oAttributeRow |
||
2074 | ' Try |
||
2075 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2076 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2077 | ' If sPIDValue.Contains("'") Then |
||
2078 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
2079 | ' End If |
||
2080 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2081 | ' oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2082 | ' Catch ex As Exception |
||
2083 | ' End Try |
||
2084 | ' Next |
||
2085 | 'End If |
||
2086 | b08338e3 | Gyusu | |
2087 | f9b63682 | Gyusu | Return sReturnUid |
2088 | b08338e3 | Gyusu | |
2089 | |||
2090 | f9b63682 | Gyusu | '현재 Uid 모델링 |
2091 | End Function |
||
2092 | b08338e3 | Gyusu | |
2093 | f9b63682 | Gyusu | Private Function CheckExistModeling(ByVal oRow As DataRow) As String |
2094 | If oRow(_XML_LINE_DRAWING_TF).ToString() = "FALSE" And oRow(_XML_LINE_Check).ToString() = "TRUE" Then |
||
2095 | Return oRow(_XML_LINE_UID).ToString() |
||
2096 | End If |
||
2097 | Return String.Empty |
||
2098 | End Function |
||
2099 | b08338e3 | Gyusu | |
2100 | |||
2101 | f9b63682 | Gyusu | Private Sub ConvertPoint(ByVal sOriginalPoint As String, ByRef dConn1_x As Double, ByRef dConn1_y As Double) |
2102 | ConvertPointBystring(sOriginalPoint, dConn1_x, dConn1_y) |
||
2103 | ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
2104 | End Sub |
||
2105 | b08338e3 | Gyusu | |
2106 | 76f465d0 | Gyusu | |
2107 | |||
2108 | |||
2109 | 'Dim _StartPos_X As Double = 0 |
||
2110 | 'Dim _StartPos_Y As Double = 0 |
||
2111 | 'Dim _EndPos_X As Double = 0 |
||
2112 | 'Dim _EndPos_Y As Double = 0 |
||
2113 | 'Dim _StartUid As String = "" |
||
2114 | 'Dim _EndUid As String = "" |
||
2115 | 'Dim _objInputs As PlaceRunInputs |
||
2116 | 'Dim _ListPos As New List(Of String) |
||
2117 | 'Dim _Direction As String = "" |
||
2118 | 'Private Function FinalLineModeling(ByVal oCurrentLineRow As DataRow, |
||
2119 | ' ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, |
||
2120 | ' ByVal oAttribute_Dt As DataTable) As String |
||
2121 | ' Dim sReturnUid As String = "" |
||
2122 | ' '현재 Uid 모델링 여부 체크 |
||
2123 | ' Dim sStartpoint As String = "" |
||
2124 | ' Dim sEndpoint As String = "" |
||
2125 | |||
2126 | ' Dim dOriginalStart_x As Double = 0.0 |
||
2127 | ' Dim dOriginalStart_y As Double = 0.0 |
||
2128 | ' Dim dOriginalEnd_x As Double = 0.0 |
||
2129 | ' Dim dOriginalEnd_y As Double = 0.0 |
||
2130 | |||
2131 | ' Dim dConvertStart_x As Double = 0 |
||
2132 | ' Dim dConvertStart_y As Double = 0 |
||
2133 | ' Dim dConvertEnd_x As Double = 0 |
||
2134 | ' Dim dConvertEnd_y As Double = 0 |
||
2135 | |||
2136 | |||
2137 | ' Dim dCenterPos_x As Double = 0.0 |
||
2138 | ' Dim dCenterPos_y As Double = 0.0 |
||
2139 | ' Dim objItem As LMAItem |
||
2140 | |||
2141 | ' Dim sUid As String = oCurrentLineRow(_XML_LINE_UID).ToString() |
||
2142 | ' Dim sLineType As String = oCurrentLineRow(_XML_LINE_TYPE).ToString() |
||
2143 | ' Dim sSystemPath As String = GetPipeType(sLineType) |
||
2144 | ' Dim sLineNoText As String = oCurrentLineRow(_XML_LINENO_TEXT).ToString() |
||
2145 | ' Dim sLineNoUid As String = oCurrentLineRow(_XML_LINE_LINENOUID).ToString() |
||
2146 | ' sStartpoint = oCurrentLineRow(_XML_LINE_STARTPOINT).ToString() |
||
2147 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2148 | ' ConvertPointByImage(dConvertStart_x, dConvertStart_y, _IMG_X, _IMG_Y) |
||
2149 | ' sEndpoint = oCurrentLineRow(_XML_LINE_ENDPOINT).ToString() |
||
2150 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2151 | ' ConvertPointByImage(dConvertEnd_x, dConvertEnd_y, _IMG_X, _IMG_Y) |
||
2152 | |||
2153 | ' dCenterPos_x = Math.Abs(dOriginalStart_x + dOriginalEnd_x) / 2 |
||
2154 | ' dCenterPos_y = Math.Abs(dOriginalStart_y + dOriginalEnd_y) / 2 |
||
2155 | |||
2156 | ' If _Direction = "" Then |
||
2157 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2158 | ' _Direction = "X" |
||
2159 | ' Else |
||
2160 | ' _Direction = "Y" |
||
2161 | ' End If |
||
2162 | ' Else |
||
2163 | ' If _Direction = "X" Then |
||
2164 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) < Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2165 | |||
2166 | ' End If |
||
2167 | ' Else |
||
2168 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2169 | |||
2170 | ' End If |
||
2171 | ' End If |
||
2172 | ' End If |
||
2173 | |||
2174 | |||
2175 | ' 'Connection 정보 체크, 모델링 되어 있는지 유무 |
||
2176 | ' '양 커넥션의 모델링 유무를 체크한다. |
||
2177 | ' Dim sConn1Uid As String = oCurrentLineRow(_XML_LINE_Conn1_Uid).ToString() |
||
2178 | ' Dim sConn2Uid As String = oCurrentLineRow(_XML_LINE_Conn2_Uid).ToString() |
||
2179 | ' Dim sConn1Type As String = "" |
||
2180 | ' Dim sConn2Type As String = "" |
||
2181 | |||
2182 | ' Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'" & |
||
2183 | ' " And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'" & |
||
2184 | ' " And [" & _XML_SYMBOL_Check & "] = 'True'") |
||
2185 | ' If oConn1Rows.Length = 0 Then |
||
2186 | ' oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'" & |
||
2187 | ' " And [" & _XML_LINE_DRAWING_TF & "] = 'False'" & |
||
2188 | ' " And [" & _XML_LINE_Check & "] = 'True'") |
||
2189 | ' If oConn1Rows.Length = 1 Then |
||
2190 | ' sConn1Type = "Line" |
||
2191 | ' End If |
||
2192 | ' Else |
||
2193 | ' sConn1Type = "Symbol" |
||
2194 | ' End If |
||
2195 | |||
2196 | ' Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'" & |
||
2197 | ' " And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'" & |
||
2198 | ' " And [" & _XML_SYMBOL_Check & "] = 'True'") |
||
2199 | ' If oConn2Rows.Length = 0 Then |
||
2200 | ' oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'" & |
||
2201 | ' " And [" & _XML_LINE_DRAWING_TF & "] = 'False'" & |
||
2202 | ' " And [" & _XML_LINE_Check & "] = 'True'") |
||
2203 | ' If oConn2Rows.Length = 1 Then |
||
2204 | ' sConn2Type = "Line" |
||
2205 | ' End If |
||
2206 | ' Else |
||
2207 | ' sConn2Type = "Symbol" |
||
2208 | ' End If |
||
2209 | |||
2210 | |||
2211 | ' If _StartPos_X = 0 And _StartPos_Y = 0 Then |
||
2212 | ' _StartPos_X = dOriginalStart_x |
||
2213 | ' _StartPos_Y = dOriginalStart_y |
||
2214 | ' _ListPos.Add(_StartPos_X & "," & _StartPos_Y) |
||
2215 | ' End If |
||
2216 | ' Dim iModelingType As Integer = 0 |
||
2217 | ' If sConn1Type = "Line" And sConn2Type = "Line" Then |
||
2218 | ' sReturnUid = sConn2Uid |
||
2219 | ' ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
2220 | ' sReturnUid = sConn2Uid |
||
2221 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
2222 | ' sReturnUid = sConn2Uid |
||
2223 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
2224 | ' sReturnUid = sConn2Uid |
||
2225 | ' ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
2226 | ' sReturnUid = sConn1Uid |
||
2227 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
2228 | ' sReturnUid = sConn1Uid |
||
2229 | ' ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
2230 | ' sReturnUid = sConn2Uid |
||
2231 | ' ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
2232 | ' sReturnUid = sConn2Uid |
||
2233 | ' Else |
||
2234 | ' sReturnUid = "" |
||
2235 | ' _EndPos_X = dOriginalEnd_x |
||
2236 | ' _EndPos_Y = dOriginalEnd_y |
||
2237 | ' End If |
||
2238 | |||
2239 | |||
2240 | ' Dim sConn1LineNo As String = "" |
||
2241 | ' If oConn1Rows.Length = 1 Then |
||
2242 | |||
2243 | ' End If |
||
2244 | ' Dim sConn2LineNo As String = "" |
||
2245 | ' If oConn2Rows.Length = 1 Then |
||
2246 | |||
2247 | ' End If |
||
2248 | ' Dim oStartLMConnector As LMConnector = Nothing |
||
2249 | ' Dim oEndLMConnector As LMConnector = Nothing |
||
2250 | ' Dim oLMSymbol1 As LMSymbol = Nothing |
||
2251 | ' Dim oLMSymbol2 As LMSymbol = Nothing |
||
2252 | ' Dim objInputs As PlaceRunInputs |
||
2253 | ' objInputs = New PlaceRunInputs |
||
2254 | |||
2255 | ' If sConn1Type = "Line" And sConn2Type = "Line" Then |
||
2256 | ' iModelingType = 1 |
||
2257 | ' ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
2258 | ' iModelingType = 1 |
||
2259 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
2260 | ' iModelingType = 1 |
||
2261 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
2262 | ' iModelingType = 1 |
||
2263 | ' ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
2264 | ' iModelingType = 2 |
||
2265 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
2266 | ' iModelingType = 2 |
||
2267 | ' ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
2268 | ' iModelingType = 3 |
||
2269 | ' ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
2270 | ' iModelingType = 3 |
||
2271 | ' Else |
||
2272 | ' iModelingType = 4 |
||
2273 | ' End If |
||
2274 | |||
2275 | ' If iModelingType = 1 Then |
||
2276 | ' If sConn1Type = "Line" Then |
||
2277 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2278 | ' Else |
||
2279 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2280 | ' End If |
||
2281 | ' If sConn1Type = "Line" Then |
||
2282 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2283 | ' Else |
||
2284 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2285 | ' End If |
||
2286 | ' 'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2287 | ' 'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2288 | ' ElseIf iModelingType = "2" Then |
||
2289 | ' If sConn1Type = "Line" Then |
||
2290 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2291 | ' Else |
||
2292 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2293 | ' End If |
||
2294 | ' ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2295 | ' ElseIf iModelingType = "3" Then |
||
2296 | ' If sConn1Type = "Line" Then |
||
2297 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2298 | ' Else |
||
2299 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2300 | ' End If |
||
2301 | ' ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector) |
||
2302 | |||
2303 | ' Else |
||
2304 | ' 'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2305 | ' 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2306 | ' End If |
||
2307 | |||
2308 | ' Dim sFirstUid As String = "" |
||
2309 | ' Dim sSecondUid As String = "" |
||
2310 | |||
2311 | ' If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then |
||
2312 | ' objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2313 | ' objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2314 | ' 'sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2315 | ' 'sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2316 | ' ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then |
||
2317 | ' If sConn1Type = "Line" Then |
||
2318 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2319 | ' Else |
||
2320 | ' objInputs.AddSymbolTarget(oLMSymbol1, dOriginalStart_x, dOriginalStart_y) |
||
2321 | ' End If |
||
2322 | |||
2323 | ' objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2324 | ' ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2325 | ' ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then |
||
2326 | ' If sConn2Type = "Line" Then |
||
2327 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalEnd_x, dOriginalEnd_y) |
||
2328 | ' Else |
||
2329 | ' objInputs.AddSymbolTarget(oLMSymbol2, dOriginalEnd_x, dOriginalEnd_y) |
||
2330 | ' End If |
||
2331 | |||
2332 | ' objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2333 | |||
2334 | ' 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2335 | |||
2336 | ' ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2337 | ' Else |
||
2338 | ' If sConn1Type = "Line" Then |
||
2339 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2340 | ' Else |
||
2341 | ' objInputs.AddSymbolTarget(oLMSymbol1, dOriginalStart_x, dOriginalStart_y) |
||
2342 | ' End If |
||
2343 | ' If sConn2Type = "Line" Then |
||
2344 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalEnd_x, dOriginalEnd_y) |
||
2345 | ' Else |
||
2346 | ' objInputs.AddSymbolTarget(oLMSymbol2, dOriginalEnd_x, dOriginalEnd_y) |
||
2347 | ' End If |
||
2348 | ' 'objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2349 | ' 'objInputs.AddConnectorTarget(oEndLMConnector, dOriginalEnd_x, dOriginalEnd_y) |
||
2350 | ' End If |
||
2351 | ' If sConn1Type <> "" And sConn2Type <> "" Then |
||
2352 | ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2353 | ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2354 | ' ElseIf sConn1Type <> "" And sConn2Type = "" Then |
||
2355 | ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2356 | ' ElseIf sConn1Type = "" And sConn2Type <> "" Then |
||
2357 | ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2358 | ' End If |
||
2359 | |||
2360 | ' If sFirstUid <> "" And sSecondUid <> "" Then |
||
2361 | ' sReturnUid = sSecondUid |
||
2362 | ' ElseIf sFirstUid = "" And sSecondUid <> "" Then |
||
2363 | ' sReturnUid = sSecondUid |
||
2364 | ' ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
2365 | ' sReturnUid = sFirstUid |
||
2366 | ' Else |
||
2367 | ' sReturnUid = "" |
||
2368 | ' End If |
||
2369 | ' _iPipecnt = _iPipecnt + 1 |
||
2370 | ' Dim oCurrentConnector As LMConnector |
||
2371 | |||
2372 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
2373 | ' Try |
||
2374 | ' objInputs.Clear() |
||
2375 | ' objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2376 | ' objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2377 | ' oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2378 | ' Catch ex As Exception |
||
2379 | |||
2380 | ' End Try |
||
2381 | |||
2382 | ' oCurrentLineRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector |
||
2383 | ' oCurrentLineRow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2384 | |||
2385 | ' SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ")..." & _iPipecnt & " count ") |
||
2386 | |||
2387 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
2388 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
2389 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentLineRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
2390 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentLineRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
2391 | ' 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
2392 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dOriginalStart_x & "," & dOriginalStart_y) |
||
2393 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dOriginalEnd_x & "," & dOriginalEnd_y) |
||
2394 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
2395 | |||
2396 | ' Dim oPipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(oCurrentConnector.ModelItemID) |
||
2397 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2398 | ' If oAttributeRow.Length > 0 Then |
||
2399 | ' For Each oAttribute In oAttributeRow |
||
2400 | ' Try |
||
2401 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2402 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2403 | ' If sPIDValue.Contains("'") Then |
||
2404 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
2405 | ' End If |
||
2406 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2407 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2408 | ' Catch ex As Exception |
||
2409 | ' End Try |
||
2410 | ' Next |
||
2411 | ' oPipeRun.Commit() |
||
2412 | ' End If |
||
2413 | |||
2414 | ' Dim sID_1 As String = "" |
||
2415 | ' Dim sID_2 As String = "" |
||
2416 | ' If oStartLMConnector IsNot Nothing Then |
||
2417 | ' sID_1 = oStartLMConnector.ModelItemID |
||
2418 | ' sID_2 = oCurrentConnector.ModelItemID |
||
2419 | ' ElseIf oEndLMConnector IsNot Nothing Then |
||
2420 | ' sID_1 = oEndLMConnector.ModelItemID |
||
2421 | ' sID_2 = oCurrentConnector.ModelItemID |
||
2422 | ' End If |
||
2423 | ' If sID_1 <> "" And sID_2 <> "" Then |
||
2424 | ' ' Dim objSurvivorItem As LMAItem = Nothing |
||
2425 | ' ' Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1) |
||
2426 | ' ' Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2) |
||
2427 | ' ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
2428 | ' End If |
||
2429 | ' Return sReturnUid |
||
2430 | ' '현재 Uid 모델링 |
||
2431 | 'End Function |
||
2432 | f9b63682 | Gyusu | Private Function FinalLineModeling(ByVal oCurrentLineRow As DataRow, |
2433 | ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, |
||
2434 | ByVal oAttribute_Dt As DataTable) As String |
||
2435 | Dim sReturnUid As String = "" |
||
2436 | 76f465d0 | Gyusu | Try |
2437 | f9b63682 | Gyusu | |
2438 | 76f465d0 | Gyusu | '현재 Uid 모델링 여부 체크 |
2439 | 'Dim sStartpoint As String = "" |
||
2440 | 'Dim sEndpoint As String = "" |
||
2441 | 'Dim dOriginalStart_x As Double = 0.0 |
||
2442 | 'Dim dOriginalStart_y As Double = 0.0 |
||
2443 | 'Dim dOriginalEnd_x As Double = 0.0 |
||
2444 | 'Dim dOriginalEnd_y As Double = 0.0 |
||
2445 | Dim dCenterPos_x As Double = 0.0 |
||
2446 | Dim dCenterPos_y As Double = 0.0 |
||
2447 | Dim objItem As LMAItem |
||
2448 | f9b63682 | Gyusu | |
2449 | 76f465d0 | Gyusu | Dim sUid As String = oCurrentLineRow(_XML_LINE_UID).ToString() |
2450 | Dim sLineType As String = oCurrentLineRow(_XML_LINE_TYPE).ToString() |
||
2451 | Dim sSystemPath As String = GetPipeType(sLineType) |
||
2452 | Dim sLineNoText As String = oCurrentLineRow(_XML_LINENO_TEXT).ToString() |
||
2453 | Dim sLineNoUid As String = oCurrentLineRow(_XML_LINE_LINENOUID).ToString() |
||
2454 | 'sStartpoint = oCurrentLineRow(_XML_LINE_STARTPOINT).ToString() |
||
2455 | 'ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2456 | 'ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
2457 | 'sEndpoint = oCurrentLineRow(_XML_LINE_ENDPOINT).ToString() |
||
2458 | 'ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2459 | 'ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
2460 | f9b63682 | Gyusu | |
2461 | 76f465d0 | Gyusu | |
2462 | Dim dStart_Dwg_x As Double = oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_X) |
||
2463 | Dim dStart_Dwg_y As Double = oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_Y) |
||
2464 | Dim dEnd_Dwg_x As Double = oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_X) |
||
2465 | Dim dEnd_Dwg_y As Double = oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_Y) |
||
2466 | Dim sPreFlowDirection As String = "" |
||
2467 | Dim sFlowDirection As String = oCurrentLineRow(_XML_LINE_FlowDirection) |
||
2468 | |||
2469 | Dim sPreConn1Direction As String = "" |
||
2470 | Dim sPreConn2Direction As String = "" |
||
2471 | Dim sDirection As String = oCurrentLineRow(_XML_LINE_Direction) |
||
2472 | |||
2473 | dCenterPos_x = Math.Abs(dStart_Dwg_x + dEnd_Dwg_x) / 2 |
||
2474 | dCenterPos_y = Math.Abs(dStart_Dwg_y + dEnd_Dwg_y) / 2 |
||
2475 | |||
2476 | |||
2477 | Dim oPidDataSource As LMADataSource = Nothing |
||
2478 | |||
2479 | Try |
||
2480 | oPidDataSource = _Placement.PIDDataSource |
||
2481 | Catch ex As Exception |
||
2482 | CheckOpenDrawing() |
||
2483 | oPidDataSource = _Placement.PIDDataSource |
||
2484 | End Try |
||
2485 | |||
2486 | 'Connection 정보 체크, 모델링 되어 있는지 유무 |
||
2487 | '양 커넥션의 모델링 유무를 체크한다. |
||
2488 | Dim sConn1Uid As String = oCurrentLineRow(_XML_LINE_Conn1_Uid).ToString() |
||
2489 | Dim sConn2Uid As String = oCurrentLineRow(_XML_LINE_Conn2_Uid).ToString() |
||
2490 | Dim sConn1Type As String = "" |
||
2491 | Dim sConn2Type As String = "" |
||
2492 | |||
2493 | Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'") |
||
2494 | If oConn1Rows.Length = 0 Then |
||
2495 | oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'") |
||
2496 | If oConn1Rows.Length = 1 Then |
||
2497 | sConn1Type = "Line" |
||
2498 | 'sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString() |
||
2499 | 'If sDirection = sPreConn1Direction Then |
||
2500 | ' If sDirection = "X" Then |
||
2501 | ' dStart_Dwg_y = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2502 | ' dEnd_Dwg_y = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2503 | ' Else |
||
2504 | ' dStart_Dwg_x = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2505 | ' dEnd_Dwg_x = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2506 | ' End If |
||
2507 | 'End If |
||
2508 | |||
2509 | End If |
||
2510 | Else |
||
2511 | sConn1Type = "Symbol" |
||
2512 | End If |
||
2513 | |||
2514 | Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'") |
||
2515 | If oConn2Rows.Length = 0 Then |
||
2516 | oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'") |
||
2517 | If oConn2Rows.Length = 1 Then |
||
2518 | sConn2Type = "Line" |
||
2519 | 'sPreConn2Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString() |
||
2520 | 'If sDirection = sPreConn2Direction Then |
||
2521 | ' If sDirection = "X" Then |
||
2522 | ' dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2523 | ' dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2524 | ' Else |
||
2525 | ' dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2526 | ' dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2527 | ' End If |
||
2528 | 'End If |
||
2529 | End If |
||
2530 | Else |
||
2531 | sConn2Type = "Symbol" |
||
2532 | End If |
||
2533 | |||
2534 | |||
2535 | |||
2536 | |||
2537 | Dim sConn1LineNo As String = "" |
||
2538 | Dim sConn2LineNo As String = "" |
||
2539 | Dim oStartLMConnector As LMConnector = Nothing |
||
2540 | Dim oEndLMConnector As LMConnector = Nothing |
||
2541 | Dim oLMSymbol1 As LMSymbol = Nothing |
||
2542 | Dim oLMSymbol2 As LMSymbol = Nothing |
||
2543 | Dim objInputs As PlaceRunInputs |
||
2544 | objInputs = New PlaceRunInputs |
||
2545 | Dim iModelingType As Integer = 0 |
||
2546 | If sConn1Type = "Line" And sConn2Type = "Line" Then |
||
2547 | iModelingType = 1 |
||
2548 | ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
2549 | iModelingType = 1 |
||
2550 | ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
2551 | iModelingType = 1 |
||
2552 | ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
2553 | iModelingType = 1 |
||
2554 | ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
2555 | iModelingType = 2 |
||
2556 | ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
2557 | iModelingType = 2 |
||
2558 | ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
2559 | iModelingType = 3 |
||
2560 | ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
2561 | iModelingType = 3 |
||
2562 | Else |
||
2563 | iModelingType = 4 |
||
2564 | End If |
||
2565 | |||
2566 | Dim dPreConnX As Double = 0 |
||
2567 | Dim dPreConnY As Double = 0 |
||
2568 | |||
2569 | CheckConnectionLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, dPreConnX, dPreConnY) |
||
2570 | If oStartLMConnector Is Nothing Then |
||
2571 | oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2572 | If oLMSymbol1 IsNot Nothing Then |
||
2573 | sConn1Type = "Symbol" |
||
2574 | Else |
||
2575 | sConn1Type = "" |
||
2576 | End If |
||
2577 | Else |
||
2578 | f9b63682 | Gyusu | sConn1Type = "Line" |
2579 | 76f465d0 | Gyusu | sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString() |
2580 | If sDirection = sPreConn1Direction Then |
||
2581 | If sDirection = "X" Then |
||
2582 | dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2583 | dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2584 | Else |
||
2585 | dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2586 | dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2587 | End If |
||
2588 | End If |
||
2589 | |||
2590 | b08338e3 | Gyusu | End If |
2591 | 76f465d0 | Gyusu | CheckConnectionLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, dPreConnX, dPreConnY) |
2592 | If oEndLMConnector Is Nothing Then |
||
2593 | oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2594 | If oLMSymbol2 IsNot Nothing Then |
||
2595 | sConn2Type = "Symbol" |
||
2596 | End If |
||
2597 | Else |
||
2598 | f9b63682 | Gyusu | sConn2Type = "Line" |
2599 | 76f465d0 | Gyusu | sPreConn2Direction = oConn2Rows(0)(_XML_LINE_Direction).ToString() |
2600 | If sDirection = sPreConn2Direction Then |
||
2601 | If sDirection = "X" Then |
||
2602 | dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2603 | dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2604 | Else |
||
2605 | dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2606 | dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2607 | End If |
||
2608 | End If |
||
2609 | b08338e3 | Gyusu | End If |
2610 | 76f465d0 | Gyusu | 'If iModelingType = 1 Then |
2611 | ' If sConn1Type = "Line" Then |
||
2612 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2613 | ' Else |
||
2614 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2615 | ' End If |
||
2616 | ' If sConn1Type = "Line" Then |
||
2617 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2618 | ' Else |
||
2619 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2620 | ' End If |
||
2621 | ' 'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2622 | ' 'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2623 | 'ElseIf iModelingType = "2" Then |
||
2624 | ' If sConn1Type = "Line" Then |
||
2625 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2626 | ' Else |
||
2627 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2628 | ' End If |
||
2629 | ' ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2630 | 'ElseIf iModelingType = "3" Then |
||
2631 | ' If sConn1Type = "Line" Then |
||
2632 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2633 | ' Else |
||
2634 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2635 | ' End If |
||
2636 | ' ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector) |
||
2637 | b08338e3 | Gyusu | |
2638 | 76f465d0 | Gyusu | 'Else |
2639 | ' 'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2640 | ' 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2641 | 'End If |
||
2642 | b08338e3 | Gyusu | |
2643 | 76f465d0 | Gyusu | Dim sFirstUid As String = "" |
2644 | Dim sSecondUid As String = "" |
||
2645 | Try |
||
2646 | If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then |
||
2647 | objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y) |
||
2648 | objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y) |
||
2649 | 'sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2650 | 'sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2651 | ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then |
||
2652 | If sConn1Type = "Line" Then |
||
2653 | objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y) |
||
2654 | Else |
||
2655 | objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y) |
||
2656 | End If |
||
2657 | b08338e3 | Gyusu | |
2658 | 76f465d0 | Gyusu | objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y) |
2659 | ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2660 | ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then |
||
2661 | If sConn2Type = "Line" Then |
||
2662 | objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2663 | Else |
||
2664 | objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2665 | End If |
||
2666 | b08338e3 | Gyusu | |
2667 | 76f465d0 | Gyusu | objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y) |
2668 | f9b63682 | Gyusu | |
2669 | 76f465d0 | Gyusu | 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
2670 | b08338e3 | Gyusu | |
2671 | 76f465d0 | Gyusu | ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
2672 | Else |
||
2673 | If sConn1Type = "Line" Then |
||
2674 | objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y) |
||
2675 | Else |
||
2676 | objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y) |
||
2677 | End If |
||
2678 | If sConn2Type = "Line" Then |
||
2679 | objInputs.AddConnectorTarget(oStartLMConnector, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2680 | Else |
||
2681 | objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2682 | End If |
||
2683 | 'objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2684 | 'objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dOriginalEnd_y) |
||
2685 | End If |
||
2686 | If sConn1Type <> "" And sConn2Type <> "" Then |
||
2687 | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2688 | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2689 | ElseIf sConn1Type <> "" And sConn2Type = "" Then |
||
2690 | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2691 | ElseIf sConn1Type = "" And sConn2Type <> "" Then |
||
2692 | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2693 | End If |
||
2694 | f9b63682 | Gyusu | |
2695 | 76f465d0 | Gyusu | If sFirstUid <> "" And sSecondUid <> "" Then |
2696 | sReturnUid = sSecondUid |
||
2697 | ElseIf sFirstUid = "" And sSecondUid <> "" Then |
||
2698 | sReturnUid = sSecondUid |
||
2699 | ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
2700 | sReturnUid = sFirstUid |
||
2701 | Else |
||
2702 | sReturnUid = "" |
||
2703 | End If |
||
2704 | _iPipecnt = _iPipecnt + 1 |
||
2705 | Dim oCurrentConnector As LMConnector = Nothing |
||
2706 | f9b63682 | Gyusu | |
2707 | 76f465d0 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
2708 | f9b63682 | Gyusu | Try |
2709 | 76f465d0 | Gyusu | If Chk_OnlyPoint.Checked Then |
2710 | objInputs.Clear() |
||
2711 | objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y) |
||
2712 | objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y) |
||
2713 | oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2714 | Else |
||
2715 | oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2716 | f9b63682 | Gyusu | End If |
2717 | 76f465d0 | Gyusu | AddProgress() |
2718 | |||
2719 | f9b63682 | Gyusu | Catch ex As Exception |
2720 | 76f465d0 | Gyusu | |
2721 | f9b63682 | Gyusu | End Try |
2722 | 76f465d0 | Gyusu | If oCurrentConnector IsNot Nothing Then |
2723 | oCurrentLineRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector |
||
2724 | oCurrentLineRow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2725 | |||
2726 | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dStart_Dwg_x & "," & dStart_Dwg_y & ") - (" & dEnd_Dwg_x & "," & dEnd_Dwg_y & ")..." & _iPipecnt & " count ") |
||
2727 | |||
2728 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
2729 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
2730 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentLineRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
2731 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentLineRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
2732 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
2733 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dStart_Dwg_x & "," & dStart_Dwg_y) |
||
2734 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dEnd_Dwg_x & "," & dEnd_Dwg_y) |
||
2735 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
2736 | |||
2737 | Dim oPipeRun As LMPipeRun = oPidDataSource.GetPipeRun(oCurrentConnector.ModelItemID) |
||
2738 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2739 | If oAttributeRow.Length > 0 Then |
||
2740 | For Each oAttribute In oAttributeRow |
||
2741 | Try |
||
2742 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2743 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2744 | If sPIDValue.Contains("'") Then |
||
2745 | sPIDValue = sPIDValue.Replace("'", """") |
||
2746 | End If |
||
2747 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2748 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2749 | Catch ex As Exception |
||
2750 | End Try |
||
2751 | Next |
||
2752 | oPipeRun.Commit() |
||
2753 | End If |
||
2754 | |||
2755 | Dim sID_1 As String = "" |
||
2756 | Dim sID_2 As String = "" |
||
2757 | If oStartLMConnector IsNot Nothing Then |
||
2758 | sID_1 = oStartLMConnector.ModelItemID |
||
2759 | sID_2 = oCurrentConnector.ModelItemID |
||
2760 | ElseIf oEndLMConnector IsNot Nothing Then |
||
2761 | sID_1 = oEndLMConnector.ModelItemID |
||
2762 | sID_2 = oCurrentConnector.ModelItemID |
||
2763 | End If |
||
2764 | If sID_1 <> "" And sID_2 <> "" Then |
||
2765 | 'Dim objSurvivorItem As LMAItem = Nothing |
||
2766 | 'Dim oPipeRun1 As LMPipeRun = oPidDataSource.GetPipeRun(sID_1) |
||
2767 | 'Dim oPipeRun2 As LMPipeRun = oPidDataSource.GetPipeRun(sID_2) |
||
2768 | '_Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
2769 | End If |
||
2770 | Else |
||
2771 | sReturnUid = "" |
||
2772 | End If |
||
2773 | Catch ex As Exception |
||
2774 | |||
2775 | End Try |
||
2776 | |||
2777 | |||
2778 | Catch ex As Exception |
||
2779 | |||
2780 | End Try |
||
2781 | |||
2782 | b08338e3 | Gyusu | |
2783 | f9b63682 | Gyusu | Return sReturnUid |
2784 | b08338e3 | Gyusu | '현재 Uid 모델링 |
2785 | f9b63682 | Gyusu | End Function |
2786 | bb2a0c79 | Gyusu | |
2787 | Private Sub PipingModeling() |
||
2788 | e4000111 | Gyusu | |
2789 | 171ac39d | Gyusu | Try |
2790 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
2791 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
2792 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
2793 | 54b98e09 | Gyusu | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
2794 | If CDrawing IsNot Nothing Then |
||
2795 | e4000111 | Gyusu | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
2796 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
2797 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
2798 | Dim iItemcnt As Integer = 0 |
||
2799 | Dim sNodeUid As String = oNode.Name |
||
2800 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
2801 | '1.Equipment |
||
2802 | '2.Piping OPC |
||
2803 | '3.OPC 시작되는 Line |
||
2804 | 'Equipment 생성 |
||
2805 | 'If sNodeUid <> "PipeLineNo" Then |
||
2806 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
2807 | b08338e3 | Gyusu | |
2808 | e4000111 | Gyusu | If CLineNo IsNot Nothing Then |
2809 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
2810 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
2811 | Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
||
2812 | Dim oDrawLinenoLabel As Boolean = False |
||
2813 | b08338e3 | Gyusu | Try |
2814 | ManualCheckNode(oLine_Dt) |
||
2815 | ManualCheckNode(oSymbol_Dt) |
||
2816 | Catch ex As Exception |
||
2817 | End Try |
||
2818 | e4000111 | Gyusu | For Each oSymbolNode As TreeNode In oNode.Nodes |
2819 | If oSymbolNode.Checked Then |
||
2820 | b08338e3 | Gyusu | Try |
2821 | Dim sUid As String = oSymbolNode.Name |
||
2822 | Dim sLineNoUid As String = CLineNo.Uid |
||
2823 | 76f465d0 | Gyusu | Dim sReturnUid = sUid |
2824 | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2825 | While True |
||
2826 | Dim oLineRows As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2827 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2828 | If oLineRows.Count > 0 Then |
||
2829 | sReturnUid = FinalLineModeling(oLineRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2830 | Else |
||
2831 | sReturnUid = "" |
||
2832 | b08338e3 | Gyusu | End If |
2833 | 76f465d0 | Gyusu | If sReturnUid = "" Then |
2834 | Exit While |
||
2835 | End If |
||
2836 | End While |
||
2837 | b08338e3 | Gyusu | Catch ex As Exception |
2838 | End Try |
||
2839 | 6a6d8ab4 | Gyusu | End If |
2840 | e4000111 | Gyusu | Next |
2841 | 76f465d0 | Gyusu | End If |
2842 | Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
2843 | If CTrimLineNo IsNot Nothing Then |
||
2844 | Dim oLine_Dt As DataTable = CTrimLineNo.Dt_Line |
||
2845 | Dim oSymbol_Dt As DataTable = CTrimLineNo.Dt_Symbol |
||
2846 | Dim oAttribute_Dt As DataTable = CTrimLineNo.Dt_Attribute |
||
2847 | Dim oDrawLinenoLabel As Boolean = False |
||
2848 | Try |
||
2849 | ManualCheckNode(oLine_Dt) |
||
2850 | ManualCheckNode(oSymbol_Dt) |
||
2851 | Catch ex As Exception |
||
2852 | End Try |
||
2853 | f9b63682 | Gyusu | |
2854 | bb2a0c79 | Gyusu | For Each oSymbolNode As TreeNode In oNode.Nodes |
2855 | If oSymbolNode.Checked Then |
||
2856 | b08338e3 | Gyusu | Try |
2857 | Dim sUid As String = oSymbolNode.Name |
||
2858 | 76f465d0 | Gyusu | Dim sLineNoUid As String = CTrimLineNo.Uid |
2859 | f9b63682 | Gyusu | Dim sReturnUid = sUid |
2860 | 76f465d0 | Gyusu | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
2861 | f9b63682 | Gyusu | While True |
2862 | Dim oLineRows As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2863 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2864 | If oLineRows.Count > 0 Then |
||
2865 | sReturnUid = FinalLineModeling(oLineRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2866 | 76f465d0 | Gyusu | Else |
2867 | sReturnUid = "" |
||
2868 | f9b63682 | Gyusu | End If |
2869 | If sReturnUid = "" Then |
||
2870 | Exit While |
||
2871 | End If |
||
2872 | End While |
||
2873 | b08338e3 | Gyusu | Catch ex As Exception |
2874 | End Try |
||
2875 | bb2a0c79 | Gyusu | End If |
2876 | Next |
||
2877 | f9b63682 | Gyusu | 'For Each oSymbolNode As TreeNode In oNode.Nodes |
2878 | ' If oSymbolNode.Checked Then |
||
2879 | ' Try |
||
2880 | ' Dim sUid As String = oSymbolNode.Name |
||
2881 | ' Dim sLineNoUid As String = CLineNo.Uid |
||
2882 | 76f465d0 | Gyusu | ' Dim sReturnUid = sUid |
2883 | ' ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2884 | ' Dim oSymbolRows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2885 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2886 | ' If oSymbolRows.Count > 0 Then |
||
2887 | ' sReturnUid = FinalSymbolModeling(oSymbolRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2888 | ' Else |
||
2889 | ' sReturnUid = "" |
||
2890 | ' End If |
||
2891 | ' If sReturnUid = "" Then |
||
2892 | f9b63682 | Gyusu | ' End If |
2893 | ' Catch ex As Exception |
||
2894 | ' End Try |
||
2895 | ' End If |
||
2896 | 'Next |
||
2897 | e4000111 | Gyusu | End If |
2898 | 76f465d0 | Gyusu | Next |
2899 | 3acffcee | Gyusu | |
2900 | |||
2901 | 76f465d0 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
2902 | Dim iItemcnt As Integer = 0 |
||
2903 | Dim sNodeUid As String = oNode.Name |
||
2904 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
2905 | '1.Equipment |
||
2906 | '2.Piping OPC |
||
2907 | '3.OPC 시작되는 Line |
||
2908 | 'Equipment 생성 |
||
2909 | 'If sNodeUid <> "PipeLineNo" Then |
||
2910 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
2911 | bb2a0c79 | Gyusu | |
2912 | 76f465d0 | Gyusu | If CLineNo IsNot Nothing Then |
2913 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
2914 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
2915 | Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
||
2916 | b08338e3 | Gyusu | Dim oDrawLinenoLabel As Boolean = False |
2917 | Try |
||
2918 | ManualCheckNode(oLine_Dt) |
||
2919 | ManualCheckNode(oSymbol_Dt) |
||
2920 | Catch ex As Exception |
||
2921 | End Try |
||
2922 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
2923 | If oSymbolNode.Checked Then |
||
2924 | Try |
||
2925 | Dim sUid As String = oSymbolNode.Name |
||
2926 | 76f465d0 | Gyusu | Dim sLineNoUid As String = CLineNo.Uid |
2927 | Dim sReturnUid = sUid |
||
2928 | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2929 | Dim oSymbolRows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2930 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2931 | If oSymbolRows.Count > 0 Then |
||
2932 | sReturnUid = FinalSymbolModeling(oSymbolRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2933 | Else |
||
2934 | sReturnUid = "" |
||
2935 | End If |
||
2936 | If sReturnUid = "" Then |
||
2937 | b08338e3 | Gyusu | End If |
2938 | Catch ex As Exception |
||
2939 | End Try |
||
2940 | End If |
||
2941 | Next |
||
2942 | 76f465d0 | Gyusu | End If |
2943 | Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
2944 | If CTrimLineNo IsNot Nothing Then |
||
2945 | Dim oLine_Dt As DataTable = CTrimLineNo.Dt_Line |
||
2946 | Dim oSymbol_Dt As DataTable = CTrimLineNo.Dt_Symbol |
||
2947 | Dim oAttribute_Dt As DataTable = CTrimLineNo.Dt_Attribute |
||
2948 | Dim oDrawLinenoLabel As Boolean = False |
||
2949 | Try |
||
2950 | ManualCheckNode(oLine_Dt) |
||
2951 | ManualCheckNode(oSymbol_Dt) |
||
2952 | Catch ex As Exception |
||
2953 | End Try |
||
2954 | b08338e3 | Gyusu | For Each oSymbolNode As TreeNode In oNode.Nodes |
2955 | 76f465d0 | Gyusu | If oSymbolNode.Checked Then |
2956 | Try |
||
2957 | b08338e3 | Gyusu | Dim sUid As String = oSymbolNode.Name |
2958 | 76f465d0 | Gyusu | Dim sLineNoUid As String = CTrimLineNo.Uid |
2959 | Dim sReturnUid = sUid |
||
2960 | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2961 | Dim oSymbolRows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2962 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2963 | If oSymbolRows.Count > 0 Then |
||
2964 | sReturnUid = FinalSymbolModeling(oSymbolRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2965 | Else |
||
2966 | sReturnUid = "" |
||
2967 | b08338e3 | Gyusu | End If |
2968 | 76f465d0 | Gyusu | If sReturnUid = "" Then |
2969 | b08338e3 | Gyusu | End If |
2970 | 76f465d0 | Gyusu | Catch ex As Exception |
2971 | End Try |
||
2972 | End If |
||
2973 | b08338e3 | Gyusu | Next |
2974 | End If |
||
2975 | Next |
||
2976 | End If |
||
2977 | Next |
||
2978 | Next |
||
2979 | Catch ex As Exception |
||
2980 | |||
2981 | End Try |
||
2982 | End Sub |
||
2983 | |||
2984 | |||
2985 | Private Sub FindNearPoint(ByVal oOPCSymbol As LMSymbol, ByRef dNear_x As Double, ByRef dNear_y As Double) |
||
2986 | Dim oConnectionPoints_x(4) As Double |
||
2987 | Dim oConnectionPoints_y(4) As Double |
||
2988 | |||
2989 | Try |
||
2990 | _Placement.PIDConnectPointLocation(oOPCSymbol, 1, oConnectionPoints_x(0), oConnectionPoints_y(0)) |
||
2991 | _Placement.PIDConnectPointLocation(oOPCSymbol, 2, oConnectionPoints_x(1), oConnectionPoints_y(1)) |
||
2992 | _Placement.PIDConnectPointLocation(oOPCSymbol, 3, oConnectionPoints_x(2), oConnectionPoints_y(2)) |
||
2993 | _Placement.PIDConnectPointLocation(oOPCSymbol, 4, oConnectionPoints_x(3), oConnectionPoints_y(3)) |
||
2994 | Dim iNearPoint As Integer = 0 |
||
2995 | Dim dGap As Double = 0 |
||
2996 | For i = 0 To 3 |
||
2997 | If dGap = 0 Then |
||
2998 | iNearPoint = i |
||
2999 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
3000 | Else |
||
3001 | If dGap >= Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) Then |
||
3002 | iNearPoint = i |
||
3003 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
3004 | End If |
||
3005 | End If |
||
3006 | Next |
||
3007 | dNear_x = oConnectionPoints_x(iNearPoint) |
||
3008 | dNear_y = oConnectionPoints_y(iNearPoint) |
||
3009 | Catch ex As Exception |
||
3010 | e4000111 | Gyusu | |
3011 | bb2a0c79 | Gyusu | End Try |
3012 | e4000111 | Gyusu | |
3013 | bb2a0c79 | Gyusu | End Sub |
3014 | |||
3015 | Private Function GetPipeType(ByVal sType As String) As String |
||
3016 | Dim sSystempath As String = "\Piping\Routing\Process Lines\Primary Piping.sym" ' oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
||
3017 | If sType.ToUpper() = "ELECTRIC" Then |
||
3018 | sSystempath = "\Instrumentation\Signal Line\Electric.sym" |
||
3019 | ElseIf sType.ToUpper() = "CONNECT TO PROCESS" Then |
||
3020 | sSystempath = "\Instrumentation\Signal Line\Connect to Process.sym" |
||
3021 | Else |
||
3022 | End If |
||
3023 | Return sSystempath |
||
3024 | End Function |
||
3025 | |||
3026 | Private Sub InitAutoRouting() |
||
3027 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
3028 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
3029 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
3030 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
3031 | If CDrawing IsNot Nothing Then |
||
3032 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
3033 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
3034 | SetListBoxItems(ListBox_Result, "Place " & CDrawing.DwgName & "....") |
||
3035 | b08338e3 | Gyusu | |
3036 | bb2a0c79 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
3037 | Dim iItemcnt As Integer = 0 |
||
3038 | Dim sNodeUid As String = oNode.Name |
||
3039 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
3040 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
3041 | If CLineNo IsNot Nothing Then |
||
3042 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
3043 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
3044 | |||
3045 | For Each oLineRow In oLine_Dt.Rows |
||
3046 | 76f465d0 | Gyusu | ' oLineRow(_XML_LINE_UID) = "" |
3047 | oLineRow(_XML_LINE_SPID) = "" |
||
3048 | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
||
3049 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
3050 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
3051 | oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
||
3052 | Next |
||
3053 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
3054 | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
||
3055 | oSymbolRow(_XML_SYMBOL_SPID) = "" |
||
3056 | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
||
3057 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
3058 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
3059 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
3060 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
3061 | |||
3062 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
||
3063 | |||
3064 | Next |
||
3065 | |||
3066 | End If |
||
3067 | |||
3068 | Dim CTRIMLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
3069 | If CTRIMLineNo IsNot Nothing Then |
||
3070 | Dim oLine_Dt As DataTable = CTRIMLineNo.Dt_Line |
||
3071 | Dim oSymbol_Dt As DataTable = CTRIMLineNo.Dt_Symbol |
||
3072 | |||
3073 | For Each oLineRow In oLine_Dt.Rows |
||
3074 | ' oLineRow(_XML_LINE_UID) = "" |
||
3075 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_SPID) = "" |
3076 | 76f465d0 | Gyusu | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
3077 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
3078 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
3079 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
3080 | Next |
||
3081 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
3082 | 76f465d0 | Gyusu | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
3083 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_SPID) = "" |
3084 | 76f465d0 | Gyusu | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
3085 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
3086 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
3087 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
3088 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
3089 | |||
3090 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
3091 | 76f465d0 | Gyusu | |
3092 | bb2a0c79 | Gyusu | Next |
3093 | |||
3094 | End If |
||
3095 | Next |
||
3096 | End If |
||
3097 | Next |
||
3098 | Next |
||
3099 | End Sub |
||
3100 | |||
3101 | |||
3102 | |||
3103 | |||
3104 | |||
3105 | |||
3106 | Private Function CheckBranchLine(ByVal oLine_Dt As DataTable, ByVal dStartX As Double, ByVal dStartY As Double, |
||
3107 | ByRef dEndX As Double, ByRef dEndY As Double, ByRef sBranchType As String, ByRef oLMConnector As LMConnector) As Boolean |
||
3108 | |||
3109 | Try |
||
3110 | Dim oModelingLineRows() As DataRow = oLine_Dt.Select("[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And [" & _XML_LINE_SPID & "] <> ''") |
||
3111 | For Each oModelrow In oModelingLineRows |
||
3112 | Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3113 | Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
3114 | Dim dModelStartX As Double |
||
3115 | Dim dModelStartY As Double |
||
3116 | Dim dModelEndX As Double |
||
3117 | Dim dModelEndY As Double |
||
3118 | ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
3119 | ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3120 | ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3121 | ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
3122 | Dim dGap As Double = 0.0002 |
||
3123 | Dim d기준x As Double = (dModelStartX + dModelEndX) / 2 |
||
3124 | Dim d기준y As Double = (dModelStartY + dModelEndY) / 2 |
||
3125 | Try |
||
3126 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3127 | Catch ex As Exception |
||
3128 | |||
3129 | End Try |
||
3130 | Dim oRun As LMPipeRun = Nothing |
||
3131 | Try |
||
3132 | |||
3133 | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
||
3134 | Dim dResultCalc As Double = -1 |
||
3135 | For Each objRep In oRun.Representations |
||
3136 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3137 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3138 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3139 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3140 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3141 | Dim dStartCalc As Double = Math.Abs(dStartX - dConn_X) + Math.Abs(dStartY - dConn_Y) |
||
3142 | |||
3143 | If dResultCalc > dStartCalc Or dResultCalc = -1 Then |
||
3144 | dResultCalc = dStartCalc |
||
3145 | oLMConnector = objConnector |
||
3146 | d기준x = dConn_X |
||
3147 | d기준y = dConn_Y |
||
3148 | End If |
||
3149 | Dim dEndCalc As Double = Math.Abs(dEndX - dConn_X) + Math.Abs(dEndY - dConn_Y) |
||
3150 | If dResultCalc > dEndCalc Then |
||
3151 | dResultCalc = dEndCalc |
||
3152 | oLMConnector = objConnector |
||
3153 | d기준x = dConn_X |
||
3154 | d기준y = dConn_Y |
||
3155 | End If |
||
3156 | Next |
||
3157 | End If |
||
3158 | Next |
||
3159 | ' _Placement.PIDConnectPointLocation(oRun, 1, dModelStartX, dModelEndX) |
||
3160 | ' _Placement.PIDConnectPointLocation(oRun, 2, dModelEndX, dModelEndY) |
||
3161 | Catch ex As Exception |
||
3162 | End Try |
||
3163 | |||
3164 | |||
3165 | 'Dim sSPID As String = oModelrow(_XML_LINE_SPID).ToString() |
||
3166 | 'Dim oPipeRun As LMPipeRun = _Placement.PIDDataSource.Get PipeRun(sSPID) |
||
3167 | 'If dModelStartX + dGap > dStartX And dModelStartX - dGap < dStartX And |
||
3168 | ' dModelStartY + dGap > dStartY And dModelStartY - dGap < dStartY Then |
||
3169 | ' dStartX = dModelStartX |
||
3170 | ' dStartY = dModelStartY |
||
3171 | 'ElseIf dModelEndX + dGap > dStartX And dModelEndX - dGap < dStartX And |
||
3172 | ' dModelEndY + dGap > dStartY And dModelEndY - dGap < dStartY Then |
||
3173 | ' dStartX = dModelEndX |
||
3174 | ' dStartY = dModelEndY |
||
3175 | 'End If |
||
3176 | |||
3177 | 'Vetical |
||
3178 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
3179 | If Math.Abs(dStartX - dEndX) >= Math.Abs(dStartY - dEndY) Then |
||
3180 | 'Horizontal |
||
3181 | ' dGap = 0.0002 'Math.Abs(dStartX - dEndX) / 20 |
||
3182 | '기준선의 Y범위안에 가로선이 포함되어야됨 |
||
3183 | If (dModelStartY + dGap >= dStartY And dModelEndY - dGap <= dStartY) Or |
||
3184 | (dModelStartY - dGap <= dStartY And dModelEndY + dGap >= dStartY) And |
||
3185 | (dModelStartY + dGap >= dEndY And dModelEndY - dGap <= dEndY) Or |
||
3186 | (dModelStartY - dGap <= dEndY And dModelEndY + dGap >= dEndY) Then |
||
3187 | '기준선보다 왼쪽에 가로선이 있을때 |
||
3188 | If d기준x >= dStartX And d기준x >= dEndX Then |
||
3189 | If dStartX >= dEndX Then |
||
3190 | 'dStartX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3191 | If dStartX + dGap >= d기준x Then |
||
3192 | dStartX = d기준x |
||
3193 | sBranchType = "1" |
||
3194 | Return True |
||
3195 | End If |
||
3196 | Else |
||
3197 | 'dEndX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3198 | If dEndX + dGap >= d기준x Then |
||
3199 | dEndX = d기준x |
||
3200 | sBranchType = "2" |
||
3201 | Return True |
||
3202 | End If |
||
3203 | End If |
||
3204 | '기준선보다 오른쪽에 가로선이 있을때 |
||
3205 | ElseIf d기준x <= dStartX And d기준x <= dEndX Then |
||
3206 | If dStartX >= dEndX Then |
||
3207 | 'dEndX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3208 | If dEndX - dGap <= d기준x Then |
||
3209 | dEndX = d기준x |
||
3210 | sBranchType = "2" |
||
3211 | Return True |
||
3212 | End If |
||
3213 | Else |
||
3214 | 'dStartX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3215 | If dStartX - dGap <= d기준x Then |
||
3216 | dStartX = d기준x |
||
3217 | sBranchType = "1" |
||
3218 | Return True |
||
3219 | End If |
||
3220 | End If |
||
3221 | Else |
||
3222 | '기준선과 세로선이 겹칠때 |
||
3223 | If (d기준x >= dStartX And d기준x <= dEndX) Or |
||
3224 | (d기준x <= dStartX And d기준x >= dEndX) Then |
||
3225 | If (dModelStartY <= dStartY And dModelEndY >= dEndY) Or |
||
3226 | (dModelStartY >= dStartY And dModelEndY <= dEndY) Then |
||
3227 | '기준선이 dStartX와 dEndX중 어느쪽에 가까운지 확인 |
||
3228 | '가로선의 왼쪽점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3229 | '가로선의 오른쪽점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
||
3230 | If Math.Abs(d기준x - dStartX) >= Math.Abs(d기준x - dEndX) Then |
||
3231 | 'EndX점이 기준선과 더 가까이 있음 |
||
3232 | If dStartX >= dEndX Then |
||
3233 | '가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3234 | If dEndX - dGap <= d기준x Then |
||
3235 | dEndX = d기준x |
||
3236 | sBranchType = "4" |
||
3237 | Return True |
||
3238 | End If |
||
3239 | Else |
||
3240 | '가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3241 | If dEndX + dGap >= d기준x Then |
||
3242 | dEndX = d기준x |
||
3243 | sBranchType = "4" |
||
3244 | Return True |
||
3245 | End If |
||
3246 | |||
3247 | End If |
||
3248 | Else |
||
3249 | 'dStartX점이 기준선과 더 가까이 있음 |
||
3250 | If dStartX >= dEndX Then |
||
3251 | '가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3252 | If dStartX + dGap >= d기준x Then |
||
3253 | dStartX = d기준x |
||
3254 | sBranchType = "3" |
||
3255 | Return True |
||
3256 | End If |
||
3257 | |||
3258 | Else |
||
3259 | '가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3260 | If dStartX - dGap <= d기준x Then |
||
3261 | dStartX = d기준x |
||
3262 | sBranchType = "3" |
||
3263 | Return True |
||
3264 | End If |
||
3265 | End If |
||
3266 | End If |
||
3267 | End If |
||
3268 | |||
3269 | End If |
||
3270 | End If |
||
3271 | End If |
||
3272 | |||
3273 | End If |
||
3274 | Else |
||
3275 | 'Horizontal |
||
3276 | If Math.Abs(dModelStartX - dModelEndX) >= Math.Abs(dModelStartY - dModelEndY) Then |
||
3277 | 'Vertical |
||
3278 | If Math.Abs(dStartX - dEndX) <= Math.Abs(dStartY - dEndY) Then |
||
3279 | ' dGap = 0.0015 'Math.Abs(dStartY - dEndY) / 80 |
||
3280 | |||
3281 | '기준선의 X범위안에 세로선이 포함되어야됨 |
||
3282 | If ((dModelStartX + dGap >= dStartX And dModelEndX - dGap <= dStartX) Or |
||
3283 | (dModelStartX - dGap <= dStartX And dModelEndX + dGap >= dStartX)) And |
||
3284 | ((dModelStartX + dGap >= dEndX And dModelEndX - dGap <= dEndX) Or |
||
3285 | (dModelStartX - dGap <= dEndX And dModelEndX + dGap >= dEndX)) Then |
||
3286 | |||
3287 | '가로선보다 아래에 세로선이 있을때 |
||
3288 | If d기준y >= dStartY And d기준y >= dEndY Then |
||
3289 | If dStartY >= dEndY Then |
||
3290 | 'dStartY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3291 | If dStartY + dGap >= d기준y Then |
||
3292 | dStartY = d기준y |
||
3293 | sBranchType = "3" |
||
3294 | Return True |
||
3295 | End If |
||
3296 | Else |
||
3297 | 'dEndY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3298 | If dEndY + dGap >= d기준y Then |
||
3299 | dEndY = d기준y |
||
3300 | |||
3301 | If Math.Abs(dEndX - dModelStartX) > Math.Abs(dEndX - dModelEndX) Then |
||
3302 | dEndX = dModelEndX |
||
3303 | Else |
||
3304 | dEndX = dModelStartX |
||
3305 | End If |
||
3306 | |||
3307 | sBranchType = "4" |
||
3308 | Return True |
||
3309 | End If |
||
3310 | End If |
||
3311 | '기준선보다 위에 세로선이 있을때 |
||
3312 | ElseIf d기준y <= dStartY And d기준y <= dEndY Then |
||
3313 | If dStartY >= dEndY Then |
||
3314 | 'dEndY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3315 | If dEndY - dGap <= d기준y Then |
||
3316 | dEndY = d기준y |
||
3317 | sBranchType = "4" |
||
3318 | Return True |
||
3319 | End If |
||
3320 | Else |
||
3321 | 'dStartY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3322 | If dStartY - dGap <= d기준y Then |
||
3323 | dStartY = d기준y |
||
3324 | sBranchType = "3" |
||
3325 | Return True |
||
3326 | End If |
||
3327 | End If |
||
3328 | Else |
||
3329 | '기준선과 세로선이 겹칠때 |
||
3330 | If (d기준y >= dStartY And d기준y <= dEndY) Or |
||
3331 | (d기준y <= dStartY And d기준y >= dEndY) Then |
||
3332 | '기준선이 dStartY와 dEndY중 어느쪽에 가까운지 확인 |
||
3333 | '세로선의 윗점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3334 | '세로선의 아래점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
||
3335 | If (dModelStartX <= dStartX And dModelEndX >= dEndX) Or |
||
3336 | (dModelStartX >= dStartX And dModelEndX <= dEndX) Then |
||
3337 | If Math.Abs(d기준y - dStartY) >= Math.Abs(d기준y - dEndY) Then |
||
3338 | 'Endy점이 기준선과 더 가까이 있음 |
||
3339 | If dStartY >= dEndY Then |
||
3340 | '세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3341 | If dEndY + dGap >= d기준y Then |
||
3342 | dEndY = d기준y |
||
3343 | sBranchType = "4" |
||
3344 | Return True |
||
3345 | End If |
||
3346 | Else |
||
3347 | '세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3348 | If dEndY - dGap <= d기준y Then |
||
3349 | dEndY = d기준y |
||
3350 | sBranchType = "4" |
||
3351 | Return True |
||
3352 | End If |
||
3353 | End If |
||
3354 | Else |
||
3355 | 'dStartY점이 기준선과 더 가까이 있음 |
||
3356 | If dStartY >= dEndY Then |
||
3357 | '세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3358 | If dStartY - dGap <= d기준y Then |
||
3359 | dStartY = d기준y |
||
3360 | sBranchType = "3" |
||
3361 | Return True |
||
3362 | End If |
||
3363 | Else |
||
3364 | '세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3365 | If dStartY + dGap >= d기준y Then |
||
3366 | dStartY = d기준y |
||
3367 | sBranchType = "3" |
||
3368 | Return True |
||
3369 | End If |
||
3370 | End If |
||
3371 | End If |
||
3372 | End If |
||
3373 | |||
3374 | End If |
||
3375 | End If |
||
3376 | End If |
||
3377 | End If |
||
3378 | End If |
||
3379 | End If |
||
3380 | Next |
||
3381 | Catch ex As Exception |
||
3382 | |||
3383 | End Try |
||
3384 | oLMConnector = Nothing |
||
3385 | Return False |
||
3386 | End Function |
||
3387 | |||
3388 | 76f465d0 | Gyusu | Private Function CheckConnectionSymbolToSymbol(ByVal oModelingLineRows() As DataRow, ByRef dX As Double, ByRef dY As Double, |
3389 | ByRef oLMConnector As LMConnector) As Boolean |
||
3390 | Dim bConnectionFlag As Boolean = False |
||
3391 | Try |
||
3392 | For Each oModelrow In oModelingLineRows |
||
3393 | Dim d기준x As Double = dX |
||
3394 | Dim d기준y As Double = dY |
||
3395 | Dim dGap As Double = 0.0002 |
||
3396 | Dim oRun As LMPipeRun = Nothing |
||
3397 | Try |
||
3398 | Dim oLMSymbol As LMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3399 | Dim dX1 As Double = 0.0 |
||
3400 | Dim dY1 As Double = 0.0 |
||
3401 | Dim dX2 As Double = 0.0 |
||
3402 | Dim dY2 As Double = 0.0 |
||
3403 | For Each oConnector In oLMSymbol.Connect1Connectors |
||
3404 | oLMConnector = oConnector |
||
3405 | Next |
||
3406 | ' oRun = _Placement.PIDDataSource.GetPipeRun(oLMSymbol.Connect1Connectors.Nth(1).ModelItemID) |
||
3407 | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3408 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3409 | If Math.Abs(dX - dX1) < dGap And Math.Abs(dY - dY1) < dGap Then |
||
3410 | dX = dX1 |
||
3411 | dY = dY1 |
||
3412 | bConnectionFlag = True |
||
3413 | Exit For |
||
3414 | End If |
||
3415 | If Math.Abs(dX - dX2) < dGap And Math.Abs(dY - dY2) < dGap Then |
||
3416 | dX = dX2 |
||
3417 | dY = dY2 |
||
3418 | bConnectionFlag = True |
||
3419 | Exit For |
||
3420 | End If |
||
3421 | |||
3422 | 'For Each oConnector In oLMSymbol.Connect1Connectors |
||
3423 | ' For Each objConnectorVertex In oConnector.ConnectorVertices |
||
3424 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3425 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3426 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3427 | ' oLMConnector = oConnector |
||
3428 | ' dX = dConn_X |
||
3429 | ' dY = dConn_Y |
||
3430 | ' bConnectionFlag = True |
||
3431 | ' Exit For |
||
3432 | ' End If |
||
3433 | ' Next |
||
3434 | 'Next |
||
3435 | |||
3436 | 'For Each oConnector In oLMSymbol.Connect2Connectors |
||
3437 | ' For Each objConnectorVertex In oConnector.ConnectorVertices |
||
3438 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3439 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3440 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3441 | ' oLMConnector = oConnector |
||
3442 | ' dX = dConn_X |
||
3443 | ' dY = dConn_Y |
||
3444 | ' bConnectionFlag = True |
||
3445 | ' Exit For |
||
3446 | ' End If |
||
3447 | ' Next |
||
3448 | 'Next |
||
3449 | |||
3450 | |||
3451 | 'If oRun IsNot Nothing Then |
||
3452 | ' Dim dResultCalc As Double = -1 |
||
3453 | ' For Each objRep In oRun.Representations |
||
3454 | ' Dim sRepresentationType As String = objRep.Attributes("RepresentationType").Value |
||
3455 | ' If objRep.Attributes("RepresentationType").Value = "Connector" Or |
||
3456 | ' objRep.Attributes("RepresentationType").Value = "Symbol" And |
||
3457 | ' objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3458 | ' Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3459 | ' For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3460 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3461 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3462 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3463 | ' oLMConnector = objConnector |
||
3464 | ' d기준x = dConn_X |
||
3465 | ' d기준y = dConn_Y |
||
3466 | ' bConnectionFlag = True |
||
3467 | ' Exit For |
||
3468 | ' End If |
||
3469 | ' Next |
||
3470 | ' End If |
||
3471 | ' Next |
||
3472 | 'End If |
||
3473 | |||
3474 | Catch ex As Exception |
||
3475 | End Try |
||
3476 | Next |
||
3477 | |||
3478 | Catch ex As Exception |
||
3479 | |||
3480 | End Try |
||
3481 | Return bConnectionFlag |
||
3482 | End Function |
||
3483 | |||
3484 | Private Function CheckConnectionSymbolToLine(ByVal oModelingLineRows() As DataRow, ByRef dX As Double, ByRef dY As Double, |
||
3485 | ByVal dCenterX As Double, ByVal dCenterY As Double, ByRef oLMConnector As LMConnector) As LMSymbol |
||
3486 | Dim bConnectionFlag As Boolean = False |
||
3487 | Dim oLMSymbol As LMSymbol = Nothing |
||
3488 | Try |
||
3489 | |||
3490 | For Each oModelrow In oModelingLineRows |
||
3491 | Dim d기준x As Double = dCenterX |
||
3492 | Dim d기준y As Double = dCenterY |
||
3493 | Dim dGap As Double = 0.001 |
||
3494 | Dim oRun As LMPipeRun = Nothing |
||
3495 | Dim dCheckGap As Double = 0 |
||
3496 | Try |
||
3497 | |||
3498 | Dim dX1 As Double = 0.0 |
||
3499 | Dim dY1 As Double = 0.0 |
||
3500 | Dim dX2 As Double = 0.0 |
||
3501 | Dim dY2 As Double = 0.0 |
||
3502 | ' oRun = _Placement.PIDDataSource.GetPipeRun(oLMSymbol.Connect1Connectors.Nth(1).ModelItemID) |
||
3503 | oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3504 | For Each oConnector In oLMSymbol.Connect1Connectors |
||
3505 | oLMConnector = oConnector |
||
3506 | Next |
||
3507 | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3508 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3509 | ' If Math.Abs(dX - dX1) < dGap And Math.Abs(dY - dY1) < dGap And |
||
3510 | If Math.Abs(d기준x - dX1) < dCheckGap And Math.Abs(d기준y - dY1) < dCheckGap Or dCheckGap = 0 Then |
||
3511 | dX = dX1 |
||
3512 | dY = dY1 |
||
3513 | bConnectionFlag = True |
||
3514 | dCheckGap = Math.Abs(d기준x - dX1) + Math.Abs(d기준y - dY1) |
||
3515 | End If |
||
3516 | 'If Math.Abs(dX - dX2) < dGap And Math.Abs(dY - dY2) < dGap And |
||
3517 | ' Math.Abs(d기준x - dX2) < dCheckGap And Math.Abs(d기준y - dY2 < dCheckGap) Or dCheckGap = 0 Then |
||
3518 | If Math.Abs(d기준x - dX2) < dCheckGap And Math.Abs(d기준y - dY2) < dCheckGap Or dCheckGap = 0 Then |
||
3519 | dX = dX2 |
||
3520 | dY = dY2 |
||
3521 | bConnectionFlag = True |
||
3522 | End If |
||
3523 | |||
3524 | Catch ex As Exception |
||
3525 | End Try |
||
3526 | If bConnectionFlag Then |
||
3527 | oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3528 | Else |
||
3529 | oLMSymbol = Nothing |
||
3530 | End If |
||
3531 | Next |
||
3532 | b08338e3 | Gyusu | |
3533 | 76f465d0 | Gyusu | Catch ex As Exception |
3534 | b08338e3 | Gyusu | |
3535 | 76f465d0 | Gyusu | End Try |
3536 | b08338e3 | Gyusu | |
3537 | 76f465d0 | Gyusu | Return oLMSymbol |
3538 | End Function |
||
3539 | b08338e3 | Gyusu | |
3540 | Private Function CheckConnectionLine(ByVal oModelingLineRows() As DataRow, ByVal dX As Double, ByVal dY As Double, |
||
3541 | 76f465d0 | Gyusu | ByRef oLMConnector As LMConnector, ByRef dPreConnX As Double, ByRef dPreConnY As Double) As Boolean |
3542 | b08338e3 | Gyusu | Dim bConnectionFlag As Boolean = False |
3543 | 76f465d0 | Gyusu | Dim iGapCheck As Integer = 0 |
3544 | b08338e3 | Gyusu | Try |
3545 | For Each oModelrow In oModelingLineRows |
||
3546 | 76f465d0 | Gyusu | Dim d기준x As Double = dX |
3547 | Dim d기준y As Double = dY |
||
3548 | Dim dGap As Double = 0.0002 |
||
3549 | Dim oRun As LMPipeRun = Nothing |
||
3550 | 'Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3551 | ' Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
3552 | b08338e3 | Gyusu | Dim dModelStartX As Double |
3553 | Dim dModelStartY As Double |
||
3554 | Dim dModelEndX As Double |
||
3555 | Dim dModelEndY As Double |
||
3556 | 76f465d0 | Gyusu | ' ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
3557 | ' ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3558 | ' ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3559 | 'ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
3560 | |||
3561 | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
3562 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3563 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3564 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3565 | d기준x = (dModelStartX + dModelEndX) / 2 |
||
3566 | d기준y = (dModelStartY + dModelEndY) / 2 |
||
3567 | b08338e3 | Gyusu | Try |
3568 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3569 | 76f465d0 | Gyusu | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
3570 | b08338e3 | Gyusu | Catch ex As Exception |
3571 | End Try |
||
3572 | 76f465d0 | Gyusu | |
3573 | |||
3574 | b08338e3 | Gyusu | Try |
3575 | 76f465d0 | Gyusu | If oRun IsNot Nothing Then |
3576 | Dim dResultCalc As Double = -1 |
||
3577 | For Each objRep In oRun.Representations |
||
3578 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3579 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3580 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3581 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3582 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3583 | If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3584 | oLMConnector = objConnector |
||
3585 | dPreConnX = dConn_X |
||
3586 | dPreConnY = dConn_Y |
||
3587 | bConnectionFlag = True |
||
3588 | End If |
||
3589 | Next |
||
3590 | End If |
||
3591 | Next |
||
3592 | End If |
||
3593 | |||
3594 | b08338e3 | Gyusu | Catch ex As Exception |
3595 | End Try |
||
3596 | Next |
||
3597 | |||
3598 | Catch ex As Exception |
||
3599 | 76f465d0 | Gyusu | bConnectionFlag = False |
3600 | oLMConnector = Nothing |
||
3601 | b08338e3 | Gyusu | End Try |
3602 | Return bConnectionFlag |
||
3603 | End Function |
||
3604 | |||
3605 | Private Function CheckLineBranch(ByVal oLine_Dt As DataTable, ByRef dX As Double, ByRef dY As Double, |
||
3606 | ByVal sDirection As String, ByRef oLMConnector As LMConnector) As Boolean |
||
3607 | |||
3608 | Dim oModelingLineRows() As DataRow = oLine_Dt.Select("[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And " & |
||
3609 | "[" & _XML_LINE_SPID & "] <> ''") |
||
3610 | |||
3611 | Dim bConnectionFlag As Boolean = False |
||
3612 | Try |
||
3613 | For Each oModelrow In oModelingLineRows |
||
3614 | Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3615 | Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
3616 | Dim dModelStartX As Double |
||
3617 | Dim dModelStartY As Double |
||
3618 | Dim dModelEndX As Double |
||
3619 | Dim dModelEndY As Double |
||
3620 | ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
3621 | ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3622 | ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3623 | ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
3624 | Dim dGap As Double = 0.0002 |
||
3625 | |||
3626 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
3627 | 'Vertical |
||
3628 | If sDirection = "X" Then |
||
3629 | 'x Direction Line |
||
3630 | If (dModelStartY + dGap >= dY And dModelEndY - dGap <= dY) Or |
||
3631 | (dModelStartY - dGap <= dY And dModelEndY + dGap >= dY) Then |
||
3632 | If (dX > dModelStartX And dX < dModelEndX) Or (dX > dModelEndX And dX < dModelStartX) Then |
||
3633 | If Math.Abs(dX - dModelStartX) > Math.Abs(dX - dModelEndX) Then |
||
3634 | dX = dModelEndX |
||
3635 | Else |
||
3636 | dX = dModelStartX |
||
3637 | End If |
||
3638 | Try |
||
3639 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3640 | Catch ex As Exception |
||
3641 | |||
3642 | End Try |
||
3643 | bConnectionFlag = True |
||
3644 | End If |
||
3645 | End If |
||
3646 | End If |
||
3647 | Else |
||
3648 | 'Horizontal |
||
3649 | If sDirection = "Y" Then |
||
3650 | If (dModelStartX + dGap >= dX And dModelEndX - dGap <= dX) Or |
||
3651 | (dModelStartX - dGap <= dX And dModelEndX + dGap >= dX) Then |
||
3652 | If (dY > dModelStartY And dY < dModelEndY) Or (dY > dModelEndY And dY < dModelStartY) Then |
||
3653 | If Math.Abs(dY - dModelStartY) > Math.Abs(dY - dModelEndY) Then |
||
3654 | dY = dModelEndY |
||
3655 | Else |
||
3656 | dY = dModelStartY |
||
3657 | End If |
||
3658 | Try |
||
3659 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3660 | Catch ex As Exception |
||
3661 | End Try |
||
3662 | bConnectionFlag = True |
||
3663 | End If |
||
3664 | End If |
||
3665 | End If |
||
3666 | End If |
||
3667 | Next |
||
3668 | Catch ex As Exception |
||
3669 | End Try |
||
3670 | Return bConnectionFlag |
||
3671 | End Function |
||
3672 | 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, |
||
3673 | ByVal sLineNoUid As String, ByVal sLineUid As String, ByVal sSystemPath As String, ByRef oLMConnector As LMConnector) As Boolean |
||
3674 | 76f465d0 | Gyusu | 'Try |
3675 | ' Dim oDatasource As Object = _Placement.PIDDataSource |
||
3676 | ' Dim oPipeRun As LMPipeRun = Nothing |
||
3677 | ' Dim objInputs As PlaceRunInputs |
||
3678 | ' objInputs = New PlaceRunInputs |
||
3679 | ' Dim objItem As LMAItem |
||
3680 | ' ' Dim objConnector As LMConnector |
||
3681 | |||
3682 | ' Dim oStartLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sStartLineUid & "' And " & |
||
3683 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
3684 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
3685 | ' If oStartLineRow.Length = 0 Then |
||
3686 | ' oStartLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sStartLineUid & "' And " & |
||
3687 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
3688 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
3689 | ' End If |
||
3690 | ' Dim oEndLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sEndLineUid & "' And " & |
||
3691 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
3692 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
3693 | |||
3694 | ' oEndLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sEndLineUid & "' And " & |
||
3695 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
3696 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
3697 | ' Dim sStartConnectionType As String = "" |
||
3698 | ' Dim sEndConnectionType As String = "" |
||
3699 | |||
3700 | ' Dim oStartLMConnector As LMConnector = Nothing |
||
3701 | ' Dim oEndLMConnector As LMConnector = Nothing |
||
3702 | ' Dim oDirectionLine As String = "" |
||
3703 | |||
3704 | ' If Math.Abs(dStart_x - dEnd_x) > Math.Abs(dStart_y - dEnd_y) Then |
||
3705 | ' oDirectionLine = "X" |
||
3706 | ' Else |
||
3707 | ' oDirectionLine = "Y" |
||
3708 | ' End If |
||
3709 | b08338e3 | Gyusu | |
3710 | 76f465d0 | Gyusu | ' Dim bCheckFlag As Boolean = False |
3711 | b08338e3 | Gyusu | |
3712 | 76f465d0 | Gyusu | ' Dim bStartCheckFlag As Boolean = CheckConnectionLine(oStartLineRow, dStart_x, dStart_y, oStartLMConnector) |
3713 | ' If bStartCheckFlag = False Then |
||
3714 | ' bStartCheckFlag = CheckConnectionLine(oStartLineRow, dEnd_x, dEnd_y, oStartLMConnector) |
||
3715 | ' bCheckFlag = True |
||
3716 | ' End If |
||
3717 | ' Dim bEndCheckFlag As Boolean = CheckConnectionLine(oEndLineRow, dEnd_x, dEnd_y, oEndLMConnector) |
||
3718 | b08338e3 | Gyusu | |
3719 | 76f465d0 | Gyusu | ' If bEndCheckFlag = False Then |
3720 | b08338e3 | Gyusu | |
3721 | 76f465d0 | Gyusu | ' bEndCheckFlag = CheckConnectionLine(oEndLineRow, dStart_x, dStart_y, oEndLMConnector) |
3722 | ' bCheckFlag = True |
||
3723 | ' End If |
||
3724 | b08338e3 | Gyusu | |
3725 | 76f465d0 | Gyusu | ' If bStartCheckFlag = True And bEndCheckFlag = False Then |
3726 | ' If bCheckFlag Then |
||
3727 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
3728 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3729 | ' Else |
||
3730 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
3731 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3732 | ' End If |
||
3733 | |||
3734 | ' ElseIf bStartCheckFlag = False And bEndCheckFlag = True Then |
||
3735 | ' If bCheckFlag Then |
||
3736 | |||
3737 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
3738 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3739 | ' Else |
||
3740 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3741 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
3742 | ' End If |
||
3743 | |||
3744 | ' ElseIf bStartCheckFlag = True And bEndCheckFlag = True Then |
||
3745 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
3746 | ' objInputs.AddConnectorTarget(oEndLMConnector, dEnd_x, dEnd_y) |
||
3747 | ' Else |
||
3748 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
3749 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
3750 | ' End If |
||
3751 | ' SetListBoxItems(ListBox_Result, "Place Pipe..(" & dStart_x & "," & dStart_y & ") - (" & dEnd_x & "," & dEnd_y & ")..." & _iPipecnt & " count ") |
||
3752 | ' _iPipecnt = _iPipecnt + 1 |
||
3753 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
3754 | ' oLMConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
3755 | b08338e3 | Gyusu | |
3756 | 76f465d0 | Gyusu | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + sLineUid + "'") |
3757 | ' If oUpdateRow.Length = 1 Then |
||
3758 | ' oUpdateRow(0)(_XML_LINE_SPID) = oLMConnector.ModelItemID |
||
3759 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = oLMConnector |
||
3760 | b08338e3 | Gyusu | |
3761 | 76f465d0 | Gyusu | ' oUpdateRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
3762 | ' End If |
||
3763 | b08338e3 | Gyusu | |
3764 | 76f465d0 | Gyusu | ' oPipeRun = oDatasource.GetPipeRun(oLMConnector.ModelItemID) |
3765 | |||
3766 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
3767 | ' If oAttributeRow.Length > 0 Then |
||
3768 | ' For Each oAttribute In oAttributeRow |
||
3769 | ' Try |
||
3770 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
3771 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
3772 | ' If sPIDValue.Contains("'") Then |
||
3773 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
3774 | ' End If |
||
3775 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
3776 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
3777 | ' Catch ex As Exception |
||
3778 | ' End Try |
||
3779 | ' Next |
||
3780 | ' oPipeRun.Commit() |
||
3781 | ' End If |
||
3782 | ' Dim sID_1 As String = "" |
||
3783 | ' Dim sID_2 As String = "" |
||
3784 | ' If oStartLMConnector IsNot Nothing Then |
||
3785 | ' sID_1 = oStartLMConnector.ModelItemID |
||
3786 | ' sID_2 = oLMConnector.ModelItemID |
||
3787 | ' ElseIf oEndLMConnector IsNot Nothing Then |
||
3788 | ' sID_1 = oEndLMConnector.ModelItemID |
||
3789 | ' sID_2 = oLMConnector.ModelItemID |
||
3790 | ' End If |
||
3791 | ' If sID_1 <> "" And sID_2 <> "" Then |
||
3792 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
3793 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
3794 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
3795 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
3796 | ' End If |
||
3797 | ' Return True |
||
3798 | 'Catch ex As Exception |
||
3799 | ' Return False |
||
3800 | 'End Try |
||
3801 | b08338e3 | Gyusu | |
3802 | End Function |
||
3803 | |||
3804 | Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
3805 | ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String, |
||
3806 | ByRef oLMConnector As LMConnector) As String |
||
3807 | Dim sReturnUid As String = "" |
||
3808 | Try |
||
3809 | Dim sLineUid As String = "" |
||
3810 | |||
3811 | Dim iConnType As Integer = 0 |
||
3812 | |||
3813 | Dim sStartpoint As String = "" |
||
3814 | Dim sEndpoint As String = "" |
||
3815 | bb2a0c79 | Gyusu | Dim dOriginalStart_x As Double = 0.0 |
3816 | Dim dOriginalStart_y As Double = 0.0 |
||
3817 | Dim dOriginalEnd_x As Double = 0.0 |
||
3818 | Dim dOriginalEnd_y As Double = 0.0 |
||
3819 | |||
3820 | b08338e3 | Gyusu | Dim dStart_x As Double = 0 |
3821 | Dim dStart_y As Double = 0 |
||
3822 | Dim dEnd_x As Double = 0 |
||
3823 | Dim dEnd_y As Double = 0 |
||
3824 | Dim sStartLineUid As String = sConnLineUid |
||
3825 | Dim sEndLineUid As String = "" |
||
3826 | Dim sDirection As String = "" |
||
3827 | Dim sSystemPath As String = GetPipeType(sType) |
||
3828 | |||
3829 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
3830 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
3831 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
3832 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
3833 | If oPipeRow.Length > 0 Then |
||
3834 | bb2a0c79 | Gyusu | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
3835 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
3836 | e4000111 | Gyusu | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
3837 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
3838 | b08338e3 | Gyusu | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
3839 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
3840 | If dStart_x = 0 And dStart_y = 0 Then |
||
3841 | dStart_x = dOriginalStart_x |
||
3842 | dStart_y = dOriginalStart_y |
||
3843 | dEnd_x = dOriginalEnd_x |
||
3844 | dEnd_y = dOriginalEnd_y |
||
3845 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
3846 | sDirection = "X" |
||
3847 | Else |
||
3848 | sDirection = "Y" |
||
3849 | End If |
||
3850 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
3851 | sLineUid = sConnLineUid |
||
3852 | End If |
||
3853 | End If |
||
3854 | bb2a0c79 | Gyusu | |
3855 | b08338e3 | Gyusu | While True |
3856 | sLineUid = "" |
||
3857 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
3858 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
3859 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
3860 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
3861 | b08338e3 | Gyusu | |
3862 | If oPipeRow.Length = 0 Then |
||
3863 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
3864 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
3865 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
3866 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
3867 | bb2a0c79 | Gyusu | Else |
3868 | b08338e3 | Gyusu | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
3869 | 'sConnLineUid = sLineUid |
||
3870 | sLineUid = sConnLineUid |
||
3871 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
3872 | iConnType = 1 |
||
3873 | End If |
||
3874 | |||
3875 | If oPipeRow.Length > 0 Then |
||
3876 | If sLineUid = "" Then |
||
3877 | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
3878 | 'sConnLineUid = sLineUid |
||
3879 | sLineUid = sConnLineUid |
||
3880 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
3881 | iConnType = 2 |
||
3882 | End If |
||
3883 | If iConnType = 1 Then |
||
3884 | |||
3885 | ElseIf iConnType = 2 Then |
||
3886 | |||
3887 | End If |
||
3888 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
3889 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
3890 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
3891 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
3892 | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
3893 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
3894 | |||
3895 | |||
3896 | |||
3897 | If dStart_x = 0 And dStart_y = 0 Then |
||
3898 | dStart_x = dOriginalStart_x |
||
3899 | dStart_y = dOriginalStart_y |
||
3900 | dEnd_x = dOriginalEnd_x |
||
3901 | dEnd_y = dOriginalEnd_y |
||
3902 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
3903 | sDirection = "X" |
||
3904 | Else |
||
3905 | sDirection = "Y" |
||
3906 | End If |
||
3907 | sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
3908 | sSystemPath = GetPipeType(sType) |
||
3909 | Else |
||
3910 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
3911 | If sDirection = "Y" Then |
||
3912 | '방향이 바꼈음 Y - > X |
||
3913 | |||
3914 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
3915 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
3916 | dStart_x = dOriginalStart_x |
||
3917 | dStart_y = dOriginalStart_y |
||
3918 | dEnd_x = dOriginalEnd_x |
||
3919 | dEnd_y = dOriginalEnd_y |
||
3920 | sStartLineUid = sConnLineUid |
||
3921 | Else |
||
3922 | dEnd_x = dOriginalEnd_x |
||
3923 | dEnd_y = dOriginalEnd_y |
||
3924 | End If |
||
3925 | sDirection = "X" |
||
3926 | Else |
||
3927 | If sDirection = "X" Then |
||
3928 | '방향이 바꼈음 X - > Y |
||
3929 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
3930 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
3931 | dStart_x = dOriginalStart_x |
||
3932 | dStart_y = dOriginalStart_y |
||
3933 | dEnd_x = dOriginalEnd_x |
||
3934 | dEnd_y = dOriginalEnd_y |
||
3935 | sStartLineUid = sConnLineUid |
||
3936 | Else |
||
3937 | |||
3938 | dEnd_x = dOriginalEnd_x |
||
3939 | dEnd_y = dOriginalEnd_y |
||
3940 | End If |
||
3941 | sDirection = "Y" |
||
3942 | End If |
||
3943 | End If |
||
3944 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
3945 | Else |
||
3946 | If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
3947 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
3948 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
3949 | End If |
||
3950 | sReturnUid = sConnLineUid |
||
3951 | Exit While |
||
3952 | End If |
||
3953 | End While |
||
3954 | |||
3955 | If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
3956 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
3957 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
3958 | dStart_x = 0 |
||
3959 | dStart_y = 0 |
||
3960 | dEnd_x = 0 |
||
3961 | dEnd_y = 0 |
||
3962 | End If |
||
3963 | Catch ex As Exception |
||
3964 | |||
3965 | End Try |
||
3966 | |||
3967 | Return sReturnUid |
||
3968 | End Function |
||
3969 | |||
3970 | |||
3971 | 'Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
3972 | ' ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String) As String |
||
3973 | ' Dim sReturnUid As String = "" |
||
3974 | ' Try |
||
3975 | ' Dim sLineUid As String = "" |
||
3976 | |||
3977 | ' Dim iConnType As Integer = 0 |
||
3978 | |||
3979 | ' Dim sStartpoint As String = "" |
||
3980 | ' Dim sEndpoint As String = "" |
||
3981 | ' Dim dOriginalStart_x As Double = 0.0 |
||
3982 | ' Dim dOriginalStart_y As Double = 0.0 |
||
3983 | ' Dim dOriginalEnd_x As Double = 0.0 |
||
3984 | ' Dim dOriginalEnd_y As Double = 0.0 |
||
3985 | |||
3986 | ' Dim dStart_x As Double = 0 |
||
3987 | ' Dim dStart_y As Double = 0 |
||
3988 | ' Dim dEnd_x As Double = 0 |
||
3989 | ' Dim dEnd_y As Double = 0 |
||
3990 | ' Dim sStartLineUid As String = sConnLineUid |
||
3991 | ' Dim sEndLineUid As String = "" |
||
3992 | ' Dim sDirection As String = "" |
||
3993 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
3994 | |||
3995 | ' Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
3996 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
3997 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
3998 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
3999 | ' If oPipeRow.Length > 0 Then |
||
4000 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4001 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4002 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4003 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4004 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4005 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4006 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
4007 | ' dStart_x = dOriginalStart_x |
||
4008 | ' dStart_y = dOriginalStart_y |
||
4009 | ' dEnd_x = dOriginalEnd_x |
||
4010 | ' dEnd_y = dOriginalEnd_y |
||
4011 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4012 | ' sDirection = "X" |
||
4013 | ' Else |
||
4014 | ' sDirection = "Y" |
||
4015 | ' End If |
||
4016 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4017 | ' sLineUid = sConnLineUid |
||
4018 | ' End If |
||
4019 | ' End If |
||
4020 | |||
4021 | ' While True |
||
4022 | ' sLineUid = "" |
||
4023 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
4024 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4025 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4026 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4027 | |||
4028 | ' If oPipeRow.Length = 0 Then |
||
4029 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
4030 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4031 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4032 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4033 | ' Else |
||
4034 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4035 | ' 'sConnLineUid = sLineUid |
||
4036 | ' sLineUid = sConnLineUid |
||
4037 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4038 | ' iConnType = 1 |
||
4039 | ' End If |
||
4040 | |||
4041 | ' If oPipeRow.Length > 0 Then |
||
4042 | ' If sLineUid = "" Then |
||
4043 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4044 | ' 'sConnLineUid = sLineUid |
||
4045 | ' sLineUid = sConnLineUid |
||
4046 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4047 | ' iConnType = 2 |
||
4048 | ' End If |
||
4049 | ' If iConnType = 1 Then |
||
4050 | |||
4051 | ' ElseIf iConnType = 2 Then |
||
4052 | |||
4053 | ' End If |
||
4054 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4055 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4056 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4057 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4058 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4059 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4060 | |||
4061 | |||
4062 | |||
4063 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
4064 | ' dStart_x = dOriginalStart_x |
||
4065 | ' dStart_y = dOriginalStart_y |
||
4066 | ' dEnd_x = dOriginalEnd_x |
||
4067 | ' dEnd_y = dOriginalEnd_y |
||
4068 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4069 | ' sDirection = "X" |
||
4070 | ' Else |
||
4071 | ' sDirection = "Y" |
||
4072 | ' End If |
||
4073 | ' sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4074 | ' sSystemPath = GetPipeType(sType) |
||
4075 | ' Else |
||
4076 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4077 | ' If sDirection = "Y" Then |
||
4078 | ' '방향이 바꼈음 Y - > X |
||
4079 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4080 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4081 | ' dStart_x = dOriginalStart_x |
||
4082 | ' dStart_y = dOriginalStart_y |
||
4083 | ' dEnd_x = dOriginalEnd_x |
||
4084 | ' dEnd_y = dOriginalEnd_y |
||
4085 | ' sStartLineUid = sConnLineUid |
||
4086 | ' Else |
||
4087 | ' dEnd_x = dOriginalEnd_x |
||
4088 | ' dEnd_y = dOriginalEnd_y |
||
4089 | ' End If |
||
4090 | ' sDirection = "X" |
||
4091 | ' Else |
||
4092 | ' If sDirection = "X" Then |
||
4093 | ' '방향이 바꼈음 X - > Y |
||
4094 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4095 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4096 | ' dStart_x = dOriginalStart_x |
||
4097 | ' dStart_y = dOriginalStart_y |
||
4098 | ' dEnd_x = dOriginalEnd_x |
||
4099 | ' dEnd_y = dOriginalEnd_y |
||
4100 | ' sStartLineUid = sConnLineUid |
||
4101 | ' Else |
||
4102 | |||
4103 | ' dEnd_x = dOriginalEnd_x |
||
4104 | ' dEnd_y = dOriginalEnd_y |
||
4105 | ' End If |
||
4106 | ' sDirection = "Y" |
||
4107 | ' End If |
||
4108 | ' End If |
||
4109 | ' ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4110 | ' Else |
||
4111 | ' If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
4112 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4113 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4114 | ' End If |
||
4115 | |||
4116 | |||
4117 | ' sReturnUid = sConnLineUid |
||
4118 | ' Exit While |
||
4119 | ' End If |
||
4120 | ' End While |
||
4121 | |||
4122 | ' If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
4123 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4124 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4125 | ' dStart_x = 0 |
||
4126 | ' dStart_y = 0 |
||
4127 | ' dEnd_x = 0 |
||
4128 | ' dEnd_y = 0 |
||
4129 | ' End If |
||
4130 | ' Catch ex As Exception |
||
4131 | |||
4132 | ' End Try |
||
4133 | |||
4134 | ' Return sReturnUid |
||
4135 | 'End Function |
||
4136 | |||
4137 | |||
4138 | Private Function SymbolToLine_Modeling(ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
4139 | ByVal sSymbolUid As String, ByVal oLMSymbol As LMSymbol) As String |
||
4140 | |||
4141 | |||
4142 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4143 | Dim oPipeRun As LMPipeRun = Nothing |
||
4144 | Dim objItem As LMAItem |
||
4145 | Dim objConnector As LMConnector |
||
4146 | Dim objInputs As PlaceRunInputs |
||
4147 | objInputs = New PlaceRunInputs |
||
4148 | |||
4149 | |||
4150 | Dim sPipeUid As String = "" |
||
4151 | Dim iConnType As Integer = 0 |
||
4152 | Dim sStartpoint As String = "" |
||
4153 | Dim sEndpoint As String = "" |
||
4154 | Dim dOriginalStart_x As Double = 0.0 |
||
4155 | Dim dOriginalStart_y As Double = 0.0 |
||
4156 | Dim dOriginalEnd_x As Double = 0.0 |
||
4157 | Dim dOriginalEnd_y As Double = 0.0 |
||
4158 | Dim dStart_x As Double = 0.0 |
||
4159 | Dim dStart_y As Double = 0.0 |
||
4160 | Dim dEnd_x As Double = 0.0 |
||
4161 | Dim dEnd_y As Double = 0.0 |
||
4162 | |||
4163 | Dim sReturnUid As String = "" |
||
4164 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sSymbolUid + "' And " & |
||
4165 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4166 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4167 | If oPipeRow.Length = 0 Then |
||
4168 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sSymbolUid + "' And " & |
||
4169 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4170 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4171 | Else |
||
4172 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4173 | iConnType = 1 |
||
4174 | End If |
||
4175 | |||
4176 | If oPipeRow.Length = 1 Then |
||
4177 | If sPipeUid = "" Then |
||
4178 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4179 | iConnType = 2 |
||
4180 | End If |
||
4181 | sReturnUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4182 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4183 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4184 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4185 | dStart_x = dOriginalStart_x |
||
4186 | dStart_y = dOriginalStart_y |
||
4187 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4188 | dEnd_x = dOriginalEnd_x |
||
4189 | dEnd_y = dOriginalEnd_y |
||
4190 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4191 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4192 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4193 | If iConnType = 1 Then |
||
4194 | FindNearPoint(oLMSymbol, dStart_x, dStart_y) |
||
4195 | objInputs.AddSymbolTarget(oLMSymbol, dStart_x, dStart_y) |
||
4196 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4197 | Else |
||
4198 | FindNearPoint(oLMSymbol, dEnd_x, dEnd_y) |
||
4199 | objInputs.AddSymbolTarget(oLMSymbol, dEnd_x, dEnd_y) |
||
4200 | objInputs.AddPoint(dStart_x, dStart_y) |
||
4201 | End If |
||
4202 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4203 | |||
4204 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4205 | Dim sSystemPath As String = GetPipeType(sType) |
||
4206 | |||
4207 | |||
4208 | |||
4209 | |||
4210 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4211 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4212 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
4213 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4214 | If oAttributeRow.Length > 0 Then |
||
4215 | For Each oAttribute In oAttributeRow |
||
4216 | Try |
||
4217 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4218 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4219 | If sPIDValue.Contains("'") Then |
||
4220 | sPIDValue = sPIDValue.Replace("'", """") |
||
4221 | End If |
||
4222 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4223 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4224 | Catch ex As Exception |
||
4225 | End Try |
||
4226 | Next |
||
4227 | oPipeRun.Commit() |
||
4228 | End If |
||
4229 | End If |
||
4230 | Return sReturnUid |
||
4231 | End Function |
||
4232 | |||
4233 | Private Function LineToSymbol_Modeling(ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
4234 | ByVal sLineUid As String, ByVal oLMConnector As LMConnector, ByRef oLMSymbol As LMSymbol) As String |
||
4235 | |||
4236 | |||
4237 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4238 | Dim objItem As LMAItem |
||
4239 | Dim objConnector As LMConnector |
||
4240 | Dim objInputs As PlaceRunInputs |
||
4241 | objInputs = New PlaceRunInputs |
||
4242 | |||
4243 | |||
4244 | Dim sSymbolUid As String = "" |
||
4245 | Dim iConnType As Integer = 0 |
||
4246 | Dim dOriginalPoint_x As Double = 0.0 |
||
4247 | Dim dORiginalPoint_y As Double = 0.0 |
||
4248 | Dim dX As Double = 0.0 |
||
4249 | Dim dY As Double = 0.0 |
||
4250 | Dim sReturnUid As String = "" |
||
4251 | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn1_Uid & " = '" + sLineUid + "' And " & |
||
4252 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4253 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4254 | If oSymbolRow.Length = 0 Then |
||
4255 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4256 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4257 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4258 | If oSymbolRow.Length = 0 Then |
||
4259 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4260 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4261 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4262 | If oSymbolRow.Length = 0 Then |
||
4263 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4264 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4265 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4266 | If oSymbolRow.Length = 0 Then |
||
4267 | |||
4268 | Else |
||
4269 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4270 | iConnType = 4 |
||
4271 | End If |
||
4272 | Else |
||
4273 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4274 | iConnType = 3 |
||
4275 | End If |
||
4276 | Else |
||
4277 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4278 | iConnType = 2 |
||
4279 | End If |
||
4280 | |||
4281 | Else |
||
4282 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4283 | iConnType = 1 |
||
4284 | End If |
||
4285 | |||
4286 | If oSymbolRow.Length = 1 Then |
||
4287 | If sSymbolUid = "" Then |
||
4288 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4289 | iConnType = 2 |
||
4290 | End If |
||
4291 | sReturnUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4292 | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
4293 | ConvertPointBystring(sOriginalPoint, dOriginalPoint_x, dORiginalPoint_y) |
||
4294 | dX = dOriginalPoint_x |
||
4295 | dY = dORiginalPoint_y |
||
4296 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
4297 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4298 | |||
4299 | oSymbolRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4300 | |||
4301 | Dim sType As String = oSymbolRow(0)(_XML_LINE_TYPE).ToString() |
||
4302 | Dim sSystemPath As String = GetPipeType(sType) |
||
4303 | |||
4304 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, ExistingItem:=oLMConnector.AsLMAItem, |
||
4305 | TargetItem:=oLMSymbol.AsLMAItem) |
||
4306 | |||
4307 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4308 | If oAttributeRow.Length > 0 Then |
||
4309 | For Each oAttribute In oAttributeRow |
||
4310 | Try |
||
4311 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4312 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4313 | If sPIDValue.Contains("'") Then |
||
4314 | sPIDValue = sPIDValue.Replace("'", """") |
||
4315 | End If |
||
4316 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4317 | oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4318 | Catch ex As Exception |
||
4319 | End Try |
||
4320 | Next |
||
4321 | End If |
||
4322 | End If |
||
4323 | Return sReturnUid |
||
4324 | End Function |
||
4325 | |||
4326 | |||
4327 | Private Sub OPCTOLineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oOPCSymbol As LMSymbol, |
||
4328 | ByVal sOPCUid As String, ByVal sLineNoUid As String) |
||
4329 | Try |
||
4330 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4331 | Dim objItem As LMAItem |
||
4332 | Dim objConnector As LMConnector |
||
4333 | Dim objInputs As PlaceRunInputs |
||
4334 | objInputs = New PlaceRunInputs |
||
4335 | Dim dOriginalStart_x As Double = 0.0 |
||
4336 | Dim dOriginalStart_y As Double = 0.0 |
||
4337 | Dim dOriginalEnd_x As Double = 0.0 |
||
4338 | Dim dOriginalEnd_y As Double = 0.0 |
||
4339 | Dim dStart_x As Double = 0.0 |
||
4340 | Dim dStart_y As Double = 0.0 |
||
4341 | Dim dEnd_x As Double = 0.0 |
||
4342 | Dim dEnd_y As Double = 0.0 |
||
4343 | |||
4344 | Dim oPipeRun As LMPipeRun = Nothing |
||
4345 | Dim sStartpoint As String = "" |
||
4346 | Dim sEndpoint As String = "" |
||
4347 | Dim iConnType As Integer = 0 |
||
4348 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sOPCUid + "' And [" & |
||
4349 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4350 | Dim sPipeUid As String = "" |
||
4351 | If oPipeRow.Length = 0 Then |
||
4352 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sOPCUid + "' And [" & |
||
4353 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4354 | Else |
||
4355 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4356 | iConnType = 1 |
||
4357 | End If |
||
4358 | Dim oAddUid_List As New List(Of String) |
||
4359 | If oPipeRow.Length = 1 Then |
||
4360 | If sPipeUid = "" Then |
||
4361 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4362 | iConnType = 2 |
||
4363 | End If |
||
4364 | oAddUid_List.Add(sPipeUid) |
||
4365 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4366 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4367 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4368 | dStart_x = dOriginalStart_x |
||
4369 | dStart_y = dOriginalStart_y |
||
4370 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4371 | dEnd_x = dOriginalEnd_x |
||
4372 | dEnd_y = dOriginalEnd_y |
||
4373 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4374 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4375 | |||
4376 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4377 | If iConnType = 1 Then |
||
4378 | FindNearPoint(oOPCSymbol, dStart_x, dStart_y) |
||
4379 | objInputs.AddSymbolTarget(oOPCSymbol, dStart_x, dStart_y) |
||
4380 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4381 | Else |
||
4382 | FindNearPoint(oOPCSymbol, dEnd_x, dEnd_y) |
||
4383 | objInputs.AddSymbolTarget(oOPCSymbol, dEnd_x, dEnd_y) |
||
4384 | bb2a0c79 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
4385 | End If |
||
4386 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4387 | |||
4388 | While True |
||
4389 | ' objInputs.Clear() |
||
4390 | Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
4391 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4392 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4393 | If oAddPipeRow.Length = 0 Then |
||
4394 | oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
4395 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4396 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4397 | sPipeUid = "" |
||
4398 | Else |
||
4399 | iConnType = 1 |
||
4400 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4401 | End If |
||
4402 | If oAddPipeRow.Length = 1 Then |
||
4403 | If sPipeUid = "" Then |
||
4404 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4405 | iConnType = 2 |
||
4406 | End If |
||
4407 | oAddUid_List.Add(sPipeUid) |
||
4408 | sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4409 | sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4410 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4411 | dStart_x = dOriginalStart_x |
||
4412 | dStart_y = dOriginalStart_y |
||
4413 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4414 | dEnd_x = dOriginalEnd_x |
||
4415 | dEnd_y = dOriginalEnd_y |
||
4416 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4417 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4418 | If iConnType = 1 Then |
||
4419 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4420 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4421 | Else |
||
4422 | 'objInputs.AddConnectorTarget(objConnector, dStart_x, dStart_y) |
||
4423 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4424 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4425 | objInputs.AddPoint(dStart_x, dStart_y) |
||
4426 | End If |
||
4427 | e4000111 | Gyusu | |
4428 | bb2a0c79 | Gyusu | oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
4429 | Else |
||
4430 | Exit While |
||
4431 | End If |
||
4432 | e4000111 | Gyusu | |
4433 | bb2a0c79 | Gyusu | End While |
4434 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4435 | Dim sSystemPath As String = GetPipeType(sType) |
||
4436 | e4000111 | Gyusu | |
4437 | bb2a0c79 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
4438 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4439 | For i = 0 To oAddUid_List.Count - 1 |
||
4440 | Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
4441 | If oUpdateRow.Length = 1 Then |
||
4442 | oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
4443 | oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
4444 | End If |
||
4445 | Next |
||
4446 | |||
4447 | |||
4448 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
4449 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4450 | If oAttributeRow.Length > 0 Then |
||
4451 | For Each oAttribute In oAttributeRow |
||
4452 | Try |
||
4453 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4454 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4455 | If sPIDValue.Contains("'") Then |
||
4456 | sPIDValue = sPIDValue.Replace("'", """") |
||
4457 | End If |
||
4458 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4459 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4460 | Catch ex As Exception |
||
4461 | End Try |
||
4462 | Next |
||
4463 | oPipeRun.Commit() |
||
4464 | End If |
||
4465 | |||
4466 | End If |
||
4467 | |||
4468 | Catch ex As Exception |
||
4469 | End Try |
||
4470 | End Sub |
||
4471 | |||
4472 | Private Function AddUidList중복체크(ByVal sUidList As List(Of String), ByVal sAddUid As String) As Boolean |
||
4473 | e4000111 | Gyusu | |
4474 | bb2a0c79 | Gyusu | For Each sUid In sUidList |
4475 | If sUid = sAddUid Then |
||
4476 | Return False |
||
4477 | End If |
||
4478 | Next |
||
4479 | Return True |
||
4480 | End Function |
||
4481 | |||
4482 | b08338e3 | Gyusu | Private Sub LineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, ByVal sLineNoText As String) |
4483 | bb2a0c79 | Gyusu | Try |
4484 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4485 | Dim objItem As LMAItem |
||
4486 | Dim objConnector As LMConnector |
||
4487 | Dim objInputs As PlaceRunInputs |
||
4488 | objInputs = New PlaceRunInputs |
||
4489 | Dim dOriginalStart_x As Double = 0.0 |
||
4490 | Dim dOriginalStart_y As Double = 0.0 |
||
4491 | Dim dOriginalEnd_x As Double = 0.0 |
||
4492 | Dim dOriginalEnd_y As Double = 0.0 |
||
4493 | Dim dStart_x As Double = 0.0 |
||
4494 | Dim dStart_y As Double = 0.0 |
||
4495 | Dim dEnd_x As Double = 0.0 |
||
4496 | Dim dEnd_y As Double = 0.0 |
||
4497 | Dim oPipeRun As LMPipeRun = Nothing |
||
4498 | Dim sStartpoint As String = "" |
||
4499 | Dim sEndpoint As String = "" |
||
4500 | Dim iConnType As Integer = 0 |
||
4501 | Dim pLMConnector As LMConnector = Nothing |
||
4502 | For Each oLinerow In oLine_Dt.Rows |
||
4503 | objInputs.Clear() |
||
4504 | b08338e3 | Gyusu | Dim sCheck As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
4505 | If sCheck = "FALSE" Then |
||
4506 | Dim sUid As String = oLinerow(_XML_LINE_UID).ToString() |
||
4507 | sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
4508 | sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
4509 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4510 | dStart_x = dOriginalStart_x |
||
4511 | dStart_y = dOriginalStart_y |
||
4512 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4513 | dEnd_x = dOriginalEnd_x |
||
4514 | dEnd_y = dOriginalEnd_y |
||
4515 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4516 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4517 | bb2a0c79 | Gyusu | |
4518 | b08338e3 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
4519 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4520 | bb2a0c79 | Gyusu | Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
4521 | Dim sSystemPath As String = GetPipeType(sType) |
||
4522 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4523 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4524 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ")..." & _iPipecnt & " count ") |
4525 | |||
4526 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
4527 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
4528 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oLinerow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
4529 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oLinerow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
4530 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
4531 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dOriginalStart_x & "," & dOriginalStart_y) |
||
4532 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dOriginalEnd_x & "," & dOriginalEnd_y) |
||
4533 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
4534 | |||
4535 | _iPipecnt = _iPipecnt + 1 |
||
4536 | oLinerow(_XML_LINE_SPID) = objConnector.ModelItemID |
||
4537 | oLinerow(_XML_LINE_LMCONNECTOR) = objConnector |
||
4538 | |||
4539 | oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4540 | bb2a0c79 | Gyusu | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
4541 | |||
4542 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4543 | If oAttributeRow.Length > 0 Then |
||
4544 | For Each oAttribute In oAttributeRow |
||
4545 | Try |
||
4546 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4547 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4548 | If sPIDValue.Contains("'") Then |
||
4549 | sPIDValue = sPIDValue.Replace("'", """") |
||
4550 | End If |
||
4551 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4552 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4553 | Catch ex As Exception |
||
4554 | End Try |
||
4555 | Next |
||
4556 | oPipeRun.Commit() |
||
4557 | End If |
||
4558 | End If |
||
4559 | |||
4560 | |||
4561 | |||
4562 | |||
4563 | |||
4564 | b08338e3 | Gyusu | 'Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
4565 | 'Dim sCheckModeling As Boolean = False |
||
4566 | 'objInputs.Clear() |
||
4567 | 'Dim oAddUid_List As New List(Of String) |
||
4568 | 'Try |
||
4569 | ' Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
4570 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4571 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4572 | ' If oAddPipeRow.Length = 0 Then |
||
4573 | ' oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
4574 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4575 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4576 | ' sPipeUid = "" |
||
4577 | ' Else |
||
4578 | ' iConnType = 1 |
||
4579 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4580 | ' End If |
||
4581 | ' If oAddPipeRow.Length = 1 Then |
||
4582 | ' sCheckModeling = True |
||
4583 | ' If sPipeUid = "" Then |
||
4584 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4585 | ' iConnType = 2 |
||
4586 | ' End If |
||
4587 | ' If AddUidList중복체크(oAddUid_List, sPipeUid) Then |
||
4588 | ' oAddUid_List.Add(sPipeUid) |
||
4589 | ' End If |
||
4590 | ' sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4591 | ' sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4592 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4593 | ' dStart_x = dOriginalStart_x |
||
4594 | ' dStart_y = dOriginalStart_y |
||
4595 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4596 | ' dEnd_x = dOriginalEnd_x |
||
4597 | ' dEnd_y = dOriginalEnd_y |
||
4598 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4599 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4600 | ' Dim sBranchType As String = "" |
||
4601 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
4602 | ' Try |
||
4603 | ' If pLMConnector Is Nothing Then |
||
4604 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4605 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4606 | ' Else |
||
4607 | ' If sBranchType = "1" Then |
||
4608 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4609 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4610 | ' ElseIf sBranchType = "2" Then |
||
4611 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4612 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4613 | ' ElseIf sBranchType = "3" Then |
||
4614 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4615 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4616 | ' ElseIf sBranchType = "4" Then |
||
4617 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4618 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4619 | ' End If |
||
4620 | ' End If |
||
4621 | ' Catch ex As Exception |
||
4622 | ' End Try |
||
4623 | ' Else |
||
4624 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4625 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4626 | ' End If |
||
4627 | ' oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4628 | ' Else |
||
4629 | ' Dim CheckTF As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
||
4630 | ' Dim CheckSelect As String = oLinerow(_XML_LINE_Check).ToString() |
||
4631 | ' If CheckTF = "FALSE" And CheckSelect = "TRUE" Then |
||
4632 | ' sPipeUid = oLinerow(_XML_LINE_UID).ToString() |
||
4633 | ' oAddUid_List.Clear() |
||
4634 | ' oAddUid_List.Add(sPipeUid) |
||
4635 | ' sCheckModeling = True |
||
4636 | ' sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
4637 | ' sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
4638 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4639 | ' dStart_x = dOriginalStart_x |
||
4640 | ' dStart_y = dOriginalStart_y |
||
4641 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4642 | ' dEnd_x = dOriginalEnd_x |
||
4643 | ' dEnd_y = dOriginalEnd_y |
||
4644 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4645 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4646 | ' Dim sBranchType As String = "" |
||
4647 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
4648 | ' Try |
||
4649 | ' If sBranchType = "1" Then |
||
4650 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4651 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4652 | ' ElseIf sBranchType = "2" Then |
||
4653 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4654 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4655 | ' ElseIf sBranchType = "3" Then |
||
4656 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4657 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4658 | ' ElseIf sBranchType = "4" Then |
||
4659 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4660 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4661 | ' End If |
||
4662 | ' Catch ex As Exception |
||
4663 | |||
4664 | ' End Try |
||
4665 | ' Else |
||
4666 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4667 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4668 | ' End If |
||
4669 | ' oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4670 | ' End If |
||
4671 | ' End If |
||
4672 | 'Catch ex As Exception |
||
4673 | 'End Try |
||
4674 | 'If sCheckModeling Then |
||
4675 | ' Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
||
4676 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
4677 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4678 | ' objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4679 | ' For i = 0 To oAddUid_List.Count - 1 |
||
4680 | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
4681 | ' If oUpdateRow.Length = 1 Then |
||
4682 | ' oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
4683 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
4684 | ' End If |
||
4685 | ' Next |
||
4686 | |||
4687 | ' oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
4688 | ' oAddUid_List.Clear() |
||
4689 | |||
4690 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4691 | ' If oAttributeRow.Length > 0 Then |
||
4692 | ' For Each oAttribute In oAttributeRow |
||
4693 | ' Try |
||
4694 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4695 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4696 | ' If sPIDValue.Contains("'") Then |
||
4697 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
4698 | ' End If |
||
4699 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4700 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4701 | ' Catch ex As Exception |
||
4702 | ' End Try |
||
4703 | ' Next |
||
4704 | ' oPipeRun.Commit() |
||
4705 | ' End If |
||
4706 | |||
4707 | ' If pLMConnector IsNot Nothing Then |
||
4708 | ' Dim sID_1 As String = pLMConnector.ModelItemID |
||
4709 | ' Dim sID_2 As String = objConnector.ModelItemID |
||
4710 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
4711 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
4712 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
4713 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
4714 | ' ' oDatasource.CommitTransaction() |
||
4715 | ' '_Placement.PIDAutoJoin(oPipeRun1.AsLMAItem, AutoJoinEndConstants.autoJoin_End, objSurvivorItem) |
||
4716 | ' 'oPipeRun1.Commit() |
||
4717 | ' 'oDatasource.CommitTransaction() |
||
4718 | ' 'objSurvivorItem = Nothing |
||
4719 | ' '_Placement.PIDAutoJoin(oPipeRun2.AsLMAItem, AutoJoinEndConstants.autoJoin_Start, objSurvivorItem) |
||
4720 | ' 'oPipeRun2.Commit() |
||
4721 | ' 'oDatasource.CommitTransaction() |
||
4722 | ' End If |
||
4723 | ' sCheckModeling = False |
||
4724 | ' End If |
||
4725 | Next |
||
4726 | bb2a0c79 | Gyusu | Catch ex As Exception |
4727 | End Try |
||
4728 | End Sub |
||
4729 | e4000111 | Gyusu | |
4730 | b08338e3 | Gyusu | |
4731 | Private Sub SymbolModeling(ByVal CDrawing As Drawing, ByVal oLine_DT As DataTable, ByVal oSymbolRow As DataRow, ByVal oAttribute_Dt As DataTable, |
||
4732 | ByVal sLineNoText As String) |
||
4733 | bb2a0c79 | Gyusu | Try |
4734 | b08338e3 | Gyusu | |
4735 | Dim sCheckModeling As String = oSymbolRow(_XML_SYMBOL_DRAWING_TF).ToString() |
||
4736 | If sCheckModeling = "FALSE" Then |
||
4737 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
4738 | Dim oSymbol As LMSymbol = Nothing |
||
4739 | Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
4740 | Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
4741 | bb2a0c79 | Gyusu | Dim oDatasource As Object = _Placement.PIDDataSource |
4742 | Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
4743 | Dim dLocationX As Double = 0.0 |
||
4744 | Dim dLocationY As Double = 0.0 |
||
4745 | Dim dX As Double = 0.0 |
||
4746 | Dim dY As Double = 0.0 |
||
4747 | b08338e3 | Gyusu | Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
4748 | ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
4749 | dX = dLocationX |
||
4750 | dY = dLocationY |
||
4751 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
4752 | |||
4753 | Dim dAngle As Double = oSymbolRow(_XML_SYMBOL_ANGLE) |
||
4754 | |||
4755 | |||
4756 | 'Dim oDatarow() As DataRow = oLine_DT.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sSymbolUid & "'") |
||
4757 | 'If oDatarow.Length = 0 Then |
||
4758 | ' oDatarow = oLine_DT.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sSymbolUid & "'") |
||
4759 | 'End If |
||
4760 | 'Dim dFix_X As Double = 0.0 |
||
4761 | 'Dim dFix_Y As Double = 0.0 |
||
4762 | 'If oDatarow.Length > 0 Then |
||
4763 | ' If dAngle <> 0 Then |
||
4764 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4765 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
4766 | |||
4767 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
4768 | ' dX = dLocationX |
||
4769 | ' Else |
||
4770 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4771 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
4772 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
4773 | ' dY = dLocationY |
||
4774 | ' End If |
||
4775 | |||
4776 | 'End If |
||
4777 | |||
4778 | |||
4779 | |||
4780 | oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY,, dAngle) |
||
4781 | SetListBoxItems(ListBox_Result, "Place Fitting.." & sSymbolUid & " (" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
4782 | |||
4783 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Fitting : " & sSymbolUid) |
||
4784 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
4785 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
4786 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
4787 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection3 : " & oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()) |
||
4788 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection4 : " & oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()) |
||
4789 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
4790 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
4791 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Fitting Count : " & _iFittingcnt) |
||
4792 | |||
4793 | |||
4794 | _iFittingcnt = _iFittingcnt + 1 |
||
4795 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
4796 | Dim oAttributeRow() As DataRow |
||
4797 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
4798 | If oAttribute_Dt.Rows.Count > 0 Then |
||
4799 | |||
4800 | bb2a0c79 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
4801 | b08338e3 | Gyusu | Dim oInstrument As LMInstrument |
4802 | oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
4803 | bb2a0c79 | Gyusu | Try |
4804 | If oAttributeRow.Length > 0 Then |
||
4805 | For Each oAttribute In oAttributeRow |
||
4806 | Try |
||
4807 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4808 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4809 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4810 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4811 | Catch ex As Exception |
||
4812 | End Try |
||
4813 | Next |
||
4814 | oInstrument.Commit() |
||
4815 | End If |
||
4816 | Catch ex As Exception |
||
4817 | End Try |
||
4818 | Else |
||
4819 | b08338e3 | Gyusu | Try |
4820 | If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
4821 | For Each oAttribute In oAttributeRow |
||
4822 | Try |
||
4823 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4824 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4825 | e4000111 | Gyusu | |
4826 | b08338e3 | Gyusu | If sPIDAttribute = "SIZE" Then |
4827 | |||
4828 | 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
4829 | If sPIDValue.Contains("x") Then |
||
4830 | Dim sSplitSize() As String = sPIDValue.Split("x") |
||
4831 | If sSplitSize.Count > 1 Then |
||
4832 | 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
4833 | Dim oConnector_1 As LMConnector = Nothing |
||
4834 | Dim oConnector_2 As LMConnector = Nothing |
||
4835 | If oSymbol IsNot Nothing Then |
||
4836 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
4837 | For Each Tconnector In oSymbol.Connect1Connectors |
||
4838 | If Tconnector.ItemStatus = "Active" Then |
||
4839 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
4840 | oConnector_1 = Tconnector |
||
4841 | End If |
||
4842 | End If |
||
4843 | Next |
||
4844 | End If |
||
4845 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
4846 | For Each Tconnector In oSymbol.Connect1Connectors |
||
4847 | If Tconnector.ItemStatus = "Active" Then |
||
4848 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
4849 | oConnector_2 = Tconnector |
||
4850 | End If |
||
4851 | End If |
||
4852 | Next |
||
4853 | End If |
||
4854 | End If |
||
4855 | Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
4856 | Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
4857 | If dAngle = 3.14 Then |
||
4858 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
4859 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
4860 | Else |
||
4861 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
4862 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
4863 | End If |
||
4864 | e4000111 | Gyusu | |
4865 | |||
4866 | b08338e3 | Gyusu | End If |
4867 | e4000111 | Gyusu | |
4868 | b08338e3 | Gyusu | Else |
4869 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4870 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4871 | End If |
||
4872 | Else |
||
4873 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4874 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4875 | End If |
||
4876 | e4000111 | Gyusu | |
4877 | b08338e3 | Gyusu | Catch ex As Exception |
4878 | End Try |
||
4879 | Next |
||
4880 | oSymbol.Commit() |
||
4881 | End If |
||
4882 | Catch ex As Exception |
||
4883 | End Try |
||
4884 | End If |
||
4885 | End If |
||
4886 | e4000111 | Gyusu | |
4887 | |||
4888 | |||
4889 | b08338e3 | Gyusu | End If |
4890 | e4000111 | Gyusu | |
4891 | |||
4892 | |||
4893 | b08338e3 | Gyusu | 'Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
4894 | 'Dim sConnTypeNo As String = "" |
||
4895 | '' Line과 연결되어있는 Symbol인지 확인 |
||
4896 | 'Dim oLine_Dt As DataTable = GetPipeFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
4897 | ''Symbol과 연결되어 있는 Symbol인지 확인 |
||
4898 | 'Dim oSymbol_Dt As DataTable = GetSymbolFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
4899 | 'Dim oSymbol As LMSymbol = Nothing |
||
4900 | 'Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
4901 | 'Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
4902 | 'Dim oDatasource As Object = _Placement.PIDDataSource |
||
4903 | 'Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
4904 | e4000111 | Gyusu | |
4905 | b08338e3 | Gyusu | 'Dim dAngle As Double = 0.0 |
4906 | 'If IsNumeric(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) Then |
||
4907 | ' dAngle = Double.Parse(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) |
||
4908 | 'End If |
||
4909 | e4000111 | Gyusu | |
4910 | b08338e3 | Gyusu | 'Dim dLocationX As Double = 0.0 |
4911 | 'Dim dLocationY As Double = 0.0 |
||
4912 | 'Dim dX As Double = 0.0 |
||
4913 | 'Dim dY As Double = 0.0 |
||
4914 | 'Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
4915 | 'ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
4916 | 'dX = dLocationX |
||
4917 | 'dY = dLocationY |
||
4918 | 'ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
4919 | 'Dim bCheckModeling As Boolean = False |
||
4920 | |||
4921 | 'If oLine_Dt.Rows.Count > 0 Then |
||
4922 | |||
4923 | ' If sSPID <> "" Then |
||
4924 | ' Dim dX1 As Double = 0 |
||
4925 | ' Dim dX2 As Double = 0 |
||
4926 | ' Dim dY1 As Double = 0 |
||
4927 | ' Dim dY2 As Double = 0 |
||
4928 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
4929 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
4930 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
4931 | |||
4932 | ' Dim dCalcPoint As Double = -1 |
||
4933 | ' Dim dModeling_X As Double = 0 |
||
4934 | ' Dim dModeling_Y As Double = 0 |
||
4935 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
4936 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
4937 | ' dModeling_X = dX1 |
||
4938 | ' dModeling_Y = dY1 |
||
4939 | ' End If |
||
4940 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
4941 | e4000111 | Gyusu | |
4942 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
4943 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
4944 | ' dModeling_X = dX2 |
||
4945 | ' dModeling_Y = dY2 |
||
4946 | ' End If |
||
4947 | ' End If |
||
4948 | e4000111 | Gyusu | |
4949 | |||
4950 | |||
4951 | b08338e3 | Gyusu | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
4952 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
4953 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
4954 | ' bCheckModeling = True |
||
4955 | ' End If |
||
4956 | e4000111 | Gyusu | |
4957 | |||
4958 | b08338e3 | Gyusu | ' End If |
4959 | 'End If |
||
4960 | 'If oSymbol_Dt.Rows.Count > 0 Then |
||
4961 | ' If sSPID <> "" Then |
||
4962 | ' Dim dX1 As Double = 0 |
||
4963 | ' Dim dX2 As Double = 0 |
||
4964 | ' Dim dX3 As Double = 0 |
||
4965 | ' Dim dX4 As Double = 0 |
||
4966 | ' Dim dY1 As Double = 0 |
||
4967 | ' Dim dY2 As Double = 0 |
||
4968 | ' Dim dY3 As Double = 0 |
||
4969 | ' Dim dY4 As Double = 0 |
||
4970 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
4971 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
4972 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
4973 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 3, dX3, dY3) |
||
4974 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 4, dX4, dY4) |
||
4975 | |||
4976 | ' Dim dCalcPoint As Double = -1 |
||
4977 | ' Dim dModeling_X As Double = 0 |
||
4978 | ' Dim dModeling_Y As Double = 0 |
||
4979 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
4980 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
4981 | ' dModeling_X = dX1 |
||
4982 | ' dModeling_Y = dY1 |
||
4983 | ' End If |
||
4984 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
4985 | 41e4023e | Gyusu | |
4986 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
4987 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
4988 | ' dModeling_X = dX2 |
||
4989 | ' dModeling_Y = dY2 |
||
4990 | ' End If |
||
4991 | ' End If |
||
4992 | ' If dX3 <> 0 And dY3 <> 0 Then |
||
4993 | ' If (Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) > dCalcPoint) Then |
||
4994 | ' dCalcPoint = Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) |
||
4995 | ' dModeling_X = dX3 |
||
4996 | ' dModeling_Y = dY3 |
||
4997 | ' End If |
||
4998 | ' End If |
||
4999 | ' If dX4 <> 0 And dY4 <> 0 Then |
||
5000 | ' If (Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) > dCalcPoint) Then |
||
5001 | ' dCalcPoint = Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) |
||
5002 | ' dModeling_X = dX4 |
||
5003 | ' dModeling_Y = dY4 |
||
5004 | ' End If |
||
5005 | ' End If |
||
5006 | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
||
5007 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
5008 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
5009 | ' bCheckModeling = True |
||
5010 | ' End If |
||
5011 | 41e4023e | Gyusu | |
5012 | e4000111 | Gyusu | |
5013 | b08338e3 | Gyusu | ' End If |
5014 | e4000111 | Gyusu | |
5015 | b08338e3 | Gyusu | 'End If |
5016 | e4000111 | Gyusu | |
5017 | b08338e3 | Gyusu | 'If (oLine_Dt.Rows.Count = 0 And oSymbol_Dt.Rows.Count = 0) Or bCheckModeling = False Then |
5018 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
5019 | ' SetListBoxItems(ListBox_Result, "Place Fittings..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
5020 | ' _iFittingcnt = _iFittingcnt + 1 |
||
5021 | 'End If |
||
5022 | 'Dim oAttributeRow() As DataRow |
||
5023 | 'oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
5024 | 'If oAttribute_Dt.Rows.Count > 0 Then |
||
5025 | |||
5026 | ' If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
||
5027 | ' Dim oInstrument As LMInstrument |
||
5028 | ' oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
5029 | ' Try |
||
5030 | ' If oAttributeRow.Length > 0 Then |
||
5031 | ' For Each oAttribute In oAttributeRow |
||
5032 | ' Try |
||
5033 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5034 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5035 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5036 | ' oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5037 | ' Catch ex As Exception |
||
5038 | ' End Try |
||
5039 | ' Next |
||
5040 | ' oInstrument.Commit() |
||
5041 | ' End If |
||
5042 | ' Catch ex As Exception |
||
5043 | ' End Try |
||
5044 | ' Else |
||
5045 | ' Try |
||
5046 | ' If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
5047 | ' For Each oAttribute In oAttributeRow |
||
5048 | ' Try |
||
5049 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5050 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5051 | |||
5052 | ' If sPIDAttribute = "SIZE" Then |
||
5053 | |||
5054 | ' 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
5055 | ' If sPIDValue.Contains("x") Then |
||
5056 | ' Dim sSplitSize() As String = sPIDValue.Split("x") |
||
5057 | ' If sSplitSize.Count > 1 Then |
||
5058 | ' 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
5059 | ' Dim oConnector_1 As LMConnector = Nothing |
||
5060 | ' Dim oConnector_2 As LMConnector = Nothing |
||
5061 | ' If oSymbol IsNot Nothing Then |
||
5062 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5063 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
5064 | ' If Tconnector.ItemStatus = "Active" Then |
||
5065 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5066 | ' oConnector_1 = Tconnector |
||
5067 | ' End If |
||
5068 | ' End If |
||
5069 | ' Next |
||
5070 | ' End If |
||
5071 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5072 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
5073 | ' If Tconnector.ItemStatus = "Active" Then |
||
5074 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5075 | ' oConnector_2 = Tconnector |
||
5076 | ' End If |
||
5077 | ' End If |
||
5078 | ' Next |
||
5079 | ' End If |
||
5080 | ' End If |
||
5081 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
5082 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
5083 | ' If dAngle = 3.14 Then |
||
5084 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5085 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5086 | ' Else |
||
5087 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5088 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5089 | ' End If |
||
5090 | |||
5091 | |||
5092 | ' End If |
||
5093 | |||
5094 | ' Else |
||
5095 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5096 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5097 | ' End If |
||
5098 | ' Else |
||
5099 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5100 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5101 | ' End If |
||
5102 | |||
5103 | ' Catch ex As Exception |
||
5104 | ' End Try |
||
5105 | ' Next |
||
5106 | ' oSymbol.Commit() |
||
5107 | ' End If |
||
5108 | ' Catch ex As Exception |
||
5109 | ' End Try |
||
5110 | ' End If |
||
5111 | 'End If |
||
5112 | Catch ex As Exception |
||
5113 | End Try |
||
5114 | End Sub |
||
5115 | e4000111 | Gyusu | |
5116 | |||
5117 | |||
5118 | Private Function AutoModeling() As Boolean |
||
5119 | Try |
||
5120 | 76f465d0 | Gyusu | _AllLine_DT = Line_Dt() |
5121 | _AllSymbol_DT = Symbol_Dt() |
||
5122 | |||
5123 | e4000111 | Gyusu | _CompleteConvert = False |
5124 | Label_Progress.Text = "0%" |
||
5125 | SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
||
5126 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 시작....") |
5127 | e4000111 | Gyusu | Dim oDwg_Dt As DataTable = LoadAllDrawing() |
5128 | b08338e3 | Gyusu | _Log_File = "AutoConverting_" + DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("HHmmss") |
5129 | e4000111 | Gyusu | _allItem = GetAllCheckNodeCount() |
5130 | 76f465d0 | Gyusu | _Itemcnt = 0 |
5131 | e4000111 | Gyusu | '1.Equipment |
5132 | '2.Piping OPC |
||
5133 | '3.OPC 시작되는 Line |
||
5134 | bb2a0c79 | Gyusu | InitAutoRouting() |
5135 | e4000111 | Gyusu | EquipmentModeling(oDwg_Dt) |
5136 | bb2a0c79 | Gyusu | PipingModeling() |
5137 | |||
5138 | ' PipeLine_Fitting_Modeling() |
||
5139 | e4000111 | Gyusu | |
5140 | 171ac39d | Gyusu | SetProgressbar(ProgressBar_Status, 100) |
5141 | 41e4023e | Gyusu | Label_Progress.Text = "100%" |
5142 | 171ac39d | Gyusu | SetListBoxItems(ListBox_Result, " Auto converting 완료") |
5143 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 완료") |
5144 | 54b98e09 | Gyusu | _CompleteConvert = True |
5145 | 171ac39d | Gyusu | Return True |
5146 | Catch ex As Exception |
||
5147 | Return False |
||
5148 | End Try |
||
5149 | End Function |
||
5150 | |||
5151 | |||
5152 | |||
5153 | 54b98e09 | Gyusu | Private Sub ThreadConvert() |
5154 | 559daf6d | Gyusu | If _DrawingsList IsNot Nothing Then |
5155 | If _DrawingsList.Count > 0 Then |
||
5156 | AutoModeling() |
||
5157 | End If |
||
5158 | 171ac39d | Gyusu | End If |
5159 | e282643f | Gyusu | End Sub |
5160 | |||
5161 | 54b98e09 | Gyusu | Private Sub ThreadOPCRemove() |
5162 | While _CompleteConvert = False |
||
5163 | Dim oFindOPC As New FindOpc |
||
5164 | oFindOPC.RemoveOPCDlg() |
||
5165 | End While |
||
5166 | e282643f | Gyusu | |
5167 | 54b98e09 | Gyusu | End Sub |
5168 | 171ac39d | Gyusu | |
5169 | e282643f | Gyusu | |
5170 | Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
||
5171 | Dim oRows As DataRow() = oDt.Select("[Name] = '" & sDwgName & "'") |
||
5172 | Dim oPath As String = "" |
||
5173 | If oRows.Length > 0 Then |
||
5174 | oPath = oRows(0).Item("Path").ToString() |
||
5175 | End If |
||
5176 | Return oPath |
||
5177 | End Function |
||
5178 | |||
5179 | 272662f9 | Gyusu | Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
5180 | 171ac39d | Gyusu | If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
5181 | 54b98e09 | Gyusu | LoadDB() |
5182 | 171ac39d | Gyusu | LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
5183 | End If |
||
5184 | End Sub |
||
5185 | Private Sub LoadXmlItem(ByVal sFolderPath As String) |
||
5186 | _DrawingsList = New List(Of Drawing) |
||
5187 | Dim sfileEntries As String() = Directory.GetFiles(sFolderPath) |
||
5188 | If Tree_Result.Nodes.Count > 0 Then |
||
5189 | Tree_Result.Nodes(0).Nodes.Clear() |
||
5190 | For Each sfileName In sfileEntries |
||
5191 | Dim sExtension As String = Path.GetExtension(sfileName) |
||
5192 | If sExtension = ".xml" Then |
||
5193 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(sfileName) |
||
5194 | Dim sDwgPath As String = sfileName |
||
5195 | Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
||
5196 | Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
||
5197 | bb2a0c79 | Gyusu | |
5198 | 171ac39d | Gyusu | _DrawingsList.Add(oDwg) |
5199 | End If |
||
5200 | Next |
||
5201 | Tree_Result.Nodes(0).Expand() |
||
5202 | End If |
||
5203 | End Sub |
||
5204 | 272662f9 | Gyusu | |
5205 | e4000111 | Gyusu | Private Sub GenerateRelation(ByRef oDwg_Ds As Drawing) |
5206 | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
||
5207 | Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
||
5208 | Dim oTrimLineLists As List(Of Line_no) = oDwg_Ds.TrimLine_nos |
||
5209 | Dim oRelation As New GenerateRelation() |
||
5210 | For Each oLinelist In oLineLists |
||
5211 | bb2a0c79 | Gyusu | oRelation.CalcLineConnectionItem_Equal(oLinelist.Dt_Line, oLineLists) |
5212 | oRelation.CalcLineConnectionItem_NonEqual(oLinelist.Dt_Line, oLineLists) |
||
5213 | oRelation.CalcSymbolConnectionItem_Equal(oLinelist.Dt_Symbol, oLineLists) |
||
5214 | oRelation.CalcSymbolConnectionItem_NonEqual(oLinelist.Dt_Symbol, oLineLists) |
||
5215 | e4000111 | Gyusu | Next |
5216 | End Sub |
||
5217 | |||
5218 | |||
5219 | 20c84e05 | Gyusu | ''' <summary> |
5220 | ''' XML Tree 구조 생성 |
||
5221 | ''' </summary> |
||
5222 | ''' <param name="sDwgPath"></param> |
||
5223 | 171ac39d | Gyusu | Private Function AddSymbolItem(ByVal sDwgPath As String, ByVal oParentNode As TreeNode) As Drawing |
5224 | Dim oDwg_Ds As Drawing = LoadSymbolInXml(sDwgPath) |
||
5225 | e4000111 | Gyusu | |
5226 | 76f465d0 | Gyusu | 'SetConnectionInfo() |
5227 | b08338e3 | Gyusu | ' GenerateRelation(oDwg_Ds) |
5228 | e4000111 | Gyusu | |
5229 | 54b98e09 | Gyusu | If oDwg_Ds IsNot Nothing Then |
5230 | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
||
5231 | |||
5232 | Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
||
5233 | 3acffcee | Gyusu | |
5234 | Dim oTrimLineLists As List(Of Line_no) = oDwg_Ds.TrimLine_nos |
||
5235 | |||
5236 | 54b98e09 | Gyusu | Dim oPipe As Boolean = False |
5237 | Dim oFitting As Boolean = False |
||
5238 | 'PipeLine 구분 |
||
5239 | |||
5240 | For Each oLinelist In oLineLists |
||
5241 | Dim sLineNoUid As String = oLinelist.Uid |
||
5242 | Dim sLineNo As String = oLinelist.Text |
||
5243 | Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
||
5244 | For Each oLineRow In oLinelist.Dt_Line.Rows |
||
5245 | Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
||
5246 | Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
||
5247 | oPipeNode.Tag = sLineNoUid |
||
5248 | Next |
||
5249 | For Each oSymbolRow In oLinelist.Dt_Symbol.Rows |
||
5250 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5251 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
5252 | Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
5253 | oSymbolNode.Tag = sLineNoUid |
||
5254 | Next |
||
5255 | Next |
||
5256 | 3acffcee | Gyusu | |
5257 | 54b98e09 | Gyusu | For Each oEqplist In oEqpLists |
5258 | Dim sEqpUid As String = oEqplist.Uid |
||
5259 | Dim sEqpNo As String = "EQUIPMENT" |
||
5260 | Dim oEqpNode As TreeNode = oParentNode.Nodes.Add(sEqpUid, sEqpNo) |
||
5261 | d039e347 | Gyusu | |
5262 | 54b98e09 | Gyusu | |
5263 | For Each oSymbolRow In oEqplist.Dt_Equipment.Rows |
||
5264 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5265 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
5266 | Dim oSymbolNode As TreeNode = oEqpNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
5267 | oSymbolNode.Tag = sEqpUid |
||
5268 | Next |
||
5269 | 171ac39d | Gyusu | Next |
5270 | 3acffcee | Gyusu | Dim sTrimLine As String = "TrimLineNos" |
5271 | Dim iTrimLinecnt As Integer = 1 |
||
5272 | For Each oTrimLinelist In oTrimLineLists |
||
5273 | Dim sLineNoUid As String = oTrimLinelist.Uid |
||
5274 | Dim sLineNo As String = sTrimLine & "_" & iTrimLinecnt |
||
5275 | Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
||
5276 | For Each oLineRow In oTrimLinelist.Dt_Line.Rows |
||
5277 | Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
||
5278 | Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
||
5279 | oPipeNode.Tag = sLineNoUid |
||
5280 | Next |
||
5281 | For Each oSymbolRow In oTrimLinelist.Dt_Symbol.Rows |
||
5282 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5283 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
5284 | Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
5285 | oSymbolNode.Tag = sLineNoUid |
||
5286 | Next |
||
5287 | iTrimLinecnt = iTrimLinecnt + 1 |
||
5288 | Next |
||
5289 | |||
5290 | 54b98e09 | Gyusu | End If |
5291 | |||
5292 | 171ac39d | Gyusu | Return oDwg_Ds |
5293 | End Function |
||
5294 | 272662f9 | Gyusu | Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
5295 | If e.Node.Checked = True Then |
||
5296 | For Each oNode As TreeNode In e.Node.Nodes |
||
5297 | oNode.Checked = True |
||
5298 | Next |
||
5299 | Else |
||
5300 | For Each oNode As TreeNode In e.Node.Nodes |
||
5301 | oNode.Checked = False |
||
5302 | Next |
||
5303 | End If |
||
5304 | End Sub |
||
5305 | 171ac39d | Gyusu | |
5306 | 559daf6d | Gyusu | Private Sub Btn_Setting_Click(sender As Object, e As EventArgs) Handles Btn_Setting.Click |
5307 | Dim oSettings As Settings = New Settings() |
||
5308 | oSettings.ShowDialog() |
||
5309 | End Sub |
||
5310 | 42c0013c | Gyusu | |
5311 | Private Sub Btn_TestNozzle_Click(sender As Object, e As EventArgs) Handles Btn_TestNozzle.Click |
||
5312 | |||
5313 | Dim sVessel_ID As String = "841D5E640AE5421B9A017DDC2E87FF11" |
||
5314 | Dim objVessel As LMVessel |
||
5315 | objVessel = _Placement.PIDDataSource.GetVessel(sVessel_ID) |
||
5316 | Dim oVesselLocation As LMLocations = objVessel.Locations |
||
5317 | Dim symVessel As LMSymbol = _Placement.PIDDataSource.GetSymbol(objVessel.Representations.Nth(1).Id) |
||
5318 | Dim XCoordinate As String = symVessel.Attributes("XCoordinate").Value |
||
5319 | Dim YCoordinate As String = symVessel.Attributes("YCoordinate").Value |
||
5320 | symVessel.Attributes("XCoordinate").Value = XCoordinate + 0.01 |
||
5321 | symVessel.Attributes("YCoordinate").Value = YCoordinate + 0.01 |
||
5322 | symVessel.Commit() |
||
5323 | Dim sValve_ID As String = "DB7B0CA8A2664A6BA7A9615764BA62B0" |
||
5324 | Dim objValve As LMSymbol |
||
5325 | Dim objValves As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(sValve_ID) |
||
5326 | |||
5327 | objValve = _Placement.PIDDataSource.GetSymbol(objValves.Representations.Nth(1).Id) |
||
5328 | objValve.Commit() |
||
5329 | Dim dVesselX As Double = XCoordinate |
||
5330 | Dim dVesselY As Double = YCoordinate |
||
5331 | Dim X1 As Double, Y1 As Double, X2 As Double, Y2 As Double |
||
5332 | |||
5333 | _Placement.PIDConnectPointLocation(objValve, 1, X1, Y1) |
||
5334 | |||
5335 | _Placement.PIDConnectPointLocation(objValve, 2, X2, Y2) |
||
5336 | |||
5337 | Dim nozzlename As String = "\Equipment Components\Nozzles\Flanged Nozzle.sym" |
||
5338 | Dim dCalc_x As Double = 0 |
||
5339 | Dim dCalc_y As Double = 0 |
||
5340 | |||
5341 | If dVesselX - X2 > 0 Then |
||
5342 | dCalc_x = dVesselX - (dVesselX - X2) |
||
5343 | Else |
||
5344 | dCalc_x = dVesselX + (X2 - dVesselX) |
||
5345 | End If |
||
5346 | If dVesselY - Y2 > 0 Then |
||
5347 | dCalc_y = dVesselY - (dVesselY - Y2) |
||
5348 | Else |
||
5349 | dCalc_y = dVesselY + (Y2 - dVesselY) |
||
5350 | End If |
||
5351 | |||
5352 | Dim objNozzle As LMSymbol = _Placement.PIDPlaceSymbol(nozzlename, dCalc_x, dCalc_y, |
||
5353 | TargetItem:=symVessel.AsLMRepresentation) |
||
5354 | |||
5355 | Dim blnSuccess As Boolean = _Placement.PIDConnectPointLocation(objNozzle, 1, X1, Y1) |
||
5356 | blnSuccess = _Placement.PIDConnectPointLocation(objNozzle, 2, X1, Y1) |
||
5357 | |||
5358 | objValve = _Placement.PIDPlaceSymbol(objValve.FileName, X1, Y1, ExistingItem:=objValve.AsLMAItem, |
||
5359 | TargetItem:=objNozzle.AsLMRepresentation) |
||
5360 | |||
5361 | |||
5362 | |||
5363 | End Sub |
||
5364 | 39d43554 | Gyusu | |
5365 | Private Sub Btn_SymbolLibrary_Click(sender As Object, e As EventArgs) Handles Btn_SymbolLibrary.Click |
||
5366 | Dim oMapping As New Mapping(_PIDSymbol_DB) |
||
5367 | oMapping.Show() |
||
5368 | End Sub |
||
5369 | 41e4023e | Gyusu | |
5370 | Private Sub Btn_Stop_Click(sender As Object, e As EventArgs) Handles Btn_Stop.Click |
||
5371 | Try |
||
5372 | SetListBoxItems(ListBox_Result, " Auto converting 중지....") |
||
5373 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 중지....") |
5374 | 41e4023e | Gyusu | _Main_trd.Abort() |
5375 | _Opc_trd.Abort() |
||
5376 | Catch ex As Exception |
||
5377 | |||
5378 | End Try |
||
5379 | End Sub |
||
5380 | b08338e3 | Gyusu | |
5381 | Private Sub AutoCheckTreeNode(ByVal iType As Integer, ByVal bCheck As Boolean) |
||
5382 | |||
5383 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
5384 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
5385 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
5386 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
5387 | If CDrawing IsNot Nothing Then |
||
5388 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
5389 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
5390 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
5391 | Dim iItemcnt As Integer = 0 |
||
5392 | Dim sNodeUid As String = oNode.Name |
||
5393 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
5394 | |||
5395 | If iType = 0 Then 'Symbol |
||
5396 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
5397 | If CLineNo IsNot Nothing Then |
||
5398 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
5399 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
5400 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
5401 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
5402 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
5403 | If sSymbolNodeUid = sSymbolUid Then |
||
5404 | oSymbolNode.Checked = bCheck |
||
5405 | Exit For |
||
5406 | End If |
||
5407 | Next |
||
5408 | Next |
||
5409 | End If |
||
5410 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
5411 | If TrimLineNo IsNot Nothing Then |
||
5412 | Dim oSymbol_Dt As DataTable = TrimLineNo.Dt_Symbol |
||
5413 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
5414 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
5415 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
5416 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
5417 | If sSymbolNodeUid = sSymbolUid Then |
||
5418 | oSymbolNode.Checked = bCheck |
||
5419 | Exit For |
||
5420 | End If |
||
5421 | Next |
||
5422 | Next |
||
5423 | End If |
||
5424 | End If |
||
5425 | If iType = 1 Then 'Line |
||
5426 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
5427 | If CLineNo IsNot Nothing Then |
||
5428 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
5429 | For Each oLineRow In oLine_Dt.Rows |
||
5430 | Dim sLineUid As String = oLineRow(_XML_LINE_UID).ToString() |
||
5431 | For Each oLineNode As TreeNode In oNode.Nodes |
||
5432 | Dim sLineNodeUid As String = oLineNode.Name |
||
5433 | If sLineNodeUid = sLineUid Then |
||
5434 | oLineNode.Checked = bCheck |
||
5435 | Exit For |
||
5436 | End If |
||
5437 | Next |
||
5438 | Next |
||
5439 | End If |
||
5440 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
5441 | If TrimLineNo IsNot Nothing Then |
||
5442 | Dim oLine_Dt As DataTable = TrimLineNo.Dt_Line |
||
5443 | For Each oLineRow In oLine_Dt.Rows |
||
5444 | Dim sLineUid As String = oLineRow(_XML_SYMBOL_UID).ToString() |
||
5445 | For Each oLineNode As TreeNode In oNode.Nodes |
||
5446 | Dim sLineNodeUid As String = oLineNode.Name |
||
5447 | If sLineNodeUid = sLineUid Then |
||
5448 | oLineNode.Checked = bCheck |
||
5449 | Exit For |
||
5450 | End If |
||
5451 | Next |
||
5452 | Next |
||
5453 | End If |
||
5454 | End If |
||
5455 | If iType = 2 Then 'Equipment |
||
5456 | Dim CEqpNo As Eqp_no = GetEqpNo(CDrawing, sNodeUid) |
||
5457 | If CEqpNo IsNot Nothing Then |
||
5458 | Dim oEqp_Dt As DataTable = CEqpNo.Dt_Equipment |
||
5459 | For Each oEqpRow In oEqp_Dt.Rows |
||
5460 | Dim sEqpUid As String = oEqpRow(_XML_LINE_UID).ToString() |
||
5461 | For Each oEqpNode As TreeNode In oNode.Nodes |
||
5462 | Dim sEqpNodeUid As String = oEqpNode.Name |
||
5463 | If sEqpNodeUid = sEqpUid Then |
||
5464 | oEqpNode.Checked = bCheck |
||
5465 | Exit For |
||
5466 | End If |
||
5467 | Next |
||
5468 | Next |
||
5469 | End If |
||
5470 | End If |
||
5471 | Next |
||
5472 | End If |
||
5473 | Next |
||
5474 | Next |
||
5475 | |||
5476 | |||
5477 | End Sub |
||
5478 | |||
5479 | |||
5480 | |||
5481 | Private Sub Chk_Symbol_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Symbol.CheckedChanged |
||
5482 | AutoCheckTreeNode(0, Chk_Symbol.Checked) |
||
5483 | End Sub |
||
5484 | |||
5485 | Private Sub Chk_Line_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Line.CheckedChanged |
||
5486 | AutoCheckTreeNode(1, Chk_Line.Checked) |
||
5487 | End Sub |
||
5488 | |||
5489 | Private Sub Chk_Equipment_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Equipment.CheckedChanged |
||
5490 | AutoCheckTreeNode(2, Chk_Equipment.Checked) |
||
5491 | End Sub |
||
5492 | e282643f | Gyusu | End Class |
5493 | |||
5494 | |||
5495 | Public Class DrawingInfo |
||
5496 | Public mDrawingName As String |
||
5497 | Public mSpID As String |
||
5498 | Public mPath As String |
||
5499 | 4f359afa | Gyusu | End Class |
5500 | e282643f | Gyusu | |
5501 | |||
5502 | |||
5503 |