117 |
117 |
if (DocumentCoordinateCorrection())
|
118 |
118 |
{
|
119 |
119 |
int AllCount = CalcProgressCount();
|
|
120 |
Log.Write("Start Modeling");
|
120 |
121 |
SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true);
|
121 |
122 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd);
|
122 |
123 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStep, AllCount);
|
... | ... | |
125 |
126 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Priority Symbol Modeling");
|
126 |
127 |
List<Symbol> prioritySymbols = GetPrioritySymbol();
|
127 |
128 |
foreach (var item in prioritySymbols)
|
128 |
|
SymbolModelingByPriority(item);
|
|
129 |
{
|
|
130 |
try
|
|
131 |
{
|
|
132 |
SymbolModelingByPriority(item);
|
|
133 |
}
|
|
134 |
catch (Exception ex)
|
|
135 |
{
|
|
136 |
Log.Write("Error in SymbolModelingByPriority");
|
|
137 |
Log.Write("UID : " + item.UID);
|
|
138 |
Log.Write(ex.Message);
|
|
139 |
Log.Write(ex.StackTrace);
|
|
140 |
}
|
|
141 |
}
|
|
142 |
|
129 |
143 |
|
130 |
144 |
// Equipment Modeling
|
131 |
145 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Equipments Modeling");
|
132 |
146 |
foreach (Equipment equipment in document.Equipments)
|
133 |
|
EquipmentModeling(equipment);
|
|
147 |
{
|
|
148 |
try
|
|
149 |
{
|
|
150 |
EquipmentModeling(equipment);
|
|
151 |
}
|
|
152 |
catch (Exception ex)
|
|
153 |
{
|
|
154 |
Log.Write("Error in EquipmentModeling");
|
|
155 |
Log.Write("UID : " + equipment.UID);
|
|
156 |
Log.Write(ex.Message);
|
|
157 |
Log.Write(ex.StackTrace);
|
|
158 |
}
|
|
159 |
}
|
|
160 |
|
134 |
161 |
|
135 |
162 |
// LineRun Symbol Modeling
|
136 |
163 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Symbols Modeling");
|
137 |
164 |
foreach (LineNumber lineNumber in document.LINENUMBERS)
|
138 |
|
foreach (LineRun run in lineNumber.RUNS)
|
139 |
|
SymbolModelingByRun(run);
|
|
165 |
try
|
|
166 |
{
|
|
167 |
foreach (LineRun run in lineNumber.RUNS)
|
|
168 |
SymbolModelingByRun(run);
|
|
169 |
}
|
|
170 |
catch (Exception ex)
|
|
171 |
{
|
|
172 |
Log.Write("Error in SymbolModelingByRun");
|
|
173 |
Log.Write("UID : " + lineNumber.UID);
|
|
174 |
Log.Write(ex.Message);
|
|
175 |
Log.Write(ex.StackTrace);
|
|
176 |
}
|
140 |
177 |
// TrimLineRun Symbol Modeling
|
141 |
178 |
foreach (TrimLine trimLine in document.TRIMLINES)
|
142 |
|
foreach (LineRun run in trimLine.RUNS)
|
143 |
|
SymbolModelingByRun(run);
|
|
179 |
try
|
|
180 |
{
|
|
181 |
foreach (LineRun run in trimLine.RUNS)
|
|
182 |
SymbolModelingByRun(run);
|
|
183 |
}
|
|
184 |
catch (Exception ex)
|
|
185 |
{
|
|
186 |
Log.Write("Error in SymbolModelingByRun");
|
|
187 |
Log.Write("UID : " + trimLine.UID);
|
|
188 |
Log.Write(ex.Message);
|
|
189 |
Log.Write(ex.StackTrace);
|
|
190 |
}
|
|
191 |
|
144 |
192 |
|
145 |
193 |
// LineRun Line Modeling
|
146 |
194 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Lines Modeling");
|
147 |
195 |
foreach (LineNumber lineNumber in document.LINENUMBERS)
|
148 |
|
foreach (LineRun run in lineNumber.RUNS)
|
149 |
|
LineModelingByRun(run);
|
|
196 |
try
|
|
197 |
{
|
|
198 |
foreach (LineRun run in lineNumber.RUNS)
|
|
199 |
LineModelingByRun(run);
|
|
200 |
}
|
|
201 |
catch (Exception ex)
|
|
202 |
{
|
|
203 |
Log.Write("Error in LineModelingByRun");
|
|
204 |
Log.Write("UID : " + lineNumber.UID);
|
|
205 |
Log.Write(ex.Message);
|
|
206 |
Log.Write(ex.StackTrace);
|
|
207 |
}
|
150 |
208 |
// TrimLineRun Line Modeling
|
151 |
209 |
foreach (TrimLine trimLine in document.TRIMLINES)
|
152 |
|
foreach (LineRun run in trimLine.RUNS)
|
153 |
|
LineModelingByRun(run);
|
|
210 |
try
|
|
211 |
{
|
|
212 |
foreach (LineRun run in trimLine.RUNS)
|
|
213 |
LineModelingByRun(run);
|
|
214 |
}
|
|
215 |
catch (Exception ex)
|
|
216 |
{
|
|
217 |
Log.Write("Error in LineModelingByRun");
|
|
218 |
Log.Write("UID : " + trimLine.UID);
|
|
219 |
Log.Write(ex.Message);
|
|
220 |
Log.Write(ex.StackTrace);
|
|
221 |
}
|
|
222 |
|
154 |
223 |
|
155 |
224 |
// Branch Line Modeling
|
156 |
225 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Branch Lines Modeling");
|
157 |
226 |
foreach (var item in BranchLines)
|
158 |
|
BranchLineModeling(item);
|
|
227 |
try
|
|
228 |
{
|
|
229 |
BranchLineModeling(item);
|
|
230 |
}
|
|
231 |
catch (Exception ex)
|
|
232 |
{
|
|
233 |
Log.Write("Error in BranchLineModeling");
|
|
234 |
if (item.Item2 != null)
|
|
235 |
Log.Write("UID : " + item.Item2.UID);
|
|
236 |
if (item.Item3 != null)
|
|
237 |
Log.Write("UID : " + item.Item3.UID);
|
|
238 |
Log.Write(ex.Message);
|
|
239 |
Log.Write(ex.StackTrace);
|
|
240 |
}
|
|
241 |
|
159 |
242 |
|
160 |
243 |
// EndBreak Modeling
|
161 |
244 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "EndBreaks Modeling");
|
162 |
245 |
foreach (var item in document.EndBreaks)
|
163 |
|
EndBreakModeling(item);
|
|
246 |
try
|
|
247 |
{
|
|
248 |
EndBreakModeling(item);
|
|
249 |
}
|
|
250 |
catch (Exception ex)
|
|
251 |
{
|
|
252 |
Log.Write("Error in EndBreakModeling");
|
|
253 |
Log.Write("UID : " + item.UID);
|
|
254 |
Log.Write(ex.Message);
|
|
255 |
Log.Write(ex.StackTrace);
|
|
256 |
}
|
|
257 |
|
164 |
258 |
|
165 |
259 |
// SpecBreak Modeling
|
166 |
260 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "SpecBreaks Modeling");
|
167 |
261 |
foreach (var item in document.SpecBreaks)
|
168 |
|
SpecBreakModeling(item);
|
|
262 |
try
|
|
263 |
{
|
|
264 |
SpecBreakModeling(item);
|
|
265 |
}
|
|
266 |
catch (Exception ex)
|
|
267 |
{
|
|
268 |
Log.Write("Error in SpecBreakModeling");
|
|
269 |
Log.Write("UID : " + item.UID);
|
|
270 |
Log.Write(ex.Message);
|
|
271 |
Log.Write(ex.StackTrace);
|
|
272 |
}
|
|
273 |
|
169 |
274 |
|
170 |
275 |
// LineNumber Modeling
|
171 |
276 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "LineNumbers Modeling");
|
172 |
277 |
foreach (var item in document.LINENUMBERS)
|
173 |
|
LineNumberModeling(item);
|
|
278 |
try
|
|
279 |
{
|
|
280 |
LineNumberModeling(item);
|
|
281 |
}
|
|
282 |
catch (Exception ex)
|
|
283 |
{
|
|
284 |
Log.Write("Error in LineNumberModeling");
|
|
285 |
Log.Write("UID : " + item.UID);
|
|
286 |
Log.Write(ex.Message);
|
|
287 |
Log.Write(ex.StackTrace);
|
|
288 |
}
|
|
289 |
|
174 |
290 |
|
175 |
291 |
// FlowMark Modeling
|
176 |
292 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Flow Mark Modeling");
|
177 |
293 |
foreach (var item in document.LINES)
|
178 |
|
FlowMarkModeling(item);
|
|
294 |
try
|
|
295 |
{
|
|
296 |
FlowMarkModeling(item);
|
|
297 |
}
|
|
298 |
catch (Exception ex)
|
|
299 |
{
|
|
300 |
Log.Write("Error in FlowMarkModeling");
|
|
301 |
Log.Write("UID : " + item.UID);
|
|
302 |
Log.Write(ex.Message);
|
|
303 |
Log.Write(ex.StackTrace);
|
|
304 |
}
|
|
305 |
|
179 |
306 |
|
180 |
307 |
// Note Symbol Modeling
|
181 |
308 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Note Symbol Modeling");
|
182 |
309 |
foreach (var item in document.SYMBOLS)
|
183 |
|
NoteSymbolModeling(item);
|
|
310 |
try
|
|
311 |
{
|
|
312 |
NoteSymbolModeling(item);
|
|
313 |
}
|
|
314 |
catch (Exception ex)
|
|
315 |
{
|
|
316 |
Log.Write("Error in NoteSymbolModeling");
|
|
317 |
Log.Write("UID : " + item.UID);
|
|
318 |
Log.Write(ex.Message);
|
|
319 |
Log.Write(ex.StackTrace);
|
|
320 |
}
|
|
321 |
|
184 |
322 |
|
185 |
323 |
// Note Modeling
|
186 |
324 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Notes Modeling");
|
187 |
325 |
foreach (var item in document.NOTES)
|
188 |
|
NoteModeling(item);
|
|
326 |
try
|
|
327 |
{
|
|
328 |
NoteModeling(item);
|
|
329 |
}
|
|
330 |
catch (Exception ex)
|
|
331 |
{
|
|
332 |
Log.Write("Error in NoteModeling");
|
|
333 |
Log.Write("UID : " + item.UID);
|
|
334 |
Log.Write(ex.Message);
|
|
335 |
Log.Write(ex.StackTrace);
|
|
336 |
}
|
|
337 |
|
189 |
338 |
|
190 |
339 |
// Text Modeling
|
191 |
340 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Texts Modeling");
|
192 |
341 |
foreach (var item in document.TEXTINFOS)
|
193 |
|
TextModeling(item);
|
|
342 |
try
|
|
343 |
{
|
|
344 |
TextModeling(item);
|
|
345 |
}
|
|
346 |
catch (Exception ex)
|
|
347 |
{
|
|
348 |
Log.Write("Error in TextModeling");
|
|
349 |
Log.Write("UID : " + item.UID);
|
|
350 |
Log.Write(ex.Message);
|
|
351 |
Log.Write(ex.StackTrace);
|
|
352 |
}
|
|
353 |
|
194 |
354 |
|
195 |
355 |
// Input LineNumber Attribute
|
196 |
356 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set LineNumbers Attribute");
|
197 |
357 |
foreach (var item in document.LINENUMBERS)
|
198 |
|
InputLineNumberAttribute(item);
|
|
358 |
try
|
|
359 |
{
|
|
360 |
InputLineNumberAttribute(item);
|
|
361 |
}
|
|
362 |
catch (Exception ex)
|
|
363 |
{
|
|
364 |
Log.Write("Error in InputLineNumberAttribute");
|
|
365 |
Log.Write("UID : " + item.UID);
|
|
366 |
Log.Write(ex.Message);
|
|
367 |
Log.Write(ex.StackTrace);
|
|
368 |
}
|
|
369 |
|
199 |
370 |
|
200 |
371 |
// Input Symbol Attribute
|
201 |
372 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute");
|
202 |
373 |
foreach (var item in document.SYMBOLS)
|
203 |
|
InputSymbolAttribute(item, item.ATTRIBUTES);
|
|
374 |
try
|
|
375 |
{
|
|
376 |
InputSymbolAttribute(item, item.ATTRIBUTES);
|
|
377 |
}
|
|
378 |
catch (Exception ex)
|
|
379 |
{
|
|
380 |
Log.Write("Error in InputSymbolAttribute");
|
|
381 |
Log.Write("UID : " + item.UID);
|
|
382 |
Log.Write(ex.Message);
|
|
383 |
Log.Write(ex.StackTrace);
|
|
384 |
}
|
|
385 |
|
204 |
386 |
|
205 |
387 |
// Input SpecBreak Attribute
|
206 |
388 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set Symbols Attribute");
|
207 |
389 |
foreach (var item in document.SpecBreaks)
|
208 |
|
InputSpecBreakAttribute(item);
|
|
390 |
try
|
|
391 |
{
|
|
392 |
InputSpecBreakAttribute(item);
|
|
393 |
}
|
|
394 |
catch (Exception ex)
|
|
395 |
{
|
|
396 |
Log.Write("Error in InputSpecBreakAttribute");
|
|
397 |
Log.Write("UID : " + item.UID);
|
|
398 |
Log.Write(ex.Message);
|
|
399 |
Log.Write(ex.StackTrace);
|
|
400 |
}
|
|
401 |
|
209 |
402 |
|
210 |
403 |
// Label Symbol Modeling
|
211 |
404 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Labels Modeling");
|
212 |
405 |
foreach (var item in document.SYMBOLS)
|
213 |
|
LabelSymbolModeling(item);
|
|
406 |
try
|
|
407 |
{
|
|
408 |
LabelSymbolModeling(item);
|
|
409 |
}
|
|
410 |
catch (Exception ex)
|
|
411 |
{
|
|
412 |
Log.Write("Error in LabelSymbolModeling");
|
|
413 |
Log.Write("UID : " + item.UID);
|
|
414 |
Log.Write(ex.Message);
|
|
415 |
Log.Write(ex.StackTrace);
|
|
416 |
}
|
|
417 |
|
214 |
418 |
|
215 |
419 |
// LineRun Line Join
|
216 |
420 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Join LineRuns");
|
217 |
421 |
foreach (LineNumber lineNumber in document.LINENUMBERS)
|
218 |
|
foreach (LineRun run in lineNumber.RUNS)
|
219 |
|
JoinRunLine(run);
|
|
422 |
try
|
|
423 |
{
|
|
424 |
foreach (LineRun run in lineNumber.RUNS)
|
|
425 |
JoinRunLine(run);
|
|
426 |
}
|
|
427 |
catch (Exception ex)
|
|
428 |
{
|
|
429 |
Log.Write("Error in JoinRunLine");
|
|
430 |
Log.Write("UID : " + lineNumber.UID);
|
|
431 |
Log.Write(ex.Message);
|
|
432 |
Log.Write(ex.StackTrace);
|
|
433 |
}
|
|
434 |
|
220 |
435 |
// TrimLineRun Line Join
|
221 |
436 |
foreach (TrimLine trimLine in document.TRIMLINES)
|
222 |
|
foreach (LineRun run in trimLine.RUNS)
|
223 |
|
JoinRunLine(run);
|
|
437 |
try
|
|
438 |
{
|
|
439 |
foreach (LineRun run in trimLine.RUNS)
|
|
440 |
JoinRunLine(run);
|
|
441 |
}
|
|
442 |
catch (Exception ex)
|
|
443 |
{
|
|
444 |
Log.Write("Error in JoinRunLine");
|
|
445 |
Log.Write("UID : " + trimLine.UID);
|
|
446 |
Log.Write(ex.Message);
|
|
447 |
Log.Write(ex.StackTrace);
|
|
448 |
}
|
224 |
449 |
|
225 |
450 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, AllCount);
|
226 |
451 |
}
|
... | ... | |
233 |
458 |
}
|
234 |
459 |
finally
|
235 |
460 |
{
|
|
461 |
Log.Write("End Modeling");
|
236 |
462 |
application.ActiveWindow.Fit();
|
237 |
463 |
|
238 |
464 |
if (radApp.ActiveDocument != null)
|
... | ... | |
252 |
478 |
{
|
253 |
479 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.ClearParent, null);
|
254 |
480 |
SplashScreenManager.CloseForm(false);
|
|
481 |
Log.Write("\r\n");
|
255 |
482 |
}
|
256 |
483 |
}
|
257 |
484 |
}
|
... | ... | |
262 |
489 |
private void CreateDocument(ref string drawingNumber, ref string drawingName)
|
263 |
490 |
{
|
264 |
491 |
GetDrawingNameAndNumber(ref drawingName, ref drawingNumber);
|
265 |
|
|
|
492 |
Log.Write("------------------ Start create document ------------------");
|
|
493 |
Log.Write("Drawing name : " + drawingName);
|
|
494 |
Log.Write("Drawing number : " + drawingNumber);
|
266 |
495 |
newDrawing = application.Drawings.Add(document.Unit, document.Template, drawingNumber, drawingName);
|
267 |
496 |
application.ActiveWindow.Fit();
|
268 |
497 |
Thread.Sleep(1000);
|
... | ... | |
326 |
555 |
{
|
327 |
556 |
if (Settings.Default.DrawingX != 0 && Settings.Default.DrawingY != 0)
|
328 |
557 |
{
|
|
558 |
Log.Write("Setting Drawing X, Drawing Y");
|
329 |
559 |
document.SetSPPIDLocation(Settings.Default.DrawingX, Settings.Default.DrawingY);
|
|
560 |
Log.Write("Start coordinate correction");
|
330 |
561 |
document.CoordinateCorrection();
|
331 |
562 |
return true;
|
332 |
563 |
}
|
333 |
564 |
else
|
|
565 |
{
|
|
566 |
Log.Write("Need Drawing X, Y");
|
334 |
567 |
return false;
|
|
568 |
}
|
335 |
569 |
}
|
336 |
570 |
|
337 |
571 |
/// <summary>
|
... | ... | |
534 |
768 |
else
|
535 |
769 |
_LMSymbol = _placement.PIDPlaceSymbol(mappingPath, x, y, Mirror: mirror, Rotation: angle);
|
536 |
770 |
|
537 |
|
|
538 |
771 |
if (_LMSymbol != null)
|
539 |
772 |
{
|
540 |
773 |
_LMSymbol.Commit();
|
... | ... | |
544 |
777 |
|
545 |
778 |
foreach (var item in symbol.ChildSymbols)
|
546 |
779 |
CreateChildSymbol(item, _LMSymbol);
|
|
780 |
|
|
781 |
ReleaseCOMObjects(_LMSymbol);
|
547 |
782 |
}
|
548 |
783 |
|
549 |
|
ReleaseCOMObjects(_LMSymbol);
|
550 |
784 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, ++CurrentCount);
|
551 |
785 |
}
|
552 |
786 |
|
... | ... | |
871 |
1105 |
SymbolModeling(symbol, null);
|
872 |
1106 |
List<Symbol> group = new List<Symbol>() { symbol };
|
873 |
1107 |
SPPIDUtil.FindConnectedSymbolGroup(document, symbol, group);
|
874 |
|
|
875 |
1108 |
List<Symbol> endModeling = new List<Symbol>() { symbol };
|
|
1109 |
|
876 |
1110 |
while (endModeling.Count != group.Count)
|
877 |
1111 |
{
|
878 |
1112 |
foreach (var item in group)
|
... | ... | |
884 |
1118 |
{
|
885 |
1119 |
Symbol connSymbol = group.Find(x => x.UID == connector.CONNECTEDITEM);
|
886 |
1120 |
if (connSymbol == item)
|
887 |
|
throw new Exception(connSymbol.UID);
|
|
1121 |
throw new Exception("");
|
888 |
1122 |
|
889 |
1123 |
if (connSymbol != null && endModeling.Contains(connSymbol))
|
890 |
1124 |
{
|
... | ... | |
2933 |
3167 |
if (_LMSymbol != null)
|
2934 |
3168 |
{
|
2935 |
3169 |
BaseModel.Attribute attribute = symbol.ATTRIBUTES.Find(x => x.ASSOCITEM == text.UID);
|
2936 |
|
if (!string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
|
|
3170 |
if (attribute != null && !string.IsNullOrEmpty(attribute.VALUE) && attribute.VALUE != "None")
|
2937 |
3171 |
{
|
2938 |
3172 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME));
|
2939 |
3173 |
|
... | ... | |
3124 |
3358 |
private List<Symbol> GetPrioritySymbol()
|
3125 |
3359 |
{
|
3126 |
3360 |
DataTable symbolTable = document.SymbolTable;
|
3127 |
|
|
3128 |
3361 |
// List에 순서대로 쌓는다.
|
3129 |
3362 |
List<Symbol> symbols = new List<Symbol>();
|
|
3363 |
|
3130 |
3364 |
// Angle Valve 부터
|
3131 |
3365 |
foreach (var symbol in document.SYMBOLS.FindAll(x => x.CONNECTORS.Count == 2))
|
3132 |
3366 |
{
|
... | ... | |
3173 |
3407 |
|
3174 |
3408 |
// Connection Point가 3개 이상
|
3175 |
3409 |
foreach (var symbol in document.SYMBOLS)
|
|
3410 |
{
|
3176 |
3411 |
if (symbol.CONNECTORS.Count > 2 && !symbols.Contains(symbol))
|
3177 |
3412 |
symbols.Add(symbol);
|
|
3413 |
}
|
|
3414 |
|
3178 |
3415 |
|
3179 |
3416 |
return symbols;
|
3180 |
3417 |
}
|