hytos / DTI_PID / SPPIDConverter / Main.vb @ c8203784
이력 | 보기 | 이력해설 | 다운로드 (324 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 | 171ac39d | Gyusu | Dim _IMG_X = 0 |
26 | Dim _IMG_Y = 0 |
||
27 | 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 | 9e1e7135 | Gyusu | Private 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 | 9e1e7135 | Gyusu | Private 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 | |||
2863 | Private Sub FindNearPoint(ByVal oOPCSymbol As LMSymbol, ByRef dNear_x As Double, ByRef dNear_y As Double) |
||
2864 | Dim oConnectionPoints_x(4) As Double |
||
2865 | Dim oConnectionPoints_y(4) As Double |
||
2866 | |||
2867 | Try |
||
2868 | _Placement.PIDConnectPointLocation(oOPCSymbol, 1, oConnectionPoints_x(0), oConnectionPoints_y(0)) |
||
2869 | _Placement.PIDConnectPointLocation(oOPCSymbol, 2, oConnectionPoints_x(1), oConnectionPoints_y(1)) |
||
2870 | _Placement.PIDConnectPointLocation(oOPCSymbol, 3, oConnectionPoints_x(2), oConnectionPoints_y(2)) |
||
2871 | _Placement.PIDConnectPointLocation(oOPCSymbol, 4, oConnectionPoints_x(3), oConnectionPoints_y(3)) |
||
2872 | Dim iNearPoint As Integer = 0 |
||
2873 | Dim dGap As Double = 0 |
||
2874 | For i = 0 To 3 |
||
2875 | If dGap = 0 Then |
||
2876 | iNearPoint = i |
||
2877 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
2878 | Else |
||
2879 | If dGap >= Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) Then |
||
2880 | iNearPoint = i |
||
2881 | dGap = Math.Abs(oConnectionPoints_x(i) - dNear_x) + Math.Abs(oConnectionPoints_y(i) - dNear_y) |
||
2882 | End If |
||
2883 | End If |
||
2884 | Next |
||
2885 | dNear_x = oConnectionPoints_x(iNearPoint) |
||
2886 | dNear_y = oConnectionPoints_y(iNearPoint) |
||
2887 | Catch ex As Exception |
||
2888 | e4000111 | Gyusu | |
2889 | bb2a0c79 | Gyusu | End Try |
2890 | e4000111 | Gyusu | |
2891 | bb2a0c79 | Gyusu | End Sub |
2892 | |||
2893 | 9c86a823 | Gyusu | Private Function GetPipeColor(ByVal sType As String) As Color |
2894 | If sType.ToUpper() = "ELECTRIC" Then |
||
2895 | Return Color.DarkOrange |
||
2896 | ElseIf sType.ToUpper() = "CONNECT TO PROCESS" Then |
||
2897 | b82166d4 | Gyusu | Return Color.Green |
2898 | 9c86a823 | Gyusu | ElseIf sType.ToUpper() = "SOFTWARE" Then |
2899 | Return Color.Blue |
||
2900 | ElseIf sType.ToUpper() = "PNEUMATIC" Then |
||
2901 | Return Color.Gray |
||
2902 | Else |
||
2903 | Return Color.Black |
||
2904 | End If |
||
2905 | End Function |
||
2906 | |||
2907 | bb2a0c79 | Gyusu | Private Function GetPipeType(ByVal sType As String) As String |
2908 | Dim sSystempath As String = "\Piping\Routing\Process Lines\Primary Piping.sym" ' oPipeRow(0)(_XML_LINE_SYSTEMPATH).ToString() |
||
2909 | If sType.ToUpper() = "ELECTRIC" Then |
||
2910 | sSystempath = "\Instrumentation\Signal Line\Electric.sym" |
||
2911 | ElseIf sType.ToUpper() = "CONNECT TO PROCESS" Then |
||
2912 | sSystempath = "\Instrumentation\Signal Line\Connect to Process.sym" |
||
2913 | 9c86a823 | Gyusu | ElseIf sType.ToUpper() = "SOFTWARE" Then |
2914 | sSystempath = "\Instrumentation\Signal Line\Software Link.sym" |
||
2915 | ElseIf sType.ToUpper() = "PNEUMATIC" Then |
||
2916 | sSystempath = "\Instrumentation\Signal Line\Pneumatic.sym" |
||
2917 | bb2a0c79 | Gyusu | Else |
2918 | End If |
||
2919 | Return sSystempath |
||
2920 | End Function |
||
2921 | |||
2922 | Private Sub InitAutoRouting() |
||
2923 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
2924 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
2925 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
2926 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
2927 | If CDrawing IsNot Nothing Then |
||
2928 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
2929 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
2930 | SetListBoxItems(ListBox_Result, "Place " & CDrawing.DwgName & "....") |
||
2931 | b08338e3 | Gyusu | |
2932 | bb2a0c79 | Gyusu | For Each oNode As TreeNode In oDwgNode.Nodes |
2933 | Dim iItemcnt As Integer = 0 |
||
2934 | Dim sNodeUid As String = oNode.Name |
||
2935 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
2936 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
2937 | If CLineNo IsNot Nothing Then |
||
2938 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
2939 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
2940 | |||
2941 | For Each oLineRow In oLine_Dt.Rows |
||
2942 | 76f465d0 | Gyusu | ' oLineRow(_XML_LINE_UID) = "" |
2943 | oLineRow(_XML_LINE_SPID) = "" |
||
2944 | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
||
2945 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
2946 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
2947 | oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
||
2948 | 76f5e1a8 | Gyusu | oLineRow(_XML_LINE_Check) = "FALSE" |
2949 | 76f465d0 | Gyusu | Next |
2950 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
2951 | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
||
2952 | oSymbolRow(_XML_SYMBOL_SPID) = "" |
||
2953 | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
||
2954 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
2955 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
2956 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
2957 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
2958 | 76f5e1a8 | Gyusu | oSymbolRow(_XML_SYMBOL_Check) = "FALSE" |
2959 | 76f465d0 | Gyusu | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
2960 | |||
2961 | Next |
||
2962 | |||
2963 | End If |
||
2964 | |||
2965 | Dim CTRIMLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
2966 | If CTRIMLineNo IsNot Nothing Then |
||
2967 | Dim oLine_Dt As DataTable = CTRIMLineNo.Dt_Line |
||
2968 | Dim oSymbol_Dt As DataTable = CTRIMLineNo.Dt_Symbol |
||
2969 | |||
2970 | For Each oLineRow In oLine_Dt.Rows |
||
2971 | ' oLineRow(_XML_LINE_UID) = "" |
||
2972 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_SPID) = "" |
2973 | 76f465d0 | Gyusu | oLineRow(_XML_LINE_LMCONNECTOR) = Nothing |
2974 | oLineRow(_XML_LINE_LMCONNECTOR_1) = Nothing |
||
2975 | oLineRow(_XML_LINE_LMCONNECTOR_2) = Nothing |
||
2976 | bb2a0c79 | Gyusu | oLineRow(_XML_LINE_DRAWING_TF) = "FALSE" |
2977 | 76f5e1a8 | Gyusu | oLineRow(_XML_LINE_Check) = "FALSE" |
2978 | bb2a0c79 | Gyusu | Next |
2979 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
2980 | 76f465d0 | Gyusu | ' oSymbolRow(_XML_SYMBOL_UID) = "" |
2981 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_SPID) = "" |
2982 | 76f465d0 | Gyusu | oSymbolRow(_XML_SYMBOL_LMSYMBOL) = Nothing |
2983 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_1) = Nothing |
||
2984 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_2) = Nothing |
||
2985 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_3) = Nothing |
||
2986 | oSymbolRow(_XML_SYMBOL_LMCONNECTOR_4) = Nothing |
||
2987 | 76f5e1a8 | Gyusu | oSymbolRow(_XML_SYMBOL_Check) = "FALSE" |
2988 | bb2a0c79 | Gyusu | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "FALSE" |
2989 | 76f465d0 | Gyusu | |
2990 | bb2a0c79 | Gyusu | Next |
2991 | |||
2992 | End If |
||
2993 | Next |
||
2994 | End If |
||
2995 | Next |
||
2996 | Next |
||
2997 | End Sub |
||
2998 | |||
2999 | |||
3000 | |||
3001 | |||
3002 | |||
3003 | |||
3004 | 79326880 | Gyusu | Private Function CheckBranchLine(ByVal dStartX As Double, ByVal dStartY As Double, |
3005 | bb2a0c79 | Gyusu | ByRef dEndX As Double, ByRef dEndY As Double, ByRef sBranchType As String, ByRef oLMConnector As LMConnector) As Boolean |
3006 | |||
3007 | Try |
||
3008 | 79326880 | Gyusu | |
3009 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
3010 | 'Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
3011 | 'Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
3012 | bb2a0c79 | Gyusu | Dim dModelStartX As Double |
3013 | Dim dModelStartY As Double |
||
3014 | Dim dModelEndX As Double |
||
3015 | Dim dModelEndY As Double |
||
3016 | 79326880 | Gyusu | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
3017 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3018 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3019 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3020 | 'ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
3021 | 'ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
3022 | 'ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
3023 | 'ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
3024 | bb2a0c79 | Gyusu | Dim dGap As Double = 0.0002 |
3025 | Dim d기준x As Double = (dModelStartX + dModelEndX) / 2 |
||
3026 | Dim d기준y As Double = (dModelStartY + dModelEndY) / 2 |
||
3027 | Try |
||
3028 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3029 | Catch ex As Exception |
||
3030 | |||
3031 | End Try |
||
3032 | Dim oRun As LMPipeRun = Nothing |
||
3033 | Try |
||
3034 | |||
3035 | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
||
3036 | Dim dResultCalc As Double = -1 |
||
3037 | For Each objRep In oRun.Representations |
||
3038 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3039 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3040 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3041 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3042 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3043 | Dim dStartCalc As Double = Math.Abs(dStartX - dConn_X) + Math.Abs(dStartY - dConn_Y) |
||
3044 | |||
3045 | If dResultCalc > dStartCalc Or dResultCalc = -1 Then |
||
3046 | dResultCalc = dStartCalc |
||
3047 | oLMConnector = objConnector |
||
3048 | d기준x = dConn_X |
||
3049 | d기준y = dConn_Y |
||
3050 | End If |
||
3051 | Dim dEndCalc As Double = Math.Abs(dEndX - dConn_X) + Math.Abs(dEndY - dConn_Y) |
||
3052 | If dResultCalc > dEndCalc Then |
||
3053 | dResultCalc = dEndCalc |
||
3054 | oLMConnector = objConnector |
||
3055 | d기준x = dConn_X |
||
3056 | d기준y = dConn_Y |
||
3057 | End If |
||
3058 | Next |
||
3059 | End If |
||
3060 | Next |
||
3061 | ' _Placement.PIDConnectPointLocation(oRun, 1, dModelStartX, dModelEndX) |
||
3062 | ' _Placement.PIDConnectPointLocation(oRun, 2, dModelEndX, dModelEndY) |
||
3063 | Catch ex As Exception |
||
3064 | End Try |
||
3065 | |||
3066 | |||
3067 | 'Dim sSPID As String = oModelrow(_XML_LINE_SPID).ToString() |
||
3068 | 'Dim oPipeRun As LMPipeRun = _Placement.PIDDataSource.Get PipeRun(sSPID) |
||
3069 | 'If dModelStartX + dGap > dStartX And dModelStartX - dGap < dStartX And |
||
3070 | ' dModelStartY + dGap > dStartY And dModelStartY - dGap < dStartY Then |
||
3071 | ' dStartX = dModelStartX |
||
3072 | ' dStartY = dModelStartY |
||
3073 | 'ElseIf dModelEndX + dGap > dStartX And dModelEndX - dGap < dStartX And |
||
3074 | ' dModelEndY + dGap > dStartY And dModelEndY - dGap < dStartY Then |
||
3075 | ' dStartX = dModelEndX |
||
3076 | ' dStartY = dModelEndY |
||
3077 | 'End If |
||
3078 | |||
3079 | 'Vetical |
||
3080 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
3081 | If Math.Abs(dStartX - dEndX) >= Math.Abs(dStartY - dEndY) Then |
||
3082 | 'Horizontal |
||
3083 | ' dGap = 0.0002 'Math.Abs(dStartX - dEndX) / 20 |
||
3084 | '기준선의 Y범위안에 가로선이 포함되어야됨 |
||
3085 | If (dModelStartY + dGap >= dStartY And dModelEndY - dGap <= dStartY) Or |
||
3086 | (dModelStartY - dGap <= dStartY And dModelEndY + dGap >= dStartY) And |
||
3087 | (dModelStartY + dGap >= dEndY And dModelEndY - dGap <= dEndY) Or |
||
3088 | (dModelStartY - dGap <= dEndY And dModelEndY + dGap >= dEndY) Then |
||
3089 | '기준선보다 왼쪽에 가로선이 있을때 |
||
3090 | If d기준x >= dStartX And d기준x >= dEndX Then |
||
3091 | If dStartX >= dEndX Then |
||
3092 | 'dStartX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3093 | If dStartX + dGap >= d기준x Then |
||
3094 | dStartX = d기준x |
||
3095 | sBranchType = "1" |
||
3096 | Return True |
||
3097 | End If |
||
3098 | Else |
||
3099 | 'dEndX 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3100 | If dEndX + dGap >= d기준x Then |
||
3101 | dEndX = d기준x |
||
3102 | sBranchType = "2" |
||
3103 | Return True |
||
3104 | End If |
||
3105 | End If |
||
3106 | '기준선보다 오른쪽에 가로선이 있을때 |
||
3107 | ElseIf d기준x <= dStartX And d기준x <= dEndX Then |
||
3108 | If dStartX >= dEndX Then |
||
3109 | 'dEndX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3110 | If dEndX - dGap <= d기준x Then |
||
3111 | dEndX = d기준x |
||
3112 | sBranchType = "2" |
||
3113 | Return True |
||
3114 | End If |
||
3115 | Else |
||
3116 | 'dStartX 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3117 | If dStartX - dGap <= d기준x Then |
||
3118 | dStartX = d기준x |
||
3119 | sBranchType = "1" |
||
3120 | Return True |
||
3121 | End If |
||
3122 | End If |
||
3123 | Else |
||
3124 | '기준선과 세로선이 겹칠때 |
||
3125 | If (d기준x >= dStartX And d기준x <= dEndX) Or |
||
3126 | (d기준x <= dStartX And d기준x >= dEndX) Then |
||
3127 | If (dModelStartY <= dStartY And dModelEndY >= dEndY) Or |
||
3128 | (dModelStartY >= dStartY And dModelEndY <= dEndY) Then |
||
3129 | '기준선이 dStartX와 dEndX중 어느쪽에 가까운지 확인 |
||
3130 | '가로선의 왼쪽점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3131 | '가로선의 오른쪽점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
||
3132 | If Math.Abs(d기준x - dStartX) >= Math.Abs(d기준x - dEndX) Then |
||
3133 | 'EndX점이 기준선과 더 가까이 있음 |
||
3134 | If dStartX >= dEndX Then |
||
3135 | '가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3136 | If dEndX - dGap <= d기준x Then |
||
3137 | dEndX = d기준x |
||
3138 | sBranchType = "4" |
||
3139 | Return True |
||
3140 | End If |
||
3141 | Else |
||
3142 | '가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3143 | If dEndX + dGap >= d기준x Then |
||
3144 | dEndX = d기준x |
||
3145 | sBranchType = "4" |
||
3146 | Return True |
||
3147 | End If |
||
3148 | |||
3149 | End If |
||
3150 | Else |
||
3151 | 'dStartX점이 기준선과 더 가까이 있음 |
||
3152 | If dStartX >= dEndX Then |
||
3153 | '가로선의 오른쪽점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3154 | If dStartX + dGap >= d기준x Then |
||
3155 | dStartX = d기준x |
||
3156 | sBranchType = "3" |
||
3157 | Return True |
||
3158 | End If |
||
3159 | |||
3160 | Else |
||
3161 | '가로선의 왼쪽점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3162 | If dStartX - dGap <= d기준x Then |
||
3163 | dStartX = d기준x |
||
3164 | sBranchType = "3" |
||
3165 | Return True |
||
3166 | End If |
||
3167 | End If |
||
3168 | End If |
||
3169 | End If |
||
3170 | |||
3171 | End If |
||
3172 | End If |
||
3173 | End If |
||
3174 | |||
3175 | End If |
||
3176 | 79326880 | Gyusu | Else |
3177 | bb2a0c79 | Gyusu | 'Horizontal |
3178 | If Math.Abs(dModelStartX - dModelEndX) >= Math.Abs(dModelStartY - dModelEndY) Then |
||
3179 | 'Vertical |
||
3180 | If Math.Abs(dStartX - dEndX) <= Math.Abs(dStartY - dEndY) Then |
||
3181 | ' dGap = 0.0015 'Math.Abs(dStartY - dEndY) / 80 |
||
3182 | |||
3183 | '기준선의 X범위안에 세로선이 포함되어야됨 |
||
3184 | If ((dModelStartX + dGap >= dStartX And dModelEndX - dGap <= dStartX) Or |
||
3185 | (dModelStartX - dGap <= dStartX And dModelEndX + dGap >= dStartX)) And |
||
3186 | ((dModelStartX + dGap >= dEndX And dModelEndX - dGap <= dEndX) Or |
||
3187 | (dModelStartX - dGap <= dEndX And dModelEndX + dGap >= dEndX)) Then |
||
3188 | |||
3189 | '가로선보다 아래에 세로선이 있을때 |
||
3190 | If d기준y >= dStartY And d기준y >= dEndY Then |
||
3191 | If dStartY >= dEndY Then |
||
3192 | 'dStartY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3193 | If dStartY + dGap >= d기준y Then |
||
3194 | dStartY = d기준y |
||
3195 | sBranchType = "3" |
||
3196 | Return True |
||
3197 | End If |
||
3198 | Else |
||
3199 | 'dEndY 좌표를 기준으로 Gap만큼 더했을때 기준선보다 큰지 확인 |
||
3200 | If dEndY + dGap >= d기준y Then |
||
3201 | dEndY = d기준y |
||
3202 | |||
3203 | If Math.Abs(dEndX - dModelStartX) > Math.Abs(dEndX - dModelEndX) Then |
||
3204 | dEndX = dModelEndX |
||
3205 | Else |
||
3206 | dEndX = dModelStartX |
||
3207 | End If |
||
3208 | |||
3209 | sBranchType = "4" |
||
3210 | Return True |
||
3211 | End If |
||
3212 | End If |
||
3213 | '기준선보다 위에 세로선이 있을때 |
||
3214 | ElseIf d기준y <= dStartY And d기준y <= dEndY Then |
||
3215 | If dStartY >= dEndY Then |
||
3216 | 'dEndY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3217 | If dEndY - dGap <= d기준y Then |
||
3218 | dEndY = d기준y |
||
3219 | sBranchType = "4" |
||
3220 | Return True |
||
3221 | End If |
||
3222 | Else |
||
3223 | 'dStartY 좌표를 기준으로 Gap만큼 뺐을때 기준선보다 작은지 확인 |
||
3224 | If dStartY - dGap <= d기준y Then |
||
3225 | dStartY = d기준y |
||
3226 | sBranchType = "3" |
||
3227 | Return True |
||
3228 | End If |
||
3229 | End If |
||
3230 | Else |
||
3231 | '기준선과 세로선이 겹칠때 |
||
3232 | If (d기준y >= dStartY And d기준y <= dEndY) Or |
||
3233 | (d기준y <= dStartY And d기준y >= dEndY) Then |
||
3234 | '기준선이 dStartY와 dEndY중 어느쪽에 가까운지 확인 |
||
3235 | '세로선의 윗점과 기준선이 가까울때는 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3236 | '세로선의 아래점과 기준선이 가까울때는 gap만큼 더했을때 기준선보다 큰지확인 |
||
3237 | If (dModelStartX <= dStartX And dModelEndX >= dEndX) Or |
||
3238 | (dModelStartX >= dStartX And dModelEndX <= dEndX) Then |
||
3239 | If Math.Abs(d기준y - dStartY) >= Math.Abs(d기준y - dEndY) Then |
||
3240 | 'Endy점이 기준선과 더 가까이 있음 |
||
3241 | If dStartY >= dEndY Then |
||
3242 | '세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3243 | If dEndY + dGap >= d기준y Then |
||
3244 | dEndY = d기준y |
||
3245 | sBranchType = "4" |
||
3246 | Return True |
||
3247 | End If |
||
3248 | Else |
||
3249 | '세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3250 | If dEndY - dGap <= d기준y Then |
||
3251 | dEndY = d기준y |
||
3252 | sBranchType = "4" |
||
3253 | Return True |
||
3254 | End If |
||
3255 | End If |
||
3256 | Else |
||
3257 | 'dStartY점이 기준선과 더 가까이 있음 |
||
3258 | If dStartY >= dEndY Then |
||
3259 | '세로선의 윗점과 기준선이 가까우므로 gap만큼 뺐을때 기준선보다 작은지확인 |
||
3260 | If dStartY - dGap <= d기준y Then |
||
3261 | dStartY = d기준y |
||
3262 | sBranchType = "3" |
||
3263 | Return True |
||
3264 | End If |
||
3265 | Else |
||
3266 | '세로선의 아래점과 기준선이 가까우므로 gap만큼 더했을때 기준선보다 큰지확인 |
||
3267 | If dStartY + dGap >= d기준y Then |
||
3268 | dStartY = d기준y |
||
3269 | sBranchType = "3" |
||
3270 | Return True |
||
3271 | End If |
||
3272 | End If |
||
3273 | End If |
||
3274 | End If |
||
3275 | |||
3276 | End If |
||
3277 | End If |
||
3278 | End If |
||
3279 | End If |
||
3280 | End If |
||
3281 | End If |
||
3282 | Next |
||
3283 | Catch ex As Exception |
||
3284 | |||
3285 | End Try |
||
3286 | oLMConnector = Nothing |
||
3287 | Return False |
||
3288 | End Function |
||
3289 | |||
3290 | 76f465d0 | Gyusu | Private Function CheckConnectionSymbolToSymbol(ByVal oModelingLineRows() As DataRow, ByRef dX As Double, ByRef dY As Double, |
3291 | ByRef oLMConnector As LMConnector) As Boolean |
||
3292 | Dim bConnectionFlag As Boolean = False |
||
3293 | Try |
||
3294 | For Each oModelrow In oModelingLineRows |
||
3295 | Dim d기준x As Double = dX |
||
3296 | Dim d기준y As Double = dY |
||
3297 | Dim dGap As Double = 0.0002 |
||
3298 | Dim oRun As LMPipeRun = Nothing |
||
3299 | Try |
||
3300 | Dim oLMSymbol As LMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3301 | Dim dX1 As Double = 0.0 |
||
3302 | Dim dY1 As Double = 0.0 |
||
3303 | Dim dX2 As Double = 0.0 |
||
3304 | Dim dY2 As Double = 0.0 |
||
3305 | For Each oConnector In oLMSymbol.Connect1Connectors |
||
3306 | oLMConnector = oConnector |
||
3307 | Next |
||
3308 | ' oRun = _Placement.PIDDataSource.GetPipeRun(oLMSymbol.Connect1Connectors.Nth(1).ModelItemID) |
||
3309 | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3310 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3311 | If Math.Abs(dX - dX1) < dGap And Math.Abs(dY - dY1) < dGap Then |
||
3312 | dX = dX1 |
||
3313 | dY = dY1 |
||
3314 | bConnectionFlag = True |
||
3315 | Exit For |
||
3316 | End If |
||
3317 | If Math.Abs(dX - dX2) < dGap And Math.Abs(dY - dY2) < dGap Then |
||
3318 | dX = dX2 |
||
3319 | dY = dY2 |
||
3320 | bConnectionFlag = True |
||
3321 | Exit For |
||
3322 | End If |
||
3323 | |||
3324 | 'For Each oConnector In oLMSymbol.Connect1Connectors |
||
3325 | ' For Each objConnectorVertex In oConnector.ConnectorVertices |
||
3326 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3327 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3328 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3329 | ' oLMConnector = oConnector |
||
3330 | ' dX = dConn_X |
||
3331 | ' dY = dConn_Y |
||
3332 | ' bConnectionFlag = True |
||
3333 | ' Exit For |
||
3334 | ' End If |
||
3335 | ' Next |
||
3336 | 'Next |
||
3337 | |||
3338 | 'For Each oConnector In oLMSymbol.Connect2Connectors |
||
3339 | ' For Each objConnectorVertex In oConnector.ConnectorVertices |
||
3340 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3341 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3342 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3343 | ' oLMConnector = oConnector |
||
3344 | ' dX = dConn_X |
||
3345 | ' dY = dConn_Y |
||
3346 | ' bConnectionFlag = True |
||
3347 | ' Exit For |
||
3348 | ' End If |
||
3349 | ' Next |
||
3350 | 'Next |
||
3351 | |||
3352 | |||
3353 | 'If oRun IsNot Nothing Then |
||
3354 | ' Dim dResultCalc As Double = -1 |
||
3355 | ' For Each objRep In oRun.Representations |
||
3356 | ' Dim sRepresentationType As String = objRep.Attributes("RepresentationType").Value |
||
3357 | ' If objRep.Attributes("RepresentationType").Value = "Connector" Or |
||
3358 | ' objRep.Attributes("RepresentationType").Value = "Symbol" And |
||
3359 | ' objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3360 | ' Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3361 | ' For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3362 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3363 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3364 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3365 | ' oLMConnector = objConnector |
||
3366 | ' d기준x = dConn_X |
||
3367 | ' d기준y = dConn_Y |
||
3368 | ' bConnectionFlag = True |
||
3369 | ' Exit For |
||
3370 | ' End If |
||
3371 | ' Next |
||
3372 | ' End If |
||
3373 | ' Next |
||
3374 | 'End If |
||
3375 | |||
3376 | Catch ex As Exception |
||
3377 | End Try |
||
3378 | Next |
||
3379 | |||
3380 | Catch ex As Exception |
||
3381 | |||
3382 | End Try |
||
3383 | Return bConnectionFlag |
||
3384 | End Function |
||
3385 | |||
3386 | Private Function CheckConnectionSymbolToLine(ByVal oModelingLineRows() As DataRow, ByRef dX As Double, ByRef dY As Double, |
||
3387 | ByVal dCenterX As Double, ByVal dCenterY As Double, ByRef oLMConnector As LMConnector) As LMSymbol |
||
3388 | Dim bConnectionFlag As Boolean = False |
||
3389 | Dim oLMSymbol As LMSymbol = Nothing |
||
3390 | Try |
||
3391 | |||
3392 | e38f99a7 | Gyusu | For Each oModelrow In _ModelingSymbol_Dt.Rows |
3393 | Dim dMinx As Double = oModelrow(_XML_SYMBOL_MIN_X) |
||
3394 | Dim dMaxx As Double = oModelrow(_XML_SYMBOL_MAX_X) |
||
3395 | Dim dMiny As Double = oModelrow(_XML_SYMBOL_MIN_Y) |
||
3396 | Dim dMaxy As Double = oModelrow(_XML_SYMBOL_MAX_Y) |
||
3397 | 76f465d0 | Gyusu | Dim dGap As Double = 0.001 |
3398 | e38f99a7 | Gyusu | If dMinx <= dX And dMaxx >= dX And dMiny <= dY And dMaxy >= dY Then |
3399 | oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3400 | 76f465d0 | Gyusu | Dim dX1 As Double = 0.0 |
3401 | Dim dY1 As Double = 0.0 |
||
3402 | Dim dX2 As Double = 0.0 |
||
3403 | Dim dY2 As Double = 0.0 |
||
3404 | e38f99a7 | Gyusu | Dim dX3 As Double = 0.0 |
3405 | Dim dY3 As Double = 0.0 |
||
3406 | Dim dX4 As Double = 0.0 |
||
3407 | Dim dY4 As Double = 0.0 |
||
3408 | Dim dX5 As Double = 0.0 |
||
3409 | Dim dY5 As Double = 0.0 |
||
3410 | Dim dX6 As Double = 0.0 |
||
3411 | Dim dY6 As Double = 0.0 |
||
3412 | Dim dX7 As Double = 0.0 |
||
3413 | Dim dY7 As Double = 0.0 |
||
3414 | Dim dX8 As Double = 0.0 |
||
3415 | Dim dY8 As Double = 0.0 |
||
3416 | 76f465d0 | Gyusu | _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
3417 | _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3418 | e38f99a7 | Gyusu | _Placement.PIDConnectPointLocation(oLMSymbol, 3, dX3, dY3) |
3419 | _Placement.PIDConnectPointLocation(oLMSymbol, 4, dX4, dY4) |
||
3420 | _Placement.PIDConnectPointLocation(oLMSymbol, 5, dX5, dY5) |
||
3421 | _Placement.PIDConnectPointLocation(oLMSymbol, 6, dX6, dY6) |
||
3422 | _Placement.PIDConnectPointLocation(oLMSymbol, 7, dX7, dY7) |
||
3423 | _Placement.PIDConnectPointLocation(oLMSymbol, 8, dX8, dY8) |
||
3424 | |||
3425 | If Math.Abs(dX - dX1) <= dGap And Math.Abs(dY - dY1) <= dGap Then |
||
3426 | 76f465d0 | Gyusu | dX = dX1 |
3427 | dY = dY1 |
||
3428 | e38f99a7 | Gyusu | ElseIf Math.Abs(dX - dX2) <= dGap And Math.Abs(dY - dY2) <= dGap Then |
3429 | 76f465d0 | Gyusu | dX = dX2 |
3430 | dY = dY2 |
||
3431 | e38f99a7 | Gyusu | ElseIf Math.Abs(dX - dX3) <= dGap And Math.Abs(dY - dY3) <= dGap Then |
3432 | dX = dX3 |
||
3433 | dY = dY3 |
||
3434 | ElseIf Math.Abs(dX - dX4) <= dGap And Math.Abs(dY - dY4) <= dGap Then |
||
3435 | dX = dX4 |
||
3436 | dY = dY4 |
||
3437 | ElseIf Math.Abs(dX - dX5) <= dGap And Math.Abs(dY - dY5) <= dGap Then |
||
3438 | dX = dX5 |
||
3439 | dY = dY5 |
||
3440 | ElseIf Math.Abs(dX - dX6) <= dGap And Math.Abs(dY - dY6) <= dGap Then |
||
3441 | dX = dX6 |
||
3442 | dY = dY6 |
||
3443 | ElseIf Math.Abs(dX - dX7) <= dGap And Math.Abs(dY - dY7) <= dGap Then |
||
3444 | dX = dX7 |
||
3445 | dY = dY7 |
||
3446 | ElseIf Math.Abs(dX - dX8) <= dGap And Math.Abs(dY - dY8) <= dGap Then |
||
3447 | dX = dX8 |
||
3448 | dY = dY8 |
||
3449 | 76f465d0 | Gyusu | End If |
3450 | End If |
||
3451 | Next |
||
3452 | b08338e3 | Gyusu | |
3453 | e38f99a7 | Gyusu | |
3454 | |||
3455 | 'For Each oModelrow In oModelingLineRows |
||
3456 | ' Dim d기준x As Double = dCenterX |
||
3457 | ' Dim d기준y As Double = dCenterY |
||
3458 | ' Dim dGap As Double = 0.001 |
||
3459 | ' Dim oRun As LMPipeRun = Nothing |
||
3460 | ' Dim dCheckGap As Double = 0 |
||
3461 | ' Try |
||
3462 | |||
3463 | ' Dim dX1 As Double = 0.0 |
||
3464 | ' Dim dY1 As Double = 0.0 |
||
3465 | ' Dim dX2 As Double = 0.0 |
||
3466 | ' Dim dY2 As Double = 0.0 |
||
3467 | ' ' oRun = _Placement.PIDDataSource.GetPipeRun(oLMSymbol.Connect1Connectors.Nth(1).ModelItemID) |
||
3468 | ' oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3469 | ' For Each oConnector In oLMSymbol.Connect1Connectors |
||
3470 | ' oLMConnector = oConnector |
||
3471 | ' Next |
||
3472 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
3473 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
3474 | ' ' If Math.Abs(dX - dX1) < dGap And Math.Abs(dY - dY1) < dGap And |
||
3475 | ' If Math.Abs(d기준x - dX1) < dCheckGap And Math.Abs(d기준y - dY1) < dCheckGap Or dCheckGap = 0 Then |
||
3476 | ' dX = dX1 |
||
3477 | ' dY = dY1 |
||
3478 | ' bConnectionFlag = True |
||
3479 | ' dCheckGap = Math.Abs(d기준x - dX1) + Math.Abs(d기준y - dY1) |
||
3480 | ' End If |
||
3481 | ' 'If Math.Abs(dX - dX2) < dGap And Math.Abs(dY - dY2) < dGap And |
||
3482 | ' ' Math.Abs(d기준x - dX2) < dCheckGap And Math.Abs(d기준y - dY2 < dCheckGap) Or dCheckGap = 0 Then |
||
3483 | ' If Math.Abs(d기준x - dX2) < dCheckGap And Math.Abs(d기준y - dY2) < dCheckGap Or dCheckGap = 0 Then |
||
3484 | ' dX = dX2 |
||
3485 | ' dY = dY2 |
||
3486 | ' bConnectionFlag = True |
||
3487 | ' End If |
||
3488 | |||
3489 | ' Catch ex As Exception |
||
3490 | ' End Try |
||
3491 | ' If bConnectionFlag Then |
||
3492 | ' oLMSymbol = oModelrow(_XML_SYMBOL_LMSYMBOL) |
||
3493 | ' Else |
||
3494 | ' oLMSymbol = Nothing |
||
3495 | ' End If |
||
3496 | 'Next |
||
3497 | |||
3498 | 76f465d0 | Gyusu | Catch ex As Exception |
3499 | b08338e3 | Gyusu | |
3500 | 76f465d0 | Gyusu | End Try |
3501 | b08338e3 | Gyusu | |
3502 | 76f465d0 | Gyusu | Return oLMSymbol |
3503 | End Function |
||
3504 | b08338e3 | Gyusu | |
3505 | 3b7a4470 | Gyusu | ''' <summary> |
3506 | ''' 라인과 라인이 만나는점이 브런치점인지 확인, 오차범위내 라인보정 |
||
3507 | ''' </summary> |
||
3508 | ''' <param name="oModelingLineRows"></param> |
||
3509 | ''' <param name="dStartX"></param> |
||
3510 | ''' <param name="dStartY"></param> |
||
3511 | ''' <param name="dEndX"></param> |
||
3512 | ''' <param name="dEndY"></param> |
||
3513 | ''' <param name="oLMConnector"></param> |
||
3514 | ''' <returns></returns> |
||
3515 | Private Function CheckBranchLine(ByVal oModelingLineRows As DataRowCollection, ByRef dStartX As Double, ByRef dStartY As Double, |
||
3516 | ByRef dEndX As Double, ByRef dEndY As Double, ByRef oLMConnector As LMConnector) As String |
||
3517 | Dim bConnectionFlag As Boolean = False |
||
3518 | Dim sBranchDirection As String = "" |
||
3519 | Try |
||
3520 | For Each oModelrow In oModelingLineRows |
||
3521 | Dim dModelStartX As Double |
||
3522 | Dim dModelStartY As Double |
||
3523 | Dim dModelEndX As Double |
||
3524 | Dim dModelEndY As Double |
||
3525 | 73bfb231 | Gyusu | Dim dGap As Double = 0.002 |
3526 | 3b7a4470 | Gyusu | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
3527 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3528 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3529 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3530 | |||
3531 | '기존라인이 X축방향이라면 현재선은 Y축방향이 되어야됨 |
||
3532 | If Math.Abs(dModelStartX - dModelEndX) > Math.Abs(dModelStartY - dModelEndY) And |
||
3533 | Math.Abs(dStartX - dEndX) < Math.Abs(dStartY - dEndY) Then |
||
3534 | |||
3535 | '기본라인의 X축영역안에 현재선이 있어야됨 |
||
3536 | ' If dModelEndY > dModelStartY Then |
||
3537 | If (dStartX < dModelEndX And dStartX > dModelStartX) Or |
||
3538 | (dStartX > dModelEndX And dStartX < dModelStartX) Then |
||
3539 | '[오차범위 수정] |
||
3540 | '현재선의 Y축방향이 기존라인의 X축방향을 통과하는지 확인 |
||
3541 | If dStartY < dEndY Then |
||
3542 | If dEndY > dModelStartY And dModelStartY > dStartY Then |
||
3543 | If dEndY - dModelStartY > dModelStartY - dStartY Then |
||
3544 | '위쪽으로 라인이 나와있을때 |
||
3545 | '현재선 중 작은 Y좌표를 오차범위만큼 더했을때 기존라인의 Y축보다 큰지확인 |
||
3546 | 'Y축보다 클경우 작은 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 큰 Y좌표에 더한다. |
||
3547 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3548 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartY - dStartY |
3549 | dEndY = dEndY + dAddPoint |
||
3550 | dStartY = dModelStartY |
||
3551 | sBranchDirection = "START" |
||
3552 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3553 | Exit For |
||
3554 | 3b7a4470 | Gyusu | End If |
3555 | Else |
||
3556 | '아래쪽으로 라인이 나와있을때 |
||
3557 | '현재선 중 큰 Y좌표를 오차범위만큼 뺐을때 기존라인의 Y축보다 작은지확인 |
||
3558 | 'Y축보다 작을경우 큰 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 작은 Y좌표에 뺀다. |
||
3559 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3560 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dEndY - dModelStartY |
3561 | dStartY = dStartY - dAddPoint |
||
3562 | dEndY = dModelStartY |
||
3563 | sBranchDirection = "END" |
||
3564 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3565 | Exit For |
||
3566 | 3b7a4470 | Gyusu | End If |
3567 | End If |
||
3568 | Else |
||
3569 | '현재선의 Y축방향이 기존라인의 X축방향에 못미치는지 확인 |
||
3570 | If dStartY > dModelStartY Then |
||
3571 | '기존라인보다 위쪽에 현재선이 있을때 |
||
3572 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3573 | 3b7a4470 | Gyusu | '오차범위만큼 작은 y좌표를 뺐을때 기존라인보다 아래쪽에 있을경우 오차보정 |
3574 | Dim dAddPoint As Double = dStartY - dModelStartY |
||
3575 | dEndY = dEndY - dAddPoint |
||
3576 | dStartY = dModelStartY |
||
3577 | sBranchDirection = "START" |
||
3578 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3579 | Exit For |
||
3580 | 3b7a4470 | Gyusu | End If |
3581 | Else |
||
3582 | '기존라인보다 아래쪽에 현재선이 있을때 |
||
3583 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3584 | 3b7a4470 | Gyusu | '오차범위만큼 큰 y좌표를 더했을때 기존라인보다 위쪽에 있을경우 오차보정 |
3585 | Dim dAddPoint As Double = dModelStartY - dEndY |
||
3586 | dEndY = dModelStartY |
||
3587 | dStartY = dStartY + dAddPoint |
||
3588 | sBranchDirection = "END" |
||
3589 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3590 | Exit For |
||
3591 | 3b7a4470 | Gyusu | End If |
3592 | End If |
||
3593 | End If |
||
3594 | Else |
||
3595 | If dEndY < dModelStartY And dModelStartY < dStartY Then |
||
3596 | If dModelStartY - dEndY < dStartY - dModelStartY Then |
||
3597 | '위쪽으로 라인이 나와있을때 |
||
3598 | '현재선 중 작은 Y좌표를 오차범위만큼 더했을때 기존라인의 Y축보다 큰지확인 |
||
3599 | 'Y축보다 클경우 작은 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 큰 Y좌표에 더한다. |
||
3600 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3601 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartY - dEndY |
3602 | dStartY = dStartY + dAddPoint |
||
3603 | dEndY = dModelStartY |
||
3604 | sBranchDirection = "END" |
||
3605 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3606 | Exit For |
||
3607 | 3b7a4470 | Gyusu | End If |
3608 | Else |
||
3609 | '아래쪽으로 라인이 나와있을때 |
||
3610 | '현재선 중 큰 Y좌표를 오차범위만큼 뺐을때 기존라인의 Y축보다 작은지확인 |
||
3611 | 'Y축보다 작을경우 큰 Y좌표를 기존라인의 Y축에 맞추고 더한 길이만큼 작은 Y좌표에 뺀다. |
||
3612 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3613 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dStartY - dModelStartY |
3614 | dEndY = dEndY - dAddPoint |
||
3615 | dStartY = dModelStartY |
||
3616 | sBranchDirection = "START" |
||
3617 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3618 | Exit For |
||
3619 | 3b7a4470 | Gyusu | End If |
3620 | End If |
||
3621 | Else |
||
3622 | If dEndY > dModelStartY Then |
||
3623 | '기존라인보다 우측에 현재선이 있을때 |
||
3624 | 73bfb231 | Gyusu | If Math.Abs(dEndY - dModelStartY) <= dGap Then |
3625 | 3b7a4470 | Gyusu | '오차범위만큼 작은 x좌표를 뺐을때 기존라인보다 좌측에 있을경우 오차보정 |
3626 | Dim dAddPoint As Double = dEndY - dModelStartY |
||
3627 | dStartY = dStartY - dAddPoint |
||
3628 | dEndY = dModelStartY |
||
3629 | sBranchDirection = "END" |
||
3630 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3631 | Exit For |
||
3632 | 3b7a4470 | Gyusu | End If |
3633 | Else |
||
3634 | '기존라인보다 좌측에 현재선이 있을때 |
||
3635 | 73bfb231 | Gyusu | If Math.Abs(dStartY - dModelStartY) <= dGap Then |
3636 | 3b7a4470 | Gyusu | '오차범위만큼 큰 x좌표를 더했을때 기존라인보다 우측에 있을경우 오차보정 |
3637 | Dim dAddPoint As Double = dModelStartY - dStartY |
||
3638 | dStartY = dModelStartY |
||
3639 | dEndY = dEndY + dAddPoint |
||
3640 | sBranchDirection = "START" |
||
3641 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3642 | Exit For |
||
3643 | 3b7a4470 | Gyusu | End If |
3644 | End If |
||
3645 | End If |
||
3646 | End If |
||
3647 | End If |
||
3648 | '기존라인이 Y축방향이라면 현재선은 X축방향이 되어야됨 |
||
3649 | ElseIf Math.Abs(dModelStartX - dModelEndX) < Math.Abs(dModelStartY - dModelEndY) And |
||
3650 | Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
||
3651 | |||
3652 | '기본라인의 Y축영역안에 현재선이 있어야됨 |
||
3653 | ' If dModelEndY > dModelStartY Then |
||
3654 | If (dStartY < dModelEndY And dStartY > dModelStartY) Or |
||
3655 | (dStartY > dModelEndY And dStartY < dModelStartY) Then |
||
3656 | '[오차범위 수정] |
||
3657 | '현재선의 X축방향이 기존라인의 Y축방향을 통과하는지 확인 |
||
3658 | If dStartX < dEndX Then |
||
3659 | If dEndX > dModelStartX And dModelStartX > dStartX Then |
||
3660 | If dEndX - dModelStartX > dModelStartX - dStartX Then |
||
3661 | '우측으로 라인이 나와있을때 |
||
3662 | '현재선 중 작은 X좌표를 오차범위만큼 더했을때 기존라인의 X축보다 큰지확인 |
||
3663 | 'X축보다 클경우 작은 X좌표를 기존라인의 X축에 맞추고 더한 길이만큼 큰 X좌표에 더한다. |
||
3664 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3665 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartX - dStartX |
3666 | dEndX = dEndX + dAddPoint |
||
3667 | dStartX = dModelStartX |
||
3668 | sBranchDirection = "START" |
||
3669 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3670 | Exit For |
||
3671 | 3b7a4470 | Gyusu | End If |
3672 | Else |
||
3673 | '좌측으로 라인이 나와있을때 |
||
3674 | '현재선 중 큰 X좌표를 오차범위만큼 뺐을때 기존라인의 X축보다 작은지확인 |
||
3675 | 'X축보다 작을경우 큰 X좌표를 기존라인의 X축에 맞추고 뺀 길이만큼 작은 X좌표에 뺀다. |
||
3676 | 73bfb231 | Gyusu | If Math.Abs(dEndX - dModelStartX) <= dGap Then |
3677 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dEndX - dModelStartX |
3678 | dStartX = dStartX - dAddPoint |
||
3679 | dEndX = dModelStartX |
||
3680 | sBranchDirection = "END" |
||
3681 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3682 | Exit For |
||
3683 | 3b7a4470 | Gyusu | End If |
3684 | End If |
||
3685 | Else |
||
3686 | '현재선의 X축방향이 기존라인의 Y축방향에 못미치는지 확인 |
||
3687 | If dStartX > dModelStartX Then |
||
3688 | '기존라인보다 우측에 현재선이 있을때 |
||
3689 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3690 | 3b7a4470 | Gyusu | '오차범위만큼 작은 x좌표를 뺐을때 기존라인보다 좌측에 있을경우 오차보정 |
3691 | Dim dAddPoint As Double = dStartX - dModelStartX |
||
3692 | dEndX = dEndX - dAddPoint |
||
3693 | dStartX = dModelStartX |
||
3694 | sBranchDirection = "START" |
||
3695 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3696 | Exit For |
||
3697 | 3b7a4470 | Gyusu | End If |
3698 | Else |
||
3699 | '기존라인보다 좌측에 현재선이 있을때 |
||
3700 | 73bfb231 | Gyusu | If Math.Abs(dEndX - dModelStartX) <= dGap Then |
3701 | 3b7a4470 | Gyusu | '오차범위만큼 큰 x좌표를 더했을때 기존라인보다 우측에 있을경우 오차보정 |
3702 | Dim dAddPoint As Double = dModelStartX - dEndX |
||
3703 | dEndX = dModelStartX |
||
3704 | dStartX = dStartX + dAddPoint |
||
3705 | sBranchDirection = "END" |
||
3706 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3707 | Exit For |
||
3708 | 3b7a4470 | Gyusu | End If |
3709 | End If |
||
3710 | End If |
||
3711 | Else |
||
3712 | If dEndX < dModelStartX And dModelStartX < dStartX Then |
||
3713 | If dModelStartX - dEndX < dStartX - dModelStartX Then |
||
3714 | '우측으로 라인이 나와있을때 |
||
3715 | '현재선 중 작은 X좌표를 오차범위만큼 더했을때 기존라인의 X축보다 큰지확인 |
||
3716 | 'X축보다 클경우 작은 X좌표를 기존라인의 X축에 맞추고 더한 길이만큼 큰 X좌에 더한다. |
||
3717 | 73bfb231 | Gyusu | If Math.Abs(dModelStartX - dEndX) <= dGap Then |
3718 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dModelStartX - dEndX |
3719 | dStartX = dStartX + dAddPoint |
||
3720 | dEndX = dModelStartX |
||
3721 | sBranchDirection = "END" |
||
3722 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3723 | Exit For |
||
3724 | 3b7a4470 | Gyusu | End If |
3725 | Else |
||
3726 | '좌측으로 라인이 나와있을때 |
||
3727 | '현재선 중 큰 X좌표를 오차범위만큼 뺐을때 기존라인의 X축보다 작은지확인 |
||
3728 | 'X축보다 작을경우 큰 X좌표를 기존라인의 X축에 맞추고 뺀 길이만큼 작은 X좌표에 뺀다. |
||
3729 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3730 | 3b7a4470 | Gyusu | Dim dAddPoint As Double = dStartX - dModelStartX |
3731 | dEndX = dEndX - dAddPoint |
||
3732 | dStartX = dModelStartX |
||
3733 | sBranchDirection = "START" |
||
3734 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3735 | Exit For |
||
3736 | 3b7a4470 | Gyusu | End If |
3737 | |||
3738 | End If |
||
3739 | Else |
||
3740 | If dEndX > dModelStartX Then |
||
3741 | '기존라인보다 우측에 현재선이 있을때 |
||
3742 | 73bfb231 | Gyusu | If Math.Abs(dEndX - dModelStartX) <= dGap Then |
3743 | 3b7a4470 | Gyusu | '오차범위만큼 작은 x좌표를 뺐을때 기존라인보다 좌측에 있을경우 오차보정 |
3744 | Dim dAddPoint As Double = dEndX - dModelStartX |
||
3745 | dStartX = dStartX - dAddPoint |
||
3746 | dEndX = dModelStartX |
||
3747 | sBranchDirection = "END" |
||
3748 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3749 | Exit For |
||
3750 | 3b7a4470 | Gyusu | End If |
3751 | Else |
||
3752 | '기존라인보다 좌측에 현재선이 있을때 |
||
3753 | 73bfb231 | Gyusu | If Math.Abs(dStartX - dModelStartX) <= dGap Then |
3754 | 3b7a4470 | Gyusu | '오차범위만큼 큰 x좌표를 더했을때 기존라인보다 우측에 있을경우 오차보정 |
3755 | Dim dAddPoint As Double = dModelStartX - dStartX |
||
3756 | dStartX = dModelStartX |
||
3757 | dEndX = dEndX + dAddPoint |
||
3758 | sBranchDirection = "START" |
||
3759 | 73bfb231 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3760 | Exit For |
||
3761 | 3b7a4470 | Gyusu | End If |
3762 | End If |
||
3763 | End If |
||
3764 | End If |
||
3765 | End If |
||
3766 | End If |
||
3767 | Next |
||
3768 | Catch ex As Exception |
||
3769 | bConnectionFlag = False |
||
3770 | oLMConnector = Nothing |
||
3771 | End Try |
||
3772 | Return sBranchDirection |
||
3773 | |||
3774 | End Function |
||
3775 | |||
3776 | 79326880 | Gyusu | Private Function UpdateCheckBranchLine(ByRef dX As Double, ByRef dY As Double, |
3777 | 1bfcc921 | Gyusu | ByRef oLMConnector As LMConnector, ByRef sUid As String) As Boolean |
3778 | dd46ca83 | Gyusu | Dim oDataSource As LMADataSource = _Placement.PIDDataSource |
3779 | 1bfcc921 | Gyusu | Dim bCheckBranchItem As Boolean = False |
3780 | 79326880 | Gyusu | Dim iGapCheck As Integer = 0 |
3781 | Try |
||
3782 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
3783 | Dim d기준x As Double = dX |
||
3784 | Dim d기준y As Double = dY |
||
3785 | Dim dGap As Double = 0.001 |
||
3786 | Dim oRun As LMPipeRun = Nothing |
||
3787 | Dim dModelStartX As Double |
||
3788 | Dim dModelStartY As Double |
||
3789 | Dim dModelEndX As Double |
||
3790 | Dim dModelEndY As Double |
||
3791 | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
3792 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3793 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3794 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3795 | d기준x = (dModelStartX + dModelEndX) / 2 |
||
3796 | d기준y = (dModelStartY + dModelEndY) / 2 |
||
3797 | |||
3798 | Dim dMax_X As Double = 0.0 |
||
3799 | Dim dMax_Y As Double = 0.0 |
||
3800 | Dim dMin_X As Double = 0.0 |
||
3801 | Dim dMin_Y As Double = 0.0 |
||
3802 | If dModelEndX > dModelStartX Then |
||
3803 | dMax_X = dModelEndX |
||
3804 | dMin_X = dModelStartX |
||
3805 | Else |
||
3806 | dMax_X = dModelStartX |
||
3807 | dMin_X = dModelEndX |
||
3808 | End If |
||
3809 | |||
3810 | If dModelEndY > dModelStartY Then |
||
3811 | dMax_Y = dModelEndY |
||
3812 | dMin_Y = dModelStartY |
||
3813 | Else |
||
3814 | dMax_Y = dModelStartY |
||
3815 | dMin_Y = dModelEndY |
||
3816 | End If |
||
3817 | |||
3818 | If dX <= dMax_X + dGap And dX >= dMin_X - dGap And |
||
3819 | dY <= dMax_Y + dGap And dY >= dMin_Y - dGap Then |
||
3820 | If Math.Abs(dMax_X - dMin_X) > Math.Abs(dMax_Y - dMin_Y) Then |
||
3821 | dY = dMax_Y |
||
3822 | Else |
||
3823 | dX = dMax_X |
||
3824 | End If |
||
3825 | 1bfcc921 | Gyusu | |
3826 | Try |
||
3827 | Dim sModelItemID As String = oModelrow(_XML_LINE_SPID).ToString() |
||
3828 | sUid = oModelrow(_XML_LINE_UID).ToString() |
||
3829 | dd46ca83 | Gyusu | oRun = oDataSource.GetPipeRun(sModelItemID) |
3830 | 1bfcc921 | Gyusu | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3831 | Catch ex As Exception |
||
3832 | End Try |
||
3833 | Try |
||
3834 | If oRun IsNot Nothing Then |
||
3835 | Dim dResultCalc As Double = -1 |
||
3836 | dd46ca83 | Gyusu | Dim bBranchFlag As Boolean = False |
3837 | Dim dBranchX As Double = 0 |
||
3838 | Dim dBranchY As Double = 0 |
||
3839 | 1bfcc921 | Gyusu | For Each objRep In oRun.Representations |
3840 | dd46ca83 | Gyusu | ' Dim sAttriName As String |
3841 | 'For Each objAttr In objRep.Attributes |
||
3842 | ' sAttriName = objAttr.name |
||
3843 | 'Next |
||
3844 | 'MsgBox(objRep.RepresentationType) |
||
3845 | 1bfcc921 | Gyusu | If objRep.RepresentationType = "Connector" Then |
3846 | dd46ca83 | Gyusu | Dim objConnector As LMConnector = oDataSource.GetConnector(objRep.ID) |
3847 | ' Dim sItemStatus As String = objConnector.Attributes("ItemStatus").Value |
||
3848 | ' Dim sModelTypeName As String = objConnector.ModelItemObject.Attributes("ItemTypeName").Value |
||
3849 | 1bfcc921 | Gyusu | |
3850 | 'Dim dConn_SX As Double = 0 |
||
3851 | 'Dim dConn_SY As Double = 0 |
||
3852 | 'Dim dConn_EX As Double = 0 |
||
3853 | 'Dim dConn_EY As Double = 0 |
||
3854 | Dim dConn_X As Double = 0 |
||
3855 | Dim dConn_Y As Double = 0 |
||
3856 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3857 | dConn_X = objConnectorVertex.Attributes("XCoordinate").Value |
||
3858 | dConn_Y = objConnectorVertex.Attributes("YCoordinate").Value |
||
3859 | 'If dConn_SX = 0 Then |
||
3860 | ' dConn_SX = objConnectorVertex.Attributes("XCoordinate").Value |
||
3861 | ' dConn_SY = objConnectorVertex.Attributes("YCoordinate").Value |
||
3862 | 'Else |
||
3863 | ' dConn_EX = objConnectorVertex.Attributes("XCoordinate").Value |
||
3864 | ' dConn_EY = objConnectorVertex.Attributes("YCoordinate").Value |
||
3865 | 'End If |
||
3866 | Dim dCalc As Double = Math.Abs(dConn_X - dX) + Math.Abs(dConn_Y - dY) |
||
3867 | dd46ca83 | Gyusu | If bBranchFlag = False Then |
3868 | If dResultCalc = -1 Or dResultCalc > dCalc Then |
||
3869 | dResultCalc = dCalc |
||
3870 | oLMConnector = objConnector |
||
3871 | bCheckBranchItem = True |
||
3872 | End If |
||
3873 | Else |
||
3874 | If (dConn_X >= dX And dBranchX <= dX And dConn_Y >= dY And dBranchY <= dY) Or |
||
3875 | (dConn_X <= dX And dBranchX >= dX And dConn_Y <= dY And dBranchY >= dY) Then |
||
3876 | If dResultCalc = -1 Or dResultCalc > dCalc Then |
||
3877 | dResultCalc = dCalc |
||
3878 | oLMConnector = objConnector |
||
3879 | bCheckBranchItem = True |
||
3880 | End If |
||
3881 | End If |
||
3882 | 1bfcc921 | Gyusu | End If |
3883 | |||
3884 | dd46ca83 | Gyusu | |
3885 | 1bfcc921 | Gyusu | 'If dConn_EX <> 0 And dConn_EY <> 0 Then |
3886 | ' If dConn_SX >= dX And dConn_EX <= dX And dConn_SY >= dY And dConn_EY <= dY Then |
||
3887 | ' oLMConnector = objConnector |
||
3888 | ' Exit For |
||
3889 | ' ElseIf dConn_SX <= dX And dConn_EX >= dX And dConn_SY <= dY And dConn_EY >= dY Then |
||
3890 | ' oLMConnector = objConnector |
||
3891 | ' Exit For |
||
3892 | ' Else |
||
3893 | ' If dConn_EX > 0 Then |
||
3894 | ' dConn_SX = dConn_EX |
||
3895 | ' dConn_SY = dConn_EY |
||
3896 | ' End If |
||
3897 | ' End If |
||
3898 | 'End If |
||
3899 | |||
3900 | Next |
||
3901 | 'If oLMConnector IsNot Nothing Then |
||
3902 | ' Exit For |
||
3903 | 'End If |
||
3904 | dd46ca83 | Gyusu | ElseIf objRep.RepresentationType = "Branch" Then |
3905 | Dim objConnector As LMSymbol = oDataSource.GetSymbol(objRep.ID) |
||
3906 | dBranchX = objConnector.Attributes("XCoordinate").Value |
||
3907 | dBranchY = objConnector.Attributes("YCoordinate").Value |
||
3908 | bBranchFlag = True |
||
3909 | 1bfcc921 | Gyusu | End If |
3910 | 'If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3911 | ' Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3912 | ' For Each objConnectorVertex In objConnector.ConnectorVertices |
||
3913 | ' Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
3914 | ' Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
3915 | ' If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
3916 | ' oLMConnector = objConnector |
||
3917 | ' dX = dConn_X |
||
3918 | ' dY = dConn_Y |
||
3919 | ' bConnectionFlag = True |
||
3920 | ' End If |
||
3921 | ' Next |
||
3922 | 'End If |
||
3923 | Next |
||
3924 | End If |
||
3925 | Catch ex As Exception |
||
3926 | End Try |
||
3927 | ' oUid = oModelrow(_XML_LINE_UID).ToString() |
||
3928 | b82166d4 | Gyusu | ' Dim oID As String = oModelrow(_XML_LINE_SPID) |
3929 | 1bfcc921 | Gyusu | ' oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
3930 | b82166d4 | Gyusu | ' oID = oLMConnector.ModelItemID |
3931 | ' oLMConnector = _Placement.PIDDataSource.GetConnector(oID) |
||
3932 | 1bfcc921 | Gyusu | 'If oLMConnector IsNot Nothing Then |
3933 | ' Exit For |
||
3934 | 'End If |
||
3935 | 79326880 | Gyusu | End If |
3936 | |||
3937 | |||
3938 | Next |
||
3939 | Catch ex As Exception |
||
3940 | 1bfcc921 | Gyusu | bCheckBranchItem = False |
3941 | 79326880 | Gyusu | oLMConnector = Nothing |
3942 | End Try |
||
3943 | 1bfcc921 | Gyusu | Return bCheckBranchItem |
3944 | 79326880 | Gyusu | End Function |
3945 | |||
3946 | 3b7a4470 | Gyusu | ''' <summary> |
3947 | ''' 라인과 특정 포인트에 커넥션을 확인하는 메서드 |
||
3948 | ''' </summary> |
||
3949 | ''' <param name="oModelingLineRows"></param> |
||
3950 | ''' <param name="dX"></param> |
||
3951 | ''' <param name="dY"></param> |
||
3952 | ''' <param name="oLMConnector"></param> |
||
3953 | ''' <param name="dPreConnX"></param> |
||
3954 | ''' <param name="dPreConnY"></param> |
||
3955 | ''' <returns></returns> |
||
3956 | |||
3957 | 79326880 | Gyusu | Private Function CheckConnectionLine(ByRef dX As Double, ByRef dY As Double, |
3958 | b82166d4 | Gyusu | ByRef oLMConnector As LMConnector, ByRef sUid As String) As Boolean |
3959 | b08338e3 | Gyusu | Dim bConnectionFlag As Boolean = False |
3960 | 76f465d0 | Gyusu | Dim iGapCheck As Integer = 0 |
3961 | b08338e3 | Gyusu | Try |
3962 | 79326880 | Gyusu | For Each oModelrow In _ModelingLine_Dt.Rows |
3963 | 76f465d0 | Gyusu | Dim d기준x As Double = dX |
3964 | Dim d기준y As Double = dY |
||
3965 | 1bfcc921 | Gyusu | Dim dGap As Double = 0.001 |
3966 | 76f465d0 | Gyusu | Dim oRun As LMPipeRun = Nothing |
3967 | b08338e3 | Gyusu | Dim dModelStartX As Double |
3968 | Dim dModelStartY As Double |
||
3969 | Dim dModelEndX As Double |
||
3970 | Dim dModelEndY As Double |
||
3971 | 76f465d0 | Gyusu | dModelStartX = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
3972 | dModelStartY = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
3973 | dModelEndX = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
3974 | dModelEndY = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
3975 | d기준x = (dModelStartX + dModelEndX) / 2 |
||
3976 | d기준y = (dModelStartY + dModelEndY) / 2 |
||
3977 | 79326880 | Gyusu | |
3978 | Dim bCheckEqual As Boolean = False |
||
3979 | If dX <= dModelStartX + dGap And dX >= dModelStartX - dGap And |
||
3980 | dY <= dModelStartY + dGap And dY >= dModelStartY - dGap Then |
||
3981 | bCheckEqual = True |
||
3982 | ElseIf dX <= dModelEndX + dGap And dX >= dModelEndX - dGap And |
||
3983 | dY <= dModelEndY + dGap And dY >= dModelEndY - dGap Then |
||
3984 | bCheckEqual = True |
||
3985 | End If |
||
3986 | If bCheckEqual Then |
||
3987 | Try |
||
3988 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
3989 | b82166d4 | Gyusu | sUid = oModelrow(_XML_LINE_UID) |
3990 | 79326880 | Gyusu | oRun = _Placement.PIDDataSource.GetPipeRun(oLMConnector.ModelItemID) |
3991 | Catch ex As Exception |
||
3992 | End Try |
||
3993 | Try |
||
3994 | If oRun IsNot Nothing Then |
||
3995 | Dim dResultCalc As Double = -1 |
||
3996 | For Each objRep In oRun.Representations |
||
3997 | If objRep.Attributes("RepresentationType").Value = "Connector" And objRep.Attributes("ItemStatus").Value = "Active" Then |
||
3998 | Dim objConnector As LMConnector = _Placement.PIDDataSource.GetConnector(objRep.ID) |
||
3999 | For Each objConnectorVertex In objConnector.ConnectorVertices |
||
4000 | Dim dConn_X As Double = objConnectorVertex.Attributes("XCoordinate").Value |
||
4001 | Dim dConn_Y As Double = objConnectorVertex.Attributes("YCoordinate").Value |
||
4002 | If Math.Abs(dX - dConn_X) < dGap And Math.Abs(dY - dConn_Y) < dGap Then |
||
4003 | oLMConnector = objConnector |
||
4004 | dX = dConn_X |
||
4005 | dY = dConn_Y |
||
4006 | bConnectionFlag = True |
||
4007 | End If |
||
4008 | Next |
||
4009 | End If |
||
4010 | Next |
||
4011 | End If |
||
4012 | Catch ex As Exception |
||
4013 | End Try |
||
4014 | Else |
||
4015 | End If |
||
4016 | b08338e3 | Gyusu | Next |
4017 | Catch ex As Exception |
||
4018 | 76f465d0 | Gyusu | bConnectionFlag = False |
4019 | oLMConnector = Nothing |
||
4020 | b08338e3 | Gyusu | End Try |
4021 | Return bConnectionFlag |
||
4022 | End Function |
||
4023 | |||
4024 | 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 |
4025 | '현재선의 방향을 보고 상대라인이 직교되는 방향인지 체크 |
||
4026 | '오차범위를 줘서 현재선을 통과하는지 체크 |
||
4027 | '통과하는 상대라인 갯수를 먼저 구한다음 라인 갯수만큼 라인을 그린다. |
||
4028 | Dim bCheckBranchLine As Boolean = False |
||
4029 | dd46ca83 | Gyusu | Dim sCurrentDirection As String = "" |
4030 | |||
4031 | Dim oModel_Dt As New DataTable() |
||
4032 | oModel_Dt.Columns.Add("X") |
||
4033 | oModel_Dt.Columns.Add("Y") |
||
4034 | oModel_Dt.Columns.Add("Type") |
||
4035 | oModel_Dt.Columns.Add("SPID") |
||
4036 | Dim dGap = 0.001 |
||
4037 | If Math.Abs(dStartX - dEndX) > Math.Abs(dStartY - dEndY) Then |
||
4038 | sCurrentDirection = "X" |
||
4039 | If dStartX > dEndX Then |
||
4040 | Dim dTempX As Double = dEndX |
||
4041 | dEndX = dStartX |
||
4042 | dStartX = dTempX |
||
4043 | Dim dTempY As Double = dEndY |
||
4044 | dEndY = dStartY |
||
4045 | dStartY = dTempY |
||
4046 | End If |
||
4047 | '현재선이 X축방향 |
||
4048 | Try |
||
4049 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
4050 | Dim dModelStart_X As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
4051 | Dim dModelStart_Y As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
4052 | Dim dModelEnd_X As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
4053 | Dim dModelEnd_Y As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
4054 | Dim sSPID As String = oModelrow(_XML_LINE_SPID) |
||
4055 | If dStartX < dModelStart_X And dStartX < dModelEnd_X And |
||
4056 | dEndX > dModelStart_X And dEndX > dModelEnd_X Then |
||
4057 | 496a0241 | Gyusu | Dim dAddX As Double = dStartX |
4058 | dd46ca83 | Gyusu | Dim dAddY As Double = dStartY |
4059 | Dim sType As String = "" |
||
4060 | 496a0241 | Gyusu | Dim dAddLineX As Double = 0 |
4061 | Dim dAddLineY As Double = 0 |
||
4062 | dd46ca83 | Gyusu | If dStartY = dModelStart_Y Then |
4063 | 496a0241 | Gyusu | dAddX = 0 |
4064 | ' dAddX = dModelStart_X |
||
4065 | dd46ca83 | Gyusu | ElseIf dStartY = dModelEnd_Y Then |
4066 | 496a0241 | Gyusu | dAddX = 0 |
4067 | ' dAddX = dModelEnd_X |
||
4068 | dd46ca83 | Gyusu | ElseIf dStartY <= dModelStart_Y + dGap And dStartY >= dModelStart_Y - dGap Then |
4069 | dAddX = dModelStart_X |
||
4070 | 496a0241 | Gyusu | If dStartY <= dModelStart_Y Then |
4071 | dd46ca83 | Gyusu | sType = "AddLine" |
4072 | 496a0241 | Gyusu | dAddLineX = dModelStart_X |
4073 | dAddLineY = dModelStart_Y |
||
4074 | dd46ca83 | Gyusu | End If |
4075 | ElseIf dStartY <= dModelEnd_Y + dGap And dStartY >= dModelEnd_Y - dGap Then |
||
4076 | dAddX = dModelEnd_X |
||
4077 | 496a0241 | Gyusu | If dStartY <= dModelEnd_Y Then |
4078 | dd46ca83 | Gyusu | sType = "AddLine" |
4079 | 496a0241 | Gyusu | dAddLineX = dModelEnd_X |
4080 | dAddLineY = dModelEnd_Y |
||
4081 | dd46ca83 | Gyusu | End If |
4082 | End If |
||
4083 | 496a0241 | Gyusu | If sType = "AddLine" Then |
4084 | Dim objInputs As PlaceRunInputs |
||
4085 | objInputs = New PlaceRunInputs |
||
4086 | Dim oLMConnector As LMConnector = Nothing |
||
4087 | CheckConnectionLine(dAddLineX, dAddLineY, oLMConnector, "") |
||
4088 | objInputs.AddPoint(dAddLineX, dAddY) |
||
4089 | objInputs.AddConnectorTarget(oLMConnector, dAddLineX, dAddLineY) |
||
4090 | Dim AddLMConnector As LMConnector = LineModeling(objInputs, sSystemPath) |
||
4091 | JoinPipeRun(oLMConnector.ModelItemID, AddLMConnector.ModelItemID) |
||
4092 | dStartY = dAddY |
||
4093 | End If |
||
4094 | |||
4095 | dd46ca83 | Gyusu | If dAddX <> 0 Then |
4096 | Dim oDatarow As DataRow = oModel_Dt.NewRow() |
||
4097 | oDatarow("X") = dAddX |
||
4098 | oDatarow("Y") = dAddY |
||
4099 | oDatarow("Type") = sType |
||
4100 | oDatarow("SPID") = sSPID |
||
4101 | oModel_Dt.Rows.Add(oDatarow) |
||
4102 | End If |
||
4103 | End If |
||
4104 | Next |
||
4105 | Catch ex As Exception |
||
4106 | End Try |
||
4107 | Else |
||
4108 | '현재선이 y축방향 |
||
4109 | sCurrentDirection = "Y" |
||
4110 | Try |
||
4111 | For Each oModelrow In _ModelingLine_Dt.Rows |
||
4112 | Dim dModelStart_X As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_X) |
||
4113 | Dim dModelStart_Y As Double = oModelrow(_XML_LINE_DWG_STARTPOINT_Y) |
||
4114 | Dim dModelEnd_X As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_X) |
||
4115 | Dim dModelEnd_Y As Double = oModelrow(_XML_LINE_DWG_ENDPOINT_Y) |
||
4116 | Dim sSPID As String = oModelrow(_XML_LINE_SPID) |
||
4117 | If dStartY < dModelStart_Y And dStartY < dModelEnd_Y And |
||
4118 | dEndY > dModelStart_Y And dEndY > dModelEnd_Y Then |
||
4119 | Dim dAddX As Double = dStartX |
||
4120 | 496a0241 | Gyusu | Dim dAddY As Double = dStartY |
4121 | dd46ca83 | Gyusu | Dim sType As String = "" |
4122 | 496a0241 | Gyusu | Dim dAddLineX As Double = 0 |
4123 | Dim dAddLineY As Double = 0 |
||
4124 | dd46ca83 | Gyusu | If dStartX = dModelStart_X Then |
4125 | 496a0241 | Gyusu | dAddY = 0 |
4126 | ' dAddY = dModelStart_Y |
||
4127 | dd46ca83 | Gyusu | ElseIf dStartX = dModelEnd_X Then |
4128 | 496a0241 | Gyusu | dAddY = 0 |
4129 | ' dAddY = dModelEnd_Y |
||
4130 | dd46ca83 | Gyusu | ElseIf dStartX <= dModelStart_X + dGap And dStartX >= dModelStart_X - dGap Then |
4131 | 496a0241 | Gyusu | ' dAddY = dModelStart_Y |
4132 | If dStartX <= dModelStart_X Then |
||
4133 | dAddLineX = dModelStart_X |
||
4134 | dAddLineY = dModelStart_Y |
||
4135 | dd46ca83 | Gyusu | sType = "AddLine" |
4136 | End If |
||
4137 | ElseIf dStartX <= dModelEnd_X + dGap And dStartX >= dModelEnd_X - dGap Then |
||
4138 | 496a0241 | Gyusu | ' dAddY = dModelEnd_Y |
4139 | If dStartX <= dModelEnd_X Then |
||
4140 | dAddLineX = dModelEnd_X |
||
4141 | dAddLineY = dModelEnd_Y |
||
4142 | dd46ca83 | Gyusu | sType = "AddLine" |
4143 | End If |
||
4144 | End If |
||
4145 | 496a0241 | Gyusu | If sType = "AddLine" Then |
4146 | Dim objInputs As PlaceRunInputs |
||
4147 | objInputs = New PlaceRunInputs |
||
4148 | Dim oLMConnector As LMConnector = Nothing |
||
4149 | CheckConnectionLine(dAddLineX, dAddLineY, oLMConnector, "") |
||
4150 | objInputs.AddPoint(dAddX, dAddLineY) |
||
4151 | objInputs.AddConnectorTarget(oLMConnector, dAddLineX, dAddLineY) |
||
4152 | Dim AddLMConnector As LMConnector = LineModeling(objInputs, sSystemPath) |
||
4153 | JoinPipeRun(oLMConnector.ModelItemID, AddLMConnector.ModelItemID) |
||
4154 | dStartX = dAddX |
||
4155 | End If |
||
4156 | |||
4157 | If dAddY <> 0 Then |
||
4158 | dd46ca83 | Gyusu | Dim oDatarow As DataRow = oModel_Dt.NewRow() |
4159 | oDatarow("X") = dAddX |
||
4160 | oDatarow("Y") = dAddY |
||
4161 | oDatarow("Type") = sType |
||
4162 | oDatarow("SPID") = sSPID |
||
4163 | oModel_Dt.Rows.Add(oDatarow) |
||
4164 | End If |
||
4165 | End If |
||
4166 | Next |
||
4167 | Catch ex As Exception |
||
4168 | End Try |
||
4169 | End If |
||
4170 | |||
4171 | '//못미치는 라인은 라인길이를 더한후 나머지 모델링(2018.09.27) |
||
4172 | |||
4173 | If oModel_Dt.Rows.Count > 0 Then |
||
4174 | If sCurrentDirection = "X" Then |
||
4175 | 'X좌표 정렬 |
||
4176 | oModel_Dt.DefaultView.Sort = "X desc" |
||
4177 | oModel_Dt = oModel_Dt.DefaultView.ToTable(True) |
||
4178 | Else |
||
4179 | 'Y좌표 정렬 |
||
4180 | oModel_Dt.DefaultView.Sort = "Y desc" |
||
4181 | oModel_Dt = oModel_Dt.DefaultView.ToTable(True) |
||
4182 | End If |
||
4183 | Dim oLMConnector As LMConnector = Nothing |
||
4184 | Dim oPreLMConnector As LMConnector = Nothing |
||
4185 | Dim dStartFlag As Boolean = True |
||
4186 | For Each oModelRow In oModel_Dt.Rows |
||
4187 | Dim objInputs As PlaceRunInputs |
||
4188 | objInputs = New PlaceRunInputs |
||
4189 | Dim dX As Double = oModelRow("X") |
||
4190 | Dim dY As Double = oModelRow("Y") |
||
4191 | Dim sType As String = oModelRow("Type") |
||
4192 | Dim sUid As String = "" |
||
4193 | 496a0241 | Gyusu | |
4194 | |||
4195 | dd46ca83 | Gyusu | CheckConnectionLine(dX, dY, oLMConnector, sUid) |
4196 | If oLMConnector IsNot Nothing Then |
||
4197 | If dStartFlag Then |
||
4198 | objInputs.AddPoint(dStartX, dStartY) |
||
4199 | objInputs.AddConnectorTarget(oLMConnector, dX, dY) |
||
4200 | Else |
||
4201 | objInputs.AddConnectorTarget(oPreLMConnector, dStartX, dStartY) |
||
4202 | objInputs.AddConnectorTarget(oLMConnector, dX, dY) |
||
4203 | End If |
||
4204 | oPreLMConnector = LineModeling(objInputs, sSystemPath) |
||
4205 | '모델링후 StartX를 현재 X로 변경 |
||
4206 | dStartX = dX |
||
4207 | dStartY = dY |
||
4208 | End If |
||
4209 | Next |
||
4210 | If oPreLMConnector IsNot Nothing Then |
||
4211 | Dim objInputs As PlaceRunInputs |
||
4212 | objInputs = New PlaceRunInputs |
||
4213 | objInputs.AddConnectorTarget(oPreLMConnector, dStartX, dStartY) |
||
4214 | objInputs.AddPoint(dEndX, dEndY) |
||
4215 | LineModeling(objInputs, sSystemPath) |
||
4216 | End If |
||
4217 | End If |
||
4218 | 1bfcc921 | Gyusu | Return bCheckBranchLine |
4219 | End Function |
||
4220 | |||
4221 | |||
4222 | b08338e3 | Gyusu | Private Function CheckLineBranch(ByVal oLine_Dt As DataTable, ByRef dX As Double, ByRef dY As Double, |
4223 | ByVal sDirection As String, ByRef oLMConnector As LMConnector) As Boolean |
||
4224 | |||
4225 | 496a0241 | Gyusu | Dim oModelingLineRows() As DataRow = oLine_Dt.Select(" Then[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And " & |
4226 | b08338e3 | Gyusu | "[" & _XML_LINE_SPID & "] <> ''") |
4227 | |||
4228 | Dim bConnectionFlag As Boolean = False |
||
4229 | Try |
||
4230 | For Each oModelrow In oModelingLineRows |
||
4231 | Dim sStartPoint As String = oModelrow(_XML_LINE_STARTPOINT) |
||
4232 | Dim sEndPoint As String = oModelrow(_XML_LINE_ENDPOINT) |
||
4233 | Dim dModelStartX As Double |
||
4234 | Dim dModelStartY As Double |
||
4235 | Dim dModelEndX As Double |
||
4236 | Dim dModelEndY As Double |
||
4237 | ConvertPointBystring(sStartPoint, dModelStartX, dModelStartY) |
||
4238 | ConvertPointBystring(sEndPoint, dModelEndX, dModelEndY) |
||
4239 | ConvertPointByImage(dModelStartX, dModelStartY, _IMG_X, _IMG_Y) |
||
4240 | ConvertPointByImage(dModelEndX, dModelEndY, _IMG_X, _IMG_Y) |
||
4241 | Dim dGap As Double = 0.0002 |
||
4242 | |||
4243 | If Math.Abs(dModelStartX - dModelEndX) <= Math.Abs(dModelStartY - dModelEndY) Then |
||
4244 | 'Vertical |
||
4245 | If sDirection = "X" Then |
||
4246 | 'x Direction Line |
||
4247 | If (dModelStartY + dGap >= dY And dModelEndY - dGap <= dY) Or |
||
4248 | (dModelStartY - dGap <= dY And dModelEndY + dGap >= dY) Then |
||
4249 | If (dX > dModelStartX And dX < dModelEndX) Or (dX > dModelEndX And dX < dModelStartX) Then |
||
4250 | If Math.Abs(dX - dModelStartX) > Math.Abs(dX - dModelEndX) Then |
||
4251 | dX = dModelEndX |
||
4252 | Else |
||
4253 | dX = dModelStartX |
||
4254 | End If |
||
4255 | Try |
||
4256 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
4257 | Catch ex As Exception |
||
4258 | |||
4259 | End Try |
||
4260 | bConnectionFlag = True |
||
4261 | End If |
||
4262 | End If |
||
4263 | End If |
||
4264 | Else |
||
4265 | 'Horizontal |
||
4266 | If sDirection = "Y" Then |
||
4267 | If (dModelStartX + dGap >= dX And dModelEndX - dGap <= dX) Or |
||
4268 | (dModelStartX - dGap <= dX And dModelEndX + dGap >= dX) Then |
||
4269 | If (dY > dModelStartY And dY < dModelEndY) Or (dY > dModelEndY And dY < dModelStartY) Then |
||
4270 | If Math.Abs(dY - dModelStartY) > Math.Abs(dY - dModelEndY) Then |
||
4271 | dY = dModelEndY |
||
4272 | Else |
||
4273 | dY = dModelStartY |
||
4274 | End If |
||
4275 | Try |
||
4276 | oLMConnector = oModelrow(_XML_LINE_LMCONNECTOR) |
||
4277 | Catch ex As Exception |
||
4278 | End Try |
||
4279 | bConnectionFlag = True |
||
4280 | End If |
||
4281 | End If |
||
4282 | End If |
||
4283 | End If |
||
4284 | Next |
||
4285 | Catch ex As Exception |
||
4286 | End Try |
||
4287 | Return bConnectionFlag |
||
4288 | End Function |
||
4289 | 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, |
||
4290 | ByVal sLineNoUid As String, ByVal sLineUid As String, ByVal sSystemPath As String, ByRef oLMConnector As LMConnector) As Boolean |
||
4291 | 76f465d0 | Gyusu | 'Try |
4292 | ' Dim oDatasource As Object = _Placement.PIDDataSource |
||
4293 | ' Dim oPipeRun As LMPipeRun = Nothing |
||
4294 | ' Dim objInputs As PlaceRunInputs |
||
4295 | ' objInputs = New PlaceRunInputs |
||
4296 | ' Dim objItem As LMAItem |
||
4297 | ' ' Dim objConnector As LMConnector |
||
4298 | |||
4299 | ' Dim oStartLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sStartLineUid & "' And " & |
||
4300 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4301 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4302 | ' If oStartLineRow.Length = 0 Then |
||
4303 | ' oStartLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sStartLineUid & "' And " & |
||
4304 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4305 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4306 | ' End If |
||
4307 | ' Dim oEndLineRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sEndLineUid & "' And " & |
||
4308 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4309 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4310 | |||
4311 | ' oEndLineRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sEndLineUid & "' And " & |
||
4312 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'TRUE' And" & |
||
4313 | ' "[" & _XML_LINE_SPID & "] <> ''") |
||
4314 | ' Dim sStartConnectionType As String = "" |
||
4315 | ' Dim sEndConnectionType As String = "" |
||
4316 | |||
4317 | ' Dim oStartLMConnector As LMConnector = Nothing |
||
4318 | ' Dim oEndLMConnector As LMConnector = Nothing |
||
4319 | ' Dim oDirectionLine As String = "" |
||
4320 | |||
4321 | ' If Math.Abs(dStart_x - dEnd_x) > Math.Abs(dStart_y - dEnd_y) Then |
||
4322 | ' oDirectionLine = "X" |
||
4323 | ' Else |
||
4324 | ' oDirectionLine = "Y" |
||
4325 | ' End If |
||
4326 | b08338e3 | Gyusu | |
4327 | 76f465d0 | Gyusu | ' Dim bCheckFlag As Boolean = False |
4328 | b08338e3 | Gyusu | |
4329 | 76f465d0 | Gyusu | ' Dim bStartCheckFlag As Boolean = CheckConnectionLine(oStartLineRow, dStart_x, dStart_y, oStartLMConnector) |
4330 | ' If bStartCheckFlag = False Then |
||
4331 | ' bStartCheckFlag = CheckConnectionLine(oStartLineRow, dEnd_x, dEnd_y, oStartLMConnector) |
||
4332 | ' bCheckFlag = True |
||
4333 | ' End If |
||
4334 | ' Dim bEndCheckFlag As Boolean = CheckConnectionLine(oEndLineRow, dEnd_x, dEnd_y, oEndLMConnector) |
||
4335 | b08338e3 | Gyusu | |
4336 | 76f465d0 | Gyusu | ' If bEndCheckFlag = False Then |
4337 | b08338e3 | Gyusu | |
4338 | 76f465d0 | Gyusu | ' bEndCheckFlag = CheckConnectionLine(oEndLineRow, dStart_x, dStart_y, oEndLMConnector) |
4339 | ' bCheckFlag = True |
||
4340 | ' End If |
||
4341 | b08338e3 | Gyusu | |
4342 | 76f465d0 | Gyusu | ' If bStartCheckFlag = True And bEndCheckFlag = False Then |
4343 | ' If bCheckFlag Then |
||
4344 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
4345 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4346 | ' Else |
||
4347 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
4348 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4349 | ' End If |
||
4350 | |||
4351 | ' ElseIf bStartCheckFlag = False And bEndCheckFlag = True Then |
||
4352 | ' If bCheckFlag Then |
||
4353 | |||
4354 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
4355 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4356 | ' Else |
||
4357 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4358 | ' objInputs.AddConnectorTarget(oStartLMConnector, dEnd_x, dEnd_y) |
||
4359 | ' End If |
||
4360 | |||
4361 | ' ElseIf bStartCheckFlag = True And bEndCheckFlag = True Then |
||
4362 | ' objInputs.AddConnectorTarget(oStartLMConnector, dStart_x, dStart_y) |
||
4363 | ' objInputs.AddConnectorTarget(oEndLMConnector, dEnd_x, dEnd_y) |
||
4364 | ' Else |
||
4365 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
4366 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4367 | ' End If |
||
4368 | ' SetListBoxItems(ListBox_Result, "Place Pipe..(" & dStart_x & "," & dStart_y & ") - (" & dEnd_x & "," & dEnd_y & ")..." & _iPipecnt & " count ") |
||
4369 | ' _iPipecnt = _iPipecnt + 1 |
||
4370 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4371 | ' oLMConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4372 | b08338e3 | Gyusu | |
4373 | 76f465d0 | Gyusu | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + sLineUid + "'") |
4374 | ' If oUpdateRow.Length = 1 Then |
||
4375 | ' oUpdateRow(0)(_XML_LINE_SPID) = oLMConnector.ModelItemID |
||
4376 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = oLMConnector |
||
4377 | b08338e3 | Gyusu | |
4378 | 76f465d0 | Gyusu | ' oUpdateRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
4379 | ' End If |
||
4380 | b08338e3 | Gyusu | |
4381 | 76f465d0 | Gyusu | ' oPipeRun = oDatasource.GetPipeRun(oLMConnector.ModelItemID) |
4382 | |||
4383 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4384 | ' If oAttributeRow.Length > 0 Then |
||
4385 | ' For Each oAttribute In oAttributeRow |
||
4386 | ' Try |
||
4387 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4388 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4389 | ' If sPIDValue.Contains("'") Then |
||
4390 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
4391 | ' End If |
||
4392 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4393 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4394 | ' Catch ex As Exception |
||
4395 | ' End Try |
||
4396 | ' Next |
||
4397 | ' oPipeRun.Commit() |
||
4398 | ' End If |
||
4399 | ' Dim sID_1 As String = "" |
||
4400 | ' Dim sID_2 As String = "" |
||
4401 | ' If oStartLMConnector IsNot Nothing Then |
||
4402 | ' sID_1 = oStartLMConnector.ModelItemID |
||
4403 | ' sID_2 = oLMConnector.ModelItemID |
||
4404 | ' ElseIf oEndLMConnector IsNot Nothing Then |
||
4405 | ' sID_1 = oEndLMConnector.ModelItemID |
||
4406 | ' sID_2 = oLMConnector.ModelItemID |
||
4407 | ' End If |
||
4408 | ' If sID_1 <> "" And sID_2 <> "" Then |
||
4409 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
4410 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
4411 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
4412 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
4413 | ' End If |
||
4414 | ' Return True |
||
4415 | 'Catch ex As Exception |
||
4416 | ' Return False |
||
4417 | 'End Try |
||
4418 | b08338e3 | Gyusu | |
4419 | End Function |
||
4420 | |||
4421 | Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
4422 | ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String, |
||
4423 | ByRef oLMConnector As LMConnector) As String |
||
4424 | Dim sReturnUid As String = "" |
||
4425 | Try |
||
4426 | Dim sLineUid As String = "" |
||
4427 | |||
4428 | Dim iConnType As Integer = 0 |
||
4429 | |||
4430 | Dim sStartpoint As String = "" |
||
4431 | Dim sEndpoint As String = "" |
||
4432 | bb2a0c79 | Gyusu | Dim dOriginalStart_x As Double = 0.0 |
4433 | Dim dOriginalStart_y As Double = 0.0 |
||
4434 | Dim dOriginalEnd_x As Double = 0.0 |
||
4435 | Dim dOriginalEnd_y As Double = 0.0 |
||
4436 | |||
4437 | b08338e3 | Gyusu | Dim dStart_x As Double = 0 |
4438 | Dim dStart_y As Double = 0 |
||
4439 | Dim dEnd_x As Double = 0 |
||
4440 | Dim dEnd_y As Double = 0 |
||
4441 | Dim sStartLineUid As String = sConnLineUid |
||
4442 | Dim sEndLineUid As String = "" |
||
4443 | Dim sDirection As String = "" |
||
4444 | Dim sSystemPath As String = GetPipeType(sType) |
||
4445 | |||
4446 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
4447 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4448 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4449 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4450 | If oPipeRow.Length > 0 Then |
||
4451 | bb2a0c79 | Gyusu | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
4452 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4453 | e4000111 | Gyusu | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
4454 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4455 | b08338e3 | Gyusu | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
4456 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4457 | If dStart_x = 0 And dStart_y = 0 Then |
||
4458 | dStart_x = dOriginalStart_x |
||
4459 | dStart_y = dOriginalStart_y |
||
4460 | dEnd_x = dOriginalEnd_x |
||
4461 | dEnd_y = dOriginalEnd_y |
||
4462 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4463 | sDirection = "X" |
||
4464 | Else |
||
4465 | sDirection = "Y" |
||
4466 | End If |
||
4467 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4468 | sLineUid = sConnLineUid |
||
4469 | End If |
||
4470 | End If |
||
4471 | bb2a0c79 | Gyusu | |
4472 | b08338e3 | Gyusu | While True |
4473 | sLineUid = "" |
||
4474 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
4475 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
4476 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4477 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4478 | b08338e3 | Gyusu | |
4479 | If oPipeRow.Length = 0 Then |
||
4480 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
4481 | f9b63682 | Gyusu | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
4482 | "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4483 | "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4484 | bb2a0c79 | Gyusu | Else |
4485 | b08338e3 | Gyusu | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
4486 | 'sConnLineUid = sLineUid |
||
4487 | sLineUid = sConnLineUid |
||
4488 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4489 | iConnType = 1 |
||
4490 | End If |
||
4491 | |||
4492 | If oPipeRow.Length > 0 Then |
||
4493 | If sLineUid = "" Then |
||
4494 | 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4495 | 'sConnLineUid = sLineUid |
||
4496 | sLineUid = sConnLineUid |
||
4497 | sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4498 | iConnType = 2 |
||
4499 | End If |
||
4500 | If iConnType = 1 Then |
||
4501 | |||
4502 | ElseIf iConnType = 2 Then |
||
4503 | |||
4504 | End If |
||
4505 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4506 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4507 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4508 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4509 | ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4510 | ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4511 | |||
4512 | If dStart_x = 0 And dStart_y = 0 Then |
||
4513 | dStart_x = dOriginalStart_x |
||
4514 | dStart_y = dOriginalStart_y |
||
4515 | dEnd_x = dOriginalEnd_x |
||
4516 | dEnd_y = dOriginalEnd_y |
||
4517 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4518 | sDirection = "X" |
||
4519 | Else |
||
4520 | sDirection = "Y" |
||
4521 | End If |
||
4522 | sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4523 | sSystemPath = GetPipeType(sType) |
||
4524 | Else |
||
4525 | If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4526 | If sDirection = "Y" Then |
||
4527 | '방향이 바꼈음 Y - > X |
||
4528 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4529 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4530 | dStart_x = dOriginalStart_x |
||
4531 | dStart_y = dOriginalStart_y |
||
4532 | dEnd_x = dOriginalEnd_x |
||
4533 | dEnd_y = dOriginalEnd_y |
||
4534 | sStartLineUid = sConnLineUid |
||
4535 | Else |
||
4536 | dEnd_x = dOriginalEnd_x |
||
4537 | dEnd_y = dOriginalEnd_y |
||
4538 | End If |
||
4539 | sDirection = "X" |
||
4540 | Else |
||
4541 | If sDirection = "X" Then |
||
4542 | '방향이 바꼈음 X - > Y |
||
4543 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4544 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4545 | dStart_x = dOriginalStart_x |
||
4546 | dStart_y = dOriginalStart_y |
||
4547 | dEnd_x = dOriginalEnd_x |
||
4548 | dEnd_y = dOriginalEnd_y |
||
4549 | sStartLineUid = sConnLineUid |
||
4550 | Else |
||
4551 | |||
4552 | dEnd_x = dOriginalEnd_x |
||
4553 | dEnd_y = dOriginalEnd_y |
||
4554 | End If |
||
4555 | sDirection = "Y" |
||
4556 | End If |
||
4557 | End If |
||
4558 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4559 | Else |
||
4560 | If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
4561 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4562 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4563 | End If |
||
4564 | sReturnUid = sConnLineUid |
||
4565 | Exit While |
||
4566 | End If |
||
4567 | End While |
||
4568 | |||
4569 | If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
4570 | LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4571 | sLineNoUid, sLineUid, sSystemPath, oLMConnector) |
||
4572 | dStart_x = 0 |
||
4573 | dStart_y = 0 |
||
4574 | dEnd_x = 0 |
||
4575 | dEnd_y = 0 |
||
4576 | End If |
||
4577 | Catch ex As Exception |
||
4578 | |||
4579 | End Try |
||
4580 | |||
4581 | Return sReturnUid |
||
4582 | End Function |
||
4583 | |||
4584 | |||
4585 | 'Private Function LineToLineModeling(ByVal sLineNoUid As String, ByVal oLine_Dt As DataTable, |
||
4586 | ' ByVal oAttribute_Dt As DataTable, ByVal sConnLineUid As String, ByVal sType As String) As String |
||
4587 | ' Dim sReturnUid As String = "" |
||
4588 | ' Try |
||
4589 | ' Dim sLineUid As String = "" |
||
4590 | |||
4591 | ' Dim iConnType As Integer = 0 |
||
4592 | |||
4593 | ' Dim sStartpoint As String = "" |
||
4594 | ' Dim sEndpoint As String = "" |
||
4595 | ' Dim dOriginalStart_x As Double = 0.0 |
||
4596 | ' Dim dOriginalStart_y As Double = 0.0 |
||
4597 | ' Dim dOriginalEnd_x As Double = 0.0 |
||
4598 | ' Dim dOriginalEnd_y As Double = 0.0 |
||
4599 | |||
4600 | ' Dim dStart_x As Double = 0 |
||
4601 | ' Dim dStart_y As Double = 0 |
||
4602 | ' Dim dEnd_x As Double = 0 |
||
4603 | ' Dim dEnd_y As Double = 0 |
||
4604 | ' Dim sStartLineUid As String = sConnLineUid |
||
4605 | ' Dim sEndLineUid As String = "" |
||
4606 | ' Dim sDirection As String = "" |
||
4607 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
4608 | |||
4609 | ' Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_UID & " = '" & sConnLineUid & "' And " & |
||
4610 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4611 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4612 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4613 | ' If oPipeRow.Length > 0 Then |
||
4614 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4615 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4616 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4617 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4618 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4619 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4620 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
4621 | ' dStart_x = dOriginalStart_x |
||
4622 | ' dStart_y = dOriginalStart_y |
||
4623 | ' dEnd_x = dOriginalEnd_x |
||
4624 | ' dEnd_y = dOriginalEnd_y |
||
4625 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4626 | ' sDirection = "X" |
||
4627 | ' Else |
||
4628 | ' sDirection = "Y" |
||
4629 | ' End If |
||
4630 | ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4631 | ' sLineUid = sConnLineUid |
||
4632 | ' End If |
||
4633 | ' End If |
||
4634 | |||
4635 | ' While True |
||
4636 | ' sLineUid = "" |
||
4637 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sConnLineUid + "' And " & |
||
4638 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4639 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4640 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4641 | |||
4642 | ' If oPipeRow.Length = 0 Then |
||
4643 | ' oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sConnLineUid + "' And " & |
||
4644 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And" & |
||
4645 | ' "[" & _XML_SYMBOL_Check & "] = 'TRUE' And " & |
||
4646 | ' "[" & _XML_SYMBOL_TYPE & "] = '" & sType & "'") |
||
4647 | ' Else |
||
4648 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4649 | ' 'sConnLineUid = sLineUid |
||
4650 | ' sLineUid = sConnLineUid |
||
4651 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4652 | ' iConnType = 1 |
||
4653 | ' End If |
||
4654 | |||
4655 | ' If oPipeRow.Length > 0 Then |
||
4656 | ' If sLineUid = "" Then |
||
4657 | ' 'sLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4658 | ' 'sConnLineUid = sLineUid |
||
4659 | ' sLineUid = sConnLineUid |
||
4660 | ' sConnLineUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4661 | ' iConnType = 2 |
||
4662 | ' End If |
||
4663 | ' If iConnType = 1 Then |
||
4664 | |||
4665 | ' ElseIf iConnType = 2 Then |
||
4666 | |||
4667 | ' End If |
||
4668 | ' sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4669 | ' sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4670 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4671 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4672 | ' ConvertPointByImage(dOriginalStart_x, dOriginalStart_y, _IMG_X, _IMG_Y) |
||
4673 | ' ConvertPointByImage(dOriginalEnd_x, dOriginalEnd_y, _IMG_X, _IMG_Y) |
||
4674 | |||
4675 | |||
4676 | |||
4677 | ' If dStart_x = 0 And dStart_y = 0 Then |
||
4678 | ' dStart_x = dOriginalStart_x |
||
4679 | ' dStart_y = dOriginalStart_y |
||
4680 | ' dEnd_x = dOriginalEnd_x |
||
4681 | ' dEnd_y = dOriginalEnd_y |
||
4682 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4683 | ' sDirection = "X" |
||
4684 | ' Else |
||
4685 | ' sDirection = "Y" |
||
4686 | ' End If |
||
4687 | ' sType = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4688 | ' sSystemPath = GetPipeType(sType) |
||
4689 | ' Else |
||
4690 | ' If Math.Abs(dOriginalStart_x - dOriginalEnd_x) > Math.Abs(dOriginalStart_y - dOriginalEnd_y) Then |
||
4691 | ' If sDirection = "Y" Then |
||
4692 | ' '방향이 바꼈음 Y - > X |
||
4693 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4694 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4695 | ' dStart_x = dOriginalStart_x |
||
4696 | ' dStart_y = dOriginalStart_y |
||
4697 | ' dEnd_x = dOriginalEnd_x |
||
4698 | ' dEnd_y = dOriginalEnd_y |
||
4699 | ' sStartLineUid = sConnLineUid |
||
4700 | ' Else |
||
4701 | ' dEnd_x = dOriginalEnd_x |
||
4702 | ' dEnd_y = dOriginalEnd_y |
||
4703 | ' End If |
||
4704 | ' sDirection = "X" |
||
4705 | ' Else |
||
4706 | ' If sDirection = "X" Then |
||
4707 | ' '방향이 바꼈음 X - > Y |
||
4708 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4709 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4710 | ' dStart_x = dOriginalStart_x |
||
4711 | ' dStart_y = dOriginalStart_y |
||
4712 | ' dEnd_x = dOriginalEnd_x |
||
4713 | ' dEnd_y = dOriginalEnd_y |
||
4714 | ' sStartLineUid = sConnLineUid |
||
4715 | ' Else |
||
4716 | |||
4717 | ' dEnd_x = dOriginalEnd_x |
||
4718 | ' dEnd_y = dOriginalEnd_y |
||
4719 | ' End If |
||
4720 | ' sDirection = "Y" |
||
4721 | ' End If |
||
4722 | ' End If |
||
4723 | ' ' oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4724 | ' Else |
||
4725 | ' If dStart_x <> 0 And dStart_y <> 0 And dEnd_x <> 0 And dEnd_y <> 0 Then |
||
4726 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4727 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4728 | ' End If |
||
4729 | |||
4730 | |||
4731 | ' sReturnUid = sConnLineUid |
||
4732 | ' Exit While |
||
4733 | ' End If |
||
4734 | ' End While |
||
4735 | |||
4736 | ' If sStartLineUid <> "" And sEndLineUid <> "" Then |
||
4737 | ' LineModeling(oLine_Dt, oAttribute_Dt, sStartLineUid, sEndLineUid, dStart_x, dStart_y, dEnd_x, dEnd_y, |
||
4738 | ' sLineNoUid, sLineUid, sSystemPath) |
||
4739 | ' dStart_x = 0 |
||
4740 | ' dStart_y = 0 |
||
4741 | ' dEnd_x = 0 |
||
4742 | ' dEnd_y = 0 |
||
4743 | ' End If |
||
4744 | ' Catch ex As Exception |
||
4745 | |||
4746 | ' End Try |
||
4747 | |||
4748 | ' Return sReturnUid |
||
4749 | 'End Function |
||
4750 | |||
4751 | |||
4752 | Private Function SymbolToLine_Modeling(ByVal oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
4753 | ByVal sSymbolUid As String, ByVal oLMSymbol As LMSymbol) As String |
||
4754 | |||
4755 | |||
4756 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4757 | Dim oPipeRun As LMPipeRun = Nothing |
||
4758 | Dim objItem As LMAItem |
||
4759 | Dim objConnector As LMConnector |
||
4760 | Dim objInputs As PlaceRunInputs |
||
4761 | objInputs = New PlaceRunInputs |
||
4762 | |||
4763 | |||
4764 | Dim sPipeUid As String = "" |
||
4765 | Dim iConnType As Integer = 0 |
||
4766 | Dim sStartpoint As String = "" |
||
4767 | Dim sEndpoint As String = "" |
||
4768 | Dim dOriginalStart_x As Double = 0.0 |
||
4769 | Dim dOriginalStart_y As Double = 0.0 |
||
4770 | Dim dOriginalEnd_x As Double = 0.0 |
||
4771 | Dim dOriginalEnd_y As Double = 0.0 |
||
4772 | Dim dStart_x As Double = 0.0 |
||
4773 | Dim dStart_y As Double = 0.0 |
||
4774 | Dim dEnd_x As Double = 0.0 |
||
4775 | Dim dEnd_y As Double = 0.0 |
||
4776 | |||
4777 | Dim sReturnUid As String = "" |
||
4778 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sSymbolUid + "' And " & |
||
4779 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4780 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4781 | If oPipeRow.Length = 0 Then |
||
4782 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sSymbolUid + "' And " & |
||
4783 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4784 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4785 | Else |
||
4786 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4787 | iConnType = 1 |
||
4788 | End If |
||
4789 | |||
4790 | If oPipeRow.Length = 1 Then |
||
4791 | If sPipeUid = "" Then |
||
4792 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4793 | iConnType = 2 |
||
4794 | End If |
||
4795 | sReturnUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4796 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4797 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4798 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4799 | dStart_x = dOriginalStart_x |
||
4800 | dStart_y = dOriginalStart_y |
||
4801 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4802 | dEnd_x = dOriginalEnd_x |
||
4803 | dEnd_y = dOriginalEnd_y |
||
4804 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4805 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4806 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4807 | If iConnType = 1 Then |
||
4808 | FindNearPoint(oLMSymbol, dStart_x, dStart_y) |
||
4809 | objInputs.AddSymbolTarget(oLMSymbol, dStart_x, dStart_y) |
||
4810 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4811 | Else |
||
4812 | FindNearPoint(oLMSymbol, dEnd_x, dEnd_y) |
||
4813 | objInputs.AddSymbolTarget(oLMSymbol, dEnd_x, dEnd_y) |
||
4814 | objInputs.AddPoint(dStart_x, dStart_y) |
||
4815 | End If |
||
4816 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4817 | |||
4818 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
4819 | Dim sSystemPath As String = GetPipeType(sType) |
||
4820 | |||
4821 | |||
4822 | |||
4823 | |||
4824 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
4825 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
4826 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
4827 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4828 | If oAttributeRow.Length > 0 Then |
||
4829 | For Each oAttribute In oAttributeRow |
||
4830 | Try |
||
4831 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4832 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4833 | If sPIDValue.Contains("'") Then |
||
4834 | sPIDValue = sPIDValue.Replace("'", """") |
||
4835 | End If |
||
4836 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4837 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4838 | Catch ex As Exception |
||
4839 | End Try |
||
4840 | Next |
||
4841 | oPipeRun.Commit() |
||
4842 | End If |
||
4843 | End If |
||
4844 | Return sReturnUid |
||
4845 | End Function |
||
4846 | |||
4847 | Private Function LineToSymbol_Modeling(ByVal oSymbol_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, |
||
4848 | ByVal sLineUid As String, ByVal oLMConnector As LMConnector, ByRef oLMSymbol As LMSymbol) As String |
||
4849 | |||
4850 | |||
4851 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4852 | Dim objItem As LMAItem |
||
4853 | Dim objConnector As LMConnector |
||
4854 | Dim objInputs As PlaceRunInputs |
||
4855 | objInputs = New PlaceRunInputs |
||
4856 | |||
4857 | |||
4858 | Dim sSymbolUid As String = "" |
||
4859 | Dim iConnType As Integer = 0 |
||
4860 | Dim dOriginalPoint_x As Double = 0.0 |
||
4861 | Dim dORiginalPoint_y As Double = 0.0 |
||
4862 | Dim dX As Double = 0.0 |
||
4863 | Dim dY As Double = 0.0 |
||
4864 | Dim sReturnUid As String = "" |
||
4865 | Dim oSymbolRow() As DataRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn1_Uid & " = '" + sLineUid + "' And " & |
||
4866 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4867 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4868 | If oSymbolRow.Length = 0 Then |
||
4869 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4870 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4871 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4872 | If oSymbolRow.Length = 0 Then |
||
4873 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4874 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4875 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4876 | If oSymbolRow.Length = 0 Then |
||
4877 | oSymbolRow = oSymbol_Dt.Select(_XML_SYMBOL_Conn2_Uid & " = '" + sLineUid + "' And " & |
||
4878 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' " & |
||
4879 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4880 | If oSymbolRow.Length = 0 Then |
||
4881 | |||
4882 | Else |
||
4883 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4884 | iConnType = 4 |
||
4885 | End If |
||
4886 | Else |
||
4887 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4888 | iConnType = 3 |
||
4889 | End If |
||
4890 | Else |
||
4891 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4892 | iConnType = 2 |
||
4893 | End If |
||
4894 | |||
4895 | Else |
||
4896 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4897 | iConnType = 1 |
||
4898 | End If |
||
4899 | |||
4900 | If oSymbolRow.Length = 1 Then |
||
4901 | If sSymbolUid = "" Then |
||
4902 | sSymbolUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4903 | iConnType = 2 |
||
4904 | End If |
||
4905 | sReturnUid = oSymbolRow(0)(_XML_SYMBOL_UID).ToString() |
||
4906 | Dim sOriginalPoint As String = oSymbolRow(0)(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
4907 | ConvertPointBystring(sOriginalPoint, dOriginalPoint_x, dORiginalPoint_y) |
||
4908 | dX = dOriginalPoint_x |
||
4909 | dY = dORiginalPoint_y |
||
4910 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
4911 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4912 | |||
4913 | oSymbolRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
4914 | |||
4915 | Dim sType As String = oSymbolRow(0)(_XML_LINE_TYPE).ToString() |
||
4916 | Dim sSystemPath As String = GetPipeType(sType) |
||
4917 | |||
4918 | oLMSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, ExistingItem:=oLMConnector.AsLMAItem, |
||
4919 | TargetItem:=oLMSymbol.AsLMAItem) |
||
4920 | |||
4921 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
4922 | If oAttributeRow.Length > 0 Then |
||
4923 | For Each oAttribute In oAttributeRow |
||
4924 | Try |
||
4925 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
4926 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
4927 | If sPIDValue.Contains("'") Then |
||
4928 | sPIDValue = sPIDValue.Replace("'", """") |
||
4929 | End If |
||
4930 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
4931 | oLMSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
4932 | Catch ex As Exception |
||
4933 | End Try |
||
4934 | Next |
||
4935 | End If |
||
4936 | End If |
||
4937 | Return sReturnUid |
||
4938 | End Function |
||
4939 | |||
4940 | |||
4941 | Private Sub OPCTOLineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal oOPCSymbol As LMSymbol, |
||
4942 | ByVal sOPCUid As String, ByVal sLineNoUid As String) |
||
4943 | Try |
||
4944 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
4945 | Dim objItem As LMAItem |
||
4946 | Dim objConnector As LMConnector |
||
4947 | Dim objInputs As PlaceRunInputs |
||
4948 | objInputs = New PlaceRunInputs |
||
4949 | Dim dOriginalStart_x As Double = 0.0 |
||
4950 | Dim dOriginalStart_y As Double = 0.0 |
||
4951 | Dim dOriginalEnd_x As Double = 0.0 |
||
4952 | Dim dOriginalEnd_y As Double = 0.0 |
||
4953 | Dim dStart_x As Double = 0.0 |
||
4954 | Dim dStart_y As Double = 0.0 |
||
4955 | Dim dEnd_x As Double = 0.0 |
||
4956 | Dim dEnd_y As Double = 0.0 |
||
4957 | |||
4958 | Dim oPipeRun As LMPipeRun = Nothing |
||
4959 | Dim sStartpoint As String = "" |
||
4960 | Dim sEndpoint As String = "" |
||
4961 | Dim iConnType As Integer = 0 |
||
4962 | Dim oPipeRow() As DataRow = oLine_Dt.Select(_XML_LINE_Conn1_Uid & " = '" + sOPCUid + "' And [" & |
||
4963 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4964 | Dim sPipeUid As String = "" |
||
4965 | If oPipeRow.Length = 0 Then |
||
4966 | oPipeRow = oLine_Dt.Select(_XML_LINE_Conn2_Uid & " = '" + sOPCUid + "' And [" & |
||
4967 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
4968 | Else |
||
4969 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4970 | iConnType = 1 |
||
4971 | End If |
||
4972 | Dim oAddUid_List As New List(Of String) |
||
4973 | If oPipeRow.Length = 1 Then |
||
4974 | If sPipeUid = "" Then |
||
4975 | sPipeUid = oPipeRow(0)(_XML_LINE_UID).ToString() |
||
4976 | iConnType = 2 |
||
4977 | End If |
||
4978 | oAddUid_List.Add(sPipeUid) |
||
4979 | sStartpoint = oPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
4980 | sEndpoint = oPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
4981 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
4982 | dStart_x = dOriginalStart_x |
||
4983 | dStart_y = dOriginalStart_y |
||
4984 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
4985 | dEnd_x = dOriginalEnd_x |
||
4986 | dEnd_y = dOriginalEnd_y |
||
4987 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
4988 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
4989 | |||
4990 | 'OPC Connection Point가져와서 연결(2018-07-12) |
||
4991 | If iConnType = 1 Then |
||
4992 | FindNearPoint(oOPCSymbol, dStart_x, dStart_y) |
||
4993 | objInputs.AddSymbolTarget(oOPCSymbol, dStart_x, dStart_y) |
||
4994 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
4995 | Else |
||
4996 | FindNearPoint(oOPCSymbol, dEnd_x, dEnd_y) |
||
4997 | objInputs.AddSymbolTarget(oOPCSymbol, dEnd_x, dEnd_y) |
||
4998 | bb2a0c79 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
4999 | End If |
||
5000 | oPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
5001 | |||
5002 | While True |
||
5003 | ' objInputs.Clear() |
||
5004 | Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
5005 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
5006 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
5007 | If oAddPipeRow.Length = 0 Then |
||
5008 | oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
5009 | "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
5010 | _XML_SYMBOL_Check & "] = 'TRUE'") |
||
5011 | sPipeUid = "" |
||
5012 | Else |
||
5013 | iConnType = 1 |
||
5014 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
5015 | End If |
||
5016 | If oAddPipeRow.Length = 1 Then |
||
5017 | If sPipeUid = "" Then |
||
5018 | sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
5019 | iConnType = 2 |
||
5020 | End If |
||
5021 | oAddUid_List.Add(sPipeUid) |
||
5022 | sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
5023 | sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
5024 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
5025 | dStart_x = dOriginalStart_x |
||
5026 | dStart_y = dOriginalStart_y |
||
5027 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
5028 | dEnd_x = dOriginalEnd_x |
||
5029 | dEnd_y = dOriginalEnd_y |
||
5030 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
5031 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
5032 | If iConnType = 1 Then |
||
5033 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5034 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5035 | Else |
||
5036 | 'objInputs.AddConnectorTarget(objConnector, dStart_x, dStart_y) |
||
5037 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5038 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5039 | objInputs.AddPoint(dStart_x, dStart_y) |
||
5040 | End If |
||
5041 | e4000111 | Gyusu | |
5042 | bb2a0c79 | Gyusu | oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
5043 | Else |
||
5044 | Exit While |
||
5045 | End If |
||
5046 | e4000111 | Gyusu | |
5047 | bb2a0c79 | Gyusu | End While |
5048 | Dim sType As String = oPipeRow(0)(_XML_LINE_TYPE).ToString() |
||
5049 | Dim sSystemPath As String = GetPipeType(sType) |
||
5050 | e4000111 | Gyusu | |
5051 | bb2a0c79 | Gyusu | objItem = _Placement.PIDCreateItem(sSystemPath) |
5052 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
5053 | For i = 0 To oAddUid_List.Count - 1 |
||
5054 | Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
5055 | If oUpdateRow.Length = 1 Then |
||
5056 | oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
5057 | oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
5058 | End If |
||
5059 | Next |
||
5060 | |||
5061 | |||
5062 | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
5063 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
5064 | If oAttributeRow.Length > 0 Then |
||
5065 | For Each oAttribute In oAttributeRow |
||
5066 | Try |
||
5067 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5068 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5069 | If sPIDValue.Contains("'") Then |
||
5070 | sPIDValue = sPIDValue.Replace("'", """") |
||
5071 | End If |
||
5072 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5073 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5074 | Catch ex As Exception |
||
5075 | End Try |
||
5076 | Next |
||
5077 | oPipeRun.Commit() |
||
5078 | End If |
||
5079 | |||
5080 | End If |
||
5081 | |||
5082 | Catch ex As Exception |
||
5083 | End Try |
||
5084 | End Sub |
||
5085 | |||
5086 | Private Function AddUidList중복체크(ByVal sUidList As List(Of String), ByVal sAddUid As String) As Boolean |
||
5087 | e4000111 | Gyusu | |
5088 | bb2a0c79 | Gyusu | For Each sUid In sUidList |
5089 | If sUid = sAddUid Then |
||
5090 | Return False |
||
5091 | End If |
||
5092 | Next |
||
5093 | Return True |
||
5094 | End Function |
||
5095 | |||
5096 | b08338e3 | Gyusu | Private Sub LineRouting(ByRef oLine_Dt As DataTable, ByVal oAttribute_Dt As DataTable, ByVal sLineNoUid As String, ByVal sLineNoText As String) |
5097 | bb2a0c79 | Gyusu | Try |
5098 | Dim oDatasource As Object = _Placement.PIDDataSource |
||
5099 | Dim objItem As LMAItem |
||
5100 | Dim objConnector As LMConnector |
||
5101 | Dim objInputs As PlaceRunInputs |
||
5102 | objInputs = New PlaceRunInputs |
||
5103 | Dim dOriginalStart_x As Double = 0.0 |
||
5104 | Dim dOriginalStart_y As Double = 0.0 |
||
5105 | Dim dOriginalEnd_x As Double = 0.0 |
||
5106 | Dim dOriginalEnd_y As Double = 0.0 |
||
5107 | Dim dStart_x As Double = 0.0 |
||
5108 | Dim dStart_y As Double = 0.0 |
||
5109 | Dim dEnd_x As Double = 0.0 |
||
5110 | Dim dEnd_y As Double = 0.0 |
||
5111 | Dim oPipeRun As LMPipeRun = Nothing |
||
5112 | Dim sStartpoint As String = "" |
||
5113 | Dim sEndpoint As String = "" |
||
5114 | Dim iConnType As Integer = 0 |
||
5115 | Dim pLMConnector As LMConnector = Nothing |
||
5116 | For Each oLinerow In oLine_Dt.Rows |
||
5117 | objInputs.Clear() |
||
5118 | b08338e3 | Gyusu | Dim sCheck As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
5119 | If sCheck = "FALSE" Then |
||
5120 | Dim sUid As String = oLinerow(_XML_LINE_UID).ToString() |
||
5121 | sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
5122 | sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
5123 | ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
5124 | dStart_x = dOriginalStart_x |
||
5125 | dStart_y = dOriginalStart_y |
||
5126 | ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
5127 | dEnd_x = dOriginalEnd_x |
||
5128 | dEnd_y = dOriginalEnd_y |
||
5129 | ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
5130 | ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
5131 | bb2a0c79 | Gyusu | |
5132 | b08338e3 | Gyusu | objInputs.AddPoint(dStart_x, dStart_y) |
5133 | objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5134 | bb2a0c79 | Gyusu | Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
5135 | Dim sSystemPath As String = GetPipeType(sType) |
||
5136 | objItem = _Placement.PIDCreateItem(sSystemPath) |
||
5137 | objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
5138 | b08338e3 | Gyusu | SetListBoxItems(ListBox_Result, "Place Pipe.." & sUid & " (" & dOriginalStart_x & "," & dOriginalStart_y & ") - (" & dOriginalEnd_x & "," & dOriginalEnd_y & ")..." & _iPipecnt & " count ") |
5139 | |||
5140 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Pipe : " & sUid) |
||
5141 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
5142 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oLinerow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
5143 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oLinerow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
5144 | 'ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
5145 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "StartPoint : " & dOriginalStart_x & "," & dOriginalStart_y) |
||
5146 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "EndPoint : " & dOriginalEnd_x & "," & dOriginalEnd_y) |
||
5147 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Pipe Count : " & _iPipecnt) |
||
5148 | |||
5149 | _iPipecnt = _iPipecnt + 1 |
||
5150 | oLinerow(_XML_LINE_SPID) = objConnector.ModelItemID |
||
5151 | oLinerow(_XML_LINE_LMCONNECTOR) = objConnector |
||
5152 | |||
5153 | oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
5154 | bb2a0c79 | Gyusu | oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
5155 | |||
5156 | Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
5157 | If oAttributeRow.Length > 0 Then |
||
5158 | For Each oAttribute In oAttributeRow |
||
5159 | Try |
||
5160 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5161 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5162 | If sPIDValue.Contains("'") Then |
||
5163 | sPIDValue = sPIDValue.Replace("'", """") |
||
5164 | End If |
||
5165 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5166 | oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5167 | Catch ex As Exception |
||
5168 | End Try |
||
5169 | Next |
||
5170 | oPipeRun.Commit() |
||
5171 | End If |
||
5172 | End If |
||
5173 | |||
5174 | |||
5175 | |||
5176 | |||
5177 | |||
5178 | b08338e3 | Gyusu | 'Dim sPipeUid As String = oLinerow(_XML_LINE_UID).ToString() |
5179 | 'Dim sCheckModeling As Boolean = False |
||
5180 | 'objInputs.Clear() |
||
5181 | 'Dim oAddUid_List As New List(Of String) |
||
5182 | 'Try |
||
5183 | ' Dim oAddPipeRow() As DataRow = oLine_Dt.Select("[" & _XML_LINE_Conn1_Uid & "] = '" + sPipeUid + "' and " & |
||
5184 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
5185 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
5186 | ' If oAddPipeRow.Length = 0 Then |
||
5187 | ' oAddPipeRow = oLine_Dt.Select("[" & _XML_LINE_Conn2_Uid & "] = '" + sPipeUid + "' and " & |
||
5188 | ' "[" & _XML_LINE_DRAWING_TF & "] = 'FALSE' And [" & |
||
5189 | ' _XML_SYMBOL_Check & "] = 'TRUE'") |
||
5190 | ' sPipeUid = "" |
||
5191 | ' Else |
||
5192 | ' iConnType = 1 |
||
5193 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
5194 | ' End If |
||
5195 | ' If oAddPipeRow.Length = 1 Then |
||
5196 | ' sCheckModeling = True |
||
5197 | ' If sPipeUid = "" Then |
||
5198 | ' sPipeUid = oAddPipeRow(0)(_XML_LINE_UID).ToString() |
||
5199 | ' iConnType = 2 |
||
5200 | ' End If |
||
5201 | ' If AddUidList중복체크(oAddUid_List, sPipeUid) Then |
||
5202 | ' oAddUid_List.Add(sPipeUid) |
||
5203 | ' End If |
||
5204 | ' sStartpoint = oAddPipeRow(0)(_XML_LINE_STARTPOINT).ToString() |
||
5205 | ' sEndpoint = oAddPipeRow(0)(_XML_LINE_ENDPOINT).ToString() |
||
5206 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
5207 | ' dStart_x = dOriginalStart_x |
||
5208 | ' dStart_y = dOriginalStart_y |
||
5209 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
5210 | ' dEnd_x = dOriginalEnd_x |
||
5211 | ' dEnd_y = dOriginalEnd_y |
||
5212 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
5213 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
5214 | ' Dim sBranchType As String = "" |
||
5215 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
5216 | ' Try |
||
5217 | ' If pLMConnector Is Nothing Then |
||
5218 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5219 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5220 | ' Else |
||
5221 | ' If sBranchType = "1" Then |
||
5222 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
5223 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5224 | ' ElseIf sBranchType = "2" Then |
||
5225 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
5226 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5227 | ' ElseIf sBranchType = "3" Then |
||
5228 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
5229 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5230 | ' ElseIf sBranchType = "4" Then |
||
5231 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
5232 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5233 | ' End If |
||
5234 | ' End If |
||
5235 | ' Catch ex As Exception |
||
5236 | ' End Try |
||
5237 | ' Else |
||
5238 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5239 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5240 | ' End If |
||
5241 | ' oAddPipeRow(0)(_XML_LINE_DRAWING_TF) = "TRUE" |
||
5242 | ' Else |
||
5243 | ' Dim CheckTF As String = oLinerow(_XML_LINE_DRAWING_TF).ToString() |
||
5244 | ' Dim CheckSelect As String = oLinerow(_XML_LINE_Check).ToString() |
||
5245 | ' If CheckTF = "FALSE" And CheckSelect = "TRUE" Then |
||
5246 | ' sPipeUid = oLinerow(_XML_LINE_UID).ToString() |
||
5247 | ' oAddUid_List.Clear() |
||
5248 | ' oAddUid_List.Add(sPipeUid) |
||
5249 | ' sCheckModeling = True |
||
5250 | ' sStartpoint = oLinerow(_XML_LINE_STARTPOINT).ToString() |
||
5251 | ' sEndpoint = oLinerow(_XML_LINE_ENDPOINT).ToString() |
||
5252 | ' ConvertPointBystring(sStartpoint, dOriginalStart_x, dOriginalStart_y) |
||
5253 | ' dStart_x = dOriginalStart_x |
||
5254 | ' dStart_y = dOriginalStart_y |
||
5255 | ' ConvertPointBystring(sEndpoint, dOriginalEnd_x, dOriginalEnd_y) |
||
5256 | ' dEnd_x = dOriginalEnd_x |
||
5257 | ' dEnd_y = dOriginalEnd_y |
||
5258 | ' ConvertPointByImage(dStart_x, dStart_y, _IMG_X, _IMG_Y) |
||
5259 | ' ConvertPointByImage(dEnd_x, dEnd_y, _IMG_X, _IMG_Y) |
||
5260 | ' Dim sBranchType As String = "" |
||
5261 | ' If (CheckBranchLine(oLine_Dt, dStart_x, dStart_y, dEnd_x, dEnd_y, sBranchType, pLMConnector)) Then |
||
5262 | ' Try |
||
5263 | ' If sBranchType = "1" Then |
||
5264 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5265 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
5266 | ' ElseIf sBranchType = "2" Then |
||
5267 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5268 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
5269 | ' ElseIf sBranchType = "3" Then |
||
5270 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5271 | ' objInputs.AddConnectorTarget(pLMConnector, dStart_x, dStart_y) |
||
5272 | ' ElseIf sBranchType = "4" Then |
||
5273 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5274 | ' objInputs.AddConnectorTarget(pLMConnector, dEnd_x, dEnd_y) |
||
5275 | ' End If |
||
5276 | ' Catch ex As Exception |
||
5277 | |||
5278 | ' End Try |
||
5279 | ' Else |
||
5280 | ' objInputs.AddPoint(dStart_x, dStart_y) |
||
5281 | ' objInputs.AddPoint(dEnd_x, dEnd_y) |
||
5282 | ' End If |
||
5283 | ' oLinerow(_XML_LINE_DRAWING_TF) = "TRUE" |
||
5284 | ' End If |
||
5285 | ' End If |
||
5286 | 'Catch ex As Exception |
||
5287 | 'End Try |
||
5288 | 'If sCheckModeling Then |
||
5289 | ' Dim sType As String = oLinerow(_XML_LINE_TYPE).ToString() |
||
5290 | ' Dim sSystemPath As String = GetPipeType(sType) |
||
5291 | ' objItem = _Placement.PIDCreateItem(sSystemPath) |
||
5292 | ' objConnector = _Placement.PIDPlaceRun(objItem, objInputs) |
||
5293 | ' For i = 0 To oAddUid_List.Count - 1 |
||
5294 | ' Dim oUpdateRow As DataRow() = oLine_Dt.Select(_XML_LINE_UID & " = '" + oAddUid_List(i) + "'") |
||
5295 | ' If oUpdateRow.Length = 1 Then |
||
5296 | ' oUpdateRow(0)(_XML_LINE_SPID) = objConnector.ModelItemID |
||
5297 | ' oUpdateRow(0)(_XML_LINE_LMCONNECTOR) = objConnector |
||
5298 | ' End If |
||
5299 | ' Next |
||
5300 | |||
5301 | ' oPipeRun = oDatasource.GetPipeRun(objConnector.ModelItemID) |
||
5302 | ' oAddUid_List.Clear() |
||
5303 | |||
5304 | ' Dim oAttributeRow() As DataRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sLineNoUid + "'") |
||
5305 | ' If oAttributeRow.Length > 0 Then |
||
5306 | ' For Each oAttribute In oAttributeRow |
||
5307 | ' Try |
||
5308 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5309 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5310 | ' If sPIDValue.Contains("'") Then |
||
5311 | ' sPIDValue = sPIDValue.Replace("'", """") |
||
5312 | ' End If |
||
5313 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5314 | ' oPipeRun.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5315 | ' Catch ex As Exception |
||
5316 | ' End Try |
||
5317 | ' Next |
||
5318 | ' oPipeRun.Commit() |
||
5319 | ' End If |
||
5320 | |||
5321 | ' If pLMConnector IsNot Nothing Then |
||
5322 | ' Dim sID_1 As String = pLMConnector.ModelItemID |
||
5323 | ' Dim sID_2 As String = objConnector.ModelItemID |
||
5324 | ' Dim objSurvivorItem As LMAItem = Nothing |
||
5325 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(sID_1) |
||
5326 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(sID_2) |
||
5327 | ' _Placement.PIDJoinRuns(oPipeRun1, oPipeRun2) |
||
5328 | ' ' oDatasource.CommitTransaction() |
||
5329 | ' '_Placement.PIDAutoJoin(oPipeRun1.AsLMAItem, AutoJoinEndConstants.autoJoin_End, objSurvivorItem) |
||
5330 | ' 'oPipeRun1.Commit() |
||
5331 | ' 'oDatasource.CommitTransaction() |
||
5332 | ' 'objSurvivorItem = Nothing |
||
5333 | ' '_Placement.PIDAutoJoin(oPipeRun2.AsLMAItem, AutoJoinEndConstants.autoJoin_Start, objSurvivorItem) |
||
5334 | ' 'oPipeRun2.Commit() |
||
5335 | ' 'oDatasource.CommitTransaction() |
||
5336 | ' End If |
||
5337 | ' sCheckModeling = False |
||
5338 | ' End If |
||
5339 | Next |
||
5340 | bb2a0c79 | Gyusu | Catch ex As Exception |
5341 | End Try |
||
5342 | End Sub |
||
5343 | e4000111 | Gyusu | |
5344 | b08338e3 | Gyusu | |
5345 | Private Sub SymbolModeling(ByVal CDrawing As Drawing, ByVal oLine_DT As DataTable, ByVal oSymbolRow As DataRow, ByVal oAttribute_Dt As DataTable, |
||
5346 | ByVal sLineNoText As String) |
||
5347 | bb2a0c79 | Gyusu | Try |
5348 | b08338e3 | Gyusu | |
5349 | Dim sCheckModeling As String = oSymbolRow(_XML_SYMBOL_DRAWING_TF).ToString() |
||
5350 | If sCheckModeling = "FALSE" Then |
||
5351 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID) |
||
5352 | Dim oSymbol As LMSymbol = Nothing |
||
5353 | Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
5354 | Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
5355 | bb2a0c79 | Gyusu | Dim oDatasource As Object = _Placement.PIDDataSource |
5356 | Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
5357 | Dim dLocationX As Double = 0.0 |
||
5358 | Dim dLocationY As Double = 0.0 |
||
5359 | Dim dX As Double = 0.0 |
||
5360 | Dim dY As Double = 0.0 |
||
5361 | b08338e3 | Gyusu | Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
5362 | ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5363 | dX = dLocationX |
||
5364 | dY = dLocationY |
||
5365 | ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
5366 | |||
5367 | Dim dAngle As Double = oSymbolRow(_XML_SYMBOL_ANGLE) |
||
5368 | |||
5369 | |||
5370 | 'Dim oDatarow() As DataRow = oLine_DT.Select("[" & _XML_LINE_Conn1_Uid & "] = '" & sSymbolUid & "'") |
||
5371 | 'If oDatarow.Length = 0 Then |
||
5372 | ' oDatarow = oLine_DT.Select("[" & _XML_LINE_Conn2_Uid & "] = '" & sSymbolUid & "'") |
||
5373 | 'End If |
||
5374 | 'Dim dFix_X As Double = 0.0 |
||
5375 | 'Dim dFix_Y As Double = 0.0 |
||
5376 | 'If oDatarow.Length > 0 Then |
||
5377 | ' If dAngle <> 0 Then |
||
5378 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
5379 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5380 | |||
5381 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
5382 | ' dX = dLocationX |
||
5383 | ' Else |
||
5384 | ' sOriginalPoint = oDatarow(0)(_XML_LINE_STARTPOINT).ToString() |
||
5385 | ' ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5386 | ' ConvertPointByImage(dLocationX, dLocationY, _IMG_X, _IMG_Y) |
||
5387 | ' dY = dLocationY |
||
5388 | ' End If |
||
5389 | |||
5390 | 'End If |
||
5391 | |||
5392 | |||
5393 | |||
5394 | oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY,, dAngle) |
||
5395 | SetListBoxItems(ListBox_Result, "Place Fitting.." & sSymbolUid & " (" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
5396 | |||
5397 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Place Fitting : " & sSymbolUid) |
||
5398 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "LineNo : " & sLineNoText) |
||
5399 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection1 : " & oSymbolRow(_XML_SYMBOL_Conn1_Uid).ToString()) |
||
5400 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection2 : " & oSymbolRow(_XML_SYMBOL_Conn2_Uid).ToString()) |
||
5401 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection3 : " & oSymbolRow(_XML_SYMBOL_Conn3_Uid).ToString()) |
||
5402 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Connection4 : " & oSymbolRow(_XML_SYMBOL_Conn4_Uid).ToString()) |
||
5403 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Angle : " & dAngle) |
||
5404 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "OriginalPoint : " & dLocationX & "," & dLocationY) |
||
5405 | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, "Fitting Count : " & _iFittingcnt) |
||
5406 | |||
5407 | |||
5408 | _iFittingcnt = _iFittingcnt + 1 |
||
5409 | oSymbolRow(_XML_SYMBOL_DRAWING_TF) = "TRUE" |
||
5410 | Dim oAttributeRow() As DataRow |
||
5411 | oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
5412 | If oAttribute_Dt.Rows.Count > 0 Then |
||
5413 | |||
5414 | bb2a0c79 | Gyusu | If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
5415 | b08338e3 | Gyusu | Dim oInstrument As LMInstrument |
5416 | oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
5417 | bb2a0c79 | Gyusu | Try |
5418 | If oAttributeRow.Length > 0 Then |
||
5419 | For Each oAttribute In oAttributeRow |
||
5420 | Try |
||
5421 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5422 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5423 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5424 | oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5425 | Catch ex As Exception |
||
5426 | End Try |
||
5427 | Next |
||
5428 | oInstrument.Commit() |
||
5429 | End If |
||
5430 | Catch ex As Exception |
||
5431 | End Try |
||
5432 | Else |
||
5433 | b08338e3 | Gyusu | Try |
5434 | If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
5435 | For Each oAttribute In oAttributeRow |
||
5436 | Try |
||
5437 | Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5438 | Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5439 | e4000111 | Gyusu | |
5440 | b08338e3 | Gyusu | If sPIDAttribute = "SIZE" Then |
5441 | |||
5442 | 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
5443 | If sPIDValue.Contains("x") Then |
||
5444 | Dim sSplitSize() As String = sPIDValue.Split("x") |
||
5445 | If sSplitSize.Count > 1 Then |
||
5446 | 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
5447 | Dim oConnector_1 As LMConnector = Nothing |
||
5448 | Dim oConnector_2 As LMConnector = Nothing |
||
5449 | If oSymbol IsNot Nothing Then |
||
5450 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5451 | For Each Tconnector In oSymbol.Connect1Connectors |
||
5452 | If Tconnector.ItemStatus = "Active" Then |
||
5453 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5454 | oConnector_1 = Tconnector |
||
5455 | End If |
||
5456 | End If |
||
5457 | Next |
||
5458 | End If |
||
5459 | If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5460 | For Each Tconnector In oSymbol.Connect1Connectors |
||
5461 | If Tconnector.ItemStatus = "Active" Then |
||
5462 | If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5463 | oConnector_2 = Tconnector |
||
5464 | End If |
||
5465 | End If |
||
5466 | Next |
||
5467 | End If |
||
5468 | End If |
||
5469 | Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
5470 | Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
5471 | If dAngle = 3.14 Then |
||
5472 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5473 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5474 | Else |
||
5475 | oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5476 | oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5477 | End If |
||
5478 | e4000111 | Gyusu | |
5479 | |||
5480 | b08338e3 | Gyusu | End If |
5481 | e4000111 | Gyusu | |
5482 | b08338e3 | Gyusu | Else |
5483 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5484 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5485 | End If |
||
5486 | Else |
||
5487 | Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5488 | oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5489 | End If |
||
5490 | e4000111 | Gyusu | |
5491 | b08338e3 | Gyusu | Catch ex As Exception |
5492 | End Try |
||
5493 | Next |
||
5494 | oSymbol.Commit() |
||
5495 | End If |
||
5496 | Catch ex As Exception |
||
5497 | End Try |
||
5498 | End If |
||
5499 | End If |
||
5500 | e4000111 | Gyusu | |
5501 | |||
5502 | |||
5503 | b08338e3 | Gyusu | End If |
5504 | e4000111 | Gyusu | |
5505 | |||
5506 | |||
5507 | b08338e3 | Gyusu | 'Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
5508 | 'Dim sConnTypeNo As String = "" |
||
5509 | '' Line과 연결되어있는 Symbol인지 확인 |
||
5510 | 'Dim oLine_Dt As DataTable = GetPipeFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
5511 | ''Symbol과 연결되어 있는 Symbol인지 확인 |
||
5512 | 'Dim oSymbol_Dt As DataTable = GetSymbolFromConnection(CDrawing, sSymbolUid, sConnTypeNo) |
||
5513 | 'Dim oSymbol As LMSymbol = Nothing |
||
5514 | 'Dim sSPID As String = oSymbolRow(_XML_SYMBOL_SPID).ToString() |
||
5515 | 'Dim sSystemPath As String = oSymbolRow(_XML_SYMBOL_SYSTEMPATH).ToString() |
||
5516 | 'Dim oDatasource As Object = _Placement.PIDDataSource |
||
5517 | 'Dim sSymbolCompType As String = oSymbolRow(_XML_SYMBOL_TYPE).ToString() |
||
5518 | e4000111 | Gyusu | |
5519 | b08338e3 | Gyusu | 'Dim dAngle As Double = 0.0 |
5520 | 'If IsNumeric(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) Then |
||
5521 | ' dAngle = Double.Parse(oSymbolRow(_XML_SYMBOL_ANGLE).ToString()) |
||
5522 | 'End If |
||
5523 | e4000111 | Gyusu | |
5524 | b08338e3 | Gyusu | 'Dim dLocationX As Double = 0.0 |
5525 | 'Dim dLocationY As Double = 0.0 |
||
5526 | 'Dim dX As Double = 0.0 |
||
5527 | 'Dim dY As Double = 0.0 |
||
5528 | 'Dim sOriginalPoint As String = oSymbolRow(_XML_SYMBOL_ORIGINALPOINT).ToString() |
||
5529 | 'ConvertPointBystring(sOriginalPoint, dLocationX, dLocationY) |
||
5530 | 'dX = dLocationX |
||
5531 | 'dY = dLocationY |
||
5532 | 'ConvertPointByImage(dX, dY, _IMG_X, _IMG_Y) |
||
5533 | 'Dim bCheckModeling As Boolean = False |
||
5534 | |||
5535 | 'If oLine_Dt.Rows.Count > 0 Then |
||
5536 | |||
5537 | ' If sSPID <> "" Then |
||
5538 | ' Dim dX1 As Double = 0 |
||
5539 | ' Dim dX2 As Double = 0 |
||
5540 | ' Dim dY1 As Double = 0 |
||
5541 | ' Dim dY2 As Double = 0 |
||
5542 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
5543 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
5544 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
5545 | |||
5546 | ' Dim dCalcPoint As Double = -1 |
||
5547 | ' Dim dModeling_X As Double = 0 |
||
5548 | ' Dim dModeling_Y As Double = 0 |
||
5549 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
5550 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
5551 | ' dModeling_X = dX1 |
||
5552 | ' dModeling_Y = dY1 |
||
5553 | ' End If |
||
5554 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
5555 | e4000111 | Gyusu | |
5556 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
5557 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
5558 | ' dModeling_X = dX2 |
||
5559 | ' dModeling_Y = dY2 |
||
5560 | ' End If |
||
5561 | ' End If |
||
5562 | e4000111 | Gyusu | |
5563 | |||
5564 | |||
5565 | b08338e3 | Gyusu | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
5566 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
5567 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
5568 | ' bCheckModeling = True |
||
5569 | ' End If |
||
5570 | e4000111 | Gyusu | |
5571 | |||
5572 | b08338e3 | Gyusu | ' End If |
5573 | 'End If |
||
5574 | 'If oSymbol_Dt.Rows.Count > 0 Then |
||
5575 | ' If sSPID <> "" Then |
||
5576 | ' Dim dX1 As Double = 0 |
||
5577 | ' Dim dX2 As Double = 0 |
||
5578 | ' Dim dX3 As Double = 0 |
||
5579 | ' Dim dX4 As Double = 0 |
||
5580 | ' Dim dY1 As Double = 0 |
||
5581 | ' Dim dY2 As Double = 0 |
||
5582 | ' Dim dY3 As Double = 0 |
||
5583 | ' Dim dY4 As Double = 0 |
||
5584 | ' Dim oLMSymbol As LMSymbol = oDatasource.GetSymbol(sSPID) |
||
5585 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 1, dX1, dY1) |
||
5586 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 2, dX2, dY2) |
||
5587 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 3, dX3, dY3) |
||
5588 | ' _Placement.PIDConnectPointLocation(oLMSymbol, 4, dX4, dY4) |
||
5589 | |||
5590 | ' Dim dCalcPoint As Double = -1 |
||
5591 | ' Dim dModeling_X As Double = 0 |
||
5592 | ' Dim dModeling_Y As Double = 0 |
||
5593 | ' If dX1 <> 0 And dY1 <> 0 Then |
||
5594 | ' dCalcPoint = Math.Abs(dX1 - dX) + Math.Abs(dY1 - dY) |
||
5595 | ' dModeling_X = dX1 |
||
5596 | ' dModeling_Y = dY1 |
||
5597 | ' End If |
||
5598 | ' If dX2 <> 0 And dY2 <> 0 Then |
||
5599 | 41e4023e | Gyusu | |
5600 | b08338e3 | Gyusu | ' If (Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) > dCalcPoint) Then |
5601 | ' dCalcPoint = Math.Abs(dX2 - dX) + Math.Abs(dY2 - dY) |
||
5602 | ' dModeling_X = dX2 |
||
5603 | ' dModeling_Y = dY2 |
||
5604 | ' End If |
||
5605 | ' End If |
||
5606 | ' If dX3 <> 0 And dY3 <> 0 Then |
||
5607 | ' If (Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) > dCalcPoint) Then |
||
5608 | ' dCalcPoint = Math.Abs(dX3 - dX) + Math.Abs(dY3 - dY) |
||
5609 | ' dModeling_X = dX3 |
||
5610 | ' dModeling_Y = dY3 |
||
5611 | ' End If |
||
5612 | ' End If |
||
5613 | ' If dX4 <> 0 And dY4 <> 0 Then |
||
5614 | ' If (Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) > dCalcPoint) Then |
||
5615 | ' dCalcPoint = Math.Abs(dX4 - dX) + Math.Abs(dY4 - dY) |
||
5616 | ' dModeling_X = dX4 |
||
5617 | ' dModeling_Y = dY4 |
||
5618 | ' End If |
||
5619 | ' End If |
||
5620 | ' If dModeling_X <> 0 And dModeling_Y <> 0 Then |
||
5621 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dModeling_X, dModeling_Y,, dAngle, ExistingItem:=oLMSymbol.AsLMAItem, |
||
5622 | ' TargetItem:=oLMSymbol.AsLMRepresentation) |
||
5623 | ' bCheckModeling = True |
||
5624 | ' End If |
||
5625 | 41e4023e | Gyusu | |
5626 | e4000111 | Gyusu | |
5627 | b08338e3 | Gyusu | ' End If |
5628 | e4000111 | Gyusu | |
5629 | b08338e3 | Gyusu | 'End If |
5630 | e4000111 | Gyusu | |
5631 | b08338e3 | Gyusu | 'If (oLine_Dt.Rows.Count = 0 And oSymbol_Dt.Rows.Count = 0) Or bCheckModeling = False Then |
5632 | ' oSymbol = _Placement.PIDPlaceSymbol(sSystemPath, dX, dY, , dAngle) |
||
5633 | ' SetListBoxItems(ListBox_Result, "Place Fittings..(" & dLocationX & "," & dLocationY & ")..." & _iFittingcnt & " count ") |
||
5634 | ' _iFittingcnt = _iFittingcnt + 1 |
||
5635 | 'End If |
||
5636 | 'Dim oAttributeRow() As DataRow |
||
5637 | 'oAttributeRow = oAttribute_Dt.Select(_XML_ATTRIBUTE_UID & " = '" + sSymbolUid + "'") |
||
5638 | 'If oAttribute_Dt.Rows.Count > 0 Then |
||
5639 | |||
5640 | ' If sSymbolCompType.ToUpper() = _SYMBOL_INSTUMENT.ToUpper() Then |
||
5641 | ' Dim oInstrument As LMInstrument |
||
5642 | ' oInstrument = oDatasource.GetInstrument(oSymbol.ModelItemID) |
||
5643 | ' Try |
||
5644 | ' If oAttributeRow.Length > 0 Then |
||
5645 | ' For Each oAttribute In oAttributeRow |
||
5646 | ' Try |
||
5647 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5648 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5649 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5650 | ' oInstrument.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5651 | ' Catch ex As Exception |
||
5652 | ' End Try |
||
5653 | ' Next |
||
5654 | ' oInstrument.Commit() |
||
5655 | ' End If |
||
5656 | ' Catch ex As Exception |
||
5657 | ' End Try |
||
5658 | ' Else |
||
5659 | ' Try |
||
5660 | ' If oAttributeRow.Length > 0 And oSymbol IsNot Nothing Then |
||
5661 | ' For Each oAttribute In oAttributeRow |
||
5662 | ' Try |
||
5663 | ' Dim sPIDAttribute As String = oAttribute(_XML_ATTRIBUTE_NAME).ToString() |
||
5664 | ' Dim sPIDValue As String = oAttribute(_XML_ATTRIBUTE_VALUE).ToString() |
||
5665 | |||
5666 | ' If sPIDAttribute = "SIZE" Then |
||
5667 | |||
5668 | ' 'Nominal diamter1,2속성이름뭔지 찾아봐야됨 (2018-07-20) |
||
5669 | ' If sPIDValue.Contains("x") Then |
||
5670 | ' Dim sSplitSize() As String = sPIDValue.Split("x") |
||
5671 | ' If sSplitSize.Count > 1 Then |
||
5672 | ' 'Connection Point와 연결되어 있는 라인을 가져와서 라인프로퍼티를 변경 |
||
5673 | ' Dim oConnector_1 As LMConnector = Nothing |
||
5674 | ' Dim oConnector_2 As LMConnector = Nothing |
||
5675 | ' If oSymbol IsNot Nothing Then |
||
5676 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5677 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
5678 | ' If Tconnector.ItemStatus = "Active" Then |
||
5679 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5680 | ' oConnector_1 = Tconnector |
||
5681 | ' End If |
||
5682 | ' End If |
||
5683 | ' Next |
||
5684 | ' End If |
||
5685 | ' If oSymbol.Connect1Connectors.Count >= 1 Then |
||
5686 | ' For Each Tconnector In oSymbol.Connect1Connectors |
||
5687 | ' If Tconnector.ItemStatus = "Active" Then |
||
5688 | ' If Tconnector.ModelItemObject.ItemTypeName = "PipeRun" Then |
||
5689 | ' oConnector_2 = Tconnector |
||
5690 | ' End If |
||
5691 | ' End If |
||
5692 | ' Next |
||
5693 | ' End If |
||
5694 | ' End If |
||
5695 | ' Dim oPipeRun1 As LMPipeRun = oDatasource.GetPipeRun(oConnector_1.ModelItemID) |
||
5696 | ' Dim oPipeRun2 As LMPipeRun = oDatasource.GetPipeRun(oConnector_2.ModelItemID) |
||
5697 | ' If dAngle = 3.14 Then |
||
5698 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5699 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5700 | ' Else |
||
5701 | ' oPipeRun1.Attributes("NominalDiameter").Value = sSplitSize(0) |
||
5702 | ' oPipeRun2.Attributes("NominalDiameter").Value = sSplitSize(1) |
||
5703 | ' End If |
||
5704 | |||
5705 | |||
5706 | ' End If |
||
5707 | |||
5708 | ' Else |
||
5709 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5710 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5711 | ' End If |
||
5712 | ' Else |
||
5713 | ' Dim sSPPIDAttribute As String = GetAttributeMapping(sPIDAttribute, _DB_COLUMN_ATTRIBUTE_SPPID_ATTRIBUTE) |
||
5714 | ' oSymbol.Attributes(sSPPIDAttribute).Value = sPIDValue |
||
5715 | ' End If |
||
5716 | |||
5717 | ' Catch ex As Exception |
||
5718 | ' End Try |
||
5719 | ' Next |
||
5720 | ' oSymbol.Commit() |
||
5721 | ' End If |
||
5722 | ' Catch ex As Exception |
||
5723 | ' End Try |
||
5724 | ' End If |
||
5725 | 'End If |
||
5726 | Catch ex As Exception |
||
5727 | End Try |
||
5728 | End Sub |
||
5729 | e4000111 | Gyusu | |
5730 | |||
5731 | |||
5732 | Private Function AutoModeling() As Boolean |
||
5733 | Try |
||
5734 | e38f99a7 | Gyusu | '_AllLine_DT = Line_Dt() |
5735 | '_AllSymbol_DT = Symbol_Dt() |
||
5736 | 79326880 | Gyusu | _ModelingLine_Dt = Line_Dt() |
5737 | e38f99a7 | Gyusu | _ModelingSymbol_Dt = Symbol_Dt() |
5738 | e4000111 | Gyusu | _CompleteConvert = False |
5739 | Label_Progress.Text = "0%" |
||
5740 | SetListBoxItems(ListBox_Result, " Auto converting 시작....") |
||
5741 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 시작....") |
5742 | e4000111 | Gyusu | Dim oDwg_Dt As DataTable = LoadAllDrawing() |
5743 | b08338e3 | Gyusu | _Log_File = "AutoConverting_" + DateTime.Now.ToString("yyyyMMdd") + "_" + DateTime.Now.ToString("HHmmss") |
5744 | e4000111 | Gyusu | _allItem = GetAllCheckNodeCount() |
5745 | 76f465d0 | Gyusu | _Itemcnt = 0 |
5746 | e4000111 | Gyusu | '1.Equipment |
5747 | '2.Piping OPC |
||
5748 | '3.OPC 시작되는 Line |
||
5749 | e6ef24be | gaqhf | |
5750 | bb2a0c79 | Gyusu | InitAutoRouting() |
5751 | e4000111 | Gyusu | EquipmentModeling(oDwg_Dt) |
5752 | bb2a0c79 | Gyusu | PipingModeling() |
5753 | |||
5754 | ' PipeLine_Fitting_Modeling() |
||
5755 | e4000111 | Gyusu | |
5756 | 171ac39d | Gyusu | SetProgressbar(ProgressBar_Status, 100) |
5757 | 41e4023e | Gyusu | Label_Progress.Text = "100%" |
5758 | 171ac39d | Gyusu | SetListBoxItems(ListBox_Result, " Auto converting 완료") |
5759 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 완료") |
5760 | 54b98e09 | Gyusu | _CompleteConvert = True |
5761 | 171ac39d | Gyusu | Return True |
5762 | Catch ex As Exception |
||
5763 | Return False |
||
5764 | End Try |
||
5765 | End Function |
||
5766 | |||
5767 | |||
5768 | |||
5769 | 54b98e09 | Gyusu | Private Sub ThreadConvert() |
5770 | 559daf6d | Gyusu | If _DrawingsList IsNot Nothing Then |
5771 | If _DrawingsList.Count > 0 Then |
||
5772 | b82166d4 | Gyusu | 'TestBranchLine() |
5773 | 559daf6d | Gyusu | AutoModeling() |
5774 | End If |
||
5775 | 171ac39d | Gyusu | End If |
5776 | e282643f | Gyusu | End Sub |
5777 | |||
5778 | 54b98e09 | Gyusu | Private Sub ThreadOPCRemove() |
5779 | While _CompleteConvert = False |
||
5780 | Dim oFindOPC As New FindOpc |
||
5781 | oFindOPC.RemoveOPCDlg() |
||
5782 | End While |
||
5783 | e282643f | Gyusu | |
5784 | 54b98e09 | Gyusu | End Sub |
5785 | 171ac39d | Gyusu | |
5786 | e282643f | Gyusu | |
5787 | Private Function OpenDrawing(ByVal oDt As DataTable, ByVal sDwgName As String) As String |
||
5788 | Dim oRows As DataRow() = oDt.Select("[Name] = '" & sDwgName & "'") |
||
5789 | Dim oPath As String = "" |
||
5790 | If oRows.Length > 0 Then |
||
5791 | oPath = oRows(0).Item("Path").ToString() |
||
5792 | End If |
||
5793 | Return oPath |
||
5794 | End Function |
||
5795 | |||
5796 | 272662f9 | Gyusu | Private Sub LoadXmlToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles LoadXmlToolStripMenuItem.Click |
5797 | 3b7a4470 | Gyusu | |
5798 | 171ac39d | Gyusu | If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then |
5799 | 54b98e09 | Gyusu | LoadDB() |
5800 | 171ac39d | Gyusu | LoadXmlItem(FolderBrowserDialog1.SelectedPath) |
5801 | End If |
||
5802 | End Sub |
||
5803 | Private Sub LoadXmlItem(ByVal sFolderPath As String) |
||
5804 | _DrawingsList = New List(Of Drawing) |
||
5805 | Dim sfileEntries As String() = Directory.GetFiles(sFolderPath) |
||
5806 | If Tree_Result.Nodes.Count > 0 Then |
||
5807 | Tree_Result.Nodes(0).Nodes.Clear() |
||
5808 | For Each sfileName In sfileEntries |
||
5809 | Dim sExtension As String = Path.GetExtension(sfileName) |
||
5810 | If sExtension = ".xml" Then |
||
5811 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(sfileName) |
||
5812 | Dim sDwgPath As String = sfileName |
||
5813 | Dim oNode As TreeNode = Tree_Result.Nodes(0).Nodes.Add(sDwgPath, sDwgName, 15) |
||
5814 | Dim oDwg As Drawing = AddSymbolItem(sDwgPath, oNode) |
||
5815 | bb2a0c79 | Gyusu | |
5816 | 171ac39d | Gyusu | _DrawingsList.Add(oDwg) |
5817 | End If |
||
5818 | Next |
||
5819 | Tree_Result.Nodes(0).Expand() |
||
5820 | End If |
||
5821 | End Sub |
||
5822 | 272662f9 | Gyusu | |
5823 | e4000111 | Gyusu | Private Sub GenerateRelation(ByRef oDwg_Ds As Drawing) |
5824 | Dim oLineLists As List(Of Line_no) = oDwg_Ds.Line_nos |
||
5825 | Dim oEqpLists As List(Of Eqp_no) = oDwg_Ds.Eqp_nos |
||
5826 | Dim oTrimLineLists As List(Of Line_no) = oDwg_Ds.TrimLine_nos |
||
5827 | Dim oRelation As New GenerateRelation() |
||
5828 | For Each oLinelist In oLineLists |
||
5829 | bb2a0c79 | Gyusu | oRelation.CalcLineConnectionItem_Equal(oLinelist.Dt_Line, oLineLists) |
5830 | oRelation.CalcLineConnectionItem_NonEqual(oLinelist.Dt_Line, oLineLists) |
||
5831 | oRelation.CalcSymbolConnectionItem_Equal(oLinelist.Dt_Symbol, oLineLists) |
||
5832 | oRelation.CalcSymbolConnectionItem_NonEqual(oLinelist.Dt_Symbol, oLineLists) |
||
5833 | e4000111 | Gyusu | Next |
5834 | End Sub |
||
5835 | |||
5836 | e6ef24be | gaqhf | Private Sub SetSymbol_LineNumberByUID(ByVal symbols As List(Of Symbol), ByVal lineNumber As LineNumber, ByVal uid As String) |
5837 | For Each symbol As Symbol In symbols |
||
5838 | If symbol.UID = uid Then |
||
5839 | symbol.LINENUMBER = lineNumber |
||
5840 | Exit For |
||
5841 | End If |
||
5842 | Next |
||
5843 | End Sub |
||
5844 | |||
5845 | Private Sub SetLine_LineNumberByUID(ByVal lines As List(Of Line), ByVal lineNumber As LineNumber, ByVal uid As String) |
||
5846 | For Each line As Line In lines |
||
5847 | If line.UID = uid Then |
||
5848 | line.LINENUMBER = lineNumber |
||
5849 | Exit For |
||
5850 | End If |
||
5851 | Next |
||
5852 | End Sub |
||
5853 | e4000111 | Gyusu | |
5854 | 20c84e05 | Gyusu | ''' <summary> |
5855 | ''' XML Tree 구조 생성 |
||
5856 | ''' </summary> |
||
5857 | ''' <param name="sDwgPath"></param> |
||
5858 | 171ac39d | Gyusu | Private Function AddSymbolItem(ByVal sDwgPath As String, ByVal oParentNode As TreeNode) As Drawing |
5859 | Dim oDwg_Ds As Drawing = LoadSymbolInXml(sDwgPath) |
||
5860 | e4000111 | Gyusu | |
5861 | 54b98e09 | Gyusu | If oDwg_Ds IsNot Nothing Then |
5862 | |||
5863 | e6ef24be | gaqhf | Dim oLineNos As List(Of LineNumber) = oDwg_Ds.LINENUMBERS |
5864 | 3acffcee | Gyusu | |
5865 | e6ef24be | gaqhf | Dim oTrimLines As List(Of LineNumber) = oDwg_Ds.TRIMLINES |
5866 | 3acffcee | Gyusu | |
5867 | e6ef24be | gaqhf | Dim oSymbols As List(Of Symbol) = oDwg_Ds.SYMBOLS |
5868 | 54b98e09 | Gyusu | |
5869 | e6ef24be | gaqhf | Dim oLines As List(Of Line) = oDwg_Ds.LINES |
5870 | 9c86a823 | Gyusu | |
5871 | e6ef24be | gaqhf | '' TreeView 구성 및 하위 아이템 상위 구성 |
5872 | ' LIne Number |
||
5873 | For Each lineNo As LineNumber In oLineNos |
||
5874 | oParentNode.Nodes.Add(lineNo.UID, lineNo.UID) |
||
5875 | 9c86a823 | Gyusu | |
5876 | e6ef24be | gaqhf | For Each uid In lineNo.SYMBOLRUNITEMS |
5877 | SetSymbol_LineNumberByUID(oSymbols, lineNo, uid) |
||
5878 | 54b98e09 | Gyusu | Next |
5879 | 9c86a823 | Gyusu | |
5880 | e6ef24be | gaqhf | For Each uid In lineNo.LINERUNITEMS |
5881 | SetLine_LineNumberByUID(oLines, lineNo, uid) |
||
5882 | 54b98e09 | Gyusu | Next |
5883 | Next |
||
5884 | 3acffcee | Gyusu | |
5885 | e6ef24be | gaqhf | ' Trim Line |
5886 | For index = 0 To oTrimLines.Count - 1 |
||
5887 | Dim trimLine As LineNumber = oTrimLines(index) |
||
5888 | oParentNode.Nodes.Add(trimLine.UID, "TrimLine" + index.ToString) |
||
5889 | d039e347 | Gyusu | |
5890 | e6ef24be | gaqhf | For Each uid In trimLine.SYMBOLRUNITEMS |
5891 | SetSymbol_LineNumberByUID(oSymbols, trimLine, uid) |
||
5892 | Next |
||
5893 | 54b98e09 | Gyusu | |
5894 | e6ef24be | gaqhf | For Each uid In trimLine.LINERUNITEMS |
5895 | SetLine_LineNumberByUID(oLines, trimLine, uid) |
||
5896 | 54b98e09 | Gyusu | Next |
5897 | 171ac39d | Gyusu | Next |
5898 | e6ef24be | gaqhf | ' symbol |
5899 | For Each symbol As Symbol In oSymbols |
||
5900 | If symbol.LINENUMBER IsNot Nothing Then |
||
5901 | Dim nodeIndex As Integer = oParentNode.Nodes.IndexOfKey(symbol.LINENUMBER.UID) |
||
5902 | oParentNode.Nodes.Item(nodeIndex).Nodes.Add(symbol.UID, symbol.TYPE) |
||
5903 | Else |
||
5904 | oParentNode.Nodes.Add(symbol.UID, symbol.TYPE) |
||
5905 | End If |
||
5906 | Next |
||
5907 | ' line |
||
5908 | For Each line As Line In oLines |
||
5909 | If line.LINENUMBER IsNot Nothing Then |
||
5910 | Dim nodeIndex As Integer = oParentNode.Nodes.IndexOfKey(line.LINENUMBER.UID) |
||
5911 | oParentNode.Nodes.Item(nodeIndex).Nodes.Add(line.UID, line.TYPE) |
||
5912 | Else |
||
5913 | oParentNode.Nodes.Add(line.UID, line.TYPE) |
||
5914 | End If |
||
5915 | 3acffcee | Gyusu | Next |
5916 | |||
5917 | 54b98e09 | Gyusu | End If |
5918 | |||
5919 | 171ac39d | Gyusu | Return oDwg_Ds |
5920 | End Function |
||
5921 | 272662f9 | Gyusu | Private Sub Tree_Result_AfterCheck(sender As Object, e As TreeViewEventArgs) Handles Tree_Result.AfterCheck |
5922 | If e.Node.Checked = True Then |
||
5923 | For Each oNode As TreeNode In e.Node.Nodes |
||
5924 | oNode.Checked = True |
||
5925 | Next |
||
5926 | Else |
||
5927 | For Each oNode As TreeNode In e.Node.Nodes |
||
5928 | oNode.Checked = False |
||
5929 | Next |
||
5930 | End If |
||
5931 | End Sub |
||
5932 | 171ac39d | Gyusu | |
5933 | 559daf6d | Gyusu | Private Sub Btn_Setting_Click(sender As Object, e As EventArgs) Handles Btn_Setting.Click |
5934 | Dim oSettings As Settings = New Settings() |
||
5935 | oSettings.ShowDialog() |
||
5936 | End Sub |
||
5937 | 42c0013c | Gyusu | |
5938 | b82166d4 | Gyusu | |
5939 | Private Sub TestBranchLine() |
||
5940 | Dim objPlacement As Placement |
||
5941 | objPlacement = New Placement |
||
5942 | Dim PipeRunLocation As String |
||
5943 | Dim objItem As LMAItem |
||
5944 | Dim objConnector As LMConnector |
||
5945 | Dim objInputs As PlaceRunInputs |
||
5946 | Dim objSymbol As LMSymbol |
||
5947 | Dim ValveLocation As String |
||
5948 | PipeRunLocation = "\Piping\Routing\Process Lines\Primary Piping.sym" |
||
5949 | objInputs = New PlaceRunInputs |
||
5950 | objInputs.AddPoint(0.1, 0.1) |
||
5951 | objInputs.AddPoint(0.2, 0.1) |
||
5952 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
5953 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
5954 | ValveLocation = "\Piping\Valves\2 Way Common\Ball Valve.sym" |
||
5955 | objSymbol = objPlacement.PIDPlaceSymbol(ValveLocation, 0.15, 0.3, , 1.57) |
||
5956 | objInputs = New PlaceRunInputs |
||
5957 | objInputs.AddConnectorTarget(objConnector, 0.15, 0.1) |
||
5958 | ' objInputs.AddConnectorTarget(objConnector, 0.12, 0.1) |
||
5959 | objInputs.AddPoint(0.15, 0.15) |
||
5960 | objInputs.AddPoint(0.12, 0.15) |
||
5961 | objInputs.AddPoint(0.12, 0.2) |
||
5962 | objInputs.AddPoint(0.15, 0.2) |
||
5963 | objInputs.AddSymbolTarget(objSymbol, 0.15, 0.3) |
||
5964 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
5965 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
5966 | |||
5967 | objInputs = New PlaceRunInputs |
||
5968 | objInputs.AddConnectorTarget(objConnector, 0.17, 0.1) |
||
5969 | objInputs.AddPoint(0.17, 0.15) |
||
5970 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
5971 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
5972 | |||
5973 | objInputs = New PlaceRunInputs |
||
5974 | objInputs.AddConnectorTarget(objConnector, 0.19, 0.1) |
||
5975 | objInputs.AddPoint(0.19, 0.15) |
||
5976 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
5977 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
5978 | |||
5979 | objInputs = New PlaceRunInputs |
||
5980 | objInputs.AddConnectorTarget(objConnector, 0.12, 0.1) |
||
5981 | objInputs.AddPoint(0.12, 0.15) |
||
5982 | objItem = objPlacement.PIDCreateItem(PipeRunLocation) |
||
5983 | objConnector = objPlacement.PIDPlaceRun(objItem, objInputs) |
||
5984 | End Sub |
||
5985 | |||
5986 | 42c0013c | Gyusu | Private Sub Btn_TestNozzle_Click(sender As Object, e As EventArgs) Handles Btn_TestNozzle.Click |
5987 | |||
5988 | Dim sVessel_ID As String = "841D5E640AE5421B9A017DDC2E87FF11" |
||
5989 | Dim objVessel As LMVessel |
||
5990 | objVessel = _Placement.PIDDataSource.GetVessel(sVessel_ID) |
||
5991 | Dim oVesselLocation As LMLocations = objVessel.Locations |
||
5992 | Dim symVessel As LMSymbol = _Placement.PIDDataSource.GetSymbol(objVessel.Representations.Nth(1).Id) |
||
5993 | Dim XCoordinate As String = symVessel.Attributes("XCoordinate").Value |
||
5994 | Dim YCoordinate As String = symVessel.Attributes("YCoordinate").Value |
||
5995 | symVessel.Attributes("XCoordinate").Value = XCoordinate + 0.01 |
||
5996 | symVessel.Attributes("YCoordinate").Value = YCoordinate + 0.01 |
||
5997 | symVessel.Commit() |
||
5998 | Dim sValve_ID As String = "DB7B0CA8A2664A6BA7A9615764BA62B0" |
||
5999 | Dim objValve As LMSymbol |
||
6000 | Dim objValves As LMPipingComp = _Placement.PIDDataSource.GetPipingComp(sValve_ID) |
||
6001 | objValve = _Placement.PIDDataSource.GetSymbol(objValves.Representations.Nth(1).Id) |
||
6002 | objValve.Commit() |
||
6003 | Dim dVesselX As Double = XCoordinate |
||
6004 | Dim dVesselY As Double = YCoordinate |
||
6005 | Dim X1 As Double, Y1 As Double, X2 As Double, Y2 As Double |
||
6006 | |||
6007 | _Placement.PIDConnectPointLocation(objValve, 1, X1, Y1) |
||
6008 | |||
6009 | _Placement.PIDConnectPointLocation(objValve, 2, X2, Y2) |
||
6010 | |||
6011 | Dim nozzlename As String = "\Equipment Components\Nozzles\Flanged Nozzle.sym" |
||
6012 | Dim dCalc_x As Double = 0 |
||
6013 | Dim dCalc_y As Double = 0 |
||
6014 | |||
6015 | If dVesselX - X2 > 0 Then |
||
6016 | dCalc_x = dVesselX - (dVesselX - X2) |
||
6017 | Else |
||
6018 | dCalc_x = dVesselX + (X2 - dVesselX) |
||
6019 | End If |
||
6020 | If dVesselY - Y2 > 0 Then |
||
6021 | dCalc_y = dVesselY - (dVesselY - Y2) |
||
6022 | Else |
||
6023 | dCalc_y = dVesselY + (Y2 - dVesselY) |
||
6024 | End If |
||
6025 | |||
6026 | Dim objNozzle As LMSymbol = _Placement.PIDPlaceSymbol(nozzlename, dCalc_x, dCalc_y, |
||
6027 | TargetItem:=symVessel.AsLMRepresentation) |
||
6028 | |||
6029 | Dim blnSuccess As Boolean = _Placement.PIDConnectPointLocation(objNozzle, 1, X1, Y1) |
||
6030 | blnSuccess = _Placement.PIDConnectPointLocation(objNozzle, 2, X1, Y1) |
||
6031 | |||
6032 | objValve = _Placement.PIDPlaceSymbol(objValve.FileName, X1, Y1, ExistingItem:=objValve.AsLMAItem, |
||
6033 | TargetItem:=objNozzle.AsLMRepresentation) |
||
6034 | |||
6035 | |||
6036 | |||
6037 | End Sub |
||
6038 | 39d43554 | Gyusu | |
6039 | Private Sub Btn_SymbolLibrary_Click(sender As Object, e As EventArgs) Handles Btn_SymbolLibrary.Click |
||
6040 | Dim oMapping As New Mapping(_PIDSymbol_DB) |
||
6041 | oMapping.Show() |
||
6042 | End Sub |
||
6043 | 41e4023e | Gyusu | |
6044 | Private Sub Btn_Stop_Click(sender As Object, e As EventArgs) Handles Btn_Stop.Click |
||
6045 | Try |
||
6046 | SetListBoxItems(ListBox_Result, " Auto converting 중지....") |
||
6047 | b08338e3 | Gyusu | ComUtil.MessageLog.CEventLog.Log_Write_Update(_Log_Path, _Log_File, " Auto converting 중지....") |
6048 | 41e4023e | Gyusu | _Main_trd.Abort() |
6049 | _Opc_trd.Abort() |
||
6050 | Catch ex As Exception |
||
6051 | |||
6052 | End Try |
||
6053 | End Sub |
||
6054 | b08338e3 | Gyusu | |
6055 | Private Sub AutoCheckTreeNode(ByVal iType As Integer, ByVal bCheck As Boolean) |
||
6056 | |||
6057 | For Each oDrwing As TreeNode In Tree_Result.Nodes |
||
6058 | For Each oDwgNode As TreeNode In oDrwing.Nodes |
||
6059 | Dim sDwgName As String = Path.GetFileNameWithoutExtension(oDwgNode.Text) |
||
6060 | Dim CDrawing As Drawing = GetDrawing(sDwgName) |
||
6061 | If CDrawing IsNot Nothing Then |
||
6062 | Dim iAllLineNoCount As Integer = Tree_Result.Nodes.Count ' GetCheckNodeCount(oLinenoNode) |
||
6063 | Dim iPipingOPC_count As Integer = 0 ' GetCheckNodeCount(oLinenoNode) |
||
6064 | For Each oNode As TreeNode In oDwgNode.Nodes |
||
6065 | Dim iItemcnt As Integer = 0 |
||
6066 | Dim sNodeUid As String = oNode.Name |
||
6067 | Dim oPipeRun_Dt As DataTable = PipeRun_Dt() |
||
6068 | |||
6069 | If iType = 0 Then 'Symbol |
||
6070 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
6071 | If CLineNo IsNot Nothing Then |
||
6072 | Dim oSymbol_Dt As DataTable = CLineNo.Dt_Symbol |
||
6073 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
6074 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
6075 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
6076 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
6077 | If sSymbolNodeUid = sSymbolUid Then |
||
6078 | oSymbolNode.Checked = bCheck |
||
6079 | Exit For |
||
6080 | End If |
||
6081 | Next |
||
6082 | Next |
||
6083 | End If |
||
6084 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
6085 | If TrimLineNo IsNot Nothing Then |
||
6086 | Dim oSymbol_Dt As DataTable = TrimLineNo.Dt_Symbol |
||
6087 | For Each oSymbolRow In oSymbol_Dt.Rows |
||
6088 | Dim sSymbolUid As String = oSymbolRow(_XML_SYMBOL_UID).ToString() |
||
6089 | For Each oSymbolNode As TreeNode In oNode.Nodes |
||
6090 | Dim sSymbolNodeUid As String = oSymbolNode.Name |
||
6091 | If sSymbolNodeUid = sSymbolUid Then |
||
6092 | oSymbolNode.Checked = bCheck |
||
6093 | Exit For |
||
6094 | End If |
||
6095 | Next |
||
6096 | Next |
||
6097 | End If |
||
6098 | End If |
||
6099 | If iType = 1 Then 'Line |
||
6100 | Dim CLineNo As Line_no = GetLineNo(CDrawing, sNodeUid) |
||
6101 | If CLineNo IsNot Nothing Then |
||
6102 | Dim oLine_Dt As DataTable = CLineNo.Dt_Line |
||
6103 | For Each oLineRow In oLine_Dt.Rows |
||
6104 | Dim sLineUid As String = oLineRow(_XML_LINE_UID).ToString() |
||
6105 | For Each oLineNode As TreeNode In oNode.Nodes |
||
6106 | Dim sLineNodeUid As String = oLineNode.Name |
||
6107 | If sLineNodeUid = sLineUid Then |
||
6108 | oLineNode.Checked = bCheck |
||
6109 | Exit For |
||
6110 | End If |
||
6111 | Next |
||
6112 | Next |
||
6113 | End If |
||
6114 | Dim TrimLineNo As Line_no = GetTrimLineNo(CDrawing, sNodeUid) |
||
6115 | If TrimLineNo IsNot Nothing Then |
||
6116 | Dim oLine_Dt As DataTable = TrimLineNo.Dt_Line |
||
6117 | For Each oLineRow In oLine_Dt.Rows |
||
6118 | Dim sLineUid As String = oLineRow(_XML_SYMBOL_UID).ToString() |
||
6119 | For Each oLineNode As TreeNode In oNode.Nodes |
||
6120 | Dim sLineNodeUid As String = oLineNode.Name |
||
6121 | If sLineNodeUid = sLineUid Then |
||
6122 | oLineNode.Checked = bCheck |
||
6123 | Exit For |
||
6124 | End If |
||
6125 | Next |
||
6126 | Next |
||
6127 | End If |
||
6128 | End If |
||
6129 | If iType = 2 Then 'Equipment |
||
6130 | Dim CEqpNo As Eqp_no = GetEqpNo(CDrawing, sNodeUid) |
||
6131 | If CEqpNo IsNot Nothing Then |
||
6132 | Dim oEqp_Dt As DataTable = CEqpNo.Dt_Equipment |
||
6133 | For Each oEqpRow In oEqp_Dt.Rows |
||
6134 | Dim sEqpUid As String = oEqpRow(_XML_LINE_UID).ToString() |
||
6135 | For Each oEqpNode As TreeNode In oNode.Nodes |
||
6136 | Dim sEqpNodeUid As String = oEqpNode.Name |
||
6137 | If sEqpNodeUid = sEqpUid Then |
||
6138 | oEqpNode.Checked = bCheck |
||
6139 | Exit For |
||
6140 | End If |
||
6141 | Next |
||
6142 | Next |
||
6143 | End If |
||
6144 | End If |
||
6145 | Next |
||
6146 | End If |
||
6147 | Next |
||
6148 | Next |
||
6149 | |||
6150 | |||
6151 | End Sub |
||
6152 | |||
6153 | |||
6154 | |||
6155 | Private Sub Chk_Symbol_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Symbol.CheckedChanged |
||
6156 | AutoCheckTreeNode(0, Chk_Symbol.Checked) |
||
6157 | End Sub |
||
6158 | |||
6159 | Private Sub Chk_Line_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Line.CheckedChanged |
||
6160 | AutoCheckTreeNode(1, Chk_Line.Checked) |
||
6161 | End Sub |
||
6162 | |||
6163 | Private Sub Chk_Equipment_CheckedChanged(sender As Object, e As EventArgs) Handles Chk_Equipment.CheckedChanged |
||
6164 | AutoCheckTreeNode(2, Chk_Equipment.Checked) |
||
6165 | End Sub |
||
6166 | e282643f | Gyusu | End Class |
6167 | |||
6168 | |||
6169 | Public Class DrawingInfo |
||
6170 | Public mDrawingName As String |
||
6171 | Public mSpID As String |
||
6172 | Public mPath As String |
||
6173 | 4f359afa | Gyusu | End Class |
6174 | e282643f | Gyusu | |
6175 | |||
6176 | |||
6177 |