개정판 d77973b3
dev issue #1174 : Line Join
Change-Id: I55d071c0c4e8fc76d5a894181e53f026aa1bf5b5
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
106 | 106 |
RunSpecBreakModeling(); |
107 | 107 |
// Join SameConnector |
108 | 108 |
RunJoinRunForSameConnector(); |
109 |
// Join Run |
|
110 |
RunJoinRun(); |
|
111 |
// Replace Original Line Item |
|
112 |
RunReplaceLine(); |
|
113 | 109 |
// Check FlowDirection |
114 | 110 |
RunFlowDirection(); |
111 |
// Join Run |
|
112 |
RunJoinRun(); |
|
115 | 113 |
// Note Modeling |
116 | 114 |
RunNoteModeling(); |
117 | 115 |
// Text Modeling |
... | ... | |
127 | 125 |
|
128 | 126 |
// Result Logging |
129 | 127 |
document.CheckModelingResult(); |
130 |
|
|
131 |
//// LineRun Line Join |
|
132 |
//SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Join LineRuns"); |
|
133 |
//foreach (LineNumber lineNumber in document.LINENUMBERS) |
|
134 |
// try |
|
135 |
// { |
|
136 |
// foreach (LineRun run in lineNumber.RUNS) |
|
137 |
// JoinRunLine(run); |
|
138 |
// } |
|
139 |
// catch (Exception ex) |
|
140 |
// { |
|
141 |
// Log.Write("Error in JoinRunLine"); |
|
142 |
// Log.Write("UID : " + lineNumber.UID); |
|
143 |
// Log.Write(ex.Message); |
|
144 |
// Log.Write(ex.StackTrace); |
|
145 |
// } |
|
146 |
|
|
147 |
//// TrimLineRun Line Join |
|
148 |
//foreach (TrimLine trimLine in document.TRIMLINES) |
|
149 |
// try |
|
150 |
// { |
|
151 |
// foreach (LineRun run in trimLine.RUNS) |
|
152 |
// JoinRunLine(run); |
|
153 |
// } |
|
154 |
// catch (Exception ex) |
|
155 |
// { |
|
156 |
// Log.Write("Error in JoinRunLine"); |
|
157 |
// Log.Write("UID : " + trimLine.UID); |
|
158 |
// Log.Write(ex.Message); |
|
159 |
// Log.Write(ex.StackTrace); |
|
160 |
// } |
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 | 128 |
} |
167 | 129 |
} |
168 | 130 |
catch (Exception ex) |
... | ... | |
465 | 427 |
List<string> endModelID = new List<string>(); |
466 | 428 |
foreach (var line in document.LINES) |
467 | 429 |
{ |
468 |
continue; |
|
469 | 430 |
if (!endModelID.Contains(line.SPPID.ModelItemId)) |
470 | 431 |
{ |
471 | 432 |
while (!endModelID.Contains(line.SPPID.ModelItemId)) |
... | ... | |
481 | 442 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
482 | 443 |
} |
483 | 444 |
} |
484 |
private void RunReplaceLine() |
|
485 |
{ |
|
486 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.LINES.Count); |
|
487 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Replace Original Line"); |
|
488 |
List<string> endModelId = new List<string>(); |
|
489 |
foreach (var line in document.LINES) |
|
490 |
{ |
|
491 |
continue; |
|
492 |
if (!string.IsNullOrEmpty(line.SPPID.ModelItemId) && !endModelId.Contains(line.SPPID.ModelItemId)) |
|
493 |
{ |
|
494 |
ReplaceLine(line); |
|
495 |
endModelId.Add(line.SPPID.ModelItemId); |
|
496 |
} |
|
497 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
498 |
} |
|
499 |
} |
|
500 | 445 |
private void RunFlowDirection() |
501 | 446 |
{ |
502 | 447 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, |
... | ... | |
1989 | 1934 |
#region get symbol path |
1990 | 1935 |
LMModelItem modelItem = dataSource.GetModelItem(prevLMConnector.ModelItemID); |
1991 | 1936 |
symbolPath = GetSPPIDFileName(modelItem); |
1937 |
ReleaseCOMObjects(modelItem); |
|
1992 | 1938 |
#endregion |
1993 | 1939 |
bool diagonal = false; |
1994 | 1940 |
if (line.SlopeType != SlopeType.HORIZONTAL && line.SlopeType != SlopeType.VERTICAL) |
... | ... | |
2234 | 2180 |
} |
2235 | 2181 |
} |
2236 | 2182 |
|
2237 |
private LMConnector ReModelingLMConnector(LMConnector connector) |
|
2183 |
private LMConnector ReModelingLMConnector(LMConnector connector, string changeSymbolPath = null)
|
|
2238 | 2184 |
{ |
2239 | 2185 |
string symbolPath = string.Empty; |
2240 | 2186 |
#region get symbol path |
2241 |
LMModelItem modelItem = dataSource.GetModelItem(connector.ModelItemID); |
|
2242 |
symbolPath = GetSPPIDFileName(modelItem); |
|
2187 |
if (string.IsNullOrEmpty(changeSymbolPath)) |
|
2188 |
{ |
|
2189 |
LMModelItem modelItem = dataSource.GetModelItem(connector.ModelItemID); |
|
2190 |
symbolPath = GetSPPIDFileName(modelItem); |
|
2191 |
ReleaseCOMObjects(modelItem); |
|
2192 |
} |
|
2193 |
else |
|
2194 |
symbolPath = changeSymbolPath; |
|
2195 |
|
|
2243 | 2196 |
#endregion |
2244 | 2197 |
|
2245 | 2198 |
LMConnector newConnector = null; |
... | ... | |
2411 | 2364 |
LMModelItem targetModelItem = dataSource.GetModelItem(targetLine.SPPID.ModelItemId); |
2412 | 2365 |
LMModelItem connectedModelItem = dataSource.GetModelItem(connectedLine.SPPID.ModelItemId); |
2413 | 2366 |
|
2414 |
if (targetModelItem != null && connectedModelItem != null)
|
|
2367 |
if (targetModelItem != null && targetModelItem.get_ItemStatus() == "Active" && connectedModelItem != null && connectedModelItem.get_ItemStatus() == "Active")
|
|
2415 | 2368 |
{ |
2416 | 2369 |
foreach (LMRepresentation rep in targetModelItem.Representations) |
2417 | 2370 |
{ |
... | ... | |
3597 | 3550 |
List<string> modelItemIds = FindOtherModelItemBySymbolWhereTypePipeRun(symbol, modelItem.Id); |
3598 | 3551 |
if (modelItemIds.Count == 1) |
3599 | 3552 |
{ |
3600 |
JoinRun(modelItemIds[0], modelItemId, ref survivorId); |
|
3553 |
string joinModelItemId = modelItemIds[0]; |
|
3554 |
CheckZeroLengthAndLabel(ref joinModelItemId); |
|
3555 |
JoinRun(joinModelItemId, modelItemId, ref survivorId); |
|
3601 | 3556 |
if (survivorId != null) |
3602 | 3557 |
break; |
3603 | 3558 |
} |
... | ... | |
3608 | 3563 |
List<string> modelItemIds = FindOtherModelItemBySymbolWhereTypePipeRun(symbol, modelItem.Id); |
3609 | 3564 |
if (modelItemIds.Count == 1) |
3610 | 3565 |
{ |
3611 |
JoinRun(modelItemIds[0], modelItemId, ref survivorId); |
|
3566 |
string joinModelItemId = modelItemIds[0]; |
|
3567 |
CheckZeroLengthAndLabel(ref joinModelItemId); |
|
3568 |
JoinRun(joinModelItemId, modelItemId, ref survivorId); |
|
3612 | 3569 |
if (survivorId != null) |
3613 | 3570 |
break; |
3614 | 3571 |
} |
... | ... | |
3616 | 3573 |
} |
3617 | 3574 |
} |
3618 | 3575 |
} |
3619 |
} |
|
3620 |
|
|
3621 |
private void ReplaceLine(Line line) |
|
3622 |
{ |
|
3623 |
LMModelItem modelItem = dataSource.GetModelItem(line.SPPID.ModelItemId); |
|
3624 |
|
|
3625 |
|
|
3626 | 3576 |
|
3627 |
ReleaseCOMObjects(modelItem); |
|
3577 |
void CheckZeroLengthAndLabel(ref string _modelItemId) |
|
3578 |
{ |
|
3579 |
LMConnector connector = GetLMConnectorOnlyOne(_modelItemId); |
|
3580 |
if (connector != null && Convert.ToBoolean(connector.get_IsZeroLength()) && connector.LabelPersists.Count == 0) |
|
3581 |
{ |
|
3582 |
string symbolPath = GetSPPIDFileName(modelItem); |
|
3583 |
LMConnector newConnector = ReModelingLMConnector(connector, symbolPath); |
|
3584 |
ReleaseCOMObjects(connector); |
|
3585 |
_modelItemId = newConnector.ModelItemID; |
|
3586 |
ReleaseCOMObjects(newConnector); |
|
3587 |
} |
|
3588 |
} |
|
3628 | 3589 |
} |
3629 | 3590 |
|
3630 | 3591 |
/// <summary> |
내보내기 Unified diff