개정판 69b7387a
dev issue #498 : OPC Button 추가 및 cs File 추가
Change-Id: I1b3a1cb59c69134d794fe7719b40ad5713060c72
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
8 | 8 |
using System.Threading.Tasks; |
9 | 9 |
using System.Windows.Forms; |
10 | 10 |
using System.Threading; |
11 |
using System.IO; |
|
11 | 12 |
using Microsoft.VisualBasic; |
12 | 13 |
using Ingr.RAD2D; |
13 | 14 |
using Converter.BaseModel; |
... | ... | |
68 | 69 |
ConverterForm converterForm = new ConverterForm(); |
69 | 70 |
if (converterForm.ShowDialog() == DialogResult.OK) |
70 | 71 |
{ |
71 |
|
|
72 | 72 |
try |
73 | 73 |
{ |
74 | 74 |
CloseOPCForm.Run(); |
... | ... | |
97 | 97 |
} |
98 | 98 |
} |
99 | 99 |
|
100 |
private void btnLinkOPC_Click(object sender, EventArgs e) |
|
101 |
{ |
|
102 |
try |
|
103 |
{ |
|
104 |
LMADataSource dataSource = new LMADataSource(); |
|
105 |
LMDrawings drawings = new LMDrawings(); |
|
106 |
drawings.Collect(dataSource); |
|
107 |
|
|
108 |
foreach (LMDrawing item in drawings) |
|
109 |
{ |
|
110 |
|
|
111 |
|
|
112 |
} |
|
113 |
|
|
114 |
} |
|
115 |
catch (Exception ex) |
|
116 |
{ |
|
117 |
MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
100 | 121 |
private void btnGetDrawingSize_Click(object sender, EventArgs e) |
101 | 122 |
{ |
102 | 123 |
if (radApp.ActiveSelectSet.Count > 0) |
... | ... | |
138 | 159 |
Placement _placement = new Placement(); |
139 | 160 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
140 | 161 |
|
141 |
string modelItemId = "1D6CF009BFCB46BFA78ADEEBA09B2E07"; |
|
142 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemId); |
|
143 |
_LMAItem item = modelItem.AsLMAItem(); |
|
162 |
string modelItemId = "B79C53F295454F489B9DBCD9F1078D3E"; |
|
163 |
LMOPC opc = dataSource.GetOPC(modelItemId); |
|
144 | 164 |
try |
145 | 165 |
{ |
146 |
foreach (LMRepresentation rep in modelItem.Representations)
|
|
166 |
if (opc != null)
|
|
147 | 167 |
{ |
148 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
149 |
{ |
|
150 |
LMConnector _LMConnector = dataSource.GetConnector(rep.Id); |
|
151 |
|
|
152 |
|
|
153 |
} |
|
168 |
LMOPC pairedOPC = opc.pairedWithOPCObject; |
|
169 |
//MessageBox.Show(pairedOPC.get_ItemStatus()); |
|
170 |
//pairedOPC.Attributes[] |
|
171 |
_placement.PIDPlaceSymbol(@"\Piping\Piping OPC's\Off-Drawing.sym", 0, 0, 0, 0, pairedOPC.AsLMAItem()); |
|
154 | 172 |
} |
155 | 173 |
} |
156 | 174 |
catch (Exception ex) |
... | ... | |
186 | 204 |
} |
187 | 205 |
else |
188 | 206 |
MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
189 |
//placement.PIDPlaceSymbol("", 0.06, 0, Mirror: 2); |
|
190 |
//Ingr.RAD2D.Symbol2d symbol2d = radApp.ActiveSelectSet[0] as Ingr.RAD2D.Symbol2d; |
|
191 |
//if (symbol2d != null) |
|
192 |
//{ |
|
193 |
// double minX; |
|
194 |
// double minY; |
|
195 |
// double maxX; |
|
196 |
// double maxY; |
|
197 |
// symbol2d.Range(out minX, out minY, out maxX, out maxY); |
|
198 |
|
|
199 |
// foreach (var attributes in symbol2d.AttributeSets) |
|
200 |
// { |
|
201 |
// foreach (var attribute in attributes) |
|
202 |
// { |
|
203 |
// string name = attribute.Name; |
|
204 |
// string value = attribute.GetValue().ToString(); |
|
205 |
// if (name == "ModelID") |
|
206 |
// { |
|
207 |
// string modelID = value; |
|
208 |
// LMModelItem modelItem = dataSource.GetModelItem(modelID); |
|
209 |
// foreach (LMRepresentation rep in modelItem.Representations) |
|
210 |
// { |
|
211 |
// if (rep.Attributes["RepresentationType"].get_Value() == "Symbol") |
|
212 |
// { |
|
213 |
// LMSymbol symbol = dataSource.GetSymbol(rep.Id); |
|
214 |
|
|
215 |
// List<double[]> points = new List<double[]>(); |
|
216 |
// StringBuilder sb = new StringBuilder(); |
|
217 |
// for (int i = 1; i < int.MaxValue; i++) |
|
218 |
// { |
|
219 |
// double connX = 0; |
|
220 |
// double connY = 0; |
|
221 |
// if (placement.PIDConnectPointLocation(symbol, i, ref connX, ref connY)) |
|
222 |
// { |
|
223 |
// points.Add(new double[] { connX, connY }); |
|
224 |
// sb.AppendLine(i + " / " + connX + " / " + connY); |
|
225 |
// } |
|
226 |
// else |
|
227 |
// break; |
|
228 |
// } |
|
229 |
|
|
230 |
// double prevX = symbol.get_XCoordinate(); |
|
231 |
// double prevY = symbol.get_YCoordinate(); |
|
232 |
|
|
233 |
// MessageBox.Show(sb.ToString()); |
|
234 |
// } |
|
235 |
// } |
|
236 |
// } |
|
237 |
// } |
|
238 |
// } |
|
239 |
|
|
240 |
|
|
241 |
//} |
|
207 |
|
|
242 | 208 |
} |
243 | 209 |
|
244 | 210 |
|
내보내기 Unified diff