개정판 f14b4e3b
dev issue #507 : VentDrain Modeling
Change-Id: I52725feb0cbdaf38b0a6cb8dad5f0e4848d7b50a
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
82 | 82 |
{ |
83 | 83 |
_placement = new Placement(); |
84 | 84 |
dataSource = _placement.PIDDataSource; |
85 |
|
|
85 |
|
|
86 | 86 |
if (CreateDocument(ref drawingNumber, ref drawingName) && DocumentCoordinateCorrection()) |
87 | 87 |
{ |
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, 23);
|
|
91 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllStepCount, 24);
|
|
92 | 92 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetDocumentName, DocumentLabelText); |
93 | 93 |
|
94 | 94 |
// VendorPackage Modeling |
... | ... | |
99 | 99 |
RunSymbolModeling(); |
100 | 100 |
// LineRun Line Modeling |
101 | 101 |
RunLineModeling(); |
102 |
// Vent Drain Modeling |
|
103 |
RunVentDrainModeling(); |
|
102 | 104 |
// Clear Attribute |
103 | 105 |
RunClearNominalDiameter(); |
104 | 106 |
// Join SameConnector |
... | ... | |
233 | 235 |
{ |
234 | 236 |
try |
235 | 237 |
{ |
238 |
if (document.VentDrainSymbol.Contains(item)) |
|
239 |
continue; |
|
236 | 240 |
SymbolModelingBySymbol(item); |
237 | 241 |
} |
238 | 242 |
catch (Exception ex) |
... | ... | |
259 | 263 |
{ |
260 | 264 |
try |
261 | 265 |
{ |
266 |
if (document.VentDrainLine.Contains(item)) |
|
267 |
continue; |
|
262 | 268 |
NewLineModeling(item); |
263 | 269 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
264 | 270 |
} |
... | ... | |
299 | 305 |
{ |
300 | 306 |
try |
301 | 307 |
{ |
308 |
if (document.VentDrainLine.Contains(item)) |
|
309 |
continue; |
|
302 | 310 |
NewLineModeling(item); |
303 | 311 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
304 | 312 |
} |
... | ... | |
311 | 319 |
} |
312 | 320 |
} |
313 | 321 |
} |
322 |
private void RunVentDrainModeling() |
|
323 |
{ |
|
324 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.VentDrainLine.Count); |
|
325 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetStep, "Vent Drain Modeling"); |
|
326 |
foreach (var item in document.VentDrainLine) |
|
327 |
{ |
|
328 |
try |
|
329 |
{ |
|
330 |
Connector connector = item.CONNECTORS.Find(x => x.ConnectedObject != null && x.ConnectedObject.GetType() == typeof(Symbol)); |
|
331 |
if (connector != null) |
|
332 |
{ |
|
333 |
SetCoordinate(); |
|
334 |
SymbolModelingBySymbol(connector.ConnectedObject as Symbol); |
|
335 |
NewLineModeling(item); |
|
336 |
} |
|
337 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.UpProgress, null); |
|
338 |
} |
|
339 |
catch (Exception ex) |
|
340 |
{ |
|
341 |
Log.Write("Error in NewLineModeling"); |
|
342 |
Log.Write("UID : " + item.UID); |
|
343 |
Log.Write(ex.Message); |
|
344 |
Log.Write(ex.StackTrace); |
|
345 |
} |
|
346 |
|
|
347 |
void SetCoordinate() |
|
348 |
{ |
|
349 |
Connector branchConnector = item.CONNECTORS.Find(loop => loop.ConnectedObject != null && loop.ConnectedObject.GetType() == typeof(Line)); |
|
350 |
if (branchConnector != null) |
|
351 |
{ |
|
352 |
Line connLine = branchConnector.ConnectedObject as Line; |
|
353 |
double x = 0; |
|
354 |
double y = 0; |
|
355 |
GetTargetLineConnectorPoint(branchConnector, item, ref x, ref y); |
|
356 |
LMConnector targetConnector = FindTargetLMConnectorForBranch(item, connLine, ref x, ref y); |
|
357 |
if (targetConnector != null) |
|
358 |
{ |
|
359 |
List<Symbol> group = new List<Symbol>(); |
|
360 |
SPPIDUtil.FindConnectedSymbolGroup(document, item.CONNECTORS.Find(loop => loop != branchConnector).ConnectedObject as Symbol, group); |
|
361 |
if (item.SlopeType == SlopeType.HORIZONTAL) |
|
362 |
{ |
|
363 |
item.SPPID.START_Y = y; |
|
364 |
item.SPPID.END_Y = y; |
|
365 |
foreach (var symbol in group) |
|
366 |
{ |
|
367 |
symbol.SPPID.ORIGINAL_Y = y; |
|
368 |
symbol.SPPID.SPPID_Y = y; |
|
369 |
} |
|
370 |
} |
|
371 |
else if (item.SlopeType == SlopeType.VERTICAL) |
|
372 |
{ |
|
373 |
item.SPPID.START_X = x; |
|
374 |
item.SPPID.END_X = x; |
|
375 |
foreach (var symbol in group) |
|
376 |
{ |
|
377 |
symbol.SPPID.ORIGINAL_X = x; |
|
378 |
symbol.SPPID.SPPID_X = x; |
|
379 |
} |
|
380 |
} |
|
381 |
} |
|
382 |
ReleaseCOMObjects(targetConnector); |
|
383 |
targetConnector = null; |
|
384 |
} |
|
385 |
} |
|
386 |
} |
|
387 |
} |
|
314 | 388 |
private void RunClearNominalDiameter() |
315 | 389 |
{ |
316 | 390 |
SplashScreenManager.Default.SendCommand(SPPIDSplashScreen.SplashScreenCommand.SetAllProgress, document.SYMBOLS.Count + document.LINES.Count); |
DTI_PID/SPPIDConverter/BaseModel/Document.cs | ||
---|---|---|
13 | 13 |
{ |
14 | 14 |
public class Document |
15 | 15 |
{ |
16 |
public List<Line> VentDrainLine = new List<Line>(); |
|
17 |
public List<Symbol> VentDrainSymbol = new List<Symbol>(); |
|
18 |
|
|
16 | 19 |
private string _DWGNAME; |
17 | 20 |
private string _SIZE; |
18 | 21 |
private double _SIZE_WIDTH; |
... | ... | |
103 | 106 |
SetAllConnectors(); |
104 | 107 |
Enable = true; |
105 | 108 |
ValidationCheck(); |
109 |
SetVentDrainItem(); |
|
106 | 110 |
} |
107 | 111 |
} |
108 | 112 |
catch (Exception ex) |
... | ... | |
581 | 585 |
connector.ConnectedObject = SPPIDUtil.FindObjectByUID(this, connector.CONNECTEDITEM); |
582 | 586 |
} |
583 | 587 |
|
584 |
|
|
585 |
|
|
586 | 588 |
public void ValidationCheck() |
587 | 589 |
{ |
588 | 590 |
|
... | ... | |
1043 | 1045 |
Enable = true; |
1044 | 1046 |
} |
1045 | 1047 |
} |
1048 |
|
|
1049 |
private void SetVentDrainItem() |
|
1050 |
{ |
|
1051 |
foreach (var item in SYMBOLS) |
|
1052 |
{ |
|
1053 |
List<Symbol> group = new List<Symbol>(); |
|
1054 |
SPPIDUtil.FindConnectedSymbolGroup(this, item, group); |
|
1055 |
List<Line> lines = new List<Line>(); |
|
1056 |
foreach (var symbol in group) |
|
1057 |
{ |
|
1058 |
foreach (var connector in symbol.CONNECTORS) |
|
1059 |
{ |
|
1060 |
if (connector.ConnectedObject != null && connector.ConnectedObject.GetType() == typeof(Line)) |
|
1061 |
{ |
|
1062 |
Line line = connector.ConnectedObject as Line; |
|
1063 |
if (!lines.Contains(line)) |
|
1064 |
lines.Add(line); |
|
1065 |
|
|
1066 |
} |
|
1067 |
} |
|
1068 |
} |
|
1069 |
|
|
1070 |
if (lines.Count == 1 && !SPPIDUtil.IsBranchedLine(this, lines[0]) && SPPIDUtil.IsBranchLine(lines[0]) && |
|
1071 |
(lines[0].SlopeType == SlopeType.HORIZONTAL || lines[0].SlopeType == SlopeType.VERTICAL)) |
|
1072 |
{ |
|
1073 |
foreach (var symbol in group) |
|
1074 |
{ |
|
1075 |
if (!VentDrainSymbol.Contains(symbol)) |
|
1076 |
VentDrainSymbol.Add(symbol); |
|
1077 |
} |
|
1078 |
VentDrainLine.Add(lines[0]); |
|
1079 |
} |
|
1080 |
} |
|
1081 |
} |
|
1046 | 1082 |
} |
1047 | 1083 |
} |
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
30 | 30 |
public partial class ConverterDocking : UserControl |
31 | 31 |
{ |
32 | 32 |
Ingr.RAD2D.Application application; |
33 |
static bool addEvent = false; |
|
33 | 34 |
public ConverterDocking() |
34 | 35 |
{ |
35 | 36 |
InitializeComponent(); |
... | ... | |
52 | 53 |
_ProjectInfo.Port = Settings.Default.ProjectPort; |
53 | 54 |
_ProjectInfo.DBUser = Settings.Default.ProjectDBUser; |
54 | 55 |
_ProjectInfo.DBPassword = Settings.Default.ProjectDBPassword; |
56 |
|
|
57 |
if (!addEvent) |
|
58 |
{ |
|
59 |
application.EventObject.BeforeApplicationExit += ApplicationEvents_ApplicationExit; |
|
60 |
addEvent = true; |
|
61 |
} |
|
55 | 62 |
} |
56 | 63 |
catch (Exception ex) |
57 | 64 |
{ |
... | ... | |
216 | 223 |
} |
217 | 224 |
|
218 | 225 |
#region TEST |
226 |
private void ApplicationEvents_ApplicationExit(out bool cancel) |
|
227 |
{ |
|
228 |
application.Documents.Close(); |
|
229 |
//SheetWindow sheetWindow = application.ActiveWindow; |
|
230 |
cancel = false; |
|
231 |
} |
|
232 |
|
|
219 | 233 |
private void simpleButton1_Click(object sender, EventArgs e) |
220 | 234 |
{ |
235 |
int z = application.RunningCommand; |
|
236 |
|
|
221 | 237 |
foreach (RADObject item in application.ActiveDocument.SelectSet) |
222 | 238 |
{ |
223 | 239 |
DependencyObject dependencyObject = item as DependencyObject; |
... | ... | |
239 | 255 |
symbol2D.Range(out minX, out minY, out maxX, out maxY); |
240 | 256 |
} |
241 | 257 |
} |
242 |
|
|
243 |
|
|
258 |
int pid = 0; |
|
259 |
GetWindowThreadProcessId((IntPtr)application.HWnd, out pid); |
|
244 | 260 |
|
245 | 261 |
return; |
246 | 262 |
Thread outThread = new Thread(func2 => |
내보내기 Unified diff