개정판 31d47a80
PPT Update
DTI_PID/SPPIDConverter/Main.vb | ||
---|---|---|
15 | 15 |
Dim _IMG_X = 0 |
16 | 16 |
Dim _IMG_Y = 0 |
17 | 17 | |
18 |
'Drawing 전역변수 |
|
19 |
Dim _objPIDADrawing As Object |
|
20 | ||
18 | 21 |
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load |
19 | 22 |
Dim sDBPath As String = "C:\Users\kyusu\Desktop\Auto SPPID 변환 프로젝트\PID.db" |
20 | 23 |
LoadDB(sDBPath) |
21 | ||
22 | 24 |
SetUpListViewColumns() |
23 | 25 |
LoadTree() |
24 |
TestOpen() |
|
26 |
' TestOpen()
|
|
25 | 27 | |
26 | 28 |
End Sub |
27 | 29 |
Private Sub LoadTree() |
... | ... | |
117 | 119 |
oRootNode.ExpandAll() |
118 | 120 |
End Sub |
119 | 121 | |
120 |
Private Sub TestOpen() |
|
121 |
Dim datasource As LMADataSource |
|
122 |
Dim objPIDAutoApp As Object |
|
123 |
Dim objPIDADrawing As Object |
|
124 |
Dim objDrawing As LMDrawing |
|
125 |
Dim objDrawings As LMDrawings |
|
126 | 122 | |
127 |
datasource = New LMADataSource |
|
128 | 123 | |
129 |
objDrawings = New LMDrawings |
|
130 |
objDrawings.Collect(datasource) |
|
131 |
objPIDAutoApp = CreateObject("PIDAutomation.Application") |
|
132 |
Dim iCount As Integer = 0 |
|
133 |
Dim sPath As String = "\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\188943-8121-PR-DW-011001.pid" |
|
134 |
For Each objDrawing In objDrawings |
|
135 |
If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
|
136 |
Try |
|
137 |
iCount = iCount + 1 |
|
138 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(sPath) |
|
139 |
If Not objPIDADrawing Is Nothing Then |
|
140 |
objPIDADrawing.CloseDrawing() |
|
141 |
End If |
|
142 |
Catch ex As Exception |
|
143 | 124 | |
144 |
End Try |
|
145 | 125 | |
146 |
End If |
|
147 |
Next |
|
148 |
objPIDAutoApp.Quit |
|
149 |
objPIDAutoApp = Nothing |
|
150 |
objPIDADrawing = Nothing |
|
151 |
objDrawing = Nothing |
|
152 |
objDrawings = Nothing |
|
153 |
End Sub |
|
126 | ||
154 | 127 | |
155 | 128 | |
156 | 129 |
Private Function CreateDwg(ByVal oDwgName As String) As Boolean |
... | ... | |
237 | 210 |
' 'if LMAItem is a piperun, connector graphic object will be returned |
238 | 211 |
' objReturnGraphics = New Collection |
239 | 212 | |
240 |
' ' IncrementProgressBar objProgressBar, "Translate need to be highlighted LMAItems to graphic object..."
|
|
213 |
' ' IncrementProgressBar objProgressBar, "Translate need To be highlighted LMAItems To graphic Object..."
|
|
241 | 214 |
' 'For Each objItem In objItems |
242 | 215 |
' ' objReturnGraphics = GetGraphicsFromLMAItem(objItem, radApp.ActiveDocument.ActiveSheet, drawingInfo.mDrawingName) |
243 | 216 |
' ' For Each objGraphic In objReturnGraphics |
... | ... | |
255 | 228 |
' ' Next |
256 | 229 |
' 'Next |
257 | 230 |
' 'If Not blnGraphic Then |
258 |
' ' Debug.WriteLine("Items are in drawing stockpile, use EDE to view.")
|
|
231 |
' ' Debug.WriteLine("Items are In drawing stockpile, use EDE to view.")
|
|
259 | 232 |
' 'Else |
260 |
' ' Debug.WriteLine("Complete! " & objItems.Count & " items are highled in drawing: " & spid) |
|
233 |
' ' Debug.WriteLine("Complete! " & objItems.Count & " items are highled in drawing: " & spid)
|
|
261 | 234 |
' 'End If |
262 | 235 | |
263 | 236 |
'Else |
... | ... | |
907 | 880 |
MsgBox(Err.Description) |
908 | 881 |
End Sub |
909 | 882 | |
883 |
Private Function LoadAllDrawing() As DataTable |
|
884 |
Dim oDt As DataTable = Drawing_Dt() |
|
885 |
_objPIDADrawing = CreateObject("PIDAutomation.Application") |
|
886 |
For Each objDrawing In _objPIDADrawing.Drawings |
|
887 |
Dim sName As String = objDrawing.Attributes("Name").Value |
|
888 |
Dim sPath As String = objDrawing.Attributes("Path").Value |
|
889 |
Dim oAddRow As DataRow = oDt.NewRow() |
|
890 |
oAddRow("Name") = sName |
|
891 |
oAddRow("Path") = sPath |
|
892 |
oDt.Rows.Add(oAddRow) |
|
893 |
Next |
|
894 |
Return oDt |
|
895 |
End Function |
|
896 | ||
897 |
Private Sub TestOpen() |
|
898 |
Dim datasource As LMADataSource |
|
899 |
Dim objPIDAutoApp As Object |
|
900 |
Dim objPIDADrawing As Object |
|
901 |
Dim objDrawing As Object 'Drawing |
|
902 |
'Dim objDrawing As LMDrawing |
|
903 |
'Dim objDrawings As LMDrawings |
|
904 | ||
905 |
datasource = New LMADataSource |
|
906 | ||
907 |
' objDrawings = New LMDrawings |
|
908 |
'objDrawings.Collect(datasource) |
|
909 |
objPIDAutoApp = CreateObject("PIDAutomation.Application") |
|
910 | ||
911 |
For Each objDrawing In objPIDAutoApp.Drawings |
|
912 |
objDrawing.CloseDrawing(True) |
|
913 |
Next |
|
914 |
Try |
|
915 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing("UY1-K-2000_P1_300dpi_0321_TEST_1") |
|
916 |
Catch ex As Exception |
|
917 |
Process.Start("\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\UY1-K-2000_P1_300dpi_0321_TEST_1.pid") |
|
918 |
End Try |
|
919 | ||
920 | ||
921 | ||
922 |
Dim sType As Type = objPIDAutoApp.GetType() |
|
923 |
Dim iCount As Integer = 0 |
|
924 |
' Dim sPath As String = "\\desktop-9vlq0dp\Test02Site\P188943_SPPID_Plant\Plant_Hierarchy\8121\8121-1\188943-8121-PR-DW-011001.pid" |
|
925 | ||
926 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing("1") |
|
927 | ||
928 |
For Each objDrawing In objPIDAutoApp.Drawings |
|
929 |
If objDrawing.Attributes("ItemStatus").Index = 1 Then '1 stands for Active |
|
930 |
Try |
|
931 | ||
932 |
Dim sName As String = objDrawing.Attributes("Name").Value |
|
933 | ||
934 |
iCount = iCount + 1 |
|
935 |
If sName = "UY1-K-2000_P1_300dpi_0321_TEST_1" Then |
|
936 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing(objDrawing.Attributes("Name")) |
|
937 |
objPIDADrawing = objPIDAutoApp.Drawings.OpenDrawing("\8121\8121-1\UY1-K-2000_P1_300dpi_0321_TEST_1.pid") |
|
938 |
If Not objPIDADrawing Is Nothing Then |
|
939 |
objPIDADrawing.CloseDrawing() |
|
940 |
End If |
|
941 |
End If |
|
942 | ||
943 | ||
944 |
Catch ex As Exception |
|
945 | ||
946 |
End Try |
|
947 | ||
948 |
End If |
|
949 |
Next |
|
950 |
objPIDAutoApp.Quit |
|
951 |
objPIDAutoApp = Nothing |
|
952 |
objPIDADrawing = Nothing |
|
953 |
objDrawing = Nothing |
|
954 |
' objDrawings = Nothing |
|
955 |
End Sub |
|
910 | 956 |
Private Sub Btn_Convert_Click(sender As Object, e As EventArgs) Handles Btn_Convert.Click |
957 | ||
911 | 958 |
If ListView_File.Items.Count > 0 Then |
959 |
Dim oDwg_Dt As DataTable = LoadAllDrawing() |
|
960 | ||
912 | 961 |
For Each oItem As ListViewItem In ListView_File.Items |
913 | 962 |
If oItem.Checked Then |
914 | 963 |
Dim sDwgName As String = oItem.Text |
... | ... | |
918 | 967 | |
919 | 968 |
Dim oPipe_Dt As DataTable = Nothing 'LoadPipeInXml(oDwgPath) |
920 | 969 |
Dim oSymbol_Dt As DataTable = LoadSymbolInXml(oDwgPath) |
921 | ||
922 | 970 |
'도면 생성 |
923 | 971 |
If CreateDwg(sDwgName) Then |
924 | 972 |
'AutoConverting |
내보내기 Unified diff