개정판 87f02fc0
dev issue #000 : Zero Length Line Join 기능 추가
Change-Id: I134910ab74219b690200ceefd6d9124163538471
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
39 | 39 |
|
40 | 40 |
int CurrentCount; |
41 | 41 |
List<Tuple<string, Line, Line>> BranchLines = new List<Tuple<string, Line, Line>>(); |
42 |
List<string> ZeroLengthModelItemID = new List<string>(); |
|
42 | 43 |
|
43 | 44 |
public AutoModeling(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp) |
44 | 45 |
{ |
... | ... | |
48 | 49 |
this._ETCSetting = ETCSetting.GetInstance(); |
49 | 50 |
} |
50 | 51 |
|
51 |
private int ClacProgressCount()
|
|
52 |
private int CalcProgressCount()
|
|
52 | 53 |
{ |
53 | 54 |
int EquipCount = 0; |
54 | 55 |
int SymbolCount = 0; |
... | ... | |
113 | 114 |
|
114 | 115 |
if (DocumentCoordinateCorrection()) |
115 | 116 |
{ |
116 |
int AllCount = ClacProgressCount();
|
|
117 |
int AllCount = CalcProgressCount();
|
|
117 | 118 |
|
118 | 119 |
SplashScreenManager.ShowForm(typeof(SPPIDSplashScreen), true, true); |
119 | 120 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStep, AllCount); |
... | ... | |
164 | 165 |
foreach (var item in document.SpecBreaks) |
165 | 166 |
SpecBreakModeling(item); |
166 | 167 |
|
168 |
JoinZeroLengthLine(); |
|
169 |
|
|
167 | 170 |
// LineNumber Modeling |
168 | 171 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "LineNumbers Modeling"); |
169 | 172 |
foreach (var item in document.LINENUMBERS) |
... | ... | |
1235 | 1238 |
if (_LMConnector != null) |
1236 | 1239 |
{ |
1237 | 1240 |
RemoveConnectorForReModelingLine(newConnector); |
1241 |
ZeroLengthModelItemID.Add(_LMConnector.ModelItemID); |
|
1238 | 1242 |
ReleaseCOMObjects(_LMConnector); |
1239 | 1243 |
} |
1240 | 1244 |
ReleaseCOMObjects(placeRunInputs); |
... | ... | |
1257 | 1261 |
if (_LMConnector != null) |
1258 | 1262 |
{ |
1259 | 1263 |
RemoveConnectorForReModelingLine(newConnector); |
1264 |
ZeroLengthModelItemID.Add(_LMConnector.ModelItemID); |
|
1260 | 1265 |
ReleaseCOMObjects(_LMConnector); |
1261 | 1266 |
} |
1262 | 1267 |
ReleaseCOMObjects(placeRunInputs); |
... | ... | |
1981 | 1986 |
_LMAItem item = modelItem.AsLMAItem(); |
1982 | 1987 |
try |
1983 | 1988 |
{ |
1984 |
string modelitemID = item.Id; |
|
1985 |
_placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item); |
|
1986 |
string afterModelItemID = item.Id; |
|
1987 |
|
|
1988 |
if (modelitemID != afterModelItemID) |
|
1989 |
if (modelItem.get_ItemStatus() == "Active") |
|
1989 | 1990 |
{ |
1990 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, modelitemID); |
|
1991 |
foreach (var line in lines) |
|
1992 |
line.SPPID.ModelItemId = afterModelItemID; |
|
1991 |
string modelitemID = item.Id; |
|
1992 |
_placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item); |
|
1993 |
string afterModelItemID = item.Id; |
|
1994 |
|
|
1995 |
if (modelitemID != afterModelItemID) |
|
1996 |
{ |
|
1997 |
List<Line> lines = SPPIDUtil.FindLinesByModelId(document, modelitemID); |
|
1998 |
foreach (var line in lines) |
|
1999 |
line.SPPID.ModelItemId = afterModelItemID; |
|
2000 |
} |
|
2001 |
item.Commit(); |
|
1993 | 2002 |
} |
1994 |
item.Commit(); |
|
1995 | 2003 |
} |
1996 | 2004 |
catch (Exception ex) |
1997 | 2005 |
{ |
... | ... | |
3055 | 3063 |
intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj); |
3056 | 3064 |
} |
3057 | 3065 |
} |
3066 |
|
|
3067 |
public void JoinZeroLengthLine() |
|
3068 |
{ |
|
3069 |
foreach (var sModelID in ZeroLengthModelItemID) |
|
3070 |
{ |
|
3071 |
LMModelItem modelItem = dataSource.GetModelItem(sModelID); |
|
3072 |
int connectorCount = 0; |
|
3073 |
string representationID = string.Empty; |
|
3074 |
|
|
3075 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active") |
|
3076 |
{ |
|
3077 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
3078 |
{ |
|
3079 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
3080 |
{ |
|
3081 |
connectorCount++; |
|
3082 |
representationID = rep.Id; |
|
3083 |
} |
|
3084 |
} |
|
3085 |
} |
|
3086 |
|
|
3087 |
ReleaseCOMObjects(modelItem); |
|
3088 |
|
|
3089 |
if (connectorCount == 1) |
|
3090 |
{ |
|
3091 |
LMConnector connector = dataSource.GetConnector(representationID); |
|
3092 |
if (connector.LabelPersists.Count == 0) |
|
3093 |
AutoJoinPipeRun(sModelID); |
|
3094 |
ReleaseCOMObjects(connector); |
|
3095 |
} |
|
3096 |
} |
|
3097 |
|
|
3098 |
return; |
|
3099 |
} |
|
3058 | 3100 |
} |
3059 | 3101 |
} |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
163 | 163 |
Placement _placement = new Placement(); |
164 | 164 |
LMADataSource dataSource = new LMADataSource();//placement.PIDDataSource; |
165 | 165 |
|
166 |
string modelItemId = "B79C53F295454F489B9DBCD9F1078D3E"; |
|
167 |
LMOPC opc = dataSource.GetOPC(modelItemId); |
|
168 |
try |
|
166 |
foreach (var item in radApp.ActiveDocument.ActiveSheet.DrawingObjects) |
|
169 | 167 |
{ |
170 |
if (opc != null) |
|
168 |
Ingr.RAD2D.DependencyObject dependencyObject = item as Ingr.RAD2D.DependencyObject; |
|
169 |
if (dependencyObject != null) |
|
171 | 170 |
{ |
172 |
LMOPC pairedOPC = opc.pairedWithOPCObject; |
|
173 |
//MessageBox.Show(pairedOPC.get_ItemStatus()); |
|
174 |
//pairedOPC.Attributes[] |
|
175 |
_placement.PIDPlaceSymbol(@"\Piping\Piping OPC's\Off-Drawing.sym", 0, 0, 0, 0, pairedOPC.AsLMAItem()); |
|
171 |
string sModelItemType = string.Empty; |
|
172 |
string sModelID = string.Empty; |
|
173 |
foreach (Ingr.RAD2D.AttributeSet attributes in dependencyObject.AttributeSets) |
|
174 |
{ |
|
175 |
foreach (var attribute in attributes) |
|
176 |
{ |
|
177 |
if (attribute.Name == "ModelItemType") |
|
178 |
sModelItemType = attribute.GetValue().ToString(); |
|
179 |
else if (attribute.Name == "ModelID") |
|
180 |
sModelID = attribute.GetValue().ToString(); |
|
181 |
} |
|
182 |
} |
|
183 |
|
|
184 |
if (sModelItemType == "PipeRun" && !string.IsNullOrEmpty(sModelID)) |
|
185 |
{ |
|
186 |
LMModelItem modelItem = dataSource.GetModelItem(sModelID); |
|
187 |
if (modelItem != null && modelItem.get_ItemStatus() == "Active") |
|
188 |
{ |
|
189 |
foreach (LMRepresentation rep in modelItem.Representations) |
|
190 |
{ |
|
191 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
192 |
{ |
|
193 |
LMConnector connector = dataSource.GetConnector(rep.Id); |
|
194 |
if (connector.get_IsZeroLength() && connector.LabelPersists.Count == 0) |
|
195 |
{ |
|
196 |
|
|
197 |
} |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
201 |
} |
|
202 |
} |
|
176 | 203 |
} |
177 | 204 |
} |
178 |
catch (Exception ex) |
|
179 |
{ |
|
180 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
181 |
} |
|
182 |
finally |
|
183 |
{ |
|
184 | 205 |
|
185 |
} |
|
206 |
//string modelItemId = "B79C53F295454F489B9DBCD9F1078D3E"; |
|
207 |
//LMOPC opc = dataSource.GetOPC(modelItemId); |
|
208 |
//try |
|
209 |
//{ |
|
210 |
// if (opc != null) |
|
211 |
// { |
|
212 |
// LMOPC pairedOPC = opc.pairedWithOPCObject; |
|
213 |
// //MessageBox.Show(pairedOPC.get_ItemStatus()); |
|
214 |
// //pairedOPC.Attributes[] |
|
215 |
// _placement.PIDPlaceSymbol(@"\Piping\Piping OPC's\Off-Drawing.sym", 0, 0, 0, 0, pairedOPC.AsLMAItem()); |
|
216 |
// } |
|
217 |
//} |
|
218 |
//catch (Exception ex) |
|
219 |
//{ |
|
220 |
// System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
221 |
//} |
|
222 |
//finally |
|
223 |
//{ |
|
186 | 224 |
|
187 |
if (radApp.ActiveSelectSet.Count > 0) |
|
188 |
{ |
|
189 |
DependencyObject line2D = radApp.ActiveSelectSet[0] as DependencyObject; |
|
190 |
if (line2D != null) |
|
191 |
{ |
|
192 |
double minX = 0; |
|
193 |
double minY = 0; |
|
194 |
double maxX = 0; |
|
195 |
double maxY = 0; |
|
196 |
line2D.Range(out minX, out minY, out maxX, out maxY); |
|
225 |
//} |
|
197 | 226 |
|
198 |
StringBuilder sb = new StringBuilder(); |
|
199 |
sb.AppendLine(minX.ToString()); |
|
200 |
sb.AppendLine(minY.ToString()); |
|
201 |
sb.AppendLine(maxX.ToString()); |
|
202 |
sb.AppendLine(maxY.ToString()); |
|
203 |
MessageBox.Show(sb.ToString()); |
|
227 |
//if (radApp.ActiveSelectSet.Count > 0) |
|
228 |
//{ |
|
229 |
// DependencyObject line2D = radApp.ActiveSelectSet[0] as DependencyObject; |
|
230 |
// if (line2D != null) |
|
231 |
// { |
|
232 |
// double minX = 0; |
|
233 |
// double minY = 0; |
|
234 |
// double maxX = 0; |
|
235 |
// double maxY = 0; |
|
236 |
// line2D.Range(out minX, out minY, out maxX, out maxY); |
|
237 |
|
|
238 |
// StringBuilder sb = new StringBuilder(); |
|
239 |
// sb.AppendLine(minX.ToString()); |
|
240 |
// sb.AppendLine(minY.ToString()); |
|
241 |
// sb.AppendLine(maxX.ToString()); |
|
242 |
// sb.AppendLine(maxY.ToString()); |
|
243 |
// MessageBox.Show(sb.ToString()); |
|
244 |
|
|
245 |
// } |
|
246 |
// else |
|
247 |
// MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
248 |
//} |
|
249 |
//else |
|
250 |
// MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
204 | 251 |
|
205 |
} |
|
206 |
else |
|
207 |
MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
208 |
} |
|
209 |
else |
|
210 |
MessageBox.Show(Msg.SelectLine, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning); |
|
211 |
|
|
212 | 252 |
} |
213 | 253 |
|
214 | 254 |
|
내보내기 Unified diff