개정판 1ed39474
dev issue #000 : Modeling bug fix / ZeroLength로 인한 ModelItem ID 꼬임현상 수정
Change-Id: I43efe6bdc339c07480653909266980c9db972930
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
174 | 174 |
foreach (var item in document.LINENUMBERS) |
175 | 175 |
LineNumberModeling(item); |
176 | 176 |
|
177 |
// LineNumber Modeling
|
|
177 |
// FlowMark Modeling
|
|
178 | 178 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Flow Mark Modeling"); |
179 | 179 |
foreach (var item in document.LINES) |
180 | 180 |
FlowMarkModeling(item); |
... | ... | |
271 | 271 |
{ |
272 | 272 |
LMDrawings drawings = new LMDrawings(); |
273 | 273 |
drawings.Collect(dataSource); |
274 |
|
|
274 |
|
|
275 | 275 |
List<string> drawingNameList = new List<string>(); |
276 | 276 |
List<string> drawingNumberList = new List<string>(); |
277 | 277 |
|
... | ... | |
3087 | 3087 |
|
3088 | 3088 |
if (connectorCount == 1) |
3089 | 3089 |
{ |
3090 |
LMConnector connector = dataSource.GetConnector(representationID); |
|
3091 |
if (connector.LabelPersists.Count == 0) |
|
3092 |
AutoJoinPipeRun(sModelID); |
|
3093 |
ReleaseCOMObjects(connector); |
|
3090 |
LMConnector _LMConnector = dataSource.GetConnector(representationID); |
|
3091 |
if (_LMConnector.LabelPersists.Count == 0) |
|
3092 |
{ |
|
3093 |
LMSymbol symbol2 = _LMConnector.ConnectItem2SymbolObject; |
|
3094 |
|
|
3095 |
LMConnector targetLine = null; |
|
3096 |
if (symbol2 != null && symbol2.get_RepresentationType() == "Branch") |
|
3097 |
{ |
|
3098 |
foreach (LMConnector connector in symbol2.Connect1Connectors) |
|
3099 |
{ |
|
3100 |
if (connector.get_ItemStatus() == "Active" && _LMConnector.Id != connector.Id) |
|
3101 |
targetLine = connector; |
|
3102 |
} |
|
3103 |
|
|
3104 |
foreach (LMConnector connector in symbol2.Connect2Connectors) |
|
3105 |
{ |
|
3106 |
if (connector.get_ItemStatus() == "Active" && _LMConnector.Id != connector.Id) |
|
3107 |
targetLine = connector; |
|
3108 |
} |
|
3109 |
} |
|
3110 |
|
|
3111 |
JoinPipeRun(_LMConnector.ModelItemID, targetLine.ModelItemID); |
|
3112 |
} |
|
3113 |
|
|
3114 |
ReleaseCOMObjects(_LMConnector); |
|
3094 | 3115 |
} |
3095 | 3116 |
} |
3096 | 3117 |
|
DTI_PID/SPPIDConverter/AutoModeling_OPC.cs | ||
---|---|---|
30 | 30 |
Placement _placement; |
31 | 31 |
LMADataSource dataSource; |
32 | 32 |
dynamic application; |
33 |
string SPPID_DrawingName; |
|
34 | 33 |
Ingr.RAD2D.Application radApp; |
35 |
SPPID_Document document;
|
|
34 |
List<SPPID_Document> allDocuments;
|
|
36 | 35 |
|
37 |
public AutoModeling_OPC(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp, string SPPID_DrawingName)
|
|
36 |
public AutoModeling_OPC(List<SPPID_Document> allDocuments, dynamic application, Ingr.RAD2D.Application radApp)
|
|
38 | 37 |
{ |
39 |
this.document = document; |
|
40 | 38 |
this.application = application; |
41 | 39 |
this.radApp = radApp; |
42 |
this.SPPID_DrawingName = SPPID_DrawingName;
|
|
40 |
this.allDocuments = allDocuments;
|
|
43 | 41 |
} |
44 | 42 |
|
45 | 43 |
public void Run() |
46 | 44 |
{ |
47 |
Placement _placement = new Placement(); |
|
48 |
LMADataSource dataSource = _placement.PIDDataSource; |
|
49 |
|
|
50 |
|
|
45 |
_placement = new Placement(); |
|
46 |
dataSource = _placement.PIDDataSource; |
|
51 | 47 |
|
48 |
foreach (var document in allDocuments) |
|
49 |
{ |
|
50 |
foreach (var opc in document.SYMBOLS) |
|
51 |
{ |
|
52 |
if ((opc.TYPE == "Piping OPC's" || |
|
53 |
opc.TYPE == "Instrument OPC's") && |
|
54 |
!string.IsNullOrEmpty(opc.SPPID.ModelItemID)) |
|
55 |
{ |
|
56 |
PairedOPCModeling(opc); |
|
57 |
} |
|
58 |
} |
|
59 |
} |
|
52 | 60 |
|
61 |
ReleaseCOMObjects(_placement); |
|
62 |
ReleaseCOMObjects(dataSource); |
|
63 |
} |
|
53 | 64 |
|
65 |
public void PairedOPCModeling(Symbol opc) |
|
66 |
{ |
|
67 |
bool result = false; |
|
68 |
LMOPC _LMOPC = dataSource.GetOPC(opc.SPPID.ModelItemID); |
|
69 |
LMOPC pairOPC = _LMOPC.pairedWithOPCObject; |
|
54 | 70 |
|
71 |
foreach (LMRepresentation rep in pairOPC.Representations) |
|
72 |
if (rep.DrawingID != "0") |
|
73 |
result = true; |
|
55 | 74 |
|
75 |
if (!result) |
|
76 |
{ |
|
77 |
// OPC Pair 찾아서 도면 오픈후 Pair 모델링 |
|
78 |
OpenDrawing(""); |
|
79 |
} |
|
56 | 80 |
|
81 |
|
|
82 |
|
|
57 | 83 |
|
58 |
ReleaseCOMObjects(_placement);
|
|
59 |
ReleaseCOMObjects(dataSource);
|
|
84 |
ReleaseCOMObjects(_LMOPC);
|
|
85 |
ReleaseCOMObjects(pairOPC);
|
|
60 | 86 |
} |
61 | 87 |
|
62 | 88 |
public void ReleaseCOMObjects(params object[] objVars) |
... | ... | |
68 | 94 |
intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj); |
69 | 95 |
} |
70 | 96 |
} |
97 |
|
|
98 |
private void OpenDrawing(string drawingName) |
|
99 |
{ |
|
100 |
dynamic doc = application.Drawings.OpenDrawing(drawingName); |
|
101 |
doc.Activate(); |
|
102 |
|
|
103 |
} |
|
71 | 104 |
} |
72 | 105 |
} |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
126 | 126 |
} |
127 | 127 |
} |
128 | 128 |
|
129 |
List<SPPID_Document> allDocuments = new List<SPPID_Document>(); |
|
129 | 130 |
foreach (DataRow row in drawingTable.Rows) |
130 | 131 |
{ |
131 | 132 |
SPPID_Document document = JsonConvert.DeserializeObject<SPPID_Document>(row["DOCUMENT"].ToString()); |
132 |
AutoModeling_OPC opc = new AutoModeling_OPC(document, application, radApp, row["DRAWINGNAME"].ToString()); |
|
133 |
opc.Run(); |
|
133 |
allDocuments.Add(document); |
|
134 | 134 |
} |
135 |
|
|
136 |
AutoModeling_OPC opc = new AutoModeling_OPC(allDocuments, application, radApp); |
|
137 |
opc.Run(); |
|
135 | 138 |
//dynamic doc = application.Drawings.OpenDrawing(drawingTable.Rows[0]["DRAWINGNAME"]); |
136 | 139 |
|
137 | 140 |
//doc.CloseDrawing(true); |
... | ... | |
209 | 212 |
Placement _placement = new Placement(); |
210 | 213 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
211 | 214 |
|
212 |
LMOPC opc = dataSource.GetOPC("B79C53F295454F489B9DBCD9F1078D3E"); |
|
213 |
LMOPC pairOPC = opc.pairedWithOPCObject; |
|
215 |
LMConnector connector = dataSource.GetConnector(""); |
|
216 |
|
|
217 |
LMSymbol symbol1 = connector.ConnectItem1SymbolObject; |
|
218 |
LMSymbol symbol2 = connector.ConnectItem2SymbolObject; |
|
214 | 219 |
|
215 |
foreach (LMRepresentation rep in pairOPC.Representations) |
|
216 |
{ |
|
217 |
if (rep.DrawingID != "0") |
|
218 |
{ |
|
219 |
MessageBox.Show(rep.DrawingObject.Attributes["Name"].get_Value().ToString()); |
|
220 |
} |
|
221 |
} |
|
222 |
|
|
223 | 220 |
} |
224 | 221 |
|
225 | 222 |
|
DTI_PID/SPPIDConverter/SPPIDModel/SPPID_Document.cs | ||
---|---|---|
298 | 298 |
{ |
299 | 299 |
Line connLine = connectedItem as Line; |
300 | 300 |
|
301 |
Connector otherConnector = connLine.CONNECTORS.Find(x => x.CONNECTEDITEM != symbol.UID); |
|
302 |
|
|
301 | 303 |
double lineX = double.NaN; |
302 | 304 |
double lineY = double.NaN; |
303 | 305 |
// Symbol의 Connector ScenePoint |
304 |
SPPIDUtil.ConvertPointBystring(connector.SCENECONNECTPOINT, ref lineX, ref lineY);
|
|
306 |
SPPIDUtil.ConvertPointBystring(otherConnector.SCENECONNECTPOINT, ref lineX, ref lineY);
|
|
305 | 307 |
double symbolX = double.NaN; |
306 | 308 |
double symbolY = double.NaN; |
307 | 309 |
SPPIDUtil.ConvertPointBystring(symbol.ORIGINALPOINT, ref symbolX, ref symbolY); |
... | ... | |
328 | 330 |
{ |
329 | 331 |
Symbol connSymbol = connectedItem as Symbol; |
330 | 332 |
|
333 |
Connector otherConnector = Line.CONNECTORS.Find(x => x.CONNECTEDITEM != connSymbol.UID); |
|
334 |
|
|
331 | 335 |
double lineX = double.NaN; |
332 | 336 |
double lineY = double.NaN; |
333 | 337 |
// Line의 Connector ScenePoint |
334 |
SPPIDUtil.ConvertPointBystring(connector.SCENECONNECTPOINT, ref lineX, ref lineY);
|
|
338 |
SPPIDUtil.ConvertPointBystring(otherConnector.SCENECONNECTPOINT, ref lineX, ref lineY);
|
|
335 | 339 |
double symbolX = double.NaN; |
336 | 340 |
double symbolY = double.NaN; |
337 | 341 |
SPPIDUtil.ConvertPointBystring(connSymbol.ORIGINALPOINT, ref symbolX, ref symbolY); |
내보내기 Unified diff