37 |
37 |
{
|
38 |
38 |
public static AutoModeling Running { get; set; }
|
39 |
39 |
Model.Document document;
|
40 |
|
|
41 |
|
System.Data.DataTable AvevaSymbolTable = null;
|
|
40 |
AvevaInfo avevaInfo;
|
42 |
41 |
|
43 |
42 |
private void SetConvertRule()
|
44 |
43 |
{
|
... | ... | |
54 |
53 |
#endregion
|
55 |
54 |
}
|
56 |
55 |
|
57 |
|
public AutoModeling(Model.Document document, System.Data.DataTable AvevaSymbolTable)
|
|
56 |
public AutoModeling(Model.Document document)
|
58 |
57 |
{
|
59 |
58 |
this.document = document;
|
60 |
|
this.AvevaSymbolTable = AvevaSymbolTable;
|
|
59 |
avevaInfo = AvevaInfo.GetInstance();
|
61 |
60 |
}
|
62 |
61 |
|
63 |
62 |
public void CreateDrawing()
|
... | ... | |
102 |
101 |
try
|
103 |
102 |
{
|
104 |
103 |
SplashScreenManager.ShowForm(typeof(APIDSplashScreen), true, true);
|
105 |
|
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllStepCount, 5);
|
|
104 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllStepCount, 8);
|
106 |
105 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetDocumentName, document.AvevaDrawingNumber + document.AvevaSheetNumber);
|
107 |
106 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetParent, Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Handle);
|
108 |
107 |
|
... | ... | |
113 |
112 |
RunSymbolModeling();
|
114 |
113 |
RunTextModeling();
|
115 |
114 |
RunNoteModeling();
|
|
115 |
RunInputLineAttribute();
|
|
116 |
RunInputLineNumberAttribute();
|
|
117 |
RunInputSymbolAttribute();
|
116 |
118 |
}
|
117 |
119 |
catch (System.Exception ex)
|
118 |
120 |
{
|
... | ... | |
182 |
184 |
}
|
183 |
185 |
private void RunInputLineAttribute()
|
184 |
186 |
{
|
185 |
|
|
|
187 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count);
|
|
188 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Input Line Attribute");
|
|
189 |
foreach (var item in document.LINES)
|
|
190 |
{
|
|
191 |
SetLineAttribute(item);
|
|
192 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
193 |
}
|
186 |
194 |
}
|
187 |
195 |
private void RunInputSymbolAttribute()
|
188 |
196 |
{
|
189 |
|
|
|
197 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count);
|
|
198 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Input Symbol Attribute");
|
|
199 |
foreach (var item in document.SYMBOLS)
|
|
200 |
{
|
|
201 |
SetSymbolAttribute(item);
|
|
202 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
203 |
}
|
|
204 |
}
|
|
205 |
private void RunInputLineNumberAttribute()
|
|
206 |
{
|
|
207 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINENUMBERS.Count);
|
|
208 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.SetStep, "Input LineNumber Attribute");
|
|
209 |
foreach (var item in document.LINENUMBERS)
|
|
210 |
{
|
|
211 |
SetLineNumberAttribute(item);
|
|
212 |
SplashScreenManager.Default.SendCommand(APIDSplashScreen.SplashScreenCommand.UpProgress, null);
|
|
213 |
}
|
190 |
214 |
}
|
191 |
215 |
#endregion
|
192 |
216 |
|
... | ... | |
227 |
251 |
}
|
228 |
252 |
private void SymbolModeling(Symbol symbol)
|
229 |
253 |
{
|
230 |
|
DataRow[] allRows = AvevaSymbolTable.Select(string.Format("Symbol_Name = '{0}'", symbol.Aveva.Name));
|
|
254 |
DataRow[] allRows = avevaInfo.AvevaSymbolTable.Select(string.Format("Symbol_Name = '{0}'", symbol.Aveva.Name));
|
231 |
255 |
if (allRows.Length == 1)
|
232 |
256 |
{
|
233 |
257 |
DataRow symbolRow = allRows[0];
|
... | ... | |
314 |
338 |
{
|
315 |
339 |
|
316 |
340 |
}
|
|
341 |
private void SetLineNumberAttribute(Model.LineNumber lineNumber)
|
|
342 |
{
|
|
343 |
|
|
344 |
}
|
317 |
345 |
private void SetSymbolAttribute(Model.Symbol symbol)
|
318 |
346 |
{
|
319 |
347 |
|
... | ... | |
880 |
908 |
symbol.Aveva.X = 50;
|
881 |
909 |
symbol.Aveva.Y = 100;
|
882 |
910 |
|
883 |
|
DataRow[] allRows = AvevaSymbolTable.Select(string.Format("Symbol_Name = '{0}'", symbol.Aveva.Name));
|
|
911 |
DataRow[] allRows = avevaInfo.AvevaSymbolTable.Select(string.Format("Symbol_Name = '{0}'", symbol.Aveva.Name));
|
884 |
912 |
if (allRows.Length == 1)
|
885 |
913 |
{
|
886 |
914 |
DataRow symbolRow = allRows[0];
|