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