개정판 9157c1b8
dev issue #1191 : segment 위치 보정 수정
Change-Id: I126996298ce1f994b0c616c88bad25e874108ff7
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
88 | 88 |
Log.Write("Start Modeling"); |
89 | 89 |
SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true); |
90 | 90 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetParent, (IntPtr)radApp.HWnd); |
91 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 20);
|
|
91 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 21);
|
|
92 | 92 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText); |
93 | 93 |
|
94 | 94 |
// Equipment Modeling |
... | ... | |
97 | 97 |
RunSymbolModeling(); |
98 | 98 |
// LineRun Line Modeling |
99 | 99 |
RunLineModeling(); |
100 |
// Clear Attribute |
|
101 |
RunClearValueInconsistancy(); |
|
102 | 100 |
// EndBreak Modeling |
103 | 101 |
RunEndBreakModeling(); |
104 | 102 |
// SpecBreak Modeling |
... | ... | |
109 | 107 |
RunJoinRun(); |
110 | 108 |
// Check FlowDirection |
111 | 109 |
RunFlowDirection(); |
110 |
// Clear Attribute |
|
111 |
RunClearNominalDiameter(); |
|
112 |
// Clear Attribute |
|
113 |
RunClearValueInconsistancy(); |
|
112 | 114 |
//Line Number Modeling |
113 | 115 |
RunLineNumberModeling(); |
114 | 116 |
// Note Modeling |
... | ... | |
286 | 288 |
} |
287 | 289 |
} |
288 | 290 |
} |
291 |
private void RunClearNominalDiameter() |
|
292 |
{ |
|
293 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count + document.LINES.Count); |
|
294 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Clear Attribute"); |
|
295 |
List<string> endClearModelItemID = new List<string>(); |
|
296 |
for (int i = 0; i < document.LINES.Count; i++) |
|
297 |
{ |
|
298 |
Line item = document.LINES[i]; |
|
299 |
string modelItemID = item.SPPID.ModelItemId; |
|
300 |
if (!string.IsNullOrEmpty(modelItemID)) |
|
301 |
{ |
|
302 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
303 |
if (modelItem != null) |
|
304 |
{ |
|
305 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
306 |
if (attribute != null) |
|
307 |
attribute.set_Value(DBNull.Value); |
|
308 |
|
|
309 |
modelItem.Commit(); |
|
310 |
ReleaseCOMObjects(modelItem); |
|
311 |
modelItem = null; |
|
312 |
} |
|
313 |
} |
|
314 |
if (!endClearModelItemID.Contains(modelItemID)) |
|
315 |
endClearModelItemID.Add(modelItemID); |
|
316 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
317 |
} |
|
318 |
for (int i = 0; i < document.SYMBOLS.Count; i++) |
|
319 |
{ |
|
320 |
Symbol item = document.SYMBOLS[i]; |
|
321 |
string repID = item.SPPID.RepresentationId; |
|
322 |
string modelItemID = item.SPPID.ModelItemID; |
|
323 |
if (!string.IsNullOrEmpty(modelItemID)) |
|
324 |
{ |
|
325 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemID); |
|
326 |
if (modelItem != null) |
|
327 |
{ |
|
328 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
329 |
if (attribute != null) |
|
330 |
attribute.set_Value(DBNull.Value); |
|
331 |
int index = 1; |
|
332 |
while (true) |
|
333 |
{ |
|
334 |
attribute = modelItem.Attributes[string.Format("PipingPoint{0}.NominalDiameter", index)]; |
|
335 |
if (attribute != null) |
|
336 |
attribute.set_Value(DBNull.Value); |
|
337 |
else |
|
338 |
break; |
|
339 |
index++; |
|
340 |
} |
|
341 |
modelItem.Commit(); |
|
342 |
ReleaseCOMObjects(modelItem); |
|
343 |
modelItem = null; |
|
344 |
} |
|
345 |
} |
|
346 |
if (!string.IsNullOrEmpty(repID)) |
|
347 |
{ |
|
348 |
LMSymbol symbol = dataSource.GetSymbol(repID); |
|
349 |
if (symbol != null) |
|
350 |
{ |
|
351 |
foreach (LMConnector connector in symbol.Connect1Connectors) |
|
352 |
{ |
|
353 |
if (connector.get_ItemStatus() == "Active" && !endClearModelItemID.Contains(connector.ModelItemID)) |
|
354 |
{ |
|
355 |
endClearModelItemID.Add(connector.ModelItemID); |
|
356 |
LMModelItem modelItem = connector.ModelItemObject; |
|
357 |
if (modelItem != null) |
|
358 |
{ |
|
359 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
360 |
if (attribute != null) |
|
361 |
attribute.set_Value(DBNull.Value); |
|
362 |
|
|
363 |
modelItem.Commit(); |
|
364 |
ReleaseCOMObjects(modelItem); |
|
365 |
modelItem = null; |
|
366 |
} |
|
367 |
} |
|
368 |
} |
|
369 |
foreach (LMConnector connector in symbol.Connect2Connectors) |
|
370 |
{ |
|
371 |
if (connector.get_ItemStatus() == "Active" && !endClearModelItemID.Contains(connector.ModelItemID)) |
|
372 |
{ |
|
373 |
endClearModelItemID.Add(connector.ModelItemID); |
|
374 |
LMModelItem modelItem = connector.ModelItemObject; |
|
375 |
if (modelItem != null) |
|
376 |
{ |
|
377 |
LMAAttribute attribute = modelItem.Attributes["NominalDiameter"]; |
|
378 |
if (attribute != null) |
|
379 |
attribute.set_Value(DBNull.Value); |
|
380 |
|
|
381 |
modelItem.Commit(); |
|
382 |
ReleaseCOMObjects(modelItem); |
|
383 |
modelItem = null; |
|
384 |
} |
|
385 |
} |
|
386 |
} |
|
387 |
} |
|
388 |
ReleaseCOMObjects(symbol); |
|
389 |
symbol = null; |
|
390 |
} |
|
391 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
392 |
} |
|
393 |
} |
|
289 | 394 |
private void RunClearValueInconsistancy() |
290 | 395 |
{ |
291 | 396 |
int count = 1; |
... | ... | |
2641 | 2746 |
Line connLine = connObj as Line; |
2642 | 2747 |
Symbol connSymbol = connObj as Symbol; |
2643 | 2748 |
|
2644 |
double move = GridSetting.GetInstance().Length * 3; |
|
2749 |
double zeroLengthMove = GridSetting.GetInstance().Length * 3; |
|
2750 |
double lineMove = GridSetting.GetInstance().Length; |
|
2645 | 2751 |
if (Convert.ToBoolean(targetConnector.get_IsZeroLength())) |
2646 | 2752 |
{ |
2647 | 2753 |
result = GetConnectorVertices(targetConnector)[0]; |
... | ... | |
2649 | 2755 |
{ |
2650 | 2756 |
SlopeType slopeType = SPPIDUtil.CalcSlope(targetSymbol.SPPID.SPPID_X, targetSymbol.SPPID.SPPID_Y, connSymbol.SPPID.SPPID_X, connSymbol.SPPID.SPPID_Y); |
2651 | 2757 |
if (slopeType == SlopeType.HORIZONTAL) |
2652 |
result = new double[] { result[0], result[1] - move };
|
|
2758 |
result = new double[] { result[0], result[1] - zeroLengthMove };
|
|
2653 | 2759 |
else if (slopeType == SlopeType.VERTICAL) |
2654 |
result = new double[] { result[0] - move, result[1] };
|
|
2760 |
result = new double[] { result[0] - zeroLengthMove, result[1] };
|
|
2655 | 2761 |
} |
2656 | 2762 |
else if (targetLine != null) |
2657 | 2763 |
{ |
2658 | 2764 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
2659 |
result = new double[] { result[0], result[1] - move };
|
|
2765 |
result = new double[] { result[0], result[1] - zeroLengthMove };
|
|
2660 | 2766 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
2661 |
result = new double[] { result[0] - move, result[1] };
|
|
2767 |
result = new double[] { result[0] - zeroLengthMove, result[1] };
|
|
2662 | 2768 |
} |
2663 | 2769 |
else if (connLine != null) |
2664 | 2770 |
{ |
2665 | 2771 |
if (connLine.SlopeType == SlopeType.HORIZONTAL) |
2666 |
result = new double[] { result[0], result[1] - move };
|
|
2772 |
result = new double[] { result[0], result[1] - zeroLengthMove };
|
|
2667 | 2773 |
else if (connLine.SlopeType == SlopeType.VERTICAL) |
2668 |
result = new double[] { result[0] - move, result[1] };
|
|
2774 |
result = new double[] { result[0] - zeroLengthMove, result[1] };
|
|
2669 | 2775 |
} |
2670 | 2776 |
} |
2671 | 2777 |
else |
... | ... | |
2692 | 2798 |
|
2693 | 2799 |
if (targetLine.SlopeType == SlopeType.HORIZONTAL) |
2694 | 2800 |
{ |
2695 |
result = new double[] { result[0], result[1] - move };
|
|
2801 |
result = new double[] { result[0], result[1] - lineMove };
|
|
2696 | 2802 |
if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X < targetLine.SPPID.END_X) |
2697 | 2803 |
{ |
2698 |
result = new double[] { result[0] + move, result[1] };
|
|
2804 |
result = new double[] { result[0] + lineMove, result[1] };
|
|
2699 | 2805 |
} |
2700 | 2806 |
else if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X > targetLine.SPPID.END_X) |
2701 | 2807 |
{ |
2702 |
result = new double[] { result[0] - move, result[1] };
|
|
2808 |
result = new double[] { result[0] - lineMove, result[1] };
|
|
2703 | 2809 |
} |
2704 | 2810 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X < targetLine.SPPID.END_X) |
2705 | 2811 |
{ |
2706 |
result = new double[] { result[0] - move, result[1] };
|
|
2812 |
result = new double[] { result[0] - lineMove, result[1] };
|
|
2707 | 2813 |
} |
2708 | 2814 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_X > targetLine.SPPID.END_X) |
2709 | 2815 |
{ |
2710 |
result = new double[] { result[0] + move, result[1] };
|
|
2816 |
result = new double[] { result[0] + lineMove, result[1] };
|
|
2711 | 2817 |
} |
2712 | 2818 |
} |
2713 | 2819 |
else if (targetLine.SlopeType == SlopeType.VERTICAL) |
2714 | 2820 |
{ |
2715 |
result = new double[] { result[0] - move, result[1] };
|
|
2821 |
result = new double[] { result[0] - lineMove, result[1] };
|
|
2716 | 2822 |
if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y < targetLine.SPPID.END_Y) |
2717 | 2823 |
{ |
2718 |
result = new double[] { result[0], result[1] + move };
|
|
2824 |
result = new double[] { result[0], result[1] + lineMove };
|
|
2719 | 2825 |
} |
2720 | 2826 |
else if (targetLine.CONNECTORS[0].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y > targetLine.SPPID.END_Y) |
2721 | 2827 |
{ |
2722 |
result = new double[] { result[0], result[1] - move };
|
|
2828 |
result = new double[] { result[0], result[1] - lineMove };
|
|
2723 | 2829 |
} |
2724 | 2830 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y < targetLine.SPPID.END_Y) |
2725 | 2831 |
{ |
2726 |
result = new double[] { result[0], result[1] - move };
|
|
2832 |
result = new double[] { result[0], result[1] - lineMove };
|
|
2727 | 2833 |
} |
2728 | 2834 |
else if (targetLine.CONNECTORS[1].CONNECTEDITEM == connLine.UID && targetLine.SPPID.START_Y > targetLine.SPPID.END_Y) |
2729 | 2835 |
{ |
2730 |
result = new double[] { result[0], result[1] + move };
|
|
2836 |
result = new double[] { result[0], result[1] + lineMove };
|
|
2731 | 2837 |
} |
2732 | 2838 |
} |
2733 | 2839 |
|
내보내기 Unified diff