개정판 224535bb
dev issue #569 : PDF To Image 변환툴 여러 파일 가능하게 수정 / OPC 작업을 위한 Drawing 정보 정리
Change-Id: I62beba4afda9acbeab9bfb5ace94ca221673c584
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
20 | 20 |
using Plaice; |
21 | 21 |
using Llama; |
22 | 22 |
using DevExpress.XtraSplashScreen; |
23 |
using Newtonsoft.Json; |
|
23 | 24 |
|
24 | 25 |
namespace Converter.SPPID.Wrapper |
25 | 26 |
{ |
... | ... | |
99 | 100 |
_ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath; |
100 | 101 |
if (Project_DB.ConnTestAndCreateTable()) |
101 | 102 |
{ |
102 |
drawings.Collect(dataSource); |
|
103 |
DataTable dt = Project_DB.SelectSPPID_DB_INFO(); |
|
104 |
if (dt.Columns.Count > 0 && dt.Rows.Count > 0) |
|
105 |
SPPIDUtil.ConvertToSPPIDInfo(dt.Rows[0][0].ToString()); |
|
106 |
else |
|
107 |
SPPID_DBInfo.Clear(); |
|
108 |
|
|
109 |
SPPID_DBInfo sPPID_DBInfo = SPPID_DBInfo.GetInstance(); |
|
110 |
if (sPPID_DBInfo.Enable) |
|
111 |
{ |
|
112 |
drawings.Collect(dataSource); |
|
103 | 113 |
|
104 |
List<string> drawingNameList = new List<string>();
|
|
105 |
List<string> drawingNumberList = new List<string>();
|
|
106 |
DataTable drawingTable = Project_DB.SelectDrawingInfo();
|
|
114 |
DataTable drawingTable = Project_DB.SelectDrawingInfo();
|
|
115 |
drawingTable.Columns.Add("EXIST", typeof(bool));
|
|
116 |
drawingTable.Columns.Add("SPPIDPATH", typeof(string));
|
|
107 | 117 |
|
108 |
foreach (LMDrawing item in drawings) |
|
109 |
{ |
|
110 |
drawingNameList.Add(item.Attributes["Name"].get_Value().ToString()); |
|
111 |
drawingNumberList.Add(item.Attributes["DrawingNumber"].get_Value().ToString()); |
|
112 |
} |
|
118 |
foreach (LMDrawing item in drawings) |
|
119 |
{ |
|
120 |
DataRow[] rows = drawingTable.Select(string.Format("DRAWINGNUMBER = '{0}'", item.Attributes["DrawingNumber"].get_Value())); |
|
121 |
foreach (DataRow row in rows) |
|
122 |
{ |
|
123 |
row["EXIST"] = true; |
|
124 |
row["DRAWINGNAME"] = item.Attributes["Name"].get_Value(); |
|
125 |
row["SPPIDPATH"] = item.get_Path(); |
|
126 |
} |
|
127 |
} |
|
113 | 128 |
|
129 |
foreach (DataRow row in drawingTable.Rows) |
|
130 |
{ |
|
131 |
SPPID_Document document = JsonConvert.DeserializeObject<SPPID_Document>(row["DOCUMENT"].ToString()); |
|
132 |
AutoModeling_OPC opc = new AutoModeling_OPC(document, application, radApp, row["DRAWINGNAME"].ToString()); |
|
133 |
opc.Run(); |
|
134 |
} |
|
135 |
//dynamic doc = application.Drawings.OpenDrawing(drawingTable.Rows[0]["DRAWINGNAME"]); |
|
114 | 136 |
|
137 |
//doc.CloseDrawing(true); |
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
//radApp.Documents.Open(sPPID_DBInfo.PlantPath + @"\" + drawingTable.Rows[0]["SPPIDPATH"].ToString()); |
|
142 |
} |
|
115 | 143 |
} |
116 | 144 |
else |
117 | 145 |
{ |
... | ... | |
181 | 209 |
Placement _placement = new Placement(); |
182 | 210 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
183 | 211 |
|
184 |
foreach (var item in radApp.ActiveDocument.ActiveSheet.DrawingObjects) |
|
212 |
LMOPC opc = dataSource.GetOPC("B79C53F295454F489B9DBCD9F1078D3E"); |
|
213 |
LMOPC pairOPC = opc.pairedWithOPCObject; |
|
214 |
|
|
215 |
foreach (LMRepresentation rep in pairOPC.Representations) |
|
185 | 216 |
{ |
186 |
Ingr.RAD2D.DependencyObject dependencyObject = item as Ingr.RAD2D.DependencyObject; |
|
187 |
if (dependencyObject != null) |
|
217 |
if (rep.DrawingID != "0") |
|
188 | 218 |
{ |
189 |
string sModelItemType = string.Empty; |
|
190 |
string sModelID = string.Empty; |
|
191 |
foreach (Ingr.RAD2D.AttributeSet attributes in dependencyObject.AttributeSets) |
|
192 |
{ |
|
193 |
foreach (var attribute in attributes) |
|
194 |
{ |
|
195 |
if (attribute.Name == "ModelItemType") |
|
196 |
sModelItemType = attribute.GetValue().ToString(); |
|
197 |
else if (attribute.Name == "ModelID") |
|
198 |
sModelID = attribute.GetValue().ToString(); |
|
199 |
} |
|
200 |
} |
|
201 |
|
|
202 |
if (sModelItemType == "PipeRun" && !string.IsNullOrEmpty(sModelID)) |
|
203 |
{ |
|
204 |
LMModelItem modelItem = dataSource.GetModelItem(sModelID); |
|
205 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active") |
|
206 |
{ |
|
207 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
208 |
{ |
|
209 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
210 |
{ |
|
211 |
LMConnector connector = dataSource.GetConnector(rep.Id); |
|
212 |
if (connector.get_IsZeroLength() && connector.LabelPersists.Count == 0) |
|
213 |
{ |
|
214 |
|
|
215 |
} |
|
216 |
} |
|
217 |
} |
|
218 |
|
|
219 |
} |
|
220 |
} |
|
219 |
MessageBox.Show(rep.DrawingObject.Attributes["Name"].get_Value().ToString()); |
|
221 | 220 |
} |
222 | 221 |
} |
223 |
|
|
224 |
//string modelItemId = "B79C53F295454F489B9DBCD9F1078D3E"; |
|
225 |
//LMOPC opc = dataSource.GetOPC(modelItemId); |
|
226 |
//try |
|
227 |
//{ |
|
228 |
// if (opc != null) |
|
229 |
// { |
|
230 |
// LMOPC pairedOPC = opc.pairedWithOPCObject; |
|
231 |
// //MessageBox.Show(pairedOPC.get_ItemStatus()); |
|
232 |
// //pairedOPC.Attributes[] |
|
233 |
// _placement.PIDPlaceSymbol(@"\Piping\Piping OPC's\Off-Drawing.sym", 0, 0, 0, 0, pairedOPC.AsLMAItem()); |
|
234 |
// } |
|
235 |
//} |
|
236 |
//catch (Exception ex) |
|
237 |
//{ |
|
238 |
// System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
239 |
//} |
|
240 |
//finally |
|
241 |
//{ |
|
242 |
|
|
243 |
//} |
|
244 |
|
|
245 |
//if (radApp.ActiveSelectSet.Count > 0) |
|
246 |
//{ |
|
247 |
// DependencyObject line2D = radApp.ActiveSelectSet[0] as DependencyObject; |
|
248 |
// if (line2D != null) |
|
249 |
// { |
|
250 |
// double minX = 0; |
|
251 |
// double minY = 0; |
|
252 |
// double maxX = 0; |
|
253 |
// double maxY = 0; |
|
254 |
// line2D.Range(out minX, out minY, out maxX, out maxY); |
|
255 |
|
|
256 |
// StringBuilder sb = new StringBuilder(); |
|
257 |
// sb.AppendLine(minX.ToString()); |
|
258 |
// sb.AppendLine(minY.ToString()); |
|
259 |
// sb.AppendLine(maxX.ToString()); |
|
260 |
// sb.AppendLine(maxY.ToString()); |
|
261 |
// MessageBox.Show(sb.ToString()); |
|
262 |
|
|
263 |
// } |
|
264 |
// else |
|
265 |
// MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
266 |
//} |
|
267 |
//else |
|
268 |
// MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
269 |
|
|
222 |
|
|
270 | 223 |
} |
271 | 224 |
|
272 | 225 |
|
내보내기 Unified diff