hytos / DTI_PID / SPPIDConverter / Main.vb @ d1a02244
이력 | 보기 | 이력해설 | 다운로드 (303 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 | 3b7a4470 | Gyusu | ' "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'") |
1661 | If oSymbolNode.Checked Then |
||
1662 | Dim oSelectRows() As DataRow = oDt.Select("[" & _XML_SYMBOL_UID & "] = '" & sUid & "'") |
||
1663 | If oSelectRows.Length = 1 Then |
||
1664 | oSelectRows(0)(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
||
1665 | 76f465d0 | Gyusu | |
1666 | 3b7a4470 | Gyusu | If oSymbolNode.Checked Then |
1667 | |||
1668 | oSelectRows(0)(_XML_SYMBOL_Check) = "TRUE" |
||
1669 | Else |
||
1670 | oSelectRows(0)(_XML_SYMBOL_Check) = "FALSE" |
||
1671 | End If |
||
1672 | bb2a0c79 | Gyusu | End If |
1673 | 3b7a4470 | Gyusu | |
1674 | bb2a0c79 | Gyusu | End If |
1675 | |||
1676 | Next |
||
1677 | Next |
||
1678 | Next |
||
1679 | Next |
||
1680 | |||
1681 | End Sub |
||
1682 | b08338e3 | Gyusu | |
1683 | f9b63682 | Gyusu | Private Function FinalSymbolModeling(ByVal oCurrentSymbolRow As DataRow, ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, |
1684 | ByVal oAttribute_Dt As DataTable) As String |
||
1685 | Dim sReturnUid As String = "" |
||
1686 | Dim sOriginalPoint As String = "" |
||
1687 | Dim dOriginal_x As Double = 0.0 |
||
1688 | Dim dOriginal_y As Double = 0.0 |
||
1689 | |||
1690 | Dim dConn1_x As Double = 0.0 |
||
1691 | Dim dConn1_y As Double = 0.0 |
||
1692 | Dim dConn2_x As Double = 0.0 |
||
1693 | Dim dConn2_y As Double = 0.0 |
||
1694 | Dim dConn3_x As Double = 0.0 |
||
1695 | Dim dConn3_y As Double = 0.0 |
||
1696 | Dim dConn4_x As Double = 0.0 |
||
1697 | Dim dConn4_y As Double = 0.0 |
||
1698 | |||
1699 | Dim sUid As String = oCurrentSymbolRow(_XML_SYMBOL_UID) |
||
1700 | Dim sSystemPath As String = oCurrentSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
1701 | Dim dAngle As Double = oCurrentSymbolRow(_XML_SYMBOL_ANGLE) |
||
1702 | Dim sLineNoText As String = oCurrentSymbolRow(_XML_LINENO_TEXT) |
||
1703 | Dim sLineNoUid As String = oCurrentSymbolRow(_XML_LINE_LINENOUID).ToString() |
||
1704 | sOriginalPoint = oCurrentSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
1705 | 76f465d0 | Gyusu | Dim sSymbolCompType As String = oCurrentSymbolRow(_XML_SYMBOL_TYPE).ToString() |
1706 | f9b63682 | Gyusu | ConvertPointBystring(sOriginalPoint, dOriginal_x, dOriginal_y) |
1707 | ConvertPointByImage(dOriginal_x, dOriginal_y, _IMG_X, _IMG_Y) |
||
1708 | |||
1709 | 'Connection 정보 체크, 모델링 되어 있는지 유무 |
||
1710 | '양 커넥션의 모델링 유무를 체크한다. |
||
1711 | Dim sConn1Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString() |
||
1712 | Dim sConn2Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString() |
||
1713 | Dim sConn3Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString() |
||
1714 | Dim sConn4Uid As String = oCurrentSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString() |
||
1715 | |||
1716 | Dim sConn1Type As String = "" |
||
1717 | Dim sConn2Type As String = "" |
||
1718 | Dim sConn3Type As String = "" |
||
1719 | Dim sConn4Type As String = "" |
||
1720 | |||
1721 | Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'") |
||
1722 | If oConn1Rows.Length = 0 Then |
||
1723 | oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'") |
||
1724 | If oConn1Rows.Length = 1 Then |
||
1725 | sConn1Type = "Line" |
||
1726 | b08338e3 | Gyusu | End If |
1727 | f9b63682 | Gyusu | Else |
1728 | sConn1Type = "Symbol" |
||
1729 | End If |
||
1730 | b08338e3 | Gyusu | |
1731 | f9b63682 | Gyusu | Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'") |
1732 | If oConn2Rows.Length = 0 Then |
||
1733 | oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'") |
||
1734 | If oConn2Rows.Length = 1 Then |
||
1735 | sConn2Type = "Line" |
||
1736 | b08338e3 | Gyusu | End If |
1737 | f9b63682 | Gyusu | Else |
1738 | sConn2Type = "Symbol" |
||
1739 | End If |
||
1740 | b08338e3 | Gyusu | |
1741 | f9b63682 | Gyusu | Dim oConn3Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn3Uid & "'") |
1742 | If oConn3Rows.Length = 0 Then |
||
1743 | oConn3Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn3Uid & "'") |
||
1744 | If oConn3Rows.Length = 1 Then |
||
1745 | sConn3Type = "Line" |
||
1746 | b08338e3 | Gyusu | End If |
1747 | f9b63682 | Gyusu | Else |
1748 | sConn3Type = "Symbol" |
||
1749 | End If |
||
1750 | b08338e3 | Gyusu | |
1751 | f9b63682 | Gyusu | Dim oConn4Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn4Uid & "'") |
1752 | If oConn4Rows.Length = 0 Then |
||
1753 | oConn4Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn4Uid & "'") |
||
1754 | If oConn4Rows.Length = 1 Then |
||
1755 | sConn4Type = "Line" |
||
1756 | b08338e3 | Gyusu | End If |
1757 | f9b63682 | Gyusu | Else |
1758 | sConn4Type = "Symbol" |
||
1759 | End If |
||
1760 | b08338e3 | Gyusu | |
1761 | f9b63682 | Gyusu | Dim oStartLMConnector As LMConnector = Nothing |
1762 | Dim oEndLMConnector As LMConnector = Nothing |
||
1763 | Dim objInputs As PlaceRunInputs |
||
1764 | objInputs = New PlaceRunInputs |
||
1765 | Dim iModelingType As Integer = 0 |
||
1766 | 76f465d0 | Gyusu | If sConn1Type <> "" Then |
1767 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1768 | f9b63682 | Gyusu | End If |
1769 | 76f465d0 | Gyusu | If sConn2Type <> "" Then |
1770 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1771 | f9b63682 | Gyusu | End If |
1772 | 76f465d0 | Gyusu | If sConn3Type <> "" Then |
1773 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1774 | f9b63682 | Gyusu | End If |
1775 | 76f465d0 | Gyusu | If sConn4Type <> "" Then |
1776 | ConvertPoint(oCurrentSymbolRow(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1777 | f9b63682 | Gyusu | End If |
1778 | b08338e3 | Gyusu | |
1779 | 76f465d0 | Gyusu | 'If sConn1Type = "Line" Then |
1780 | ' Dim sStartpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn1_Point).ToString() |
||
1781 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1782 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1783 | 'ElseIf sConn1Type = "Symbol" Then |
||
1784 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1785 | 'End If |
||
1786 | |||
1787 | 'If sConn2Type = "Line" Then |
||
1788 | ' Dim sEndpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn2_Point).ToString() |
||
1789 | ' ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y) |
||
1790 | ' ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y) |
||
1791 | 'ElseIf sConn2Type = "Symbol" Then |
||
1792 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1793 | 'End If |
||
1794 | |||
1795 | 'If sConn3Type = "Line" Then |
||
1796 | ' Dim sStartpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn3_Point).ToString() |
||
1797 | ' ConvertPointBystring(sStartpoint, dConn3_x, dConn3_y) |
||
1798 | ' ConvertPointByImage(dConn3_x, dConn3_y, _IMG_X, _IMG_Y) |
||
1799 | 'ElseIf sConn3Type = "Symbol" Then |
||
1800 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1801 | 'End If |
||
1802 | |||
1803 | 'If sConn4Type = "Line" Then |
||
1804 | ' Dim sEndpoint As String = oCurrentSymbolRow(0)(_XML_SYMBOL_Conn4_Point).ToString() |
||
1805 | ' ConvertPointBystring(sEndpoint, dConn4_x, dConn4_y) |
||
1806 | ' ConvertPointByImage(dConn4_x, dConn4_y, _IMG_X, _IMG_Y) |
||
1807 | 'ElseIf sConn4Type = "Symbol" Then |
||
1808 | ' ConvertPoint(oCurrentSymbolRow(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1809 | 'End If |
||
1810 | |||
1811 | b08338e3 | Gyusu | |
1812 | |||
1813 | f9b63682 | Gyusu | 'If sConn1Type = "Line" And sConn2Type = "Line" Then |
1814 | ' Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString() |
||
1815 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1816 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1817 | ' Dim sEndpoint As String = oConn1Rows(_XML_LINE_ENDPOINT).ToString() |
||
1818 | ' ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y) |
||
1819 | ' ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y) |
||
1820 | |||
1821 | 'ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
1822 | ' Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString() |
||
1823 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1824 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1825 | |||
1826 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1827 | 'ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
1828 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1829 | |||
1830 | ' Dim sEndpoint As String = oConn1Rows(_XML_LINE_ENDPOINT).ToString() |
||
1831 | ' ConvertPointBystring(sEndpoint, dConn2_x, dConn2_y) |
||
1832 | ' ConvertPointByImage(dConn2_x, dConn2_y, _IMG_X, _IMG_Y) |
||
1833 | |||
1834 | 'ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
1835 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1836 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1837 | 'ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
1838 | ' Dim sStartpoint As String = oConn1Rows(_XML_LINE_STARTPOINT).ToString() |
||
1839 | ' ConvertPointBystring(sStartpoint, dConn1_x, dConn1_y) |
||
1840 | ' ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
1841 | |||
1842 | 'ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
1843 | ' iModelingType = 6 |
||
1844 | 'ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
1845 | ' iModelingType = 7 |
||
1846 | 'ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
1847 | ' iModelingType = 8 |
||
1848 | 'ElseIf sConn3Type = "Line" And sConn4Type = "Line" Then |
||
1849 | ' iModelingType = 4 |
||
1850 | ' ElseIf sConn3Type = "Line" And sConn4Type = "Symbol" Then |
||
1851 | ' iModelingType = 4 |
||
1852 | ' ElseIf sConn3Type = "Symbol" And sConn4Type = "Line" Then |
||
1853 | ' iModelingType = 4 |
||
1854 | ' ElseIf sConn3Type = "Symbol" And sConn4Type = "Symbol" Then |
||
1855 | ' iModelingType = 4 |
||
1856 | ' ElseIf sConn3Type = "Line" And sConn4Type = "" Then |
||
1857 | ' iModelingType = 5 |
||
1858 | ' ElseIf sConn3Type = "Symbol" And sConn4Type = "" Then |
||
1859 | ' iModelingType = 5 |
||
1860 | ' ElseIf sConn3Type = "" And sConn4Type = "Line" Then |
||
1861 | ' iModelingType = 6 |
||
1862 | ' ElseIf sConn3Type = "" And sConn4Type = "Symbol" Then |
||
1863 | ' iModelingType = 6 |
||
1864 | ' Else |
||
1865 | ' iModelingType = 7 |
||
1866 | ' End If |
||
1867 | |||
1868 | 'If iModelingType = 1 Then |
||
1869 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1870 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1871 | ' ElseIf iModelingType = 2 Then |
||
1872 | ' ConvertPoint(oConn1Rows(0)(_XML_SYMBOL_Conn1_Point).ToString(), dConn1_x, dConn1_y) |
||
1873 | ' ElseIf iModelingType = 3 Then |
||
1874 | ' ConvertPoint(oConn2Rows(0)(_XML_SYMBOL_Conn2_Point).ToString(), dConn2_x, dConn2_y) |
||
1875 | ' ElseIf iModelingType = 4 Then |
||
1876 | ' ConvertPoint(oConn3Rows(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1877 | ' ConvertPoint(oConn4Rows(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1878 | ' ElseIf iModelingType = 5 Then |
||
1879 | ' ConvertPoint(oConn3Rows(0)(_XML_SYMBOL_Conn3_Point).ToString(), dConn3_x, dConn3_y) |
||
1880 | ' ElseIf iModelingType = 6 Then |
||
1881 | ' ConvertPoint(oConn4Rows(0)(_XML_SYMBOL_Conn4_Point).ToString(), dConn4_x, dConn4_y) |
||
1882 | ' End If |
||
1883 | Dim sFirstUid As String = "" |
||
1884 | Dim sSecondUid As String = "" |
||
1885 | Dim oLMSymbol As LMSymbol = Nothing |
||
1886 | 76f465d0 | Gyusu | Dim dPreConn_x As Double = 0 |
1887 | Dim dPreConn_y As Double = 0 |
||
1888 | f9b63682 | Gyusu | If sConn1Type <> "" And sConn2Type <> "" Then |
1889 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1890 | CheckConnectionLine(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1891 | Else |
||
1892 | CheckConnectionSymbolToSymbol(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector) |
||
1893 | End If |
||
1894 | |||
1895 | If sConn2Type = "Line" Then |
||
1896 | CheckConnectionLine(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1897 | Else |
||
1898 | CheckConnectionSymbolToSymbol(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector) |
||
1899 | End If |
||
1900 | |||
1901 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
1902 | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
1903 | 76f465d0 | Gyusu | If oStartLMConnector IsNot Nothing Then |
1904 | dOriginal_x = dConn1_x |
||
1905 | dOriginal_y = dConn1_y |
||
1906 | Else |
||
1907 | dOriginal_x = dConn2_x |
||
1908 | dOriginal_y = dConn2_y |
||
1909 | End If |
||
1910 | |||
1911 | f9b63682 | Gyusu | ElseIf sConn1Type <> "" And sConn2Type = "" Then |
1912 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1913 | CheckConnectionLine(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1914 | Else |
||
1915 | CheckConnectionSymbolToSymbol(oConn1Rows, dConn1_x, dConn1_y, oStartLMConnector) |
||
1916 | End If |
||
1917 | |||
1918 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
1919 | dOriginal_x = dConn1_x |
||
1920 | dOriginal_y = dConn1_y |
||
1921 | ElseIf sConn1Type = "" And sConn2Type <> "" Then |
||
1922 | 76f465d0 | Gyusu | |
1923 | If sConn1Type = "Line" Then |
||
1924 | CheckConnectionLine(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1925 | Else |
||
1926 | CheckConnectionSymbolToSymbol(oConn2Rows, dConn2_x, dConn2_y, oEndLMConnector) |
||
1927 | End If |
||
1928 | f9b63682 | Gyusu | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
1929 | dOriginal_x = dConn2_x |
||
1930 | dOriginal_y = dConn2_y |
||
1931 | ElseIf sConn3Type <> "" And sConn4Type <> "" Then |
||
1932 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1933 | CheckConnectionLine(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1934 | Else |
||
1935 | CheckConnectionSymbolToSymbol(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector) |
||
1936 | End If |
||
1937 | |||
1938 | If sConn2Type = "Line" Then |
||
1939 | CheckConnectionLine(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1940 | Else |
||
1941 | CheckConnectionSymbolToSymbol(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector) |
||
1942 | End If |
||
1943 | |||
1944 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn3Rows(0)) |
1945 | sSecondUid = CheckExistModeling(oConn4Rows(0)) |
||
1946 | 76f465d0 | Gyusu | If oStartLMConnector IsNot Nothing Then |
1947 | dOriginal_x = dConn3_x |
||
1948 | dOriginal_y = dConn3_y |
||
1949 | Else |
||
1950 | dOriginal_x = dConn4_x |
||
1951 | dOriginal_y = dConn4_y |
||
1952 | End If |
||
1953 | |||
1954 | f9b63682 | Gyusu | ElseIf sConn3Type <> "" And sConn4Type = "" Then |
1955 | 76f465d0 | Gyusu | If sConn1Type = "Line" Then |
1956 | CheckConnectionLine(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector, dPreConn_x, dPreConn_y) |
||
1957 | Else |
||
1958 | CheckConnectionSymbolToSymbol(oConn3Rows, dConn3_x, dConn3_y, oStartLMConnector) |
||
1959 | End If |
||
1960 | |||
1961 | f9b63682 | Gyusu | sFirstUid = CheckExistModeling(oConn3Rows(0)) |
1962 | dOriginal_x = dConn3_x |
||
1963 | dOriginal_y = dConn3_y |
||
1964 | ElseIf sConn3Type = "" And sConn4Type <> "" Then |
||
1965 | 76f465d0 | Gyusu | If sConn2Type = "Line" Then |
1966 | CheckConnectionLine(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector, dPreConn_x, dPreConn_y) |
||
1967 | Else |
||
1968 | CheckConnectionSymbolToSymbol(oConn4Rows, dConn4_x, dConn4_y, oEndLMConnector) |
||
1969 | End If |
||
1970 | |||
1971 | f9b63682 | Gyusu | sSecondUid = CheckExistModeling(oConn4Rows(0)) |
1972 | dOriginal_x = dConn4_x |
||
1973 | dOriginal_y = dConn4_y |
||
1974 | Else |
||
1975 | 76f465d0 | Gyusu | ' oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
1976 | f9b63682 | Gyusu | End If |
1977 | b08338e3 | Gyusu | |
1978 | f9b63682 | Gyusu | If sFirstUid <> "" And sSecondUid <> "" Then |
1979 | sReturnUid = sSecondUid |
||
1980 | ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
1981 | sReturnUid = sFirstUid |
||
1982 | ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
1983 | sReturnUid = sFirstUid |
||
1984 | 76f465d0 | Gyusu | ElseIf sSecondUid <> "" And sFirstUid = "" Then |
1985 | sReturnUid = sSecondUid |
||
1986 | ElseIf sSecondUid <> "" And sFirstUid = "" Then |
||
1987 | sReturnUid = sSecondUid |
||
1988 | f9b63682 | Gyusu | Else |
1989 | sReturnUid = "" |
||
1990 | End If |
||
1991 | b08338e3 | Gyusu | |
1992 | 76f465d0 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
1993 | f9b63682 | Gyusu | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
1994 | 76f465d0 | Gyusu | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
1995 | Else |
||
1996 | If oStartLMConnector IsNot Nothing And oEndLMConnector IsNot Nothing Then |
||
1997 | 'oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle, ExistingItem:=oStartLMConnector.AsLMAItem, |
||
1998 | ' TargetItem:=oEndLMConnector.AsLMAItem) |
||
1999 | 'oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2000 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
||
2001 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2002 | ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then |
||
2003 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle,, |
||
2004 | TargetItem:=oStartLMConnector.AsLMAItem) |
||
2005 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2006 | ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then |
||
2007 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle,, |
||
2008 | TargetItem:=oEndLMConnector.AsLMAItem) |
||
2009 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2010 | Else |
||
2011 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dOriginal_x, dOriginal_y,, dAngle) |
||
2012 | oCurrentSymbolRow(_XML_SYMBOL_LMSYMBOL) = oLMSymbol |
||
2013 | End If |
||
2014 | b08338e3 | Gyusu | End If |
2015 | 76f465d0 | Gyusu | AddProgress() |
2016 | b08338e3 | Gyusu | |
2017 | f9b63682 | Gyusu | SetListBoxItems(ListBox_Result, "Place Fitting.." & sUid & " (" & dOriginal_x & "," & dOriginal_y & ")..." & _iFittingcnt & " count ") |
2018 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Fitting : " & sUid) |
||
2019 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
2020 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "ModelingType : " & iModelingType) |
||
2021 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn1_Point : " & dConn1_x & "," & dConn1_y) |
||
2022 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn2_Point : " & dConn2_x & "," & dConn2_y) |
||
2023 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn3_Point : " & dConn3_x & "," & dConn3_y) |
||
2024 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Conn4_Point : " & dConn4_x & "," & dConn4_y) |
||
2025 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
2026 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
2027 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection3 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()) |
||
2028 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection4 : " & oCurrentSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()) |
||
2029 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
2030 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dOriginal_x & "," & dOriginal_y) |
||
2031 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Fitting Count : " & _iFittingcnt) |
||
2032 | _iFittingcnt = _iFittingcnt + 1 |
||
2033 | oCurrentSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
2034 | 76f465d0 | Gyusu | Dim oAttributeRow() As DataRow |
2035 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sUid + "'") |
||
2036 | If oAttribute_Dt.Rows.Count > 0 Then |
||
2037 | f9b63682 | Gyusu | |
2038 | 76f465d0 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
2039 | Dim oInstrument As LMInstrument |
||
2040 | oInstrument = _Placement.PIDDataSource.GetInstrument(oLMSymbol.ModelItemID) |
||
2041 | Try |
||
2042 | If oAttributeRow.Length > 0 Then |
||
2043 | For Each oAttribute In oAttributeRow |
||
2044 | Try |
||
2045 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2046 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2047 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2048 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2049 | Catch ex As Exception |
||
2050 | End Try |
||
2051 | Next |
||
2052 | oInstrument.Commit() |
||
2053 | End If |
||
2054 | Catch ex As Exception |
||
2055 | End Try |
||
2056 | Else |
||
2057 | f9b63682 | Gyusu | Try |
2058 | 76f465d0 | Gyusu | If oAttributeRow.Length > 0 And oLMSymbol IsNot Nothing Then |
2059 | For Each oAttribute In oAttributeRow |
||
2060 | Try |
||
2061 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2062 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2063 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2064 | oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2065 | |||
2066 | Catch ex As Exception |
||
2067 | End Try |
||
2068 | Next |
||
2069 | oLMSymbol.Commit() |
||
2070 | f9b63682 | Gyusu | End If |
2071 | Catch ex As Exception |
||
2072 | End Try |
||
2073 | 76f465d0 | Gyusu | End If |
2074 | f9b63682 | Gyusu | End If |
2075 | 76f465d0 | Gyusu | 'Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
2076 | 'If oAttributeRow.Length > 0 Then |
||
2077 | ' For Each oAttribute In oAttributeRow |
||
2078 | ' Try |
||
2079 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2080 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2081 | ' If sPIDValue.Contains("'") Then |
||
2082 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
2083 | ' End If |
||
2084 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2085 | ' oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2086 | ' Catch ex As Exception |
||
2087 | ' End Try |
||
2088 | ' Next |
||
2089 | 'End If |
||
2090 | b08338e3 | Gyusu | |
2091 | f9b63682 | Gyusu | Return sReturnUid |
2092 | b08338e3 | Gyusu | |
2093 | |||
2094 | f9b63682 | Gyusu | '현재 Uid 모델링 |
2095 | End Function |
||
2096 | b08338e3 | Gyusu | |
2097 | f9b63682 | Gyusu | Private Function CheckExistModeling(ByVal oRow As DataRow) As String |
2098 | If oRow(_XML_LINE_DRAWING_TF).ToString() = "FALSE" And oRow(_XML_LINE_Check).ToString() = "TRUE" Then |
||
2099 | Return oRow(_XML_LINE_UID).ToString() |
||
2100 | End If |
||
2101 | Return String.Empty |
||
2102 | End Function |
||
2103 | b08338e3 | Gyusu | |
2104 | |||
2105 | f9b63682 | Gyusu | Private Sub ConvertPoint(ByVal sOriginalPoint As String, ByRef dConn1_x As Double, ByRef dConn1_y As Double) |
2106 | ConvertPointBystring(sOriginalPoint, dConn1_x, dConn1_y) |
||
2107 | ConvertPointByImage(dConn1_x, dConn1_y, _IMG_X, _IMG_Y) |
||
2108 | End Sub |
||
2109 | b08338e3 | Gyusu | |
2110 | 76f465d0 | Gyusu | |
2111 | |||
2112 | |||
2113 | 'Dim _StartPos_X As Double = 0 |
||
2114 | 'Dim _StartPos_Y As Double = 0 |
||
2115 | 'Dim _EndPos_X As Double = 0 |
||
2116 | 'Dim _EndPos_Y As Double = 0 |
||
2117 | 'Dim _StartUid As String = "" |
||
2118 | 'Dim _EndUid As String = "" |
||
2119 | 'Dim _objInputs As PlaceRunInputs |
||
2120 | 'Dim _ListPos As New List(Of String) |
||
2121 | 'Dim _Direction As String = "" |
||
2122 | 'Private Function FinalLineModeling(ByVal oCurrentLineRow As DataRow, |
||
2123 | ' ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, |
||
2124 | ' ByVal oAttribute_Dt As DataTable) As String |
||
2125 | ' Dim sReturnUid As String = "" |
||
2126 | ' '현재 Uid 모델링 여부 체크 |
||
2127 | ' Dim sStartpoint As String = "" |
||
2128 | ' Dim sEndpoint As String = "" |
||
2129 | |||
2130 | ' Dim dOriginalStart_x As Double = 0.0 |
||
2131 | ' Dim dOriginalStart_y As Double = 0.0 |
||
2132 | ' Dim dOriginalEnd_x As Double = 0.0 |
||
2133 | ' Dim dOriginalEnd_y As Double = 0.0 |
||
2134 | |||
2135 | ' Dim dConvertStart_x As Double = 0 |
||
2136 | ' Dim dConvertStart_y As Double = 0 |
||
2137 | ' Dim dConvertEnd_x As Double = 0 |
||
2138 | ' Dim dConvertEnd_y As Double = 0 |
||
2139 | |||
2140 | |||
2141 | ' Dim dCenterPos_x As Double = 0.0 |
||
2142 | ' Dim dCenterPos_y As Double = 0.0 |
||
2143 | ' Dim objItem As LMAItem |
||
2144 | |||
2145 | ' Dim sUid As String = oCurrentLineRow(_XML_LINE_UID).ToString() |
||
2146 | ' Dim sLineType As String = oCurrentLineRow(_XML_LINE_TYPE).ToString() |
||
2147 | ' Dim sSystemPath As String = GetPipeType(sLineType) |
||
2148 | ' Dim sLineNoText As String = oCurrentLineRow(_XML_LINENO_TEXT).ToString() |
||
2149 | ' Dim sLineNoUid As String = oCurrentLineRow(_XML_LINE_LINENOUID).ToString() |
||
2150 | ' sStartpoint = oCurrentLineRow(_XML_LINE_STARTPOINT).ToString() |
||
2151 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2152 | ' ConvertPointByImage(dConvertStart_x, dConvertStart_y, _IMG_X, _IMG_Y) |
||
2153 | ' sEndpoint = oCurrentLineRow(_XML_LINE_ENDPOINT).ToString() |
||
2154 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2155 | ' ConvertPointByImage(dConvertEnd_x, dConvertEnd_y, _IMG_X, _IMG_Y) |
||
2156 | |||
2157 | ' dCenterPos_x = Math.Abs(dOriginalStart_x + dOriginalEnd_x) / 2 |
||
2158 | ' dCenterPos_y = Math.Abs(dOriginalStart_y + dOriginalEnd_y) / 2 |
||
2159 | |||
2160 | ' If _Direction = "" Then |
||
2161 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2162 | ' _Direction = "X" |
||
2163 | ' Else |
||
2164 | ' _Direction = "Y" |
||
2165 | ' End If |
||
2166 | ' Else |
||
2167 | ' If _Direction = "X" Then |
||
2168 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) < Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2169 | |||
2170 | ' End If |
||
2171 | ' Else |
||
2172 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
2173 | |||
2174 | ' End If |
||
2175 | ' End If |
||
2176 | ' End If |
||
2177 | |||
2178 | |||
2179 | ' 'Connection 정보 체크, 모델링 되어 있는지 유무 |
||
2180 | ' '양 커넥션의 모델링 유무를 체크한다. |
||
2181 | ' Dim sConn1Uid As String = oCurrentLineRow(_XML_LINE_Conn1_Uid).ToString() |
||
2182 | ' Dim sConn2Uid As String = oCurrentLineRow(_XML_LINE_Conn2_Uid).ToString() |
||
2183 | ' Dim sConn1Type As String = "" |
||
2184 | ' Dim sConn2Type As String = "" |
||
2185 | |||
2186 | ' Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'" & |
||
2187 | ' " And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'" & |
||
2188 | ' " And [" & _XML_SYMBOL_Check & "] = 'True'") |
||
2189 | ' If oConn1Rows.Length = 0 Then |
||
2190 | ' oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'" & |
||
2191 | ' " And [" & _XML_LINE_DRAWING_TF & "] = 'False'" & |
||
2192 | ' " And [" & _XML_LINE_Check & "] = 'True'") |
||
2193 | ' If oConn1Rows.Length = 1 Then |
||
2194 | ' sConn1Type = "Line" |
||
2195 | ' End If |
||
2196 | ' Else |
||
2197 | ' sConn1Type = "Symbol" |
||
2198 | ' End If |
||
2199 | |||
2200 | ' Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'" & |
||
2201 | ' " And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False'" & |
||
2202 | ' " And [" & _XML_SYMBOL_Check & "] = 'True'") |
||
2203 | ' If oConn2Rows.Length = 0 Then |
||
2204 | ' oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'" & |
||
2205 | ' " And [" & _XML_LINE_DRAWING_TF & "] = 'False'" & |
||
2206 | ' " And [" & _XML_LINE_Check & "] = 'True'") |
||
2207 | ' If oConn2Rows.Length = 1 Then |
||
2208 | ' sConn2Type = "Line" |
||
2209 | ' End If |
||
2210 | ' Else |
||
2211 | ' sConn2Type = "Symbol" |
||
2212 | ' End If |
||
2213 | |||
2214 | |||
2215 | ' If _StartPos_X = 0 And _StartPos_Y = 0 Then |
||
2216 | ' _StartPos_X = dOriginalStart_x |
||
2217 | ' _StartPos_Y = dOriginalStart_y |
||
2218 | ' _ListPos.Add(_StartPos_X & "," & _StartPos_Y) |
||
2219 | ' End If |
||
2220 | ' Dim iModelingType As Integer = 0 |
||
2221 | ' If sConn1Type = "Line" And sConn2Type = "Line" Then |
||
2222 | ' sReturnUid = sConn2Uid |
||
2223 | ' ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
2224 | ' sReturnUid = sConn2Uid |
||
2225 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
2226 | ' sReturnUid = sConn2Uid |
||
2227 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
2228 | ' sReturnUid = sConn2Uid |
||
2229 | ' ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
2230 | ' sReturnUid = sConn1Uid |
||
2231 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
2232 | ' sReturnUid = sConn1Uid |
||
2233 | ' ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
2234 | ' sReturnUid = sConn2Uid |
||
2235 | ' ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
2236 | ' sReturnUid = sConn2Uid |
||
2237 | ' Else |
||
2238 | ' sReturnUid = "" |
||
2239 | ' _EndPos_X = dOriginalEnd_x |
||
2240 | ' _EndPos_Y = dOriginalEnd_y |
||
2241 | ' End If |
||
2242 | |||
2243 | |||
2244 | ' Dim sConn1LineNo As String = "" |
||
2245 | ' If oConn1Rows.Length = 1 Then |
||
2246 | |||
2247 | ' End If |
||
2248 | ' Dim sConn2LineNo As String = "" |
||
2249 | ' If oConn2Rows.Length = 1 Then |
||
2250 | |||
2251 | ' End If |
||
2252 | ' Dim oStartLMConnector As LMConnector = Nothing |
||
2253 | ' Dim oEndLMConnector As LMConnector = Nothing |
||
2254 | ' Dim oLMSymbol1 As LMSymbol = Nothing |
||
2255 | ' Dim oLMSymbol2 As LMSymbol = Nothing |
||
2256 | ' Dim objInputs As PlaceRunInputs |
||
2257 | ' objInputs = New PlaceRunInputs |
||
2258 | |||
2259 | ' If sConn1Type = "Line" And sConn2Type = "Line" Then |
||
2260 | ' iModelingType = 1 |
||
2261 | ' ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
2262 | ' iModelingType = 1 |
||
2263 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
2264 | ' iModelingType = 1 |
||
2265 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
2266 | ' iModelingType = 1 |
||
2267 | ' ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
2268 | ' iModelingType = 2 |
||
2269 | ' ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
2270 | ' iModelingType = 2 |
||
2271 | ' ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
2272 | ' iModelingType = 3 |
||
2273 | ' ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
2274 | ' iModelingType = 3 |
||
2275 | ' Else |
||
2276 | ' iModelingType = 4 |
||
2277 | ' End If |
||
2278 | |||
2279 | ' If iModelingType = 1 Then |
||
2280 | ' If sConn1Type = "Line" Then |
||
2281 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2282 | ' Else |
||
2283 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2284 | ' End If |
||
2285 | ' If sConn1Type = "Line" Then |
||
2286 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2287 | ' Else |
||
2288 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2289 | ' End If |
||
2290 | ' 'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2291 | ' 'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2292 | ' ElseIf iModelingType = "2" Then |
||
2293 | ' If sConn1Type = "Line" Then |
||
2294 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2295 | ' Else |
||
2296 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2297 | ' End If |
||
2298 | ' ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2299 | ' ElseIf iModelingType = "3" Then |
||
2300 | ' If sConn1Type = "Line" Then |
||
2301 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2302 | ' Else |
||
2303 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2304 | ' End If |
||
2305 | ' ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector) |
||
2306 | |||
2307 | ' Else |
||
2308 | ' 'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2309 | ' 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2310 | ' End If |
||
2311 | |||
2312 | ' Dim sFirstUid As String = "" |
||
2313 | ' Dim sSecondUid As String = "" |
||
2314 | |||
2315 | ' If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then |
||
2316 | ' objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2317 | ' objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2318 | ' 'sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2319 | ' 'sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2320 | ' ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then |
||
2321 | ' If sConn1Type = "Line" Then |
||
2322 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2323 | ' Else |
||
2324 | ' objInputs.AddSymbolTarget(oLMSymbol1, dOriginalStart_x, dOriginalStart_y) |
||
2325 | ' End If |
||
2326 | |||
2327 | ' objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2328 | ' ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2329 | ' ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then |
||
2330 | ' If sConn2Type = "Line" Then |
||
2331 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalEnd_x, dOriginalEnd_y) |
||
2332 | ' Else |
||
2333 | ' objInputs.AddSymbolTarget(oLMSymbol2, dOriginalEnd_x, dOriginalEnd_y) |
||
2334 | ' End If |
||
2335 | |||
2336 | ' objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2337 | |||
2338 | ' 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2339 | |||
2340 | ' ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2341 | ' Else |
||
2342 | ' If sConn1Type = "Line" Then |
||
2343 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2344 | ' Else |
||
2345 | ' objInputs.AddSymbolTarget(oLMSymbol1, dOriginalStart_x, dOriginalStart_y) |
||
2346 | ' End If |
||
2347 | ' If sConn2Type = "Line" Then |
||
2348 | ' objInputs.AddConnectorTarget(oStartLMConnector, dOriginalEnd_x, dOriginalEnd_y) |
||
2349 | ' Else |
||
2350 | ' objInputs.AddSymbolTarget(oLMSymbol2, dOriginalEnd_x, dOriginalEnd_y) |
||
2351 | ' End If |
||
2352 | ' 'objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2353 | ' 'objInputs.AddConnectorTarget(oEndLMConnector, dOriginalEnd_x, dOriginalEnd_y) |
||
2354 | ' End If |
||
2355 | ' If sConn1Type <> "" And sConn2Type <> "" Then |
||
2356 | ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2357 | ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2358 | ' ElseIf sConn1Type <> "" And sConn2Type = "" Then |
||
2359 | ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2360 | ' ElseIf sConn1Type = "" And sConn2Type <> "" Then |
||
2361 | ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2362 | ' End If |
||
2363 | |||
2364 | ' If sFirstUid <> "" And sSecondUid <> "" Then |
||
2365 | ' sReturnUid = sSecondUid |
||
2366 | ' ElseIf sFirstUid = "" And sSecondUid <> "" Then |
||
2367 | ' sReturnUid = sSecondUid |
||
2368 | ' ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
2369 | ' sReturnUid = sFirstUid |
||
2370 | ' Else |
||
2371 | ' sReturnUid = "" |
||
2372 | ' End If |
||
2373 | ' _iPipecnt = _iPipecnt + 1 |
||
2374 | ' Dim oCurrentConnector As LMConnector |
||
2375 | |||
2376 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
2377 | ' Try |
||
2378 | ' objInputs.Clear() |
||
2379 | ' objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2380 | ' objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2381 | ' oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2382 | ' Catch ex As Exception |
||
2383 | |||
2384 | ' End Try |
||
2385 | |||
2386 | ' oCurrentLineRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector |
||
2387 | ' oCurrentLineRow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2388 | |||
2389 | ' SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ")..." & _iPipecnt & " count ") |
||
2390 | |||
2391 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
2392 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
2393 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentLineRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
2394 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentLineRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
2395 | ' 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
2396 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dOriginalStart_x & "," & dOriginalStart_y) |
||
2397 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dOriginalEnd_x & "," & dOriginalEnd_y) |
||
2398 | ' ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
2399 | |||
2400 | ' Dim oPipeRun As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(oCurrentConnector.ModelItemID) |
||
2401 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2402 | ' If oAttributeRow.Length > 0 Then |
||
2403 | ' For Each oAttribute In oAttributeRow |
||
2404 | ' Try |
||
2405 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2406 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2407 | ' If sPIDValue.Contains("'") Then |
||
2408 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
2409 | ' End If |
||
2410 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2411 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2412 | ' Catch ex As Exception |
||
2413 | ' End Try |
||
2414 | ' Next |
||
2415 | ' oPipeRun.Commit() |
||
2416 | ' End If |
||
2417 | |||
2418 | ' Dim sID_1 As String = "" |
||
2419 | ' Dim sID_2 As String = "" |
||
2420 | ' If oStartLMConnector IsNot Nothing Then |
||
2421 | ' sID_1 = oStartLMConnector.ModelItemID |
||
2422 | ' sID_2 = oCurrentConnector.ModelItemID |
||
2423 | ' ElseIf oEndLMConnector IsNot Nothing Then |
||
2424 | ' sID_1 = oEndLMConnector.ModelItemID |
||
2425 | ' sID_2 = oCurrentConnector.ModelItemID |
||
2426 | ' End If |
||
2427 | ' If sID_1 <> "" And sID_2 <> "" Then |
||
2428 | ' ' Dim objSurvivorItem As LMAItem = Nothing |
||
2429 | ' ' Dim oPipeRun1 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_1) |
||
2430 | ' ' Dim oPipeRun2 As LMPipeRun = _Placement.PIDDataSource.GetPipeRun(sID_2) |
||
2431 | ' ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
2432 | ' End If |
||
2433 | ' Return sReturnUid |
||
2434 | ' '현재 Uid 모델링 |
||
2435 | 'End Function |
||
2436 | f9b63682 | Gyusu | Private Function FinalLineModeling(ByVal oCurrentLineRow As DataRow, |
2437 | ByVal oLine_Dt As DataTable, ByVal oSymbol_Dt As DataTable, |
||
2438 | ByVal oAttribute_Dt As DataTable) As String |
||
2439 | Dim sReturnUid As String = "" |
||
2440 | 76f465d0 | Gyusu | Try |
2441 | f9b63682 | Gyusu | |
2442 | 76f465d0 | Gyusu | '현재 Uid 모델링 여부 체크 |
2443 | 'Dim sStartpoint As String = "" |
||
2444 | 'Dim sEndpoint As String = "" |
||
2445 | 'Dim dOriginalStart_x As Double = 0.0 |
||
2446 | 'Dim dOriginalStart_y As Double = 0.0 |
||
2447 | 'Dim dOriginalEnd_x As Double = 0.0 |
||
2448 | 'Dim dOriginalEnd_y As Double = 0.0 |
||
2449 | Dim dCenterPos_x As Double = 0.0 |
||
2450 | Dim dCenterPos_y As Double = 0.0 |
||
2451 | Dim objItem As LMAItem |
||
2452 | f9b63682 | Gyusu | |
2453 | 76f465d0 | Gyusu | Dim sUid As String = oCurrentLineRow(_XML_LINE_UID).ToString() |
2454 | Dim sLineType As String = oCurrentLineRow(_XML_LINE_TYPE).ToString() |
||
2455 | Dim sSystemPath As String = GetPipeType(sLineType) |
||
2456 | Dim sLineNoText As String = oCurrentLineRow(_XML_LINENO_TEXT).ToString() |
||
2457 | Dim sLineNoUid As String = oCurrentLineRow(_XML_LINE_LINENOUID).ToString() |
||
2458 | 'sStartpoint = oCurrentLineRow(_XML_LINE_STARTPOINT).ToString() |
||
2459 | 'ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
2460 | 'ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
2461 | 'sEndpoint = oCurrentLineRow(_XML_LINE_ENDPOINT).ToString() |
||
2462 | 'ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
2463 | 'ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
2464 | f9b63682 | Gyusu | |
2465 | 76f465d0 | Gyusu | |
2466 | Dim dStart_Dwg_x As Double = oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_X) |
||
2467 | Dim dStart_Dwg_y As Double = oCurrentLineRow(_XML_LINE_DWG_STARTPOINT_Y) |
||
2468 | Dim dEnd_Dwg_x As Double = oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_X) |
||
2469 | Dim dEnd_Dwg_y As Double = oCurrentLineRow(_XML_LINE_DWG_ENDPOINT_Y) |
||
2470 | Dim sPreFlowDirection As String = "" |
||
2471 | Dim sFlowDirection As String = oCurrentLineRow(_XML_LINE_FlowDirection) |
||
2472 | |||
2473 | Dim sPreConn1Direction As String = "" |
||
2474 | Dim sPreConn2Direction As String = "" |
||
2475 | Dim sDirection As String = oCurrentLineRow(_XML_LINE_Direction) |
||
2476 | |||
2477 | dCenterPos_x = Math.Abs(dStart_Dwg_x + dEnd_Dwg_x) / 2 |
||
2478 | dCenterPos_y = Math.Abs(dStart_Dwg_y + dEnd_Dwg_y) / 2 |
||
2479 | |||
2480 | |||
2481 | Dim oPidDataSource As LMADataSource = Nothing |
||
2482 | |||
2483 | Try |
||
2484 | oPidDataSource = _Placement.PIDDataSource |
||
2485 | Catch ex As Exception |
||
2486 | CheckOpenDrawing() |
||
2487 | oPidDataSource = _Placement.PIDDataSource |
||
2488 | End Try |
||
2489 | |||
2490 | 'Connection 정보 체크, 모델링 되어 있는지 유무 |
||
2491 | '양 커넥션의 모델링 유무를 체크한다. |
||
2492 | Dim sConn1Uid As String = oCurrentLineRow(_XML_LINE_Conn1_Uid).ToString() |
||
2493 | Dim sConn2Uid As String = oCurrentLineRow(_XML_LINE_Conn2_Uid).ToString() |
||
2494 | Dim sConn1Type As String = "" |
||
2495 | Dim sConn2Type As String = "" |
||
2496 | |||
2497 | Dim oConn1Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn1Uid & "'") |
||
2498 | If oConn1Rows.Length = 0 Then |
||
2499 | oConn1Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn1Uid & "'") |
||
2500 | If oConn1Rows.Length = 1 Then |
||
2501 | sConn1Type = "Line" |
||
2502 | 'sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString() |
||
2503 | 'If sDirection = sPreConn1Direction Then |
||
2504 | ' If sDirection = "X" Then |
||
2505 | ' dStart_Dwg_y = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2506 | ' dEnd_Dwg_y = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2507 | ' Else |
||
2508 | ' dStart_Dwg_x = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2509 | ' dEnd_Dwg_x = oConn1Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2510 | ' End If |
||
2511 | 'End If |
||
2512 | |||
2513 | End If |
||
2514 | Else |
||
2515 | sConn1Type = "Symbol" |
||
2516 | End If |
||
2517 | |||
2518 | Dim oConn2Rows() As DataRow = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "] = '" & sConn2Uid & "'") |
||
2519 | If oConn2Rows.Length = 0 Then |
||
2520 | oConn2Rows = oLine_Dt.Select("[" & _XML_LINE_UID & "] = '" & sConn2Uid & "'") |
||
2521 | If oConn2Rows.Length = 1 Then |
||
2522 | sConn2Type = "Line" |
||
2523 | 'sPreConn2Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString() |
||
2524 | 'If sDirection = sPreConn2Direction Then |
||
2525 | ' If sDirection = "X" Then |
||
2526 | ' dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2527 | ' dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2528 | ' Else |
||
2529 | ' dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2530 | ' dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2531 | ' End If |
||
2532 | 'End If |
||
2533 | End If |
||
2534 | Else |
||
2535 | sConn2Type = "Symbol" |
||
2536 | End If |
||
2537 | |||
2538 | |||
2539 | |||
2540 | |||
2541 | Dim sConn1LineNo As String = "" |
||
2542 | Dim sConn2LineNo As String = "" |
||
2543 | 3b7a4470 | Gyusu | Dim oLMConnector As LMConnector = Nothing |
2544 | 76f465d0 | Gyusu | Dim oStartLMConnector As LMConnector = Nothing |
2545 | Dim oEndLMConnector As LMConnector = Nothing |
||
2546 | Dim oLMSymbol1 As LMSymbol = Nothing |
||
2547 | Dim oLMSymbol2 As LMSymbol = Nothing |
||
2548 | Dim objInputs As PlaceRunInputs |
||
2549 | objInputs = New PlaceRunInputs |
||
2550 | Dim iModelingType As Integer = 0 |
||
2551 | If sConn1Type = "Line" And sConn2Type = "Line" Then |
||
2552 | iModelingType = 1 |
||
2553 | ElseIf sConn1Type = "Line" And sConn2Type = "Symbol" Then |
||
2554 | iModelingType = 1 |
||
2555 | ElseIf sConn1Type = "Symbol" And sConn2Type = "Line" Then |
||
2556 | iModelingType = 1 |
||
2557 | ElseIf sConn1Type = "Symbol" And sConn2Type = "Symbol" Then |
||
2558 | iModelingType = 1 |
||
2559 | ElseIf sConn1Type = "Line" And sConn2Type = "" Then |
||
2560 | iModelingType = 2 |
||
2561 | ElseIf sConn1Type = "Symbol" And sConn2Type = "" Then |
||
2562 | iModelingType = 2 |
||
2563 | ElseIf sConn1Type = "" And sConn2Type = "Line" Then |
||
2564 | iModelingType = 3 |
||
2565 | ElseIf sConn1Type = "" And sConn2Type = "Symbol" Then |
||
2566 | iModelingType = 3 |
||
2567 | Else |
||
2568 | iModelingType = 4 |
||
2569 | End If |
||
2570 | |||
2571 | Dim dPreConnX As Double = 0 |
||
2572 | Dim dPreConnY As Double = 0 |
||
2573 | |||
2574 | 3b7a4470 | Gyusu | |
2575 | Dim sTargetDirection As String = CheckBranchLine(oLine_Dt.Rows, dStart_Dwg_x, dStart_Dwg_y, dEnd_Dwg_x, dEnd_Dwg_y, oLMConnector) |
||
2576 | |||
2577 | If sTargetDirection = "" Then |
||
2578 | CheckConnectionLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, oStartLMConnector, dPreConnX, dPreConnY) |
||
2579 | |||
2580 | If oStartLMConnector Is Nothing Then |
||
2581 | |||
2582 | oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dStart_Dwg_x, dStart_Dwg_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2583 | If oLMSymbol1 IsNot Nothing Then |
||
2584 | sConn1Type = "Symbol" |
||
2585 | 76f465d0 | Gyusu | Else |
2586 | 3b7a4470 | Gyusu | sConn1Type = "" |
2587 | End If |
||
2588 | Else |
||
2589 | sConn1Type = "Line" |
||
2590 | sPreConn1Direction = oConn1Rows(0)(_XML_LINE_Direction).ToString() |
||
2591 | If sDirection = sPreConn1Direction Then |
||
2592 | If sDirection = "X" Then |
||
2593 | dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2594 | dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2595 | Else |
||
2596 | dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2597 | dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2598 | End If |
||
2599 | 76f465d0 | Gyusu | End If |
2600 | |||
2601 | End If |
||
2602 | 3b7a4470 | Gyusu | CheckConnectionLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, oEndLMConnector, dPreConnX, dPreConnY) |
2603 | If oEndLMConnector Is Nothing Then |
||
2604 | oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dEnd_Dwg_x, dEnd_Dwg_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2605 | If oLMSymbol2 IsNot Nothing Then |
||
2606 | sConn2Type = "Symbol" |
||
2607 | End If |
||
2608 | Else |
||
2609 | sConn2Type = "Line" |
||
2610 | sPreConn2Direction = oConn2Rows(0)(_XML_LINE_Direction).ToString() |
||
2611 | If sDirection = sPreConn2Direction Then |
||
2612 | If sDirection = "X" Then |
||
2613 | dStart_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2614 | dEnd_Dwg_y = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_Y) |
||
2615 | Else |
||
2616 | dStart_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2617 | dEnd_Dwg_x = oConn2Rows(0)(_XML_LINE_DWG_STARTPOINT_X) |
||
2618 | End If |
||
2619 | 76f465d0 | Gyusu | End If |
2620 | End If |
||
2621 | 3b7a4470 | Gyusu | Else |
2622 | If sTargetDirection = "START" Then |
||
2623 | oStartLMConnector = oLMConnector |
||
2624 | sConn1Type = "Line" |
||
2625 | ElseIf sTargetDirection = "END" Then |
||
2626 | oEndLMConnector = oLMConnector |
||
2627 | sConn2Type = "Line" |
||
2628 | End If |
||
2629 | b08338e3 | Gyusu | End If |
2630 | 3b7a4470 | Gyusu | |
2631 | 76f465d0 | Gyusu | 'If iModelingType = 1 Then |
2632 | ' If sConn1Type = "Line" Then |
||
2633 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2634 | ' Else |
||
2635 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2636 | ' End If |
||
2637 | ' If sConn1Type = "Line" Then |
||
2638 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2639 | ' Else |
||
2640 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2641 | ' End If |
||
2642 | ' 'CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2643 | ' 'CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2644 | 'ElseIf iModelingType = "2" Then |
||
2645 | ' If sConn1Type = "Line" Then |
||
2646 | ' CheckConnectionLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2647 | ' Else |
||
2648 | ' oLMSymbol1 = CheckConnectionSymbolToLine(oConn1Rows, dOriginalStart_x, dOriginalStart_y, dCenterPos_x, dCenterPos_y, oStartLMConnector) |
||
2649 | ' End If |
||
2650 | ' ' CheckConnectionLine(oConn2Rows, dOriginalStart_x, dOriginalStart_y, oStartLMConnector) |
||
2651 | 'ElseIf iModelingType = "3" Then |
||
2652 | ' If sConn1Type = "Line" Then |
||
2653 | ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oEndLMConnector) |
||
2654 | ' Else |
||
2655 | ' oLMSymbol2 = CheckConnectionSymbolToLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, dCenterPos_x, dCenterPos_y, oEndLMConnector) |
||
2656 | ' End If |
||
2657 | ' ' CheckConnectionLine(oConn2Rows, dOriginalEnd_x, dOriginalEnd_y, oStartLMConnector) |
||
2658 | b08338e3 | Gyusu | |
2659 | 76f465d0 | Gyusu | 'Else |
2660 | ' 'objInputs.AddPoint(dOriginalStart_x, dOriginalStart_y) |
||
2661 | ' 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
||
2662 | 'End If |
||
2663 | b08338e3 | Gyusu | |
2664 | 76f465d0 | Gyusu | Dim sFirstUid As String = "" |
2665 | Dim sSecondUid As String = "" |
||
2666 | Try |
||
2667 | If oStartLMConnector Is Nothing And oEndLMConnector Is Nothing Then |
||
2668 | objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y) |
||
2669 | objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y) |
||
2670 | 'sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2671 | 'sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2672 | ElseIf oStartLMConnector IsNot Nothing And oEndLMConnector Is Nothing Then |
||
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 | b08338e3 | Gyusu | |
2679 | 76f465d0 | Gyusu | objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y) |
2680 | ' sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2681 | ElseIf oStartLMConnector Is Nothing And oEndLMConnector IsNot Nothing Then |
||
2682 | If sConn2Type = "Line" Then |
||
2683 | objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2684 | Else |
||
2685 | objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2686 | End If |
||
2687 | b08338e3 | Gyusu | |
2688 | 76f465d0 | Gyusu | objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y) |
2689 | f9b63682 | Gyusu | |
2690 | 76f465d0 | Gyusu | 'objInputs.AddPoint(dOriginalEnd_x, dOriginalEnd_y) |
2691 | b08338e3 | Gyusu | |
2692 | 76f465d0 | Gyusu | ' sFirstUid = CheckExistModeling(oConn1Rows(0)) |
2693 | Else |
||
2694 | If sConn1Type = "Line" Then |
||
2695 | objInputs.AddConnectorTarget(oStartLMConnector, dStart_Dwg_x, dStart_Dwg_y) |
||
2696 | Else |
||
2697 | objInputs.AddSymbolTarget(oLMSymbol1, dStart_Dwg_x, dStart_Dwg_y) |
||
2698 | End If |
||
2699 | If sConn2Type = "Line" Then |
||
2700 | objInputs.AddConnectorTarget(oStartLMConnector, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2701 | Else |
||
2702 | objInputs.AddSymbolTarget(oLMSymbol2, dEnd_Dwg_x, dEnd_Dwg_y) |
||
2703 | End If |
||
2704 | 'objInputs.AddConnectorTarget(oStartLMConnector, dOriginalStart_x, dOriginalStart_y) |
||
2705 | 'objInputs.AddConnectorTarget(oEndLMConnector, dEnd_Dwg_x, dOriginalEnd_y) |
||
2706 | End If |
||
2707 | If sConn1Type <> "" And sConn2Type <> "" Then |
||
2708 | 73bfb231 | Gyusu | If oConn1Rows.Count > 0 Then |
2709 | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2710 | End If |
||
2711 | If oConn2Rows.Count > 0 Then |
||
2712 | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2713 | End If |
||
2714 | |||
2715 | 76f465d0 | Gyusu | ElseIf sConn1Type <> "" And sConn2Type = "" Then |
2716 | 73bfb231 | Gyusu | If oConn1Rows.Count > 0 Then |
2717 | sFirstUid = CheckExistModeling(oConn1Rows(0)) |
||
2718 | End If |
||
2719 | |||
2720 | 76f465d0 | Gyusu | ElseIf sConn1Type = "" And sConn2Type <> "" Then |
2721 | 73bfb231 | Gyusu | If oConn2Rows.Count > 0 Then |
2722 | sSecondUid = CheckExistModeling(oConn2Rows(0)) |
||
2723 | End If |
||
2724 | |||
2725 | 76f465d0 | Gyusu | End If |
2726 | f9b63682 | Gyusu | |
2727 | 76f465d0 | Gyusu | If sFirstUid <> "" And sSecondUid <> "" Then |
2728 | sReturnUid = sSecondUid |
||
2729 | ElseIf sFirstUid = "" And sSecondUid <> "" Then |
||
2730 | sReturnUid = sSecondUid |
||
2731 | ElseIf sFirstUid <> "" And sSecondUid = "" Then |
||
2732 | sReturnUid = sFirstUid |
||
2733 | Else |
||
2734 | sReturnUid = "" |
||
2735 | End If |
||
2736 | _iPipecnt = _iPipecnt + 1 |
||
2737 | Dim oCurrentConnector As LMConnector = Nothing |
||
2738 | f9b63682 | Gyusu | |
2739 | 76f465d0 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
2740 | f9b63682 | Gyusu | Try |
2741 | 76f465d0 | Gyusu | If Chk_OnlyPoint.Checked Then |
2742 | objInputs.Clear() |
||
2743 | objInputs.AddPoint(dStart_Dwg_x, dStart_Dwg_y) |
||
2744 | objInputs.AddPoint(dEnd_Dwg_x, dEnd_Dwg_y) |
||
2745 | oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2746 | Else |
||
2747 | oCurrentConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
2748 | f9b63682 | Gyusu | End If |
2749 | 76f465d0 | Gyusu | AddProgress() |
2750 | |||
2751 | f9b63682 | Gyusu | Catch ex As Exception |
2752 | 76f465d0 | Gyusu | |
2753 | f9b63682 | Gyusu | End Try |
2754 | 76f465d0 | Gyusu | If oCurrentConnector IsNot Nothing Then |
2755 | oCurrentLineRow(_XML_LINE_LMCONNECTOR) = oCurrentConnector |
||
2756 | oCurrentLineRow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
2757 | |||
2758 | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dStart_Dwg_x & "," & dStart_Dwg_y & ") - (" & dEnd_Dwg_x & "," & dEnd_Dwg_y & ")..." & _iPipecnt & " count ") |
||
2759 | |||
2760 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
2761 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
2762 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oCurrentLineRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
2763 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oCurrentLineRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
2764 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
2765 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dStart_Dwg_x & "," & dStart_Dwg_y) |
||
2766 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dEnd_Dwg_x & "," & dEnd_Dwg_y) |
||
2767 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
2768 | |||
2769 | Dim oPipeRun As LMPipeRun = oPidDataSource.GetPipeRun(oCurrentConnector.ModelItemID) |
||
2770 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
2771 | If oAttributeRow.Length > 0 Then |
||
2772 | For Each oAttribute In oAttributeRow |
||
2773 | Try |
||
2774 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
2775 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
2776 | If sPIDValue.Contains("'") Then |
||
2777 | sPIDValue = sPIDValue.Replace("'", """") |
||
2778 | End If |
||
2779 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
2780 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
2781 | Catch ex As Exception |
||
2782 | End Try |
||
2783 | Next |
||
2784 | oPipeRun.Commit() |
||
2785 | End If |
||
2786 | |||
2787 | Dim sID_1 As String = "" |
||
2788 | Dim sID_2 As String = "" |
||
2789 | If oStartLMConnector IsNot Nothing Then |
||
2790 | sID_1 = oStartLMConnector.ModelItemID |
||
2791 | sID_2 = oCurrentConnector.ModelItemID |
||
2792 | ElseIf oEndLMConnector IsNot Nothing Then |
||
2793 | sID_1 = oEndLMConnector.ModelItemID |
||
2794 | sID_2 = oCurrentConnector.ModelItemID |
||
2795 | End If |
||
2796 | If sID_1 <> "" And sID_2 <> "" Then |
||
2797 | 73bfb231 | Gyusu | Dim objSurvivorItem As LMAItem = Nothing |
2798 | Dim oPipeRun1 As LMPipeRun = oPidDataSource.GetPipeRun(sID_1) |
||
2799 | Dim oPipeRun2 As LMPipeRun = oPidDataSource.GetPipeRun(sID_2) |
||
2800 | _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
2801 | 76f465d0 | Gyusu | End If |
2802 | Else |
||
2803 | sReturnUid = "" |
||
2804 | End If |
||
2805 | Catch ex As Exception |
||
2806 | |||
2807 | End Try |
||
2808 | |||
2809 | |||
2810 | Catch ex As Exception |
||
2811 | |||
2812 | End Try |
||
2813 | |||
2814 | b08338e3 | Gyusu | |
2815 | f9b63682 | Gyusu | Return sReturnUid |
2816 | b08338e3 | Gyusu | '현재 Uid 모델링 |
2817 | f9b63682 | Gyusu | End Function |
2818 | bb2a0c79 | Gyusu | |
2819 | Private Sub PipingModeling() |
||
2820 | e4000111 | Gyusu | |
2821 | 171ac39d | Gyusu | Try |
2822 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
2823 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
2824 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
2825 | 54b98e09 | Gyusu | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
2826 | If CDrawing IsNot Nothing Then |
||
2827 | e4000111 | Gyusu | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
2828 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
2829 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
2830 | Dim iItemcnt As Integer = 0 |
||
2831 | Dim sNodeUid As String = oNode.Name |
||
2832 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
2833 | '1.Equipment |
||
2834 | '2.Piping OPC |
||
2835 | '3.OPC 시작되는 Line |
||
2836 | 'Equipment 생성 |
||
2837 | 'If sNodeUid <> "PipeLineNo" Then |
||
2838 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
2839 | b08338e3 | Gyusu | |
2840 | e4000111 | Gyusu | If CLineNo IsNot Nothing Then |
2841 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
2842 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
2843 | Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
||
2844 | Dim oDrawLinenoLabel As Boolean = False |
||
2845 | b08338e3 | Gyusu | Try |
2846 | ManualCheckNode(oLine_Dt) |
||
2847 | ManualCheckNode(oSymbol_Dt) |
||
2848 | Catch ex As Exception |
||
2849 | End Try |
||
2850 | e4000111 | Gyusu | For Each oSymbolNode As TreeNode In oNode.Nodes |
2851 | If oSymbolNode.Checked Then |
||
2852 | b08338e3 | Gyusu | Try |
2853 | Dim sUid As String = oSymbolNode.Name |
||
2854 | 3b7a4470 | Gyusu | If sUid = "152b5931-e7ed-4fe9-bed8-6c01303567b7" Then |
2855 | MessageBox.Show("") |
||
2856 | End If |
||
2857 | b08338e3 | Gyusu | Dim sLineNoUid As String = CLineNo.Uid |
2858 | 76f465d0 | Gyusu | Dim sReturnUid = sUid |
2859 | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2860 | While True |
||
2861 | Dim oLineRows As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2862 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2863 | If oLineRows.Count > 0 Then |
||
2864 | sReturnUid = FinalLineModeling(oLineRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2865 | Else |
||
2866 | sReturnUid = "" |
||
2867 | b08338e3 | Gyusu | End If |
2868 | 76f465d0 | Gyusu | If sReturnUid = "" Then |
2869 | Exit While |
||
2870 | End If |
||
2871 | End While |
||
2872 | b08338e3 | Gyusu | Catch ex As Exception |
2873 | End Try |
||
2874 | 6a6d8ab4 | Gyusu | End If |
2875 | e4000111 | Gyusu | Next |
2876 | 76f465d0 | Gyusu | End If |
2877 | Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
2878 | If CTrimLineNo IsNot Nothing Then |
||
2879 | Dim oLine_Dt As DataTable = CTrimLineNo.Dt_Line |
||
2880 | Dim oSymbol_Dt As DataTable = CTrimLineNo.Dt_Symbol |
||
2881 | Dim oAttribute_Dt As DataTable = CTrimLineNo.Dt_Attribute |
||
2882 | Dim oDrawLinenoLabel As Boolean = False |
||
2883 | Try |
||
2884 | ManualCheckNode(oLine_Dt) |
||
2885 | ManualCheckNode(oSymbol_Dt) |
||
2886 | Catch ex As Exception |
||
2887 | End Try |
||
2888 | f9b63682 | Gyusu | |
2889 | bb2a0c79 | Gyusu | For Each oSymbolNode As TreeNode In oNode.Nodes |
2890 | If oSymbolNode.Checked Then |
||
2891 | b08338e3 | Gyusu | Try |
2892 | Dim sUid As String = oSymbolNode.Name |
||
2893 | 76f465d0 | Gyusu | Dim sLineNoUid As String = CTrimLineNo.Uid |
2894 | f9b63682 | Gyusu | Dim sReturnUid = sUid |
2895 | 76f465d0 | Gyusu | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
2896 | f9b63682 | Gyusu | While True |
2897 | Dim oLineRows As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2898 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2899 | If oLineRows.Count > 0 Then |
||
2900 | sReturnUid = FinalLineModeling(oLineRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2901 | 76f465d0 | Gyusu | Else |
2902 | sReturnUid = "" |
||
2903 | f9b63682 | Gyusu | End If |
2904 | If sReturnUid = "" Then |
||
2905 | Exit While |
||
2906 | End If |
||
2907 | End While |
||
2908 | b08338e3 | Gyusu | Catch ex As Exception |
2909 | End Try |
||
2910 | bb2a0c79 | Gyusu | End If |
2911 | Next |
||
2912 | f9b63682 | Gyusu | 'For Each oSymbolNode As TreeNode In oNode.Nodes |
2913 | ' If oSymbolNode.Checked Then |
||
2914 | ' Try |
||
2915 | ' Dim sUid As String = oSymbolNode.Name |
||
2916 | ' Dim sLineNoUid As String = CLineNo.Uid |
||
2917 | 76f465d0 | Gyusu | ' Dim sReturnUid = sUid |
2918 | ' ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2919 | ' Dim oSymbolRows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2920 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2921 | ' If oSymbolRows.Count > 0 Then |
||
2922 | ' sReturnUid = FinalSymbolModeling(oSymbolRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2923 | ' Else |
||
2924 | ' sReturnUid = "" |
||
2925 | ' End If |
||
2926 | ' If sReturnUid = "" Then |
||
2927 | f9b63682 | Gyusu | ' End If |
2928 | ' Catch ex As Exception |
||
2929 | ' End Try |
||
2930 | ' End If |
||
2931 | 'Next |
||
2932 | e4000111 | Gyusu | End If |
2933 | 76f465d0 | Gyusu | Next |
2934 | 3acffcee | Gyusu | |
2935 | |||
2936 | 76f465d0 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
2937 | Dim iItemcnt As Integer = 0 |
||
2938 | Dim sNodeUid As String = oNode.Name |
||
2939 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
2940 | '1.Equipment |
||
2941 | '2.Piping OPC |
||
2942 | '3.OPC 시작되는 Line |
||
2943 | 'Equipment 생성 |
||
2944 | 'If sNodeUid <> "PipeLineNo" Then |
||
2945 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
2946 | bb2a0c79 | Gyusu | |
2947 | 76f465d0 | Gyusu | If CLineNo IsNot Nothing Then |
2948 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
2949 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
2950 | Dim oAttribute_Dt As DataTable = CLineNo.Dt_Attribute |
||
2951 | b08338e3 | Gyusu | Dim oDrawLinenoLabel As Boolean = False |
2952 | Try |
||
2953 | ManualCheckNode(oLine_Dt) |
||
2954 | ManualCheckNode(oSymbol_Dt) |
||
2955 | Catch ex As Exception |
||
2956 | End Try |
||
2957 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
2958 | If oSymbolNode.Checked Then |
||
2959 | Try |
||
2960 | Dim sUid As String = oSymbolNode.Name |
||
2961 | 76f465d0 | Gyusu | Dim sLineNoUid As String = CLineNo.Uid |
2962 | Dim sReturnUid = sUid |
||
2963 | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2964 | 3b7a4470 | Gyusu | Dim oSymbolRows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'FALSE' And [" & |
2965 | 76f465d0 | Gyusu | _XML_SYMBOL_Check & "] = 'TRUE'") |
2966 | 3b7a4470 | Gyusu | |
2967 | 76f465d0 | Gyusu | If oSymbolRows.Count > 0 Then |
2968 | sReturnUid = FinalSymbolModeling(oSymbolRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2969 | Else |
||
2970 | sReturnUid = "" |
||
2971 | End If |
||
2972 | If sReturnUid = "" Then |
||
2973 | b08338e3 | Gyusu | End If |
2974 | Catch ex As Exception |
||
2975 | End Try |
||
2976 | End If |
||
2977 | Next |
||
2978 | 76f465d0 | Gyusu | End If |
2979 | Dim CTrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
2980 | If CTrimLineNo IsNot Nothing Then |
||
2981 | Dim oLine_Dt As DataTable = CTrimLineNo.Dt_Line |
||
2982 | Dim oSymbol_Dt As DataTable = CTrimLineNo.Dt_Symbol |
||
2983 | Dim oAttribute_Dt As DataTable = CTrimLineNo.Dt_Attribute |
||
2984 | Dim oDrawLinenoLabel As Boolean = False |
||
2985 | Try |
||
2986 | ManualCheckNode(oLine_Dt) |
||
2987 | ManualCheckNode(oSymbol_Dt) |
||
2988 | Catch ex As Exception |
||
2989 | End Try |
||
2990 | b08338e3 | Gyusu | For Each oSymbolNode As TreeNode In oNode.Nodes |
2991 | 76f465d0 | Gyusu | If oSymbolNode.Checked Then |
2992 | Try |
||
2993 | b08338e3 | Gyusu | Dim sUid As String = oSymbolNode.Name |
2994 | 76f465d0 | Gyusu | Dim sLineNoUid As String = CTrimLineNo.Uid |
2995 | Dim sReturnUid = sUid |
||
2996 | ' FinalModeling(sUid, oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
2997 | Dim oSymbolRows As DataRow() = oSymbol_Dt.Select("[" & _XML_SYMBOL_UID & "]= '" & sReturnUid & "' And [" & _XML_SYMBOL_DRAWING_TF & "] = 'False' And [" & |
||
2998 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
2999 | If oSymbolRows.Count > 0 Then |
||
3000 | sReturnUid = FinalSymbolModeling(oSymbolRows(0), oLine_Dt, oSymbol_Dt, oAttribute_Dt) |
||
3001 | Else |
||
3002 | sReturnUid = "" |
||
3003 | b08338e3 | Gyusu | End If |
3004 | 76f465d0 | Gyusu | If sReturnUid = "" Then |
3005 | b08338e3 | Gyusu | End If |
3006 | 76f465d0 | Gyusu | Catch ex As Exception |
3007 | End Try |
||
3008 | End If |
||
3009 | b08338e3 | Gyusu | Next |
3010 | End If |
||
3011 | Next |
||
3012 | End If |
||
3013 | Next |
||
3014 | Next |
||
3015 | Catch ex As Exception |
||
3016 | |||
3017 | End Try |
||
3018 | End Sub |
||
3019 | |||
3020 | |||
3021 | Private Sub FindNearPoint(ByVal oOPCSymbol As LMSymbol, ByRef dNear_x As Double, ByRef dNear_y As Double) |
||
3022 | Dim oConnectionPoints_x(4) As Double |
||
3023 | Dim oConnectionPoints_y(4) As Double |
||
3024 | |||
3025 | Try |
||
3026 | _Placement.PIDConnectPointLocation(oOPCSymbol, 1, oConnectionPoints_x(0), oConnectionPoints_y(0)) |
||
3027 | _Placement.PIDConnectPointLocation(oOPCSymbol, 2, oConnectionPoints_x(1), oConnectionPoints_y(1)) |
||
3028 | _Placement.PIDConnectPointLocation(oOPCSymbol, 3, oConnectionPoints_x(2), oConnectionPoints_y(2)) |
||
3029 | _Placement.PIDConnectPointLocation(oOPCSymbol, 4, oConnectionPoints_x(3), oConnectionPoints_y(3)) |
||
3030 | Dim iNearPoint As Integer = 0 |
||
3031 | Dim dGap As Double = 0 |
||
3032 | For i = 0 To 3 |
||
3033 | If dGap = 0 Then |
||
3034 | iNearPoint = i |
||
3035 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
3036 | Else |
||
3037 | If dGap >= Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) Then |
||
3038 | iNearPoint = i |
||
3039 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
3040 | End If |
||
3041 | End If |
||
3042 | Next |
||
3043 | dNear_x = oConnectionPoints_x(iNearPoint) |
||
3044 | dNear_y = oConnectionPoints_y(iNearPoint) |
||
3045 | Catch ex As Exception |
||
3046 | e4000111 | Gyusu | |
3047 | bb2a0c79 | Gyusu | End Try |
3048 | e4000111 | Gyusu | |
3049 | bb2a0c79 | Gyusu | End Sub |
3050 | |||
3051 | Private Function GetPipeType(ByVal sType As String) As String |
||
3052 | Dim sSystempath As String = "\Piping\Routing\Process Lines\Primary Piping.sym" ' oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
||
3053 | If sType.ToUpper() = "ELECTRIC" Then |
||
3054 | sSystempath = "\Instrumentation\Signal Line\Electric.sym" |
||
3055 | ElseIf sType.ToUpper() = "CONNECT TO PROCESS" Then |
||
3056 | sSystempath = "\Instrumentation\Signal Line\Connect to Process.sym" |
||
3057 | Else |
||
3058 | End If |
||
3059 | Return sSystempath |
||
3060 | End Function |
||
3061 | |||
3062 | Private Sub InitAutoRouting() |
||
3063 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
3064 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
3065 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
3066 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
3067 | If CDrawing IsNot Nothing Then |
||
3068 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
3069 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
3070 | SetListBoxItems(ListBox_Result, "Place " & CDrawing.DwgName & "....") |
||
3071 | b08338e3 | Gyusu | |
3072 | bb2a0c79 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
3073 | Dim iItemcnt As Integer = 0 |
||
3074 | Dim sNodeUid As String = oNode.Name |
||
3075 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
3076 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
3077 | If CLineNo IsNot Nothing Then |
||
3078 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
3079 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
3080 | |||
3081 | For Each oLineRow In oLine_Dt.Rows |
||
3082 | 76f465d0 | Gyusu | ' oLineRow(_XML_LINE_UID) = "" |
3083 | oLineRow(_XML_LINE_SPID) = "" |
||
3084 | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
||
3085 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
3086 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
3087 | oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
||
3088 | Next |
||
3089 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
3090 | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
||
3091 | oSymbolRow(_XML_SYMBOL_SPID) = "" |
||
3092 | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
||
3093 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
3094 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
3095 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
3096 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
3097 | |||
3098 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
||
3099 | |||
3100 | Next |
||
3101 | |||
3102 | End If |
||
3103 | |||
3104 | Dim CTRIMLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
3105 | If CTRIMLineNo IsNot Nothing Then |
||
3106 | Dim oLine_Dt As DataTable = CTRIMLineNo.Dt_Line |
||
3107 | Dim oSymbol_Dt As DataTable = CTRIMLineNo.Dt_Symbol |
||
3108 | |||
3109 | For Each oLineRow In oLine_Dt.Rows |
||
3110 | ' oLineRow(_XML_LINE_UID) = "" |
||
3111 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_SPID) = "" |
3112 | 76f465d0 | Gyusu | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
3113 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
3114 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
3115 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
3116 | Next |
||
3117 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
3118 | 76f465d0 | Gyusu | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
3119 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_SPID) = "" |
3120 | 76f465d0 | Gyusu | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
3121 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
3122 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
3123 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
3124 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
3125 | |||
3126 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
3127 | 76f465d0 | Gyusu | |
3128 | bb2a0c79 | Gyusu | Next |
3129 | |||
3130 | End If |
||
3131 | Next |
||
3132 | End If |
||
3133 | Next |
||
3134 | Next |
||
3135 | End Sub |
||
3136 | |||
3137 | |||
3138 | |||
3139 | |||
3140 | |||
3141 | |||
3142 | Private Function CheckBranchLine(ByVal oLine_Dt As DataTable, ByVal dStartX As Double, ByVal dStartY As Double, |
||
3143 | ByRef dEndX As Double, ByRef dEndY As Double, ByRef sBranchType As String, ByRef oLMConnector As LMConnector) As Boolean |
||
3144 | |||
3145 | Try |
||
3146 | Dim oModelingLineRows() As DataRow = oLine_Dt.Select("[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And [" & _XML_LINE_SPID & "] <> ''") |
||
3147 | For Each oModelrow In oModelingLineRows |
||
3148 | Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3149 | Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
3150 | Dim dModelStartX As Double |
||
3151 | Dim dModelStartY As Double |
||
3152 | Dim dModelEndX As Double |
||
3153 | Dim dModelEndY As Double |
||
3154 | ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
3155 | ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3156 | ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3157 | ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
3158 | Dim dGap As Double = 0.0002 |
||
3159 | Dim d기준x As Double = (dModelStartX + dModelEndX) / 2 |
||
3160 | Dim d기준y As Double = (dModelStartY + dModelEndY) / 2 |
||
3161 | Try |
||
3162 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3163 | Catch ex As Exception |
||
3164 | |||
3165 | End Try |
||
3166 | Dim oRun As LMPipeRun = Nothing |
||
3167 | Try |
||
3168 | |||
3169 | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
||
3170 | Dim dResultCalc As Double = -1 |
||
3171 | For Each objRep In oRun.Representations |
||
3172 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3173 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3174 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3175 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3176 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3177 | Dim dStartCalc As Double = Math.Abs(dStartX - dConn_X) + Math.Abs(dStartY - dConn_Y) |
||
3178 | |||
3179 | If dResultCalc > dStartCalc Or dResultCalc = -1 Then |
||
3180 | dResultCalc = dStartCalc |
||
3181 | oLMConnector = objConnector |
||
3182 | d기준x = dConn_X |
||
3183 | d기준y = dConn_Y |
||
3184 | End If |
||
3185 | Dim dEndCalc As Double = Math.Abs(dEndX - dConn_X) + Math.Abs(dEndY - dConn_Y) |
||
3186 | If dResultCalc > dEndCalc Then |
||
3187 | dResultCalc = dEndCalc |
||
3188 | oLMConnector = objConnector |
||
3189 | d기준x = dConn_X |
||
3190 | d기준y = dConn_Y |
||
3191 | End If |
||
3192 | Next |
||
3193 | End If |
||
3194 | Next |
||
3195 | ' _Placement.PIDConnectPointLocation(oRun, 1, dModelStartX, dModelEndX) |
||
3196 | ' _Placement.PIDConnectPointLocation(oRun, 2, dModelEndX, dModelEndY) |
||
3197 | Catch ex As Exception |
||
3198 | End Try |
||
3199 | |||
3200 | |||
3201 | 'Dim sSPID As String = oModelrow(_XML_LINE_SPID).ToString() |
||
3202 | 'Dim oPipeRun As LMPipeRun = _Placement.PIDDataSource.Get PipeRun(sSPID) |
||
3203 | 'If dModelStartX + dGap > dStartX And dModelStartX - dGap < dStartX And |
||
3204 | ' dModelStartY + dGap > dStartY And dModelStartY - dGap < dStartY Then |
||
3205 | ' dStartX = dModelStartX |
||
3206 | ' dStartY = dModelStartY |
||
3207 | 'ElseIf dModelEndX + dGap > dStartX And dModelEndX - dGap < dStartX And |
||
3208 | ' dModelEndY + dGap > dStartY And dModelEndY - dGap < dStartY Then |
||
3209 | ' dStartX = dModelEndX |
||
3210 | ' dStartY = dModelEndY |
||
3211 | 'End If |
||
3212 | |||
3213 | 'Vetical |
||
3214 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
3215 | If Math.Abs(dStartX - dEndX) >= Math.Abs(dStartY - dEndY) Then |
||
3216 | 'Horizontal |
||
3217 | ' dGap = 0.0002 'Math.Abs(dStartX - dEndX) / 20 |
||
3218 | '기준선의 Y범위안에 가로선이 포함되어야됨 |
||
3219 | If (dModelStartY + dGap >= dStartY And dModelEndY - dGap <= dStartY) Or |
||
3220 | (dModelStartY - dGap <= dStartY And dModelEndY + dGap >= dStartY) And |
||
3221 | (dModelStartY + dGap >= dEndY And dModelEndY - dGap <= dEndY) Or |
||
3222 | (dModelStartY - dGap <= dEndY And dModelEndY + dGap >= dEndY) Then |
||
3223 | '기준선보다 왼쪽에 가로선이 있을때 |
||
3224 | If d기준x >= dStartX And d기준x >= dEndX Then |
||
3225 | If dStartX >= dEndX Then |
||
3226 | 'dStartX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3227 | If dStartX + dGap >= d기준x Then |
||
3228 | dStartX = d기준x |
||
3229 | sBranchType = "1" |
||
3230 | Return True |
||
3231 | End If |
||
3232 | Else |
||
3233 | 'dEndX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3234 | If dEndX + dGap >= d기준x Then |
||
3235 | dEndX = d기준x |
||
3236 | sBranchType = "2" |
||
3237 | Return True |
||
3238 | End If |
||
3239 | End If |
||
3240 | '기준선보다 오른쪽에 가로선이 있을때 |
||
3241 | ElseIf d기준x <= dStartX And d기준x <= dEndX Then |
||
3242 | If dStartX >= dEndX Then |
||
3243 | 'dEndX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3244 | If dEndX - dGap <= d기준x Then |
||
3245 | dEndX = d기준x |
||
3246 | sBranchType = "2" |
||
3247 | Return True |
||
3248 | End If |
||
3249 | Else |
||
3250 | 'dStartX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3251 | If dStartX - dGap <= d기준x Then |
||
3252 | dStartX = d기준x |
||
3253 | sBranchType = "1" |
||
3254 | Return True |
||
3255 | End If |
||
3256 | End If |
||
3257 | Else |
||
3258 | '기준선과 세로선이 겹칠때 |
||
3259 | If (d기준x >= dStartX And d기준x <= dEndX) Or |
||
3260 | (d기준x <= dStartX And d기준x >= dEndX) Then |
||
3261 | If (dModelStartY <= dStartY And dModelEndY >= dEndY) Or |
||
3262 | (dModelStartY >= dStartY And dModelEndY <= dEndY) Then |
||
3263 | '기준선이 dStartX와 dEndX중 어느쪽에 가까운지 확인 |
||
3264 | '가로선의 왼쪽점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3265 | '가로선의 오른쪽점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
||
3266 | If Math.Abs(d기준x - dStartX) >= Math.Abs(d기준x - dEndX) Then |
||
3267 | 'EndX점이 기준선과 더 가까이 있음 |
||
3268 | If dStartX >= dEndX Then |
||
3269 | '가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3270 | If dEndX - dGap <= d기준x Then |
||
3271 | dEndX = d기준x |
||
3272 | sBranchType = "4" |
||
3273 | Return True |
||
3274 | End If |
||
3275 | Else |
||
3276 | '가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3277 | If dEndX + dGap >= d기준x Then |
||
3278 | dEndX = d기준x |
||
3279 | sBranchType = "4" |
||
3280 | Return True |
||
3281 | End If |
||
3282 | |||
3283 | End If |
||
3284 | Else |
||
3285 | 'dStartX점이 기준선과 더 가까이 있음 |
||
3286 | If dStartX >= dEndX Then |
||
3287 | '가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3288 | If dStartX + dGap >= d기준x Then |
||
3289 | dStartX = d기준x |
||
3290 | sBranchType = "3" |
||
3291 | Return True |
||
3292 | End If |
||
3293 | |||
3294 | Else |
||
3295 | '가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3296 | If dStartX - dGap <= d기준x Then |
||
3297 | dStartX = d기준x |
||
3298 | sBranchType = "3" |
||
3299 | Return True |
||
3300 | End If |
||
3301 | End If |
||
3302 | End If |
||
3303 | End If |
||
3304 | |||
3305 | End If |
||
3306 | End If |
||
3307 | End If |
||
3308 | |||
3309 | End If |
||
3310 | Else |
||
3311 | 'Horizontal |
||
3312 | If Math.Abs(dModelStartX - dModelEndX) >= Math.Abs(dModelStartY - dModelEndY) Then |
||
3313 | 'Vertical |
||
3314 | If Math.Abs(dStartX - dEndX) <= Math.Abs(dStartY - dEndY) Then |
||
3315 | ' dGap = 0.0015 'Math.Abs(dStartY - dEndY) / 80 |
||
3316 | |||
3317 | '기준선의 X범위안에 세로선이 포함되어야됨 |
||
3318 | If ((dModelStartX + dGap >= dStartX And dModelEndX - dGap <= dStartX) Or |
||
3319 | (dModelStartX - dGap <= dStartX And dModelEndX + dGap >= dStartX)) And |
||
3320 | ((dModelStartX + dGap >= dEndX And dModelEndX - dGap <= dEndX) Or |
||
3321 | (dModelStartX - dGap <= dEndX And dModelEndX + dGap >= dEndX)) Then |
||
3322 | |||
3323 | '가로선보다 아래에 세로선이 있을때 |
||
3324 | If d기준y >= dStartY And d기준y >= dEndY Then |
||
3325 | If dStartY >= dEndY Then |
||
3326 | 'dStartY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3327 | If dStartY + dGap >= d기준y Then |
||
3328 | dStartY = d기준y |
||
3329 | sBranchType = "3" |
||
3330 | Return True |
||
3331 | End If |
||
3332 | Else |
||
3333 | 'dEndY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3334 | If dEndY + dGap >= d기준y Then |
||
3335 | dEndY = d기준y |
||
3336 | |||
3337 | If Math.Abs(dEndX - dModelStartX) > Math.Abs(dEndX - dModelEndX) Then |
||
3338 | dEndX = dModelEndX |
||
3339 | Else |
||
3340 | dEndX = dModelStartX |
||
3341 | End If |
||
3342 | |||
3343 | sBranchType = "4" |
||
3344 | Return True |
||
3345 | End If |
||
3346 | End If |
||
3347 | '기준선보다 위에 세로선이 있을때 |
||
3348 | ElseIf d기준y <= dStartY And d기준y <= dEndY Then |
||
3349 | If dStartY >= dEndY Then |
||
3350 | 'dEndY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3351 | If dEndY - dGap <= d기준y Then |
||
3352 | dEndY = d기준y |
||
3353 | sBranchType = "4" |
||
3354 | Return True |
||
3355 | End If |
||
3356 | Else |
||
3357 | 'dStartY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3358 | If dStartY - dGap <= d기준y Then |
||
3359 | dStartY = d기준y |
||
3360 | sBranchType = "3" |
||
3361 | Return True |
||
3362 | End If |
||
3363 | End If |
||
3364 | Else |
||
3365 | '기준선과 세로선이 겹칠때 |
||
3366 | If (d기준y >= dStartY And d기준y <= dEndY) Or |
||
3367 | (d기준y <= dStartY And d기준y >= dEndY) Then |
||
3368 | '기준선이 dStartY와 dEndY중 어느쪽에 가까운지 확인 |
||
3369 | '세로선의 윗점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3370 | '세로선의 아래점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
||
3371 | If (dModelStartX <= dStartX And dModelEndX >= dEndX) Or |
||
3372 | (dModelStartX >= dStartX And dModelEndX <= dEndX) Then |
||
3373 | If Math.Abs(d기준y - dStartY) >= Math.Abs(d기준y - dEndY) Then |
||
3374 | 'Endy점이 기준선과 더 가까이 있음 |
||
3375 | If dStartY >= dEndY Then |
||
3376 | '세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3377 | If dEndY + dGap >= d기준y Then |
||
3378 | dEndY = d기준y |
||
3379 | sBranchType = "4" |
||
3380 | Return True |
||
3381 | End If |
||
3382 | Else |
||
3383 | '세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3384 | If dEndY - dGap <= d기준y Then |
||
3385 | dEndY = d기준y |
||
3386 | sBranchType = "4" |
||
3387 | Return True |
||
3388 | End If |
||
3389 | End If |
||
3390 | Else |
||
3391 | 'dStartY점이 기준선과 더 가까이 있음 |
||
3392 | If dStartY >= dEndY Then |
||
3393 | '세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3394 | If dStartY - dGap <= d기준y Then |
||
3395 | dStartY = d기준y |
||
3396 | sBranchType = "3" |
||
3397 | Return True |
||
3398 | End If |
||
3399 | Else |
||
3400 | '세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3401 | If dStartY + dGap >= d기준y Then |
||
3402 | dStartY = d기준y |
||
3403 | sBranchType = "3" |
||
3404 | Return True |
||
3405 | End If |
||
3406 | End If |
||
3407 | End If |
||
3408 | End If |
||
3409 | |||
3410 | End If |
||
3411 | End If |
||
3412 | End If |
||
3413 | End If |
||
3414 | End If |
||
3415 | End If |
||
3416 | Next |
||
3417 | Catch ex As Exception |
||
3418 | |||
3419 | End Try |
||
3420 | oLMConnector = Nothing |
||
3421 | Return False |
||
3422 | End Function |
||
3423 | |||
3424 | 76f465d0 | Gyusu | Private Function CheckConnectionSymbolToSymbol(ByVal oModelingLineRows() As DataRow, ByRef dX As Double, ByRef dY As Double, |
3425 | ByRef oLMConnector As LMConnector) As Boolean |
||
3426 | Dim bConnectionFlag As Boolean = False |
||
3427 | Try |
||
3428 | For Each oModelrow In oModelingLineRows |
||
3429 | Dim d기준x As Double = dX |
||
3430 | Dim d기준y As Double = dY |
||
3431 | Dim dGap As Double = 0.0002 |
||
3432 | Dim oRun As LMPipeRun = Nothing |
||
3433 | Try |
||
3434 | Dim oLMSymbol As LMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3435 | Dim dX1 As Double = 0.0 |
||
3436 | Dim dY1 As Double = 0.0 |
||
3437 | Dim dX2 As Double = 0.0 |
||
3438 | Dim dY2 As Double = 0.0 |
||
3439 | For Each oConnector In oLMSymbol.Connect1Connectors |
||
3440 | oLMConnector = oConnector |
||
3441 | Next |
||
3442 | ' oRun = _Placement.PIDDataSource.GetPipeRun(oLMSymbol.Connect1Connectors.Nth(1).ModelItemID) |
||
3443 | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3444 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3445 | If Math.Abs(dX - dX1) < dGap And Math.Abs(dY - dY1) < dGap Then |
||
3446 | dX = dX1 |
||
3447 | dY = dY1 |
||
3448 | bConnectionFlag = True |
||
3449 | Exit For |
||
3450 | End If |
||
3451 | If Math.Abs(dX - dX2) < dGap And Math.Abs(dY - dY2) < dGap Then |
||
3452 | dX = dX2 |
||
3453 | dY = dY2 |
||
3454 | bConnectionFlag = True |
||
3455 | Exit For |
||
3456 | End If |
||
3457 | |||
3458 | 'For Each oConnector In oLMSymbol.Connect1Connectors |
||
3459 | ' For Each objConnectorVertex In oConnector.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 = oConnector |
||
3464 | ' dX = dConn_X |
||
3465 | ' dY = dConn_Y |
||
3466 | ' bConnectionFlag = True |
||
3467 | ' Exit For |
||
3468 | ' End If |
||
3469 | ' Next |
||
3470 | 'Next |
||
3471 | |||
3472 | 'For Each oConnector In oLMSymbol.Connect2Connectors |
||
3473 | ' For Each objConnectorVertex In oConnector.ConnectorVertices |
||
3474 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3475 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3476 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3477 | ' oLMConnector = oConnector |
||
3478 | ' dX = dConn_X |
||
3479 | ' dY = dConn_Y |
||
3480 | ' bConnectionFlag = True |
||
3481 | ' Exit For |
||
3482 | ' End If |
||
3483 | ' Next |
||
3484 | 'Next |
||
3485 | |||
3486 | |||
3487 | 'If oRun IsNot Nothing Then |
||
3488 | ' Dim dResultCalc As Double = -1 |
||
3489 | ' For Each objRep In oRun.Representations |
||
3490 | ' Dim sRepresentationType As String = objRep.Attributes("RepresentationType").Value |
||
3491 | ' If objRep.Attributes("RepresentationType").Value = "Connector" Or |
||
3492 | ' objRep.Attributes("RepresentationType").Value = "Symbol" And |
||
3493 | ' objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3494 | ' Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3495 | ' For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3496 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3497 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3498 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3499 | ' oLMConnector = objConnector |
||
3500 | ' d기준x = dConn_X |
||
3501 | ' d기준y = dConn_Y |
||
3502 | ' bConnectionFlag = True |
||
3503 | ' Exit For |
||
3504 | ' End If |
||
3505 | ' Next |
||
3506 | ' End If |
||
3507 | ' Next |
||
3508 | 'End If |
||
3509 | |||
3510 | Catch ex As Exception |
||
3511 | End Try |
||
3512 | Next |
||
3513 | |||
3514 | Catch ex As Exception |
||
3515 | |||
3516 | End Try |
||
3517 | Return bConnectionFlag |
||
3518 | End Function |
||
3519 | |||
3520 | Private Function CheckConnectionSymbolToLine(ByVal oModelingLineRows() As DataRow, ByRef dX As Double, ByRef dY As Double, |
||
3521 | ByVal dCenterX As Double, ByVal dCenterY As Double, ByRef oLMConnector As LMConnector) As LMSymbol |
||
3522 | Dim bConnectionFlag As Boolean = False |
||
3523 | Dim oLMSymbol As LMSymbol = Nothing |
||
3524 | Try |
||
3525 | |||
3526 | For Each oModelrow In oModelingLineRows |
||
3527 | Dim d기준x As Double = dCenterX |
||
3528 | Dim d기준y As Double = dCenterY |
||
3529 | Dim dGap As Double = 0.001 |
||
3530 | Dim oRun As LMPipeRun = Nothing |
||
3531 | Dim dCheckGap As Double = 0 |
||
3532 | Try |
||
3533 | |||
3534 | Dim dX1 As Double = 0.0 |
||
3535 | Dim dY1 As Double = 0.0 |
||
3536 | Dim dX2 As Double = 0.0 |
||
3537 | Dim dY2 As Double = 0.0 |
||
3538 | ' oRun = _Placement.PIDDataSource.GetPipeRun(oLMSymbol.Connect1Connectors.Nth(1).ModelItemID) |
||
3539 | oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3540 | For Each oConnector In oLMSymbol.Connect1Connectors |
||
3541 | oLMConnector = oConnector |
||
3542 | Next |
||
3543 | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3544 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3545 | ' If Math.Abs(dX - dX1) < dGap And Math.Abs(dY - dY1) < dGap And |
||
3546 | If Math.Abs(d기준x - dX1) < dCheckGap And Math.Abs(d기준y - dY1) < dCheckGap Or dCheckGap = 0 Then |
||
3547 | dX = dX1 |
||
3548 | dY = dY1 |
||
3549 | bConnectionFlag = True |
||
3550 | dCheckGap = Math.Abs(d기준x - dX1) + Math.Abs(d기준y - dY1) |
||
3551 | End If |
||
3552 | 'If Math.Abs(dX - dX2) < dGap And Math.Abs(dY - dY2) < dGap And |
||
3553 | ' Math.Abs(d기준x - dX2) < dCheckGap And Math.Abs(d기준y - dY2 < dCheckGap) Or dCheckGap = 0 Then |
||
3554 | If Math.Abs(d기준x - dX2) < dCheckGap And Math.Abs(d기준y - dY2) < dCheckGap Or dCheckGap = 0 Then |
||
3555 | dX = dX2 |
||
3556 | dY = dY2 |
||
3557 | bConnectionFlag = True |
||
3558 | End If |
||
3559 | |||
3560 | Catch ex As Exception |
||
3561 | End Try |
||
3562 | If bConnectionFlag Then |
||
3563 | oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3564 | Else |
||
3565 | oLMSymbol = Nothing |
||
3566 | End If |
||
3567 | Next |
||
3568 | b08338e3 | Gyusu | |
3569 | 76f465d0 | Gyusu | Catch ex As Exception |
3570 | b08338e3 | Gyusu | |
3571 | 76f465d0 | Gyusu | End Try |
3572 | b08338e3 | Gyusu | |
3573 | 76f465d0 | Gyusu | Return oLMSymbol |
3574 | End Function |
||
3575 | b08338e3 | Gyusu | |
3576 | 3b7a4470 | Gyusu | ''' <summary> |
3577 | ''' 라인과 라인이 만나는점이 브런치점인지 확인, 오차범위내 라인보정 |
||
3578 | ''' </summary> |
||
3579 | ''' <param name="oModelingLineRows"></param> |
||
3580 | ''' <param name="dStartX"></param> |
||
3581 | ''' <param name="dStartY"></param> |
||
3582 | ''' <param name="dEndX"></param> |
||
3583 | ''' <param name="dEndY"></param> |
||
3584 | ''' <param name="oLMConnector"></param> |
||
3585 | ''' <returns></returns> |
||
3586 | Private Function CheckBranchLine(ByVal oModelingLineRows As DataRowCollection, ByRef dStartX As Double, ByRef dStartY As Double, |
||
3587 | ByRef dEndX As Double, ByRef dEndY As Double, ByRef oLMConnector As LMConnector) As String |
||
3588 | Dim bConnectionFlag As Boolean = False |
||
3589 | Dim sBranchDirection As String = "" |
||
3590 | Try |
||
3591 | For Each oModelrow In oModelingLineRows |
||
3592 | Dim dModelStartX As Double |
||
3593 | Dim dModelStartY As Double |
||
3594 | Dim dModelEndX As Double |
||
3595 | Dim dModelEndY As Double |
||
3596 | 73bfb231 | Gyusu | Dim dGap As Double = 0.002 |
3597 | 3b7a4470 | Gyusu | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
3598 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3599 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3600 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3601 | |||
3602 | '기존라인이 X축방향이라면 현재선은 Y축방향이 되어야됨 |
||
3603 | If Math.Abs(dModelStartX - dModelEndX) > Math.Abs(dModelStartY - dModelEndY) And |
||
3604 | Math.Abs(dStartX - dEndX) < Math.Abs(dStartY - dEndY) Then |
||
3605 | |||
3606 | '기본라인의 X축영역안에 현재선이 있어야됨 |
||
3607 | ' If dModelEndY > dModelStartY Then |
||
3608 | If (dStartX < dModelEndX And dStartX > dModelStartX) Or |
||
3609 | (dStartX > dModelEndX And dStartX < dModelStartX) Then |
||
3610 | '[오차범위 수정] |
||
3611 | '현재선의 Y축방향이 기존라인의 X축방향을 통과하는지 확인 |
||
3612 | If dStartY < dEndY Then |
||
3613 | If dEndY > dModelStartY And dModelStartY > dStartY Then |
||
3614 | If dEndY - dModelStartY > dModelStartY - dStartY Then |
||
3615 | '위쪽으로 라인이 나와있을때 |
||
3616 | '현재선 중 작은 Y좌표를 오차범위만큼 더했을때 기존라인의 Y축보다 큰지확인 |
||
3617 | 'Y축보다 클경우 작은 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 큰 Y좌표에 더한다. |
||
3618 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3619 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartY - dStartY |
3620 | dEndY = dEndY + dAddPoint |
||
3621 | dStartY = dModelStartY |
||
3622 | sBranchDirection = "START" |
||
3623 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3624 | Exit For |
||
3625 | 3b7a4470 | Gyusu | End If |
3626 | Else |
||
3627 | '아래쪽으로 라인이 나와있을때 |
||
3628 | '현재선 중 큰 Y좌표를 오차범위만큼 뺐을때 기존라인의 Y축보다 작은지확인 |
||
3629 | 'Y축보다 작을경우 큰 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 작은 Y좌표에 뺀다. |
||
3630 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3631 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dEndY - dModelStartY |
3632 | dStartY = dStartY - dAddPoint |
||
3633 | dEndY = dModelStartY |
||
3634 | sBranchDirection = "END" |
||
3635 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3636 | Exit For |
||
3637 | 3b7a4470 | Gyusu | End If |
3638 | End If |
||
3639 | Else |
||
3640 | '현재선의 Y축방향이 기존라인의 X축방향에 못미치는지 확인 |
||
3641 | If dStartY > dModelStartY Then |
||
3642 | '기존라인보다 위쪽에 현재선이 있을때 |
||
3643 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3644 | 3b7a4470 | Gyusu | '오차범위만큼 작은 y좌표를 뺐을때 기존라인보다 아래쪽에 있을경우 오차보정 |
3645 | Dim dAddPoint As Double = dStartY - dModelStartY |
||
3646 | dEndY = dEndY - dAddPoint |
||
3647 | dStartY = dModelStartY |
||
3648 | sBranchDirection = "START" |
||
3649 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3650 | Exit For |
||
3651 | 3b7a4470 | Gyusu | End If |
3652 | Else |
||
3653 | '기존라인보다 아래쪽에 현재선이 있을때 |
||
3654 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3655 | 3b7a4470 | Gyusu | '오차범위만큼 큰 y좌표를 더했을때 기존라인보다 위쪽에 있을경우 오차보정 |
3656 | Dim dAddPoint As Double = dModelStartY - dEndY |
||
3657 | dEndY = dModelStartY |
||
3658 | dStartY = dStartY + dAddPoint |
||
3659 | sBranchDirection = "END" |
||
3660 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3661 | Exit For |
||
3662 | 3b7a4470 | Gyusu | End If |
3663 | End If |
||
3664 | End If |
||
3665 | Else |
||
3666 | If dEndY < dModelStartY And dModelStartY < dStartY Then |
||
3667 | If dModelStartY - dEndY < dStartY - dModelStartY Then |
||
3668 | '위쪽으로 라인이 나와있을때 |
||
3669 | '현재선 중 작은 Y좌표를 오차범위만큼 더했을때 기존라인의 Y축보다 큰지확인 |
||
3670 | 'Y축보다 클경우 작은 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 큰 Y좌표에 더한다. |
||
3671 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3672 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartY - dEndY |
3673 | dStartY = dStartY + dAddPoint |
||
3674 | dEndY = dModelStartY |
||
3675 | sBranchDirection = "END" |
||
3676 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3677 | Exit For |
||
3678 | 3b7a4470 | Gyusu | End If |
3679 | Else |
||
3680 | '아래쪽으로 라인이 나와있을때 |
||
3681 | '현재선 중 큰 Y좌표를 오차범위만큼 뺐을때 기존라인의 Y축보다 작은지확인 |
||
3682 | 'Y축보다 작을경우 큰 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 작은 Y좌표에 뺀다. |
||
3683 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3684 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dStartY - dModelStartY |
3685 | dEndY = dEndY - dAddPoint |
||
3686 | dStartY = dModelStartY |
||
3687 | sBranchDirection = "START" |
||
3688 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3689 | Exit For |
||
3690 | 3b7a4470 | Gyusu | End If |
3691 | End If |
||
3692 | Else |
||
3693 | If dEndY > dModelStartY Then |
||
3694 | '기존라인보다 우측에 현재선이 있을때 |
||
3695 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3696 | 3b7a4470 | Gyusu | '오차범위만큼 작은 x좌표를 뺐을때 기존라인보다 좌측에 있을경우 오차보정 |
3697 | Dim dAddPoint As Double = dEndY - dModelStartY |
||
3698 | dStartY = dStartY - dAddPoint |
||
3699 | dEndY = dModelStartY |
||
3700 | sBranchDirection = "END" |
||
3701 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3702 | Exit For |
||
3703 | 3b7a4470 | Gyusu | End If |
3704 | Else |
||
3705 | '기존라인보다 좌측에 현재선이 있을때 |
||
3706 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3707 | 3b7a4470 | Gyusu | '오차범위만큼 큰 x좌표를 더했을때 기존라인보다 우측에 있을경우 오차보정 |
3708 | Dim dAddPoint As Double = dModelStartY - dStartY |
||
3709 | dStartY = dModelStartY |
||
3710 | dEndY = dEndY + dAddPoint |
||
3711 | sBranchDirection = "START" |
||
3712 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3713 | Exit For |
||
3714 | 3b7a4470 | Gyusu | End If |
3715 | End If |
||
3716 | End If |
||
3717 | End If |
||
3718 | End If |
||
3719 | '기존라인이 Y축방향이라면 현재선은 X축방향이 되어야됨 |
||
3720 | ElseIf Math.Abs(dModelStartX - dModelEndX) < Math.Abs(dModelStartY - dModelEndY) And |
||
3721 | Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
||
3722 | |||
3723 | '기본라인의 Y축영역안에 현재선이 있어야됨 |
||
3724 | ' If dModelEndY > dModelStartY Then |
||
3725 | If (dStartY < dModelEndY And dStartY > dModelStartY) Or |
||
3726 | (dStartY > dModelEndY And dStartY < dModelStartY) Then |
||
3727 | '[오차범위 수정] |
||
3728 | '현재선의 X축방향이 기존라인의 Y축방향을 통과하는지 확인 |
||
3729 | If dStartX < dEndX Then |
||
3730 | If dEndX > dModelStartX And dModelStartX > dStartX Then |
||
3731 | If dEndX - dModelStartX > dModelStartX - dStartX Then |
||
3732 | '우측으로 라인이 나와있을때 |
||
3733 | '현재선 중 작은 X좌표를 오차범위만큼 더했을때 기존라인의 X축보다 큰지확인 |
||
3734 | 'X축보다 클경우 작은 X좌표를 기존라인의 X축에 맞추고 더한 길이만큼 큰 X좌표에 더한다. |
||
3735 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3736 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartX - dStartX |
3737 | dEndX = dEndX + dAddPoint |
||
3738 | dStartX = dModelStartX |
||
3739 | sBranchDirection = "START" |
||
3740 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3741 | Exit For |
||
3742 | 3b7a4470 | Gyusu | End If |
3743 | Else |
||
3744 | '좌측으로 라인이 나와있을때 |
||
3745 | '현재선 중 큰 X좌표를 오차범위만큼 뺐을때 기존라인의 X축보다 작은지확인 |
||
3746 | 'X축보다 작을경우 큰 X좌표를 기존라인의 X축에 맞추고 뺀 길이만큼 작은 X좌표에 뺀다. |
||
3747 | 73bfb231 | Gyusu | If Math.Abs(dEndX - dModelStartX) <= dGap Then |
3748 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dEndX - dModelStartX |
3749 | dStartX = dStartX - dAddPoint |
||
3750 | dEndX = dModelStartX |
||
3751 | sBranchDirection = "END" |
||
3752 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3753 | Exit For |
||
3754 | 3b7a4470 | Gyusu | End If |
3755 | End If |
||
3756 | Else |
||
3757 | '현재선의 X축방향이 기존라인의 Y축방향에 못미치는지 확인 |
||
3758 | If dStartX > dModelStartX Then |
||
3759 | '기존라인보다 우측에 현재선이 있을때 |
||
3760 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3761 | 3b7a4470 | Gyusu | '오차범위만큼 작은 x좌표를 뺐을때 기존라인보다 좌측에 있을경우 오차보정 |
3762 | Dim dAddPoint As Double = dStartX - dModelStartX |
||
3763 | dEndX = dEndX - dAddPoint |
||
3764 | dStartX = dModelStartX |
||
3765 | sBranchDirection = "START" |
||
3766 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3767 | Exit For |
||
3768 | 3b7a4470 | Gyusu | End If |
3769 | Else |
||
3770 | '기존라인보다 좌측에 현재선이 있을때 |
||
3771 | 73bfb231 | Gyusu | If Math.Abs(dEndX - dModelStartX) <= dGap Then |
3772 | 3b7a4470 | Gyusu | '오차범위만큼 큰 x좌표를 더했을때 기존라인보다 우측에 있을경우 오차보정 |
3773 | Dim dAddPoint As Double = dModelStartX - dEndX |
||
3774 | dEndX = dModelStartX |
||
3775 | dStartX = dStartX + dAddPoint |
||
3776 | sBranchDirection = "END" |
||
3777 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3778 | Exit For |
||
3779 | 3b7a4470 | Gyusu | End If |
3780 | End If |
||
3781 | End If |
||
3782 | Else |
||
3783 | If dEndX < dModelStartX And dModelStartX < dStartX Then |
||
3784 | If dModelStartX - dEndX < dStartX - dModelStartX Then |
||
3785 | '우측으로 라인이 나와있을때 |
||
3786 | '현재선 중 작은 X좌표를 오차범위만큼 더했을때 기존라인의 X축보다 큰지확인 |
||
3787 | 'X축보다 클경우 작은 X좌표를 기존라인의 X축에 맞추고 더한 길이만큼 큰 X좌에 더한다. |
||
3788 | 73bfb231 | Gyusu | If Math.Abs(dModelStartX - dEndX) <= dGap Then |
3789 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartX - dEndX |
3790 | dStartX = dStartX + dAddPoint |
||
3791 | dEndX = dModelStartX |
||
3792 | sBranchDirection = "END" |
||
3793 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3794 | Exit For |
||
3795 | 3b7a4470 | Gyusu | End If |
3796 | Else |
||
3797 | '좌측으로 라인이 나와있을때 |
||
3798 | '현재선 중 큰 X좌표를 오차범위만큼 뺐을때 기존라인의 X축보다 작은지확인 |
||
3799 | 'X축보다 작을경우 큰 X좌표를 기존라인의 X축에 맞추고 뺀 길이만큼 작은 X좌표에 뺀다. |
||
3800 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3801 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dStartX - dModelStartX |
3802 | dEndX = dEndX - dAddPoint |
||
3803 | dStartX = dModelStartX |
||
3804 | sBranchDirection = "START" |
||
3805 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3806 | Exit For |
||
3807 | 3b7a4470 | Gyusu | End If |
3808 | |||
3809 | End If |
||
3810 | Else |
||
3811 | If dEndX > dModelStartX Then |
||
3812 | '기존라인보다 우측에 현재선이 있을때 |
||
3813 | 73bfb231 | Gyusu | If Math.Abs(dEndX - dModelStartX) <= dGap Then |
3814 | 3b7a4470 | Gyusu | '오차범위만큼 작은 x좌표를 뺐을때 기존라인보다 좌측에 있을경우 오차보정 |
3815 | Dim dAddPoint As Double = dEndX - dModelStartX |
||
3816 | dStartX = dStartX - dAddPoint |
||
3817 | dEndX = dModelStartX |
||
3818 | sBranchDirection = "END" |
||
3819 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3820 | Exit For |
||
3821 | 3b7a4470 | Gyusu | End If |
3822 | Else |
||
3823 | '기존라인보다 좌측에 현재선이 있을때 |
||
3824 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3825 | 3b7a4470 | Gyusu | '오차범위만큼 큰 x좌표를 더했을때 기존라인보다 우측에 있을경우 오차보정 |
3826 | Dim dAddPoint As Double = dModelStartX - dStartX |
||
3827 | dStartX = dModelStartX |
||
3828 | dEndX = dEndX + dAddPoint |
||
3829 | sBranchDirection = "START" |
||
3830 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3831 | Exit For |
||
3832 | 3b7a4470 | Gyusu | End If |
3833 | End If |
||
3834 | End If |
||
3835 | End If |
||
3836 | End If |
||
3837 | End If |
||
3838 | Next |
||
3839 | Catch ex As Exception |
||
3840 | bConnectionFlag = False |
||
3841 | oLMConnector = Nothing |
||
3842 | End Try |
||
3843 | Return sBranchDirection |
||
3844 | |||
3845 | End Function |
||
3846 | |||
3847 | ''' <summary> |
||
3848 | ''' 라인과 특정 포인트에 커넥션을 확인하는 메서드 |
||
3849 | ''' </summary> |
||
3850 | ''' <param name="oModelingLineRows"></param> |
||
3851 | ''' <param name="dX"></param> |
||
3852 | ''' <param name="dY"></param> |
||
3853 | ''' <param name="oLMConnector"></param> |
||
3854 | ''' <param name="dPreConnX"></param> |
||
3855 | ''' <param name="dPreConnY"></param> |
||
3856 | ''' <returns></returns> |
||
3857 | |||
3858 | |||
3859 | b08338e3 | Gyusu | Private Function CheckConnectionLine(ByVal oModelingLineRows() As DataRow, ByVal dX As Double, ByVal dY As Double, |
3860 | 76f465d0 | Gyusu | ByRef oLMConnector As LMConnector, ByRef dPreConnX As Double, ByRef dPreConnY As Double) As Boolean |
3861 | b08338e3 | Gyusu | Dim bConnectionFlag As Boolean = False |
3862 | 76f465d0 | Gyusu | Dim iGapCheck As Integer = 0 |
3863 | b08338e3 | Gyusu | Try |
3864 | For Each oModelrow In oModelingLineRows |
||
3865 | 76f465d0 | Gyusu | Dim d기준x As Double = dX |
3866 | Dim d기준y As Double = dY |
||
3867 | Dim dGap As Double = 0.0002 |
||
3868 | Dim oRun As LMPipeRun = Nothing |
||
3869 | 'Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3870 | 3b7a4470 | Gyusu | 'Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
3871 | b08338e3 | Gyusu | Dim dModelStartX As Double |
3872 | Dim dModelStartY As Double |
||
3873 | Dim dModelEndX As Double |
||
3874 | Dim dModelEndY As Double |
||
3875 | 3b7a4470 | Gyusu | 'ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
3876 | 'ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3877 | 'ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3878 | 76f465d0 | Gyusu | 'ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
3879 | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
3880 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3881 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3882 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3883 | d기준x = (dModelStartX + dModelEndX) / 2 |
||
3884 | d기준y = (dModelStartY + dModelEndY) / 2 |
||
3885 | b08338e3 | Gyusu | Try |
3886 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3887 | 76f465d0 | Gyusu | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
3888 | b08338e3 | Gyusu | Catch ex As Exception |
3889 | End Try |
||
3890 | Try |
||
3891 | 76f465d0 | Gyusu | If oRun IsNot Nothing Then |
3892 | Dim dResultCalc As Double = -1 |
||
3893 | For Each objRep In oRun.Representations |
||
3894 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3895 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3896 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3897 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3898 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3899 | If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3900 | oLMConnector = objConnector |
||
3901 | dPreConnX = dConn_X |
||
3902 | dPreConnY = dConn_Y |
||
3903 | bConnectionFlag = True |
||
3904 | End If |
||
3905 | Next |
||
3906 | End If |
||
3907 | Next |
||
3908 | End If |
||
3909 | b08338e3 | Gyusu | Catch ex As Exception |
3910 | End Try |
||
3911 | Next |
||
3912 | Catch ex As Exception |
||
3913 | 76f465d0 | Gyusu | bConnectionFlag = False |
3914 | oLMConnector = Nothing |
||
3915 | b08338e3 | Gyusu | End Try |
3916 | Return bConnectionFlag |
||
3917 | End Function |
||
3918 | |||
3919 | Private Function CheckLineBranch(ByVal oLine_Dt As DataTable, ByRef dX As Double, ByRef dY As Double, |
||
3920 | ByVal sDirection As String, ByRef oLMConnector As LMConnector) As Boolean |
||
3921 | |||
3922 | Dim oModelingLineRows() As DataRow = oLine_Dt.Select("[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And " & |
||
3923 | "[" & _XML_LINE_SPID & "] <> ''") |
||
3924 | |||
3925 | Dim bConnectionFlag As Boolean = False |
||
3926 | Try |
||
3927 | For Each oModelrow In oModelingLineRows |
||
3928 | Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3929 | Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
3930 | Dim dModelStartX As Double |
||
3931 | Dim dModelStartY As Double |
||
3932 | Dim dModelEndX As Double |
||
3933 | Dim dModelEndY As Double |
||
3934 | ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
3935 | ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3936 | ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3937 | ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
3938 | Dim dGap As Double = 0.0002 |
||
3939 | |||
3940 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
3941 | 'Vertical |
||
3942 | If sDirection = "X" Then |
||
3943 | 'x Direction Line |
||
3944 | If (dModelStartY + dGap >= dY And dModelEndY - dGap <= dY) Or |
||
3945 | (dModelStartY - dGap <= dY And dModelEndY + dGap >= dY) Then |
||
3946 | If (dX > dModelStartX And dX < dModelEndX) Or (dX > dModelEndX And dX < dModelStartX) Then |
||
3947 | If Math.Abs(dX - dModelStartX) > Math.Abs(dX - dModelEndX) Then |
||
3948 | dX = dModelEndX |
||
3949 | Else |
||
3950 | dX = dModelStartX |
||
3951 | End If |
||
3952 | Try |
||
3953 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3954 | Catch ex As Exception |
||
3955 | |||
3956 | End Try |
||
3957 | bConnectionFlag = True |
||
3958 | End If |
||
3959 | End If |
||
3960 | End If |
||
3961 | Else |
||
3962 | 'Horizontal |
||
3963 | If sDirection = "Y" Then |
||
3964 | If (dModelStartX + dGap >= dX And dModelEndX - dGap <= dX) Or |
||
3965 | (dModelStartX - dGap <= dX And dModelEndX + dGap >= dX) Then |
||
3966 | If (dY > dModelStartY And dY < dModelEndY) Or (dY > dModelEndY And dY < dModelStartY) Then |
||
3967 | If Math.Abs(dY - dModelStartY) > Math.Abs(dY - dModelEndY) Then |
||
3968 | dY = dModelEndY |
||
3969 | Else |
||
3970 | dY = dModelStartY |
||
3971 | End If |
||
3972 | Try |
||
3973 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3974 | Catch ex As Exception |
||
3975 | End Try |
||
3976 | bConnectionFlag = True |
||
3977 | End If |
||
3978 | End If |
||
3979 | End If |
||
3980 | End If |
||
3981 | Next |
||
3982 | Catch ex As Exception |
||
3983 | End Try |
||
3984 | Return bConnectionFlag |
||
3985 | End Function |
||
3986 | 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, |
||
3987 | ByVal sLineNoUid As String, ByVal sLineUid As String, ByVal sSystemPath As String, ByRef oLMConnector As LMConnector) As Boolean |
||
3988 | 76f465d0 | Gyusu | 'Try |
3989 | ' Dim oDatasource As Object = _Placement.PIDDataSource |
||
3990 | ' Dim oPipeRun As LMPipeRun = Nothing |
||
3991 | ' Dim objInputs As PlaceRunInputs |
||
3992 | ' objInputs = New PlaceRunInputs |
||
3993 | ' Dim objItem As LMAItem |
||
3994 | ' ' Dim objConnector As LMConnector |
||
3995 | |||
3996 | ' Dim oStartLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sStartLineUid & "' And " & |
||
3997 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
3998 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
3999 | ' If oStartLineRow.Length = 0 Then |
||
4000 | ' oStartLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sStartLineUid & "' And " & |
||
4001 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4002 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4003 | ' End If |
||
4004 | ' Dim oEndLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sEndLineUid & "' And " & |
||
4005 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4006 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4007 | |||
4008 | ' oEndLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sEndLineUid & "' And " & |
||
4009 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4010 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4011 | ' Dim sStartConnectionType As String = "" |
||
4012 | ' Dim sEndConnectionType As String = "" |
||
4013 | |||
4014 | ' Dim oStartLMConnector As LMConnector = Nothing |
||
4015 | ' Dim oEndLMConnector As LMConnector = Nothing |
||
4016 | ' Dim oDirectionLine As String = "" |
||
4017 | |||
4018 | ' If Math.Abs(dStart_x - dEnd_x) > Math.Abs(dStart_y - dEnd_y) Then |
||
4019 | ' oDirectionLine = "X" |
||
4020 | ' Else |
||
4021 | ' oDirectionLine = "Y" |
||
4022 | ' End If |
||
4023 | b08338e3 | Gyusu | |
4024 | 76f465d0 | Gyusu | ' Dim bCheckFlag As Boolean = False |
4025 | b08338e3 | Gyusu | |
4026 | 76f465d0 | Gyusu | ' Dim bStartCheckFlag As Boolean = CheckConnectionLine(oStartLineRow, dStart_x, dStart_y, oStartLMConnector) |
4027 | ' If bStartCheckFlag = False Then |
||
4028 | ' bStartCheckFlag = CheckConnectionLine(oStartLineRow, dEnd_x, dEnd_y, oStartLMConnector) |
||
4029 | ' bCheckFlag = True |
||
4030 | ' End If |
||
4031 | ' Dim bEndCheckFlag As Boolean = CheckConnectionLine(oEndLineRow, dEnd_x, dEnd_y, oEndLMConnector) |
||
4032 | b08338e3 | Gyusu | |
4033 | 76f465d0 | Gyusu | ' If bEndCheckFlag = False Then |
4034 | b08338e3 | Gyusu | |
4035 | 76f465d0 | Gyusu | ' bEndCheckFlag = CheckConnectionLine(oEndLineRow, dStart_x, dStart_y, oEndLMConnector) |
4036 | ' bCheckFlag = True |
||
4037 | ' End If |
||
4038 | b08338e3 | Gyusu | |
4039 | 76f465d0 | Gyusu | ' If bStartCheckFlag = True And bEndCheckFlag = False Then |
4040 | ' If bCheckFlag Then |
||
4041 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
4042 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4043 | ' Else |
||
4044 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
4045 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4046 | ' End If |
||
4047 | |||
4048 | ' ElseIf bStartCheckFlag = False And bEndCheckFlag = True Then |
||
4049 | ' If bCheckFlag Then |
||
4050 | |||
4051 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
4052 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4053 | ' Else |
||
4054 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4055 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
4056 | ' End If |
||
4057 | |||
4058 | ' ElseIf bStartCheckFlag = True And bEndCheckFlag = True Then |
||
4059 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
4060 | ' objInputs.AddConnectorTarget(oEndLMConnector, dEnd_x, dEnd_y) |
||
4061 | ' Else |
||
4062 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4063 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4064 | ' End If |
||
4065 | ' SetListBoxItems(ListBox_Result, "Place Pipe..(" & dStart_x & "," & dStart_y & ") - (" & dEnd_x & "," & dEnd_y & ")..." & _iPipecnt & " count ") |
||
4066 | ' _iPipecnt = _iPipecnt + 1 |
||
4067 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4068 | ' oLMConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4069 | b08338e3 | Gyusu | |
4070 | 76f465d0 | Gyusu | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + sLineUid + "'") |
4071 | ' If oUpdateRow.Length = 1 Then |
||
4072 | ' oUpdateRow(0)(_XML_LINE_SPID) = oLMConnector.ModelItemID |
||
4073 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = oLMConnector |
||
4074 | b08338e3 | Gyusu | |
4075 | 76f465d0 | Gyusu | ' oUpdateRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
4076 | ' End If |
||
4077 | b08338e3 | Gyusu | |
4078 | 76f465d0 | Gyusu | ' oPipeRun = oDatasource.GetPipeRun(oLMConnector.ModelItemID) |
4079 | |||
4080 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4081 | ' If oAttributeRow.Length > 0 Then |
||
4082 | ' For Each oAttribute In oAttributeRow |
||
4083 | ' Try |
||
4084 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4085 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4086 | ' If sPIDValue.Contains("'") Then |
||
4087 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
4088 | ' End If |
||
4089 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4090 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4091 | ' Catch ex As Exception |
||
4092 | ' End Try |
||
4093 | ' Next |
||
4094 | ' oPipeRun.Commit() |
||
4095 | ' End If |
||
4096 | ' Dim sID_1 As String = "" |
||
4097 | ' Dim sID_2 As String = "" |
||
4098 | ' If oStartLMConnector IsNot Nothing Then |
||
4099 | ' sID_1 = oStartLMConnector.ModelItemID |
||
4100 | ' sID_2 = oLMConnector.ModelItemID |
||
4101 | ' ElseIf oEndLMConnector IsNot Nothing Then |
||
4102 | ' sID_1 = oEndLMConnector.ModelItemID |
||
4103 | ' sID_2 = oLMConnector.ModelItemID |
||
4104 | ' End If |
||
4105 | ' If sID_1 <> "" And sID_2 <> "" Then |
||
4106 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
4107 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
4108 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
4109 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
4110 | ' End If |
||
4111 | ' Return True |
||
4112 | 'Catch ex As Exception |
||
4113 | ' Return False |
||
4114 | 'End Try |
||
4115 | b08338e3 | Gyusu | |
4116 | End Function |
||
4117 | |||
4118 | Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
4119 | ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String, |
||
4120 | ByRef oLMConnector As LMConnector) As String |
||
4121 | Dim sReturnUid As String = "" |
||
4122 | Try |
||
4123 | Dim sLineUid As String = "" |
||
4124 | |||
4125 | Dim iConnType As Integer = 0 |
||
4126 | |||
4127 | Dim sStartpoint As String = "" |
||
4128 | Dim sEndpoint As String = "" |
||
4129 | bb2a0c79 | Gyusu | Dim dOriginalStart_x As Double = 0.0 |
4130 | Dim dOriginalStart_y As Double = 0.0 |
||
4131 | Dim dOriginalEnd_x As Double = 0.0 |
||
4132 | Dim dOriginalEnd_y As Double = 0.0 |
||
4133 | |||
4134 | b08338e3 | Gyusu | Dim dStart_x As Double = 0 |
4135 | Dim dStart_y As Double = 0 |
||
4136 | Dim dEnd_x As Double = 0 |
||
4137 | Dim dEnd_y As Double = 0 |
||
4138 | Dim sStartLineUid As String = sConnLineUid |
||
4139 | Dim sEndLineUid As String = "" |
||
4140 | Dim sDirection As String = "" |
||
4141 | Dim sSystemPath As String = GetPipeType(sType) |
||
4142 | |||
4143 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
4144 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4145 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4146 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4147 | If oPipeRow.Length > 0 Then |
||
4148 | bb2a0c79 | Gyusu | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
4149 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4150 | e4000111 | Gyusu | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
4151 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4152 | b08338e3 | Gyusu | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
4153 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4154 | If dStart_x = 0 And dStart_y = 0 Then |
||
4155 | dStart_x = dOriginalStart_x |
||
4156 | dStart_y = dOriginalStart_y |
||
4157 | dEnd_x = dOriginalEnd_x |
||
4158 | dEnd_y = dOriginalEnd_y |
||
4159 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4160 | sDirection = "X" |
||
4161 | Else |
||
4162 | sDirection = "Y" |
||
4163 | End If |
||
4164 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4165 | sLineUid = sConnLineUid |
||
4166 | End If |
||
4167 | End If |
||
4168 | bb2a0c79 | Gyusu | |
4169 | b08338e3 | Gyusu | While True |
4170 | sLineUid = "" |
||
4171 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
4172 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
4173 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4174 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4175 | b08338e3 | Gyusu | |
4176 | If oPipeRow.Length = 0 Then |
||
4177 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
4178 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
4179 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4180 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4181 | bb2a0c79 | Gyusu | Else |
4182 | b08338e3 | Gyusu | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
4183 | 'sConnLineUid = sLineUid |
||
4184 | sLineUid = sConnLineUid |
||
4185 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4186 | iConnType = 1 |
||
4187 | End If |
||
4188 | |||
4189 | If oPipeRow.Length > 0 Then |
||
4190 | If sLineUid = "" Then |
||
4191 | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4192 | 'sConnLineUid = sLineUid |
||
4193 | sLineUid = sConnLineUid |
||
4194 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4195 | iConnType = 2 |
||
4196 | End If |
||
4197 | If iConnType = 1 Then |
||
4198 | |||
4199 | ElseIf iConnType = 2 Then |
||
4200 | |||
4201 | End If |
||
4202 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4203 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4204 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4205 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4206 | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4207 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4208 | |||
4209 | |||
4210 | |||
4211 | If dStart_x = 0 And dStart_y = 0 Then |
||
4212 | dStart_x = dOriginalStart_x |
||
4213 | dStart_y = dOriginalStart_y |
||
4214 | dEnd_x = dOriginalEnd_x |
||
4215 | dEnd_y = dOriginalEnd_y |
||
4216 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4217 | sDirection = "X" |
||
4218 | Else |
||
4219 | sDirection = "Y" |
||
4220 | End If |
||
4221 | sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4222 | sSystemPath = GetPipeType(sType) |
||
4223 | Else |
||
4224 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4225 | If sDirection = "Y" Then |
||
4226 | '방향이 바꼈음 Y - > X |
||
4227 | |||
4228 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4229 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4230 | dStart_x = dOriginalStart_x |
||
4231 | dStart_y = dOriginalStart_y |
||
4232 | dEnd_x = dOriginalEnd_x |
||
4233 | dEnd_y = dOriginalEnd_y |
||
4234 | sStartLineUid = sConnLineUid |
||
4235 | Else |
||
4236 | dEnd_x = dOriginalEnd_x |
||
4237 | dEnd_y = dOriginalEnd_y |
||
4238 | End If |
||
4239 | sDirection = "X" |
||
4240 | Else |
||
4241 | If sDirection = "X" Then |
||
4242 | '방향이 바꼈음 X - > Y |
||
4243 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4244 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4245 | dStart_x = dOriginalStart_x |
||
4246 | dStart_y = dOriginalStart_y |
||
4247 | dEnd_x = dOriginalEnd_x |
||
4248 | dEnd_y = dOriginalEnd_y |
||
4249 | sStartLineUid = sConnLineUid |
||
4250 | Else |
||
4251 | |||
4252 | dEnd_x = dOriginalEnd_x |
||
4253 | dEnd_y = dOriginalEnd_y |
||
4254 | End If |
||
4255 | sDirection = "Y" |
||
4256 | End If |
||
4257 | End If |
||
4258 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4259 | Else |
||
4260 | If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
4261 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4262 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4263 | End If |
||
4264 | sReturnUid = sConnLineUid |
||
4265 | Exit While |
||
4266 | End If |
||
4267 | End While |
||
4268 | |||
4269 | If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
4270 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4271 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4272 | dStart_x = 0 |
||
4273 | dStart_y = 0 |
||
4274 | dEnd_x = 0 |
||
4275 | dEnd_y = 0 |
||
4276 | End If |
||
4277 | Catch ex As Exception |
||
4278 | |||
4279 | End Try |
||
4280 | |||
4281 | Return sReturnUid |
||
4282 | End Function |
||
4283 | |||
4284 | |||
4285 | 'Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
4286 | ' ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String) As String |
||
4287 | ' Dim sReturnUid As String = "" |
||
4288 | ' Try |
||
4289 | ' Dim sLineUid As String = "" |
||
4290 | |||
4291 | ' Dim iConnType As Integer = 0 |
||
4292 | |||
4293 | ' Dim sStartpoint As String = "" |
||
4294 | ' Dim sEndpoint As String = "" |
||
4295 | ' Dim dOriginalStart_x As Double = 0.0 |
||
4296 | ' Dim dOriginalStart_y As Double = 0.0 |
||
4297 | ' Dim dOriginalEnd_x As Double = 0.0 |
||
4298 | ' Dim dOriginalEnd_y As Double = 0.0 |
||
4299 | |||
4300 | ' Dim dStart_x As Double = 0 |
||
4301 | ' Dim dStart_y As Double = 0 |
||
4302 | ' Dim dEnd_x As Double = 0 |
||
4303 | ' Dim dEnd_y As Double = 0 |
||
4304 | ' Dim sStartLineUid As String = sConnLineUid |
||
4305 | ' Dim sEndLineUid As String = "" |
||
4306 | ' Dim sDirection As String = "" |
||
4307 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
4308 | |||
4309 | ' Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
4310 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4311 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4312 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4313 | ' If oPipeRow.Length > 0 Then |
||
4314 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4315 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4316 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4317 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4318 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4319 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4320 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
4321 | ' dStart_x = dOriginalStart_x |
||
4322 | ' dStart_y = dOriginalStart_y |
||
4323 | ' dEnd_x = dOriginalEnd_x |
||
4324 | ' dEnd_y = dOriginalEnd_y |
||
4325 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4326 | ' sDirection = "X" |
||
4327 | ' Else |
||
4328 | ' sDirection = "Y" |
||
4329 | ' End If |
||
4330 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4331 | ' sLineUid = sConnLineUid |
||
4332 | ' End If |
||
4333 | ' End If |
||
4334 | |||
4335 | ' While True |
||
4336 | ' sLineUid = "" |
||
4337 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
4338 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4339 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4340 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4341 | |||
4342 | ' If oPipeRow.Length = 0 Then |
||
4343 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
4344 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4345 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4346 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4347 | ' Else |
||
4348 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4349 | ' 'sConnLineUid = sLineUid |
||
4350 | ' sLineUid = sConnLineUid |
||
4351 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4352 | ' iConnType = 1 |
||
4353 | ' End If |
||
4354 | |||
4355 | ' If oPipeRow.Length > 0 Then |
||
4356 | ' If sLineUid = "" Then |
||
4357 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4358 | ' 'sConnLineUid = sLineUid |
||
4359 | ' sLineUid = sConnLineUid |
||
4360 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4361 | ' iConnType = 2 |
||
4362 | ' End If |
||
4363 | ' If iConnType = 1 Then |
||
4364 | |||
4365 | ' ElseIf iConnType = 2 Then |
||
4366 | |||
4367 | ' End If |
||
4368 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4369 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4370 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4371 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4372 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4373 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4374 | |||
4375 | |||
4376 | |||
4377 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
4378 | ' dStart_x = dOriginalStart_x |
||
4379 | ' dStart_y = dOriginalStart_y |
||
4380 | ' dEnd_x = dOriginalEnd_x |
||
4381 | ' dEnd_y = dOriginalEnd_y |
||
4382 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4383 | ' sDirection = "X" |
||
4384 | ' Else |
||
4385 | ' sDirection = "Y" |
||
4386 | ' End If |
||
4387 | ' sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4388 | ' sSystemPath = GetPipeType(sType) |
||
4389 | ' Else |
||
4390 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4391 | ' If sDirection = "Y" Then |
||
4392 | ' '방향이 바꼈음 Y - > X |
||
4393 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4394 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4395 | ' dStart_x = dOriginalStart_x |
||
4396 | ' dStart_y = dOriginalStart_y |
||
4397 | ' dEnd_x = dOriginalEnd_x |
||
4398 | ' dEnd_y = dOriginalEnd_y |
||
4399 | ' sStartLineUid = sConnLineUid |
||
4400 | ' Else |
||
4401 | ' dEnd_x = dOriginalEnd_x |
||
4402 | ' dEnd_y = dOriginalEnd_y |
||
4403 | ' End If |
||
4404 | ' sDirection = "X" |
||
4405 | ' Else |
||
4406 | ' If sDirection = "X" Then |
||
4407 | ' '방향이 바꼈음 X - > Y |
||
4408 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4409 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4410 | ' dStart_x = dOriginalStart_x |
||
4411 | ' dStart_y = dOriginalStart_y |
||
4412 | ' dEnd_x = dOriginalEnd_x |
||
4413 | ' dEnd_y = dOriginalEnd_y |
||
4414 | ' sStartLineUid = sConnLineUid |
||
4415 | ' Else |
||
4416 | |||
4417 | ' dEnd_x = dOriginalEnd_x |
||
4418 | ' dEnd_y = dOriginalEnd_y |
||
4419 | ' End If |
||
4420 | ' sDirection = "Y" |
||
4421 | ' End If |
||
4422 | ' End If |
||
4423 | ' ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4424 | ' Else |
||
4425 | ' If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
4426 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4427 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4428 | ' End If |
||
4429 | |||
4430 | |||
4431 | ' sReturnUid = sConnLineUid |
||
4432 | ' Exit While |
||
4433 | ' End If |
||
4434 | ' End While |
||
4435 | |||
4436 | ' If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
4437 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4438 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4439 | ' dStart_x = 0 |
||
4440 | ' dStart_y = 0 |
||
4441 | ' dEnd_x = 0 |
||
4442 | ' dEnd_y = 0 |
||
4443 | ' End If |
||
4444 | ' Catch ex As Exception |
||
4445 | |||
4446 | ' End Try |
||
4447 | |||
4448 | ' Return sReturnUid |
||
4449 | 'End Function |
||
4450 | |||
4451 | |||
4452 | Private Function SymbolToLine_Modeling(ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
4453 | ByVal sSymbolUid As String, ByVal oLMSymbol As LMSymbol) As String |
||
4454 | |||
4455 | |||
4456 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4457 | Dim oPipeRun As LMPipeRun = Nothing |
||
4458 | Dim objItem As LMAItem |
||
4459 | Dim objConnector As LMConnector |
||
4460 | Dim objInputs As PlaceRunInputs |
||
4461 | objInputs = New PlaceRunInputs |
||
4462 | |||
4463 | |||
4464 | Dim sPipeUid As String = "" |
||
4465 | Dim iConnType As Integer = 0 |
||
4466 | Dim sStartpoint As String = "" |
||
4467 | Dim sEndpoint As String = "" |
||
4468 | Dim dOriginalStart_x As Double = 0.0 |
||
4469 | Dim dOriginalStart_y As Double = 0.0 |
||
4470 | Dim dOriginalEnd_x As Double = 0.0 |
||
4471 | Dim dOriginalEnd_y As Double = 0.0 |
||
4472 | Dim dStart_x As Double = 0.0 |
||
4473 | Dim dStart_y As Double = 0.0 |
||
4474 | Dim dEnd_x As Double = 0.0 |
||
4475 | Dim dEnd_y As Double = 0.0 |
||
4476 | |||
4477 | Dim sReturnUid As String = "" |
||
4478 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sSymbolUid + "' And " & |
||
4479 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4480 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4481 | If oPipeRow.Length = 0 Then |
||
4482 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sSymbolUid + "' And " & |
||
4483 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4484 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4485 | Else |
||
4486 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4487 | iConnType = 1 |
||
4488 | End If |
||
4489 | |||
4490 | If oPipeRow.Length = 1 Then |
||
4491 | If sPipeUid = "" Then |
||
4492 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4493 | iConnType = 2 |
||
4494 | End If |
||
4495 | sReturnUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4496 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4497 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4498 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4499 | dStart_x = dOriginalStart_x |
||
4500 | dStart_y = dOriginalStart_y |
||
4501 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4502 | dEnd_x = dOriginalEnd_x |
||
4503 | dEnd_y = dOriginalEnd_y |
||
4504 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4505 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4506 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4507 | If iConnType = 1 Then |
||
4508 | FindNearPoint(oLMSymbol, dStart_x, dStart_y) |
||
4509 | objInputs.AddSymbolTarget(oLMSymbol, dStart_x, dStart_y) |
||
4510 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4511 | Else |
||
4512 | FindNearPoint(oLMSymbol, dEnd_x, dEnd_y) |
||
4513 | objInputs.AddSymbolTarget(oLMSymbol, dEnd_x, dEnd_y) |
||
4514 | objInputs.AddPoint(dStart_x, dStart_y) |
||
4515 | End If |
||
4516 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4517 | |||
4518 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4519 | Dim sSystemPath As String = GetPipeType(sType) |
||
4520 | |||
4521 | |||
4522 | |||
4523 | |||
4524 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4525 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4526 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
4527 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4528 | If oAttributeRow.Length > 0 Then |
||
4529 | For Each oAttribute In oAttributeRow |
||
4530 | Try |
||
4531 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4532 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4533 | If sPIDValue.Contains("'") Then |
||
4534 | sPIDValue = sPIDValue.Replace("'", """") |
||
4535 | End If |
||
4536 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4537 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4538 | Catch ex As Exception |
||
4539 | End Try |
||
4540 | Next |
||
4541 | oPipeRun.Commit() |
||
4542 | End If |
||
4543 | End If |
||
4544 | Return sReturnUid |
||
4545 | End Function |
||
4546 | |||
4547 | Private Function LineToSymbol_Modeling(ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
4548 | ByVal sLineUid As String, ByVal oLMConnector As LMConnector, ByRef oLMSymbol As LMSymbol) As String |
||
4549 | |||
4550 | |||
4551 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4552 | Dim objItem As LMAItem |
||
4553 | Dim objConnector As LMConnector |
||
4554 | Dim objInputs As PlaceRunInputs |
||
4555 | objInputs = New PlaceRunInputs |
||
4556 | |||
4557 | |||
4558 | Dim sSymbolUid As String = "" |
||
4559 | Dim iConnType As Integer = 0 |
||
4560 | Dim dOriginalPoint_x As Double = 0.0 |
||
4561 | Dim dORiginalPoint_y As Double = 0.0 |
||
4562 | Dim dX As Double = 0.0 |
||
4563 | Dim dY As Double = 0.0 |
||
4564 | Dim sReturnUid As String = "" |
||
4565 | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn1_Uid & " = '" + sLineUid + "' And " & |
||
4566 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4567 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4568 | If oSymbolRow.Length = 0 Then |
||
4569 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4570 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4571 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4572 | If oSymbolRow.Length = 0 Then |
||
4573 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4574 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4575 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4576 | If oSymbolRow.Length = 0 Then |
||
4577 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4578 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4579 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4580 | If oSymbolRow.Length = 0 Then |
||
4581 | |||
4582 | Else |
||
4583 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4584 | iConnType = 4 |
||
4585 | End If |
||
4586 | Else |
||
4587 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4588 | iConnType = 3 |
||
4589 | End If |
||
4590 | Else |
||
4591 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4592 | iConnType = 2 |
||
4593 | End If |
||
4594 | |||
4595 | Else |
||
4596 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4597 | iConnType = 1 |
||
4598 | End If |
||
4599 | |||
4600 | If oSymbolRow.Length = 1 Then |
||
4601 | If sSymbolUid = "" Then |
||
4602 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4603 | iConnType = 2 |
||
4604 | End If |
||
4605 | sReturnUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4606 | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
4607 | ConvertPointBystring(sOriginalPoint, dOriginalPoint_x, dORiginalPoint_y) |
||
4608 | dX = dOriginalPoint_x |
||
4609 | dY = dORiginalPoint_y |
||
4610 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
4611 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4612 | |||
4613 | oSymbolRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4614 | |||
4615 | Dim sType As String = oSymbolRow(0)(_XML_LINE_TYPE).ToString() |
||
4616 | Dim sSystemPath As String = GetPipeType(sType) |
||
4617 | |||
4618 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, ExistingItem:=oLMConnector.AsLMAItem, |
||
4619 | TargetItem:=oLMSymbol.AsLMAItem) |
||
4620 | |||
4621 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4622 | If oAttributeRow.Length > 0 Then |
||
4623 | For Each oAttribute In oAttributeRow |
||
4624 | Try |
||
4625 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4626 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4627 | If sPIDValue.Contains("'") Then |
||
4628 | sPIDValue = sPIDValue.Replace("'", """") |
||
4629 | End If |
||
4630 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4631 | oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4632 | Catch ex As Exception |
||
4633 | End Try |
||
4634 | Next |
||
4635 | End If |
||
4636 | End If |
||
4637 | Return sReturnUid |
||
4638 | End Function |
||
4639 | |||
4640 | |||
4641 | Private Sub OPCTOLineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oOPCSymbol As LMSymbol, |
||
4642 | ByVal sOPCUid As String, ByVal sLineNoUid As String) |
||
4643 | Try |
||
4644 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4645 | Dim objItem As LMAItem |
||
4646 | Dim objConnector As LMConnector |
||
4647 | Dim objInputs As PlaceRunInputs |
||
4648 | objInputs = New PlaceRunInputs |
||
4649 | Dim dOriginalStart_x As Double = 0.0 |
||
4650 | Dim dOriginalStart_y As Double = 0.0 |
||
4651 | Dim dOriginalEnd_x As Double = 0.0 |
||
4652 | Dim dOriginalEnd_y As Double = 0.0 |
||
4653 | Dim dStart_x As Double = 0.0 |
||
4654 | Dim dStart_y As Double = 0.0 |
||
4655 | Dim dEnd_x As Double = 0.0 |
||
4656 | Dim dEnd_y As Double = 0.0 |
||
4657 | |||
4658 | Dim oPipeRun As LMPipeRun = Nothing |
||
4659 | Dim sStartpoint As String = "" |
||
4660 | Dim sEndpoint As String = "" |
||
4661 | Dim iConnType As Integer = 0 |
||
4662 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sOPCUid + "' And [" & |
||
4663 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4664 | Dim sPipeUid As String = "" |
||
4665 | If oPipeRow.Length = 0 Then |
||
4666 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sOPCUid + "' And [" & |
||
4667 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4668 | Else |
||
4669 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4670 | iConnType = 1 |
||
4671 | End If |
||
4672 | Dim oAddUid_List As New List(Of String) |
||
4673 | If oPipeRow.Length = 1 Then |
||
4674 | If sPipeUid = "" Then |
||
4675 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4676 | iConnType = 2 |
||
4677 | End If |
||
4678 | oAddUid_List.Add(sPipeUid) |
||
4679 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4680 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4681 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4682 | dStart_x = dOriginalStart_x |
||
4683 | dStart_y = dOriginalStart_y |
||
4684 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4685 | dEnd_x = dOriginalEnd_x |
||
4686 | dEnd_y = dOriginalEnd_y |
||
4687 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4688 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4689 | |||
4690 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4691 | If iConnType = 1 Then |
||
4692 | FindNearPoint(oOPCSymbol, dStart_x, dStart_y) |
||
4693 | objInputs.AddSymbolTarget(oOPCSymbol, dStart_x, dStart_y) |
||
4694 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4695 | Else |
||
4696 | FindNearPoint(oOPCSymbol, dEnd_x, dEnd_y) |
||
4697 | objInputs.AddSymbolTarget(oOPCSymbol, dEnd_x, dEnd_y) |
||
4698 | bb2a0c79 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
4699 | End If |
||
4700 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4701 | |||
4702 | While True |
||
4703 | ' objInputs.Clear() |
||
4704 | Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
4705 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4706 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4707 | If oAddPipeRow.Length = 0 Then |
||
4708 | oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
4709 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4710 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4711 | sPipeUid = "" |
||
4712 | Else |
||
4713 | iConnType = 1 |
||
4714 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4715 | End If |
||
4716 | If oAddPipeRow.Length = 1 Then |
||
4717 | If sPipeUid = "" Then |
||
4718 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4719 | iConnType = 2 |
||
4720 | End If |
||
4721 | oAddUid_List.Add(sPipeUid) |
||
4722 | sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4723 | sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4724 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4725 | dStart_x = dOriginalStart_x |
||
4726 | dStart_y = dOriginalStart_y |
||
4727 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4728 | dEnd_x = dOriginalEnd_x |
||
4729 | dEnd_y = dOriginalEnd_y |
||
4730 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4731 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4732 | If iConnType = 1 Then |
||
4733 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4734 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4735 | Else |
||
4736 | 'objInputs.AddConnectorTarget(objConnector, dStart_x, dStart_y) |
||
4737 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4738 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4739 | objInputs.AddPoint(dStart_x, dStart_y) |
||
4740 | End If |
||
4741 | e4000111 | Gyusu | |
4742 | bb2a0c79 | Gyusu | oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
4743 | Else |
||
4744 | Exit While |
||
4745 | End If |
||
4746 | e4000111 | Gyusu | |
4747 | bb2a0c79 | Gyusu | End While |
4748 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4749 | Dim sSystemPath As String = GetPipeType(sType) |
||
4750 | e4000111 | Gyusu | |
4751 | bb2a0c79 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
4752 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4753 | For i = 0 To oAddUid_List.Count - 1 |
||
4754 | Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
4755 | If oUpdateRow.Length = 1 Then |
||
4756 | oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
4757 | oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
4758 | End If |
||
4759 | Next |
||
4760 | |||
4761 | |||
4762 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
4763 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4764 | If oAttributeRow.Length > 0 Then |
||
4765 | For Each oAttribute In oAttributeRow |
||
4766 | Try |
||
4767 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4768 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4769 | If sPIDValue.Contains("'") Then |
||
4770 | sPIDValue = sPIDValue.Replace("'", """") |
||
4771 | End If |
||
4772 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4773 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4774 | Catch ex As Exception |
||
4775 | End Try |
||
4776 | Next |
||
4777 | oPipeRun.Commit() |
||
4778 | End If |
||
4779 | |||
4780 | End If |
||
4781 | |||
4782 | Catch ex As Exception |
||
4783 | End Try |
||
4784 | End Sub |
||
4785 | |||
4786 | Private Function AddUidList중복체크(ByVal sUidList As List(Of String), ByVal sAddUid As String) As Boolean |
||
4787 | e4000111 | Gyusu | |
4788 | bb2a0c79 | Gyusu | For Each sUid In sUidList |
4789 | If sUid = sAddUid Then |
||
4790 | Return False |
||
4791 | End If |
||
4792 | Next |
||
4793 | Return True |
||
4794 | End Function |
||
4795 | |||
4796 | b08338e3 | Gyusu | Private Sub LineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, ByVal sLineNoText As String) |
4797 | bb2a0c79 | Gyusu | Try |
4798 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4799 | Dim objItem As LMAItem |
||
4800 | Dim objConnector As LMConnector |
||
4801 | Dim objInputs As PlaceRunInputs |
||
4802 | objInputs = New PlaceRunInputs |
||
4803 | Dim dOriginalStart_x As Double = 0.0 |
||
4804 | Dim dOriginalStart_y As Double = 0.0 |
||
4805 | Dim dOriginalEnd_x As Double = 0.0 |
||
4806 | Dim dOriginalEnd_y As Double = 0.0 |
||
4807 | Dim dStart_x As Double = 0.0 |
||
4808 | Dim dStart_y As Double = 0.0 |
||
4809 | Dim dEnd_x As Double = 0.0 |
||
4810 | Dim dEnd_y As Double = 0.0 |
||
4811 | Dim oPipeRun As LMPipeRun = Nothing |
||
4812 | Dim sStartpoint As String = "" |
||
4813 | Dim sEndpoint As String = "" |
||
4814 | Dim iConnType As Integer = 0 |
||
4815 | Dim pLMConnector As LMConnector = Nothing |
||
4816 | For Each oLinerow In oLine_Dt.Rows |
||
4817 | objInputs.Clear() |
||
4818 | b08338e3 | Gyusu | Dim sCheck As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
4819 | If sCheck = "FALSE" Then |
||
4820 | Dim sUid As String = oLinerow(_XML_LINE_UID).ToString() |
||
4821 | sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
4822 | sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
4823 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4824 | dStart_x = dOriginalStart_x |
||
4825 | dStart_y = dOriginalStart_y |
||
4826 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4827 | dEnd_x = dOriginalEnd_x |
||
4828 | dEnd_y = dOriginalEnd_y |
||
4829 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4830 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4831 | bb2a0c79 | Gyusu | |
4832 | b08338e3 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
4833 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4834 | bb2a0c79 | Gyusu | Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
4835 | Dim sSystemPath As String = GetPipeType(sType) |
||
4836 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4837 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4838 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ")..." & _iPipecnt & " count ") |
4839 | |||
4840 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
4841 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
4842 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oLinerow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
4843 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oLinerow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
4844 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
4845 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dOriginalStart_x & "," & dOriginalStart_y) |
||
4846 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dOriginalEnd_x & "," & dOriginalEnd_y) |
||
4847 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
4848 | |||
4849 | _iPipecnt = _iPipecnt + 1 |
||
4850 | oLinerow(_XML_LINE_SPID) = objConnector.ModelItemID |
||
4851 | oLinerow(_XML_LINE_LMCONNECTOR) = objConnector |
||
4852 | |||
4853 | oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4854 | bb2a0c79 | Gyusu | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
4855 | |||
4856 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4857 | If oAttributeRow.Length > 0 Then |
||
4858 | For Each oAttribute In oAttributeRow |
||
4859 | Try |
||
4860 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4861 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4862 | If sPIDValue.Contains("'") Then |
||
4863 | sPIDValue = sPIDValue.Replace("'", """") |
||
4864 | End If |
||
4865 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4866 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4867 | Catch ex As Exception |
||
4868 | End Try |
||
4869 | Next |
||
4870 | oPipeRun.Commit() |
||
4871 | End If |
||
4872 | End If |
||
4873 | |||
4874 | |||
4875 | |||
4876 | |||
4877 | |||
4878 | b08338e3 | Gyusu | 'Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
4879 | 'Dim sCheckModeling As Boolean = False |
||
4880 | 'objInputs.Clear() |
||
4881 | 'Dim oAddUid_List As New List(Of String) |
||
4882 | 'Try |
||
4883 | ' Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
4884 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4885 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4886 | ' If oAddPipeRow.Length = 0 Then |
||
4887 | ' oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
4888 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
4889 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4890 | ' sPipeUid = "" |
||
4891 | ' Else |
||
4892 | ' iConnType = 1 |
||
4893 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4894 | ' End If |
||
4895 | ' If oAddPipeRow.Length = 1 Then |
||
4896 | ' sCheckModeling = True |
||
4897 | ' If sPipeUid = "" Then |
||
4898 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
4899 | ' iConnType = 2 |
||
4900 | ' End If |
||
4901 | ' If AddUidList중복체크(oAddUid_List, sPipeUid) Then |
||
4902 | ' oAddUid_List.Add(sPipeUid) |
||
4903 | ' End If |
||
4904 | ' sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4905 | ' sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4906 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4907 | ' dStart_x = dOriginalStart_x |
||
4908 | ' dStart_y = dOriginalStart_y |
||
4909 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4910 | ' dEnd_x = dOriginalEnd_x |
||
4911 | ' dEnd_y = dOriginalEnd_y |
||
4912 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4913 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4914 | ' Dim sBranchType As String = "" |
||
4915 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
4916 | ' Try |
||
4917 | ' If pLMConnector Is Nothing Then |
||
4918 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4919 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4920 | ' Else |
||
4921 | ' If sBranchType = "1" Then |
||
4922 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4923 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4924 | ' ElseIf sBranchType = "2" Then |
||
4925 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4926 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4927 | ' ElseIf sBranchType = "3" Then |
||
4928 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4929 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4930 | ' ElseIf sBranchType = "4" Then |
||
4931 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4932 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4933 | ' End If |
||
4934 | ' End If |
||
4935 | ' Catch ex As Exception |
||
4936 | ' End Try |
||
4937 | ' Else |
||
4938 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4939 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4940 | ' End If |
||
4941 | ' oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4942 | ' Else |
||
4943 | ' Dim CheckTF As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
||
4944 | ' Dim CheckSelect As String = oLinerow(_XML_LINE_Check).ToString() |
||
4945 | ' If CheckTF = "FALSE" And CheckSelect = "TRUE" Then |
||
4946 | ' sPipeUid = oLinerow(_XML_LINE_UID).ToString() |
||
4947 | ' oAddUid_List.Clear() |
||
4948 | ' oAddUid_List.Add(sPipeUid) |
||
4949 | ' sCheckModeling = True |
||
4950 | ' sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
4951 | ' sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
4952 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4953 | ' dStart_x = dOriginalStart_x |
||
4954 | ' dStart_y = dOriginalStart_y |
||
4955 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4956 | ' dEnd_x = dOriginalEnd_x |
||
4957 | ' dEnd_y = dOriginalEnd_y |
||
4958 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4959 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4960 | ' Dim sBranchType As String = "" |
||
4961 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
4962 | ' Try |
||
4963 | ' If sBranchType = "1" Then |
||
4964 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4965 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4966 | ' ElseIf sBranchType = "2" Then |
||
4967 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4968 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4969 | ' ElseIf sBranchType = "3" Then |
||
4970 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4971 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
4972 | ' ElseIf sBranchType = "4" Then |
||
4973 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4974 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
4975 | ' End If |
||
4976 | ' Catch ex As Exception |
||
4977 | |||
4978 | ' End Try |
||
4979 | ' Else |
||
4980 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4981 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4982 | ' End If |
||
4983 | ' oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4984 | ' End If |
||
4985 | ' End If |
||
4986 | 'Catch ex As Exception |
||
4987 | 'End Try |
||
4988 | 'If sCheckModeling Then |
||
4989 | ' Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
||
4990 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
4991 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4992 | ' objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4993 | ' For i = 0 To oAddUid_List.Count - 1 |
||
4994 | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
4995 | ' If oUpdateRow.Length = 1 Then |
||
4996 | ' oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
4997 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
4998 | ' End If |
||
4999 | ' Next |
||
5000 | |||
5001 | ' oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
5002 | ' oAddUid_List.Clear() |
||
5003 | |||
5004 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
5005 | ' If oAttributeRow.Length > 0 Then |
||
5006 | ' For Each oAttribute In oAttributeRow |
||
5007 | ' Try |
||
5008 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5009 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5010 | ' If sPIDValue.Contains("'") Then |
||
5011 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
5012 | ' End If |
||
5013 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5014 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5015 | ' Catch ex As Exception |
||
5016 | ' End Try |
||
5017 | ' Next |
||
5018 | ' oPipeRun.Commit() |
||
5019 | ' End If |
||
5020 | |||
5021 | ' If pLMConnector IsNot Nothing Then |
||
5022 | ' Dim sID_1 As String = pLMConnector.ModelItemID |
||
5023 | ' Dim sID_2 As String = objConnector.ModelItemID |
||
5024 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
5025 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
5026 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
5027 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
5028 | ' ' oDatasource.CommitTransaction() |
||
5029 | ' '_Placement.PIDAutoJoin(oPipeRun1.AsLMAItem, AutoJoinEndConstants.autoJoin_End, objSurvivorItem) |
||
5030 | ' 'oPipeRun1.Commit() |
||
5031 | ' 'oDatasource.CommitTransaction() |
||
5032 | ' 'objSurvivorItem = Nothing |
||
5033 | ' '_Placement.PIDAutoJoin(oPipeRun2.AsLMAItem, AutoJoinEndConstants.autoJoin_Start, objSurvivorItem) |
||
5034 | ' 'oPipeRun2.Commit() |
||
5035 | ' 'oDatasource.CommitTransaction() |
||
5036 | ' End If |
||
5037 | ' sCheckModeling = False |
||
5038 | ' End If |
||
5039 | Next |
||
5040 | bb2a0c79 | Gyusu | Catch ex As Exception |
5041 | End Try |
||
5042 | End Sub |
||
5043 | e4000111 | Gyusu | |
5044 | b08338e3 | Gyusu | |
5045 | Private Sub SymbolModeling(ByVal CDrawing As Drawing, ByVal oLine_DT As DataTable, ByVal oSymbolRow As DataRow, ByVal oAttribute_Dt As DataTable, |
||
5046 | ByVal sLineNoText As String) |
||
5047 | bb2a0c79 | Gyusu | Try |
5048 | b08338e3 | Gyusu | |
5049 | Dim sCheckModeling As String = oSymbolRow(_XML_SYMBOL_DRAWING_TF).ToString() |
||
5050 | If sCheckModeling = "FALSE" Then |
||
5051 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5052 | Dim oSymbol As LMSymbol = Nothing |
||
5053 | Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
5054 | Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
5055 | bb2a0c79 | Gyusu | Dim oDatasource As Object = _Placement.PIDDataSource |
5056 | Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
5057 | Dim dLocationX As Double = 0.0 |
||
5058 | Dim dLocationY As Double = 0.0 |
||
5059 | Dim dX As Double = 0.0 |
||
5060 | Dim dY As Double = 0.0 |
||
5061 | b08338e3 | Gyusu | Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
5062 | ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5063 | dX = dLocationX |
||
5064 | dY = dLocationY |
||
5065 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
5066 | |||
5067 | Dim dAngle As Double = oSymbolRow(_XML_SYMBOL_ANGLE) |
||
5068 | |||
5069 | |||
5070 | 'Dim oDatarow() As DataRow = oLine_DT.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sSymbolUid & "'") |
||
5071 | 'If oDatarow.Length = 0 Then |
||
5072 | ' oDatarow = oLine_DT.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sSymbolUid & "'") |
||
5073 | 'End If |
||
5074 | 'Dim dFix_X As Double = 0.0 |
||
5075 | 'Dim dFix_Y As Double = 0.0 |
||
5076 | 'If oDatarow.Length > 0 Then |
||
5077 | ' If dAngle <> 0 Then |
||
5078 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
5079 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5080 | |||
5081 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
5082 | ' dX = dLocationX |
||
5083 | ' Else |
||
5084 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
5085 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5086 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
5087 | ' dY = dLocationY |
||
5088 | ' End If |
||
5089 | |||
5090 | 'End If |
||
5091 | |||
5092 | |||
5093 | |||
5094 | oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY,, dAngle) |
||
5095 | SetListBoxItems(ListBox_Result, "Place Fitting.." & sSymbolUid & " (" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
5096 | |||
5097 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Fitting : " & sSymbolUid) |
||
5098 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
5099 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
5100 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
5101 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection3 : " & oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()) |
||
5102 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection4 : " & oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()) |
||
5103 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
5104 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
5105 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Fitting Count : " & _iFittingcnt) |
||
5106 | |||
5107 | |||
5108 | _iFittingcnt = _iFittingcnt + 1 |
||
5109 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
5110 | Dim oAttributeRow() As DataRow |
||
5111 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
5112 | If oAttribute_Dt.Rows.Count > 0 Then |
||
5113 | |||
5114 | bb2a0c79 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
5115 | b08338e3 | Gyusu | Dim oInstrument As LMInstrument |
5116 | oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
5117 | bb2a0c79 | Gyusu | Try |
5118 | If oAttributeRow.Length > 0 Then |
||
5119 | For Each oAttribute In oAttributeRow |
||
5120 | Try |
||
5121 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5122 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5123 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5124 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5125 | Catch ex As Exception |
||
5126 | End Try |
||
5127 | Next |
||
5128 | oInstrument.Commit() |
||
5129 | End If |
||
5130 | Catch ex As Exception |
||
5131 | End Try |
||
5132 | Else |
||
5133 | b08338e3 | Gyusu | Try |
5134 | If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
5135 | For Each oAttribute In oAttributeRow |
||
5136 | Try |
||
5137 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5138 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5139 | e4000111 | Gyusu | |
5140 | b08338e3 | Gyusu | If sPIDAttribute = "SIZE" Then |
5141 | |||
5142 | 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
5143 | If sPIDValue.Contains("x") Then |
||
5144 | Dim sSplitSize() As String = sPIDValue.Split("x") |
||
5145 | If sSplitSize.Count > 1 Then |
||
5146 | 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
5147 | Dim oConnector_1 As LMConnector = Nothing |
||
5148 | Dim oConnector_2 As LMConnector = Nothing |
||
5149 | If oSymbol IsNot Nothing Then |
||
5150 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5151 | For Each Tconnector In oSymbol.Connect1Connectors |
||
5152 | If Tconnector.ItemStatus = "Active" Then |
||
5153 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5154 | oConnector_1 = Tconnector |
||
5155 | End If |
||
5156 | End If |
||
5157 | Next |
||
5158 | End If |
||
5159 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5160 | For Each Tconnector In oSymbol.Connect1Connectors |
||
5161 | If Tconnector.ItemStatus = "Active" Then |
||
5162 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5163 | oConnector_2 = Tconnector |
||
5164 | End If |
||
5165 | End If |
||
5166 | Next |
||
5167 | End If |
||
5168 | End If |
||
5169 | Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
5170 | Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
5171 | If dAngle = 3.14 Then |
||
5172 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5173 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5174 | Else |
||
5175 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5176 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5177 | End If |
||
5178 | e4000111 | Gyusu | |
5179 | |||
5180 | b08338e3 | Gyusu | End If |
5181 | e4000111 | Gyusu | |
5182 | b08338e3 | Gyusu | Else |
5183 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5184 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5185 | End If |
||
5186 | Else |
||
5187 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5188 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5189 | End If |
||
5190 | e4000111 | Gyusu | |
5191 | b08338e3 | Gyusu | Catch ex As Exception |
5192 | End Try |
||
5193 | Next |
||
5194 | oSymbol.Commit() |
||
5195 | End If |
||
5196 | Catch ex As Exception |
||
5197 | End Try |
||
5198 | End If |
||
5199 | End If |
||
5200 | e4000111 | Gyusu | |
5201 | |||
5202 | |||
5203 | b08338e3 | Gyusu | End If |
5204 | e4000111 | Gyusu | |
5205 | |||
5206 | |||
5207 | b08338e3 | Gyusu | 'Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
5208 | 'Dim sConnTypeNo As String = "" |
||
5209 | '' Line과 연결되어있는 Symbol인지 확인 |
||
5210 | 'Dim oLine_Dt As DataTable = GetPipeFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
5211 | ''Symbol과 연결되어 있는 Symbol인지 확인 |
||
5212 | 'Dim oSymbol_Dt As DataTable = GetSymbolFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
5213 | 'Dim oSymbol As LMSymbol = Nothing |
||
5214 | 'Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
5215 | 'Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
5216 | 'Dim oDatasource As Object = _Placement.PIDDataSource |
||
5217 | 'Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
5218 | e4000111 | Gyusu | |
5219 | b08338e3 | Gyusu | 'Dim dAngle As Double = 0.0 |
5220 | 'If IsNumeric(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) Then |
||
5221 | ' dAngle = Double.Parse(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) |
||
5222 | 'End If |
||
5223 | e4000111 | Gyusu | |
5224 | b08338e3 | Gyusu | 'Dim dLocationX As Double = 0.0 |
5225 | 'Dim dLocationY As Double = 0.0 |
||
5226 | 'Dim dX As Double = 0.0 |
||
5227 | 'Dim dY As Double = 0.0 |
||
5228 | 'Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
5229 | 'ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5230 | 'dX = dLocationX |
||
5231 | 'dY = dLocationY |
||
5232 | 'ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
5233 | 'Dim bCheckModeling As Boolean = False |
||
5234 | |||
5235 | 'If oLine_Dt.Rows.Count > 0 Then |
||
5236 | |||
5237 | ' If sSPID <> "" Then |
||
5238 | ' Dim dX1 As Double = 0 |
||
5239 | ' Dim dX2 As Double = 0 |
||
5240 | ' Dim dY1 As Double = 0 |
||
5241 | ' Dim dY2 As Double = 0 |
||
5242 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
5243 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
5244 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
5245 | |||
5246 | ' Dim dCalcPoint As Double = -1 |
||
5247 | ' Dim dModeling_X As Double = 0 |
||
5248 | ' Dim dModeling_Y As Double = 0 |
||
5249 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
5250 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
5251 | ' dModeling_X = dX1 |
||
5252 | ' dModeling_Y = dY1 |
||
5253 | ' End If |
||
5254 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
5255 | e4000111 | Gyusu | |
5256 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
5257 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
5258 | ' dModeling_X = dX2 |
||
5259 | ' dModeling_Y = dY2 |
||
5260 | ' End If |
||
5261 | ' End If |
||
5262 | e4000111 | Gyusu | |
5263 | |||
5264 | |||
5265 | b08338e3 | Gyusu | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
5266 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
5267 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
5268 | ' bCheckModeling = True |
||
5269 | ' End If |
||
5270 | e4000111 | Gyusu | |
5271 | |||
5272 | b08338e3 | Gyusu | ' End If |
5273 | 'End If |
||
5274 | 'If oSymbol_Dt.Rows.Count > 0 Then |
||
5275 | ' If sSPID <> "" Then |
||
5276 | ' Dim dX1 As Double = 0 |
||
5277 | ' Dim dX2 As Double = 0 |
||
5278 | ' Dim dX3 As Double = 0 |
||
5279 | ' Dim dX4 As Double = 0 |
||
5280 | ' Dim dY1 As Double = 0 |
||
5281 | ' Dim dY2 As Double = 0 |
||
5282 | ' Dim dY3 As Double = 0 |
||
5283 | ' Dim dY4 As Double = 0 |
||
5284 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
5285 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
5286 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
5287 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 3, dX3, dY3) |
||
5288 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 4, dX4, dY4) |
||
5289 | |||
5290 | ' Dim dCalcPoint As Double = -1 |
||
5291 | ' Dim dModeling_X As Double = 0 |
||
5292 | ' Dim dModeling_Y As Double = 0 |
||
5293 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
5294 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
5295 | ' dModeling_X = dX1 |
||
5296 | ' dModeling_Y = dY1 |
||
5297 | ' End If |
||
5298 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
5299 | 41e4023e | Gyusu | |
5300 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
5301 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
5302 | ' dModeling_X = dX2 |
||
5303 | ' dModeling_Y = dY2 |
||
5304 | ' End If |
||
5305 | ' End If |
||
5306 | ' If dX3 <> 0 And dY3 <> 0 Then |
||
5307 | ' If (Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) > dCalcPoint) Then |
||
5308 | ' dCalcPoint = Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) |
||
5309 | ' dModeling_X = dX3 |
||
5310 | ' dModeling_Y = dY3 |
||
5311 | ' End If |
||
5312 | ' End If |
||
5313 | ' If dX4 <> 0 And dY4 <> 0 Then |
||
5314 | ' If (Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) > dCalcPoint) Then |
||
5315 | ' dCalcPoint = Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) |
||
5316 | ' dModeling_X = dX4 |
||
5317 | ' dModeling_Y = dY4 |
||
5318 | ' End If |
||
5319 | ' End If |
||
5320 | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
||
5321 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
5322 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
5323 | ' bCheckModeling = True |
||
5324 | ' End If |
||
5325 | 41e4023e | Gyusu | |
5326 | e4000111 | Gyusu | |
5327 | b08338e3 | Gyusu | ' End If |
5328 | e4000111 | Gyusu | |
5329 | b08338e3 | Gyusu | 'End If |
5330 | e4000111 | Gyusu | |
5331 | b08338e3 | Gyusu | 'If (oLine_Dt.Rows.Count = 0 And oSymbol_Dt.Rows.Count = 0) Or bCheckModeling = False Then |
5332 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
5333 | ' SetListBoxItems(ListBox_Result, "Place Fittings..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
5334 | ' _iFittingcnt = _iFittingcnt + 1 |
||
5335 | 'End If |
||
5336 | 'Dim oAttributeRow() As DataRow |
||
5337 | 'oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
5338 | 'If oAttribute_Dt.Rows.Count > 0 Then |
||
5339 | |||
5340 | ' If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
||
5341 | ' Dim oInstrument As LMInstrument |
||
5342 | ' oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
5343 | ' Try |
||
5344 | ' If oAttributeRow.Length > 0 Then |
||
5345 | ' For Each oAttribute In oAttributeRow |
||
5346 | ' Try |
||
5347 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5348 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5349 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5350 | ' oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5351 | ' Catch ex As Exception |
||
5352 | ' End Try |
||
5353 | ' Next |
||
5354 | ' oInstrument.Commit() |
||
5355 | ' End If |
||
5356 | ' Catch ex As Exception |
||
5357 | ' End Try |
||
5358 | ' Else |
||
5359 | ' Try |
||
5360 | ' If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
5361 | ' For Each oAttribute In oAttributeRow |
||
5362 | ' Try |
||
5363 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5364 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5365 | |||
5366 | ' If sPIDAttribute = "SIZE" Then |
||
5367 | |||
5368 | ' 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
5369 | ' If sPIDValue.Contains("x") Then |
||
5370 | ' Dim sSplitSize() As String = sPIDValue.Split("x") |
||
5371 | ' If sSplitSize.Count > 1 Then |
||
5372 | ' 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
5373 | ' Dim oConnector_1 As LMConnector = Nothing |
||
5374 | ' Dim oConnector_2 As LMConnector = Nothing |
||
5375 | ' If oSymbol IsNot Nothing Then |
||
5376 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5377 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
5378 | ' If Tconnector.ItemStatus = "Active" Then |
||
5379 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5380 | ' oConnector_1 = Tconnector |
||
5381 | ' End If |
||
5382 | ' End If |
||
5383 | ' Next |
||
5384 | ' End If |
||
5385 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5386 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
5387 | ' If Tconnector.ItemStatus = "Active" Then |
||
5388 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5389 | ' oConnector_2 = Tconnector |
||
5390 | ' End If |
||
5391 | ' End If |
||
5392 | ' Next |
||
5393 | ' End If |
||
5394 | ' End If |
||
5395 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
5396 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
5397 | ' If dAngle = 3.14 Then |
||
5398 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5399 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5400 | ' Else |
||
5401 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5402 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5403 | ' End If |
||
5404 | |||
5405 | |||
5406 | ' End If |
||
5407 | |||
5408 | ' Else |
||
5409 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5410 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5411 | ' End If |
||
5412 | ' Else |
||
5413 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5414 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5415 | ' End If |
||
5416 | |||
5417 | ' Catch ex As Exception |
||
5418 | ' End Try |
||
5419 | ' Next |
||
5420 | ' oSymbol.Commit() |
||
5421 | ' End If |
||
5422 | ' Catch ex As Exception |
||
5423 | ' End Try |
||
5424 | ' End If |
||
5425 | 'End If |
||
5426 | Catch ex As Exception |
||
5427 | End Try |
||
5428 | End Sub |
||
5429 | e4000111 | Gyusu | |
5430 | |||
5431 | |||
5432 | Private Function AutoModeling() As Boolean |
||
5433 | Try |
||
5434 | 76f465d0 | Gyusu | _AllLine_DT = Line_Dt() |
5435 | _AllSymbol_DT = Symbol_Dt() |
||
5436 | |||
5437 | e4000111 | Gyusu | _CompleteConvert = False |
5438 | Label_Progress.Text = "0%" |
||
5439 | SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
||
5440 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 시작....") |
5441 | e4000111 | Gyusu | Dim oDwg_Dt As DataTable = LoadAllDrawing() |
5442 | b08338e3 | Gyusu | _Log_File = "AutoConverting_" + DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("HHmmss") |
5443 | e4000111 | Gyusu | _allItem = GetAllCheckNodeCount() |
5444 | 76f465d0 | Gyusu | _Itemcnt = 0 |
5445 | e4000111 | Gyusu | '1.Equipment |
5446 | '2.Piping OPC |
||
5447 | '3.OPC 시작되는 Line |
||
5448 | bb2a0c79 | Gyusu | InitAutoRouting() |
5449 | e4000111 | Gyusu | EquipmentModeling(oDwg_Dt) |
5450 | bb2a0c79 | Gyusu | PipingModeling() |
5451 | |||
5452 | ' PipeLine_Fitting_Modeling() |
||
5453 | e4000111 | Gyusu | |
5454 | 171ac39d | Gyusu | SetProgressbar(ProgressBar_Status, 100) |
5455 | 41e4023e | Gyusu | Label_Progress.Text = "100%" |
5456 | 171ac39d | Gyusu | SetListBoxItems(ListBox_Result, " Auto converting 완료") |
5457 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 완료") |
5458 | 54b98e09 | Gyusu | _CompleteConvert = True |
5459 | 171ac39d | Gyusu | Return True |
5460 | Catch ex As Exception |
||
5461 | Return False |
||
5462 | End Try |
||
5463 | End Function |
||
5464 | |||
5465 | |||
5466 | |||
5467 | 54b98e09 | Gyusu | Private Sub ThreadConvert() |
5468 | 559daf6d | Gyusu | If _DrawingsList IsNot Nothing Then |
5469 | If _DrawingsList.Count > 0 Then |
||
5470 | AutoModeling() |
||
5471 | End If |
||
5472 | 171ac39d | Gyusu | End If |
5473 | e282643f | Gyusu | End Sub |
5474 | |||
5475 | 54b98e09 | Gyusu | Private Sub ThreadOPCRemove() |
5476 | While _CompleteConvert = False |
||
5477 | Dim oFindOPC As New FindOpc |
||
5478 | oFindOPC.RemoveOPCDlg() |
||
5479 | End While |
||
5480 | e282643f | Gyusu | |
5481 | 54b98e09 | Gyusu | End Sub |
5482 | 171ac39d | Gyusu | |
5483 | e282643f | Gyusu | |
5484 | Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
||
5485 | Dim oRows As DataRow() = oDt.Select("[Name] = '" & sDwgName & "'") |
||
5486 | Dim oPath As String = "" |
||
5487 | If oRows.Length > 0 Then |
||
5488 | oPath = oRows(0).Item("Path").ToString() |
||
5489 | End If |
||
5490 | Return oPath |
||
5491 | End Function |
||
5492 | |||
5493 | 272662f9 | Gyusu | Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
5494 | 3b7a4470 | Gyusu | |
5495 | 171ac39d | Gyusu | If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
5496 | 54b98e09 | Gyusu | LoadDB() |
5497 | 171ac39d | Gyusu | LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
5498 | End If |
||
5499 | End Sub |
||
5500 | Private Sub LoadXmlItem(ByVal sFolderPath As String) |
||
5501 | _DrawingsList = New List(Of Drawing) |
||
5502 | Dim sfileEntries As String() = Directory.GetFiles(sFolderPath) |
||
5503 | If Tree_Result.Nodes.Count > 0 Then |
||
5504 | Tree_Result.Nodes(0).Nodes.Clear() |
||
5505 | For Each sfileName In sfileEntries |
||
5506 | Dim sExtension As String = Path.GetExtension(sfileName) |
||
5507 | If sExtension = ".xml" Then |
||
5508 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(sfileName) |
||
5509 | Dim sDwgPath As String = sfileName |
||
5510 | Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
||
5511 | Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
||
5512 | bb2a0c79 | Gyusu | |
5513 | 171ac39d | Gyusu | _DrawingsList.Add(oDwg) |
5514 | End If |
||
5515 | Next |
||
5516 | Tree_Result.Nodes(0).Expand() |
||
5517 | End If |
||
5518 | End Sub |
||
5519 | 272662f9 | Gyusu | |
5520 | e4000111 | Gyusu | Private Sub GenerateRelation(ByRef oDwg_Ds As Drawing) |
5521 | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
||
5522 | Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
||
5523 | Dim oTrimLineLists As List(Of Line_no) = oDwg_Ds.TrimLine_nos |
||
5524 | Dim oRelation As New GenerateRelation() |
||
5525 | For Each oLinelist In oLineLists |
||
5526 | bb2a0c79 | Gyusu | oRelation.CalcLineConnectionItem_Equal(oLinelist.Dt_Line, oLineLists) |
5527 | oRelation.CalcLineConnectionItem_NonEqual(oLinelist.Dt_Line, oLineLists) |
||
5528 | oRelation.CalcSymbolConnectionItem_Equal(oLinelist.Dt_Symbol, oLineLists) |
||
5529 | oRelation.CalcSymbolConnectionItem_NonEqual(oLinelist.Dt_Symbol, oLineLists) |
||
5530 | e4000111 | Gyusu | Next |
5531 | End Sub |
||
5532 | |||
5533 | |||
5534 | 20c84e05 | Gyusu | ''' <summary> |
5535 | ''' XML Tree 구조 생성 |
||
5536 | ''' </summary> |
||
5537 | ''' <param name="sDwgPath"></param> |
||
5538 | 171ac39d | Gyusu | Private Function AddSymbolItem(ByVal sDwgPath As String, ByVal oParentNode As TreeNode) As Drawing |
5539 | Dim oDwg_Ds As Drawing = LoadSymbolInXml(sDwgPath) |
||
5540 | e4000111 | Gyusu | |
5541 | 76f465d0 | Gyusu | 'SetConnectionInfo() |
5542 | b08338e3 | Gyusu | ' GenerateRelation(oDwg_Ds) |
5543 | e4000111 | Gyusu | |
5544 | 54b98e09 | Gyusu | If oDwg_Ds IsNot Nothing Then |
5545 | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
||
5546 | |||
5547 | Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
||
5548 | 3acffcee | Gyusu | |
5549 | Dim oTrimLineLists As List(Of Line_no) = oDwg_Ds.TrimLine_nos |
||
5550 | |||
5551 | 54b98e09 | Gyusu | Dim oPipe As Boolean = False |
5552 | Dim oFitting As Boolean = False |
||
5553 | 'PipeLine 구분 |
||
5554 | |||
5555 | For Each oLinelist In oLineLists |
||
5556 | Dim sLineNoUid As String = oLinelist.Uid |
||
5557 | Dim sLineNo As String = oLinelist.Text |
||
5558 | Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
||
5559 | For Each oLineRow In oLinelist.Dt_Line.Rows |
||
5560 | Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
||
5561 | Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
||
5562 | oPipeNode.Tag = sLineNoUid |
||
5563 | Next |
||
5564 | For Each oSymbolRow In oLinelist.Dt_Symbol.Rows |
||
5565 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5566 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
5567 | Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
5568 | oSymbolNode.Tag = sLineNoUid |
||
5569 | Next |
||
5570 | Next |
||
5571 | 3acffcee | Gyusu | |
5572 | 54b98e09 | Gyusu | For Each oEqplist In oEqpLists |
5573 | Dim sEqpUid As String = oEqplist.Uid |
||
5574 | Dim sEqpNo As String = "EQUIPMENT" |
||
5575 | Dim oEqpNode As TreeNode = oParentNode.Nodes.Add(sEqpUid, sEqpNo) |
||
5576 | d039e347 | Gyusu | |
5577 | 54b98e09 | Gyusu | |
5578 | For Each oSymbolRow In oEqplist.Dt_Equipment.Rows |
||
5579 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5580 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
5581 | Dim oSymbolNode As TreeNode = oEqpNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
5582 | oSymbolNode.Tag = sEqpUid |
||
5583 | Next |
||
5584 | 171ac39d | Gyusu | Next |
5585 | 3acffcee | Gyusu | Dim sTrimLine As String = "TrimLineNos" |
5586 | Dim iTrimLinecnt As Integer = 1 |
||
5587 | For Each oTrimLinelist In oTrimLineLists |
||
5588 | Dim sLineNoUid As String = oTrimLinelist.Uid |
||
5589 | Dim sLineNo As String = sTrimLine & "_" & iTrimLinecnt |
||
5590 | Dim oLineNoNode As TreeNode = oParentNode.Nodes.Add(sLineNoUid, sLineNo) |
||
5591 | For Each oLineRow In oTrimLinelist.Dt_Line.Rows |
||
5592 | Dim sLineUid As String = oLineRow(_XML_LINE_UID) |
||
5593 | Dim oPipeNode As TreeNode = oLineNoNode.Nodes.Add(sLineUid, "Pipe") |
||
5594 | oPipeNode.Tag = sLineNoUid |
||
5595 | Next |
||
5596 | For Each oSymbolRow In oTrimLinelist.Dt_Symbol.Rows |
||
5597 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5598 | Dim sSymbolName As String = oSymbolRow(_XML_SYMBOL_NAME) |
||
5599 | Dim oSymbolNode As TreeNode = oLineNoNode.Nodes.Add(sSymbolUid, sSymbolName) |
||
5600 | oSymbolNode.Tag = sLineNoUid |
||
5601 | Next |
||
5602 | iTrimLinecnt = iTrimLinecnt + 1 |
||
5603 | Next |
||
5604 | |||
5605 | 54b98e09 | Gyusu | End If |
5606 | |||
5607 | 171ac39d | Gyusu | Return oDwg_Ds |
5608 | End Function |
||
5609 | 272662f9 | Gyusu | Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
5610 | If e.Node.Checked = True Then |
||
5611 | For Each oNode As TreeNode In e.Node.Nodes |
||
5612 | oNode.Checked = True |
||
5613 | Next |
||
5614 | Else |
||
5615 | For Each oNode As TreeNode In e.Node.Nodes |
||
5616 | oNode.Checked = False |
||
5617 | Next |
||
5618 | End If |
||
5619 | End Sub |
||
5620 | 171ac39d | Gyusu | |
5621 | 559daf6d | Gyusu | Private Sub Btn_Setting_Click(sender As Object, e As EventArgs) Handles Btn_Setting.Click |
5622 | Dim oSettings As Settings = New Settings() |
||
5623 | oSettings.ShowDialog() |
||
5624 | End Sub |
||
5625 | 42c0013c | Gyusu | |
5626 | Private Sub Btn_TestNozzle_Click(sender As Object, e As EventArgs) Handles Btn_TestNozzle.Click |
||
5627 | |||
5628 | Dim sVessel_ID As String = "841D5E640AE5421B9A017DDC2E87FF11" |
||
5629 | Dim objVessel As LMVessel |
||
5630 | objVessel = _Placement.PIDDataSource.GetVessel(sVessel_ID) |
||
5631 | Dim oVesselLocation As LMLocations = objVessel.Locations |
||
5632 | Dim symVessel As LMSymbol = _Placement.PIDDataSource.GetSymbol(objVessel.Representations.Nth(1).Id) |
||
5633 | Dim XCoordinate As String = symVessel.Attributes("XCoordinate").Value |
||
5634 | Dim YCoordinate As String = symVessel.Attributes("YCoordinate").Value |
||
5635 | symVessel.Attributes("XCoordinate").Value = XCoordinate + 0.01 |
||
5636 | symVessel.Attributes("YCoordinate").Value = YCoordinate + 0.01 |
||
5637 | symVessel.Commit() |
||
5638 | Dim sValve_ID As String = "DB7B0CA8A2664A6BA7A9615764BA62B0" |
||
5639 | Dim objValve As LMSymbol |
||
5640 | Dim objValves As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(sValve_ID) |
||
5641 | |||
5642 | objValve = _Placement.PIDDataSource.GetSymbol(objValves.Representations.Nth(1).Id) |
||
5643 | objValve.Commit() |
||
5644 | Dim dVesselX As Double = XCoordinate |
||
5645 | Dim dVesselY As Double = YCoordinate |
||
5646 | Dim X1 As Double, Y1 As Double, X2 As Double, Y2 As Double |
||
5647 | |||
5648 | _Placement.PIDConnectPointLocation(objValve, 1, X1, Y1) |
||
5649 | |||
5650 | _Placement.PIDConnectPointLocation(objValve, 2, X2, Y2) |
||
5651 | |||
5652 | Dim nozzlename As String = "\Equipment Components\Nozzles\Flanged Nozzle.sym" |
||
5653 | Dim dCalc_x As Double = 0 |
||
5654 | Dim dCalc_y As Double = 0 |
||
5655 | |||
5656 | If dVesselX - X2 > 0 Then |
||
5657 | dCalc_x = dVesselX - (dVesselX - X2) |
||
5658 | Else |
||
5659 | dCalc_x = dVesselX + (X2 - dVesselX) |
||
5660 | End If |
||
5661 | If dVesselY - Y2 > 0 Then |
||
5662 | dCalc_y = dVesselY - (dVesselY - Y2) |
||
5663 | Else |
||
5664 | dCalc_y = dVesselY + (Y2 - dVesselY) |
||
5665 | End If |
||
5666 | |||
5667 | Dim objNozzle As LMSymbol = _Placement.PIDPlaceSymbol(nozzlename, dCalc_x, dCalc_y, |
||
5668 | TargetItem:=symVessel.AsLMRepresentation) |
||
5669 | |||
5670 | Dim blnSuccess As Boolean = _Placement.PIDConnectPointLocation(objNozzle, 1, X1, Y1) |
||
5671 | blnSuccess = _Placement.PIDConnectPointLocation(objNozzle, 2, X1, Y1) |
||
5672 | |||
5673 | objValve = _Placement.PIDPlaceSymbol(objValve.FileName, X1, Y1, ExistingItem:=objValve.AsLMAItem, |
||
5674 | TargetItem:=objNozzle.AsLMRepresentation) |
||
5675 | |||
5676 | |||
5677 | |||
5678 | End Sub |
||
5679 | 39d43554 | Gyusu | |
5680 | Private Sub Btn_SymbolLibrary_Click(sender As Object, e As EventArgs) Handles Btn_SymbolLibrary.Click |
||
5681 | Dim oMapping As New Mapping(_PIDSymbol_DB) |
||
5682 | oMapping.Show() |
||
5683 | End Sub |
||
5684 | 41e4023e | Gyusu | |
5685 | Private Sub Btn_Stop_Click(sender As Object, e As EventArgs) Handles Btn_Stop.Click |
||
5686 | Try |
||
5687 | SetListBoxItems(ListBox_Result, " Auto converting 중지....") |
||
5688 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 중지....") |
5689 | 41e4023e | Gyusu | _Main_trd.Abort() |
5690 | _Opc_trd.Abort() |
||
5691 | Catch ex As Exception |
||
5692 | |||
5693 | End Try |
||
5694 | End Sub |
||
5695 | b08338e3 | Gyusu | |
5696 | Private Sub AutoCheckTreeNode(ByVal iType As Integer, ByVal bCheck As Boolean) |
||
5697 | |||
5698 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
5699 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
5700 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
5701 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
5702 | If CDrawing IsNot Nothing Then |
||
5703 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
5704 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
5705 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
5706 | Dim iItemcnt As Integer = 0 |
||
5707 | Dim sNodeUid As String = oNode.Name |
||
5708 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
5709 | |||
5710 | If iType = 0 Then 'Symbol |
||
5711 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
5712 | If CLineNo IsNot Nothing Then |
||
5713 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
5714 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
5715 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
5716 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
5717 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
5718 | If sSymbolNodeUid = sSymbolUid Then |
||
5719 | oSymbolNode.Checked = bCheck |
||
5720 | Exit For |
||
5721 | End If |
||
5722 | Next |
||
5723 | Next |
||
5724 | End If |
||
5725 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
5726 | If TrimLineNo IsNot Nothing Then |
||
5727 | Dim oSymbol_Dt As DataTable = TrimLineNo.Dt_Symbol |
||
5728 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
5729 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
5730 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
5731 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
5732 | If sSymbolNodeUid = sSymbolUid Then |
||
5733 | oSymbolNode.Checked = bCheck |
||
5734 | Exit For |
||
5735 | End If |
||
5736 | Next |
||
5737 | Next |
||
5738 | End If |
||
5739 | End If |
||
5740 | If iType = 1 Then 'Line |
||
5741 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
5742 | If CLineNo IsNot Nothing Then |
||
5743 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
5744 | For Each oLineRow In oLine_Dt.Rows |
||
5745 | Dim sLineUid As String = oLineRow(_XML_LINE_UID).ToString() |
||
5746 | For Each oLineNode As TreeNode In oNode.Nodes |
||
5747 | Dim sLineNodeUid As String = oLineNode.Name |
||
5748 | If sLineNodeUid = sLineUid Then |
||
5749 | oLineNode.Checked = bCheck |
||
5750 | Exit For |
||
5751 | End If |
||
5752 | Next |
||
5753 | Next |
||
5754 | End If |
||
5755 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
5756 | If TrimLineNo IsNot Nothing Then |
||
5757 | Dim oLine_Dt As DataTable = TrimLineNo.Dt_Line |
||
5758 | For Each oLineRow In oLine_Dt.Rows |
||
5759 | Dim sLineUid As String = oLineRow(_XML_SYMBOL_UID).ToString() |
||
5760 | For Each oLineNode As TreeNode In oNode.Nodes |
||
5761 | Dim sLineNodeUid As String = oLineNode.Name |
||
5762 | If sLineNodeUid = sLineUid Then |
||
5763 | oLineNode.Checked = bCheck |
||
5764 | Exit For |
||
5765 | End If |
||
5766 | Next |
||
5767 | Next |
||
5768 | End If |
||
5769 | End If |
||
5770 | If iType = 2 Then 'Equipment |
||
5771 | Dim CEqpNo As Eqp_no = GetEqpNo(CDrawing, sNodeUid) |
||
5772 | If CEqpNo IsNot Nothing Then |
||
5773 | Dim oEqp_Dt As DataTable = CEqpNo.Dt_Equipment |
||
5774 | For Each oEqpRow In oEqp_Dt.Rows |
||
5775 | Dim sEqpUid As String = oEqpRow(_XML_LINE_UID).ToString() |
||
5776 | For Each oEqpNode As TreeNode In oNode.Nodes |
||
5777 | Dim sEqpNodeUid As String = oEqpNode.Name |
||
5778 | If sEqpNodeUid = sEqpUid Then |
||
5779 | oEqpNode.Checked = bCheck |
||
5780 | Exit For |
||
5781 | End If |
||
5782 | Next |
||
5783 | Next |
||
5784 | End If |
||
5785 | End If |
||
5786 | Next |
||
5787 | End If |
||
5788 | Next |
||
5789 | Next |
||
5790 | |||
5791 | |||
5792 | End Sub |
||
5793 | |||
5794 | |||
5795 | |||
5796 | Private Sub Chk_Symbol_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Symbol.CheckedChanged |
||
5797 | AutoCheckTreeNode(0, Chk_Symbol.Checked) |
||
5798 | End Sub |
||
5799 | |||
5800 | Private Sub Chk_Line_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Line.CheckedChanged |
||
5801 | AutoCheckTreeNode(1, Chk_Line.Checked) |
||
5802 | End Sub |
||
5803 | |||
5804 | Private Sub Chk_Equipment_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Equipment.CheckedChanged |
||
5805 | AutoCheckTreeNode(2, Chk_Equipment.Checked) |
||
5806 | End Sub |
||
5807 | e282643f | Gyusu | End Class |
5808 | |||
5809 | |||
5810 | Public Class DrawingInfo |
||
5811 | Public mDrawingName As String |
||
5812 | Public mSpID As String |
||
5813 | Public mPath As String |
||
5814 | 4f359afa | Gyusu | End Class |
5815 | e282643f | Gyusu | |
5816 | |||
5817 | |||
5818 |