개정판 71ba1ca3
dev issue #000 : fix bug
Change-Id: I254e19b9c8f4ca7d618d9542c0190bb47fa87edc
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
187 | 187 |
foreach (var item in document.TEXTINFOS) |
188 | 188 |
TextModeling(item); |
189 | 189 |
|
190 |
// LineRun Line Join |
|
191 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Join LineRuns"); |
|
192 |
foreach (LineNumber lineNumber in document.LINENUMBERS) |
|
193 |
foreach (LineRun run in lineNumber.RUNS) |
|
194 |
JoinRunLine(run); |
|
195 |
// TrimLineRun Line Join |
|
196 |
foreach (TrimLine trimLine in document.TRIMLINES) |
|
197 |
foreach (LineRun run in trimLine.RUNS) |
|
198 |
JoinRunLine(run); |
|
199 |
|
|
200 | 190 |
// Input LineNumber Attribute |
201 | 191 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Set LineNumbers Attribute"); |
202 | 192 |
foreach (var item in document.LINENUMBERS) |
... | ... | |
217 | 207 |
foreach (var item in document.SYMBOLS) |
218 | 208 |
LabelSymbolModeling(item); |
219 | 209 |
|
210 |
// LineRun Line Join |
|
211 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Join LineRuns"); |
|
212 |
foreach (LineNumber lineNumber in document.LINENUMBERS) |
|
213 |
foreach (LineRun run in lineNumber.RUNS) |
|
214 |
JoinRunLine(run); |
|
215 |
// TrimLineRun Line Join |
|
216 |
foreach (TrimLine trimLine in document.TRIMLINES) |
|
217 |
foreach (LineRun run in trimLine.RUNS) |
|
218 |
JoinRunLine(run); |
|
219 |
|
|
220 | 220 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetProgress, AllCount); |
221 | 221 |
} |
222 | 222 |
} |
... | ... | |
1179 | 1179 |
{ |
1180 | 1180 |
if (symbol != null) |
1181 | 1181 |
{ |
1182 |
string symbolUID = document.SYMBOLS.Find(x => x.SPPID.RepresentationId == symbol.AsLMRepresentation().Id).UID; |
|
1183 |
string lineUID = line.UID; |
|
1182 |
try |
|
1183 |
{ |
|
1184 |
string repID = symbol.AsLMRepresentation().Id; |
|
1185 |
string symbolUID = SPPIDUtil.FindSymbolByRepresentationID(document, repID).UID; |
|
1186 |
string lineUID = line.UID; |
|
1184 | 1187 |
|
1185 |
SpecBreak startSpecBreak = document.SpecBreaks.Find(x => |
|
1186 |
(x.DownStreamUID == symbolUID || x.UpStreamUID == symbolUID) && |
|
1187 |
(x.DownStreamUID == lineUID || x.UpStreamUID == lineUID)); |
|
1188 |
SpecBreak startSpecBreak = document.SpecBreaks.Find(x =>
|
|
1189 |
(x.DownStreamUID == symbolUID || x.UpStreamUID == symbolUID) &&
|
|
1190 |
(x.DownStreamUID == lineUID || x.UpStreamUID == lineUID));
|
|
1188 | 1191 |
|
1189 |
EndBreak startEndBreak = document.EndBreaks.Find(x => |
|
1190 |
(x.OWNER == symbolUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == symbolUID) && |
|
1191 |
(x.OWNER == lineUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == lineUID)); |
|
1192 |
EndBreak startEndBreak = document.EndBreaks.Find(x => |
|
1193 |
(x.OWNER == symbolUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == symbolUID) && |
|
1194 |
(x.OWNER == lineUID || x.PROPERTIES.Find(y => y.ATTRIBUTE == "Connected Item").VALUE == lineUID)); |
|
1195 |
|
|
1196 |
if (startSpecBreak != null || startEndBreak != null) |
|
1197 |
result = true; |
|
1198 |
} |
|
1199 |
catch (Exception ex) |
|
1200 |
{ |
|
1192 | 1201 |
|
1193 |
if (startSpecBreak != null || startEndBreak != null) |
|
1194 |
result = true; |
|
1202 |
} |
|
1195 | 1203 |
} |
1196 | 1204 |
} |
1197 | 1205 |
|
... | ... | |
1439 | 1447 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, branch.Item1); |
1440 | 1448 |
|
1441 | 1449 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(branch.Item1); |
1442 |
if (lines.Find(x => x.UID == "d4bea462-44cc-473d-8fe2-fb2e98009578") != null) |
|
1443 |
{ |
|
1444 |
|
|
1445 |
} |
|
1446 | 1450 |
LMConnector _StartConnector = null; |
1447 | 1451 |
LMConnector _EndConnector = null; |
1448 | 1452 |
double lengthStart = double.MaxValue; |
... | ... | |
3024 | 3028 |
CalcLabelLocation(ref x, ref y, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y, text.SPPIDLabelLocation, mapping.Location); |
3025 | 3029 |
Array array = new double[] { 0, x, y }; |
3026 | 3030 |
|
3027 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
|
|
3031 |
LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: mapping.LeaderLine);
|
|
3028 | 3032 |
if (_LMLabelPersist != null) |
3029 | 3033 |
{ |
3030 | 3034 |
_LMLabelPersist.Commit(); |
DTI_PID/SPPIDConverter/AutoModeling_OPC.cs | ||
---|---|---|
32 | 32 |
dynamic application; |
33 | 33 |
Ingr.RAD2D.Application radApp; |
34 | 34 |
List<SPPID_Document> allDocuments; |
35 |
DataTable drawingTable; |
|
35 | 36 |
|
36 |
public AutoModeling_OPC(List<SPPID_Document> allDocuments, dynamic application, Ingr.RAD2D.Application radApp) |
|
37 |
public AutoModeling_OPC(List<SPPID_Document> allDocuments, dynamic application, Ingr.RAD2D.Application radApp, DataTable drawingTable)
|
|
37 | 38 |
{ |
38 | 39 |
this.application = application; |
39 | 40 |
this.radApp = radApp; |
40 | 41 |
this.allDocuments = allDocuments; |
42 |
this.drawingTable = drawingTable; |
|
41 | 43 |
} |
42 | 44 |
|
43 | 45 |
public void Run() |
... | ... | |
75 | 77 |
if (!result) |
76 | 78 |
{ |
77 | 79 |
// OPC Pair 찾아서 도면 오픈후 Pair 모델링 |
78 |
OpenDrawing("");
|
|
79 |
}
|
|
80 |
BaseModel.Attribute pathAttribute = opc.ATTRIBUTES.Find(x => x.ATTRIBUTE == "PATH");
|
|
81 |
BaseModel.Attribute linkOPCAttribute = opc.ATTRIBUTES.Find(x => x.ATTRIBUTE == "LinkOPC");
|
|
80 | 82 |
|
81 |
|
|
82 |
|
|
83 |
DataRow[] rows = drawingTable.Select(string.Format("PATH = '{0}'", pathAttribute.VALUE)); |
|
84 |
if (rows.Length == 1 && OpenDrawing(rows[0]["DRAWINGNAME"].ToString())) |
|
85 |
{ |
|
86 |
|
|
87 |
} |
|
88 |
} |
|
83 | 89 |
|
84 | 90 |
ReleaseCOMObjects(_LMOPC); |
85 | 91 |
ReleaseCOMObjects(pairOPC); |
... | ... | |
95 | 101 |
} |
96 | 102 |
} |
97 | 103 |
|
98 |
private void OpenDrawing(string drawingName)
|
|
104 |
private bool OpenDrawing(string drawingName)
|
|
99 | 105 |
{ |
100 |
dynamic doc = application.Drawings.OpenDrawing(drawingName); |
|
101 |
doc.Activate(); |
|
106 |
bool result = false; |
|
107 |
try |
|
108 |
{ |
|
109 |
|
|
110 |
|
|
111 |
//dynamic doc = application.Drawings.OpenDrawing(drawingName); |
|
112 |
//doc.Activate(); |
|
113 |
|
|
114 |
result = true; |
|
115 |
} |
|
116 |
catch (Exception ex) |
|
117 |
{ |
|
118 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
119 |
} |
|
102 | 120 |
|
121 |
return result; |
|
103 | 122 |
} |
104 | 123 |
} |
105 | 124 |
} |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
133 | 133 |
allDocuments.Add(document); |
134 | 134 |
} |
135 | 135 |
|
136 |
AutoModeling_OPC opc = new AutoModeling_OPC(allDocuments, application, radApp); |
|
136 |
AutoModeling_OPC opc = new AutoModeling_OPC(allDocuments, application, radApp, drawingTable);
|
|
137 | 137 |
opc.Run(); |
138 | 138 |
//dynamic doc = application.Drawings.OpenDrawing(drawingTable.Rows[0]["DRAWINGNAME"]); |
139 | 139 |
|
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
388 | 388 |
|
389 | 389 |
return null; |
390 | 390 |
} |
391 |
|
|
392 |
public static Symbol FindSymbolByRepresentationID(Document document, string repID) |
|
393 |
{ |
|
394 |
Symbol findSymbol = null; |
|
395 |
foreach (var symbol in document.SYMBOLS) |
|
396 |
{ |
|
397 |
if (symbol.SPPID.RepresentationId == repID) |
|
398 |
{ |
|
399 |
findSymbol = symbol; |
|
400 |
} |
|
401 |
else |
|
402 |
{ |
|
403 |
ChildSymbol childSymbol = FindChildSymbolByRepresentationID(document, symbol, repID); |
|
404 |
if (childSymbol != null) |
|
405 |
findSymbol = symbol; |
|
406 |
} |
|
407 |
|
|
408 |
if (findSymbol != null) |
|
409 |
break; |
|
410 |
} |
|
411 |
|
|
412 |
return findSymbol; |
|
413 |
} |
|
414 |
|
|
415 |
public static ChildSymbol FindChildSymbolByRepresentationID(Document document, Symbol symbol, string repID) |
|
416 |
{ |
|
417 |
ChildSymbol childSymbol = null; |
|
418 |
|
|
419 |
foreach (ChildSymbol loopChild in symbol.ChildSymbols) |
|
420 |
{ |
|
421 |
if (loopChild.SPPID.RepresentationId == repID) |
|
422 |
{ |
|
423 |
childSymbol = loopChild; |
|
424 |
break; |
|
425 |
} |
|
426 |
else |
|
427 |
{ |
|
428 |
childSymbol = FindChildSymbolByRepresentationIDLoop(document, repID, loopChild); |
|
429 |
if (childSymbol != null) |
|
430 |
break; |
|
431 |
} |
|
432 |
} |
|
433 |
|
|
434 |
return childSymbol; |
|
435 |
} |
|
436 |
|
|
437 |
private static ChildSymbol FindChildSymbolByRepresentationIDLoop(Document document, string repID, ChildSymbol childSymbol) |
|
438 |
{ |
|
439 |
ChildSymbol findChild = null; |
|
440 |
|
|
441 |
foreach (var item in childSymbol.ChildSymbols) |
|
442 |
{ |
|
443 |
if (item.SPPID.RepresentationId == repID) |
|
444 |
{ |
|
445 |
findChild = item; |
|
446 |
break; |
|
447 |
} |
|
448 |
else |
|
449 |
{ |
|
450 |
findChild = FindChildSymbolByRepresentationIDLoop(document, repID, item); |
|
451 |
if (findChild != null) |
|
452 |
break; |
|
453 |
} |
|
454 |
} |
|
455 |
|
|
456 |
return findChild; |
|
457 |
} |
|
391 | 458 |
} |
392 | 459 |
} |
내보내기 Unified diff