개정판 54311b41
dev issue #000 : edit specbreak
Change-Id: I918ea5f98af1f0ea243124a16c5b4b392d39481c
DTI_PID/SPPIDConverter/ConverterDocking.cs | ||
---|---|---|
958 | 958 |
{ |
959 | 959 |
double d1X1, d1Y1, d1X2, d1Y2, d2X1, d2Y1, d2X2, d2Y2; |
960 | 960 |
|
961 |
Ingr.RAD2D.TextBox textBox1 = FindTextBoxArea(dependency1, out d1X1, out d1Y1, out d1X2, out d1Y2);
|
|
962 |
Ingr.RAD2D.TextBox textBox2 = FindTextBoxArea(dependency2, out d2X1, out d2Y1, out d2X2, out d2Y2);
|
|
961 |
FindRangeWithOutLineString2d(dependency1, out d1X1, out d1Y1, out d1X2, out d1Y2);
|
|
962 |
FindRangeWithOutLineString2d(dependency2, out d2X1, out d2Y1, out d2X2, out d2Y2);
|
|
963 | 963 |
|
964 | 964 |
switch (degree) |
965 | 965 |
{ |
... | ... | |
985 | 985 |
} |
986 | 986 |
private void MoveDependency(DependencyObject dependency, double xFrom, double yFrom, double xTo, double yTo) |
987 | 987 |
{ |
988 |
foreach (var item in dependency.DrawingObjects) |
|
989 |
{ |
|
990 |
DrawingObjectBaseEx ex = item as DrawingObjectBaseEx; |
|
991 |
if (ex != null) |
|
992 |
ex.Move(xFrom, yFrom, xTo, yTo); |
|
993 |
} |
|
988 |
application.ActiveSelectSet.Add(dependency); |
|
989 |
|
|
990 |
Transform transform = dependency.GetTransform(); |
|
991 |
transform.DefineByMove2d(xTo - xFrom, yTo - yFrom); |
|
992 |
application.ActiveSelectSet.Transform(transform, false); |
|
993 |
|
|
994 |
application.ActiveSelectSet.RemoveAll(); |
|
994 | 995 |
} |
995 | 996 |
private string GetDrawingItemType(DependencyObject dependency) |
996 | 997 |
{ |
... | ... | |
1007 | 1008 |
|
1008 | 1009 |
return result; |
1009 | 1010 |
} |
1010 |
private Ingr.RAD2D.TextBox FindTextBoxArea(DependencyObject dependency, out double x1, out double y1, out double x2, out double y2)
|
|
1011 |
private void FindRangeWithOutLineString2d(DependencyObject dependency, out double x1, out double y1, out double x2, out double y2)
|
|
1011 | 1012 |
{ |
1012 |
x1 = 0; |
|
1013 |
y1 = 0; |
|
1014 |
x2 = 0; |
|
1015 |
y2 = 0; |
|
1016 |
Ingr.RAD2D.TextBox textBox = null; |
|
1017 |
foreach (var item in dependency.DrawingObjects) |
|
1013 |
x1 = double.MaxValue; |
|
1014 |
y1 = double.MaxValue; |
|
1015 |
x2 = double.MinValue; |
|
1016 |
y2 = double.MinValue; |
|
1017 |
foreach (DrawingObjectBase item in dependency.DrawingObjects) |
|
1018 | 1018 |
{ |
1019 |
if (item.GetType() == typeof(Ingr.RAD2D.TextBox))
|
|
1019 |
if (item.GetType() != typeof(LineString2d))
|
|
1020 | 1020 |
{ |
1021 |
textBox = item as Ingr.RAD2D.TextBox; |
|
1022 |
textBox.Range(out x1, out y1, out x2, out y2); |
|
1023 |
break; |
|
1021 |
double minX, minY, maxX, maxY; |
|
1022 |
item.Range(out minX, out minY, out maxX, out maxY); |
|
1023 |
if (x1 > minX) |
|
1024 |
x1 = minX; |
|
1025 |
if (y1 > minY) |
|
1026 |
y1 = minY; |
|
1027 |
if (x2 < maxX) |
|
1028 |
x2 = maxX; |
|
1029 |
if (y2 < maxY) |
|
1030 |
y2 = maxY; |
|
1024 | 1031 |
} |
1025 | 1032 |
} |
1026 | 1033 |
|
1027 |
return textBox; |
|
1028 | 1034 |
} |
1029 | 1035 |
#endregion |
1030 | 1036 |
#region Hot Key |
... | ... | |
1059 | 1065 |
|
1060 | 1066 |
private void simpleButton1_Click(object sender, EventArgs e) |
1061 | 1067 |
{ |
1062 |
Placement placement = new Placement(); |
|
1063 |
if (application.ActiveSelectSet.Count > 0) |
|
1068 |
//Placement placement = new Placement(); |
|
1069 |
//LMADataSource dataSource = placement.PIDDataSource; |
|
1070 |
//string a = "0A509911F33441A2AF088BFBA78B770D"; |
|
1071 |
//LMLabelPersist label = dataSource.GetLabelPersist(a); |
|
1072 |
//label.set_XCoordinate(0.4); |
|
1073 |
|
|
1074 |
DependencyObject dependency = application.ActiveSelectSet[0] as DependencyObject; |
|
1075 |
if (dependency != null) |
|
1064 | 1076 |
{ |
1065 |
string modelItemId = null; |
|
1066 |
Symbol2d symbol2D = application.ActiveSelectSet[0] as Symbol2d; |
|
1067 |
DependencyObject dependency = application.ActiveSelectSet[0] as DependencyObject; |
|
1068 |
application.ActiveSelectSet.RemoveAll(); |
|
1069 |
if (symbol2D != null) |
|
1070 |
{ |
|
1071 |
return; |
|
1072 |
foreach (var attributes in symbol2D.AttributeSets) |
|
1073 |
{ |
|
1074 |
foreach (var attribute in attributes) |
|
1075 |
{ |
|
1076 |
if (attribute.Name == "ModelID") |
|
1077 |
modelItemId = attribute.GetValue().ToString(); |
|
1078 |
} |
|
1079 |
} |
|
1080 |
|
|
1081 |
if (modelItemId!=null) |
|
1082 |
{ |
|
1083 |
LMADataSource dataSource = new LMADataSource(); |
|
1084 |
LMModelItem modelItem = dataSource.GetModelItem(modelItemId); |
|
1085 |
foreach (LMRepresentation item in modelItem.Representations) |
|
1086 |
{ |
|
1087 |
if (item.ModelItemID == modelItemId) |
|
1088 |
{ |
|
1089 |
dataSource = placement.PIDDataSource; |
|
1090 |
LMSymbol symbol = dataSource.GetSymbol(item.Id); |
|
1091 |
double oldx = symbol.get_XCoordinate(); |
|
1092 |
double oldy = symbol.get_YCoordinate(); |
|
1093 |
symbol2D.Move(0, 0, 0, GridSetting.GetInstance().Length); |
|
1094 |
|
|
1095 |
dataSource = new LMADataSource(); |
|
1096 |
//dataSource = placement.PIDDataSource; |
|
1097 |
symbol = dataSource.GetSymbol(item.Id); |
|
1098 |
double x = symbol.get_XCoordinate(); |
|
1099 |
double y = symbol.get_YCoordinate(); |
|
1100 |
} |
|
1101 |
} |
|
1102 |
} |
|
1103 |
} |
|
1104 |
else if (dependency != null) |
|
1105 |
{ |
|
1106 |
foreach (dynamic item in dependency.DrawingObjects) |
|
1107 |
{ |
|
1108 |
item.Move(0, 0, 0, GridSetting.GetInstance().Length); |
|
1109 |
} |
|
1110 |
} |
|
1077 |
Transform transform = dependency.GetTransform(); |
|
1078 |
transform.DefineByMove2d(0.01, 0); |
|
1079 |
application.ActiveSelectSet.Transform(transform, true); |
|
1111 | 1080 |
} |
1112 |
|
|
1113 |
return; |
|
1114 |
Thread outThread = new Thread(func2 => |
|
1115 |
{ |
|
1116 |
for (int i = 100; i < 120; i++) |
|
1117 |
{ |
|
1118 |
Thread thread = new Thread(func => |
|
1119 |
{ |
|
1120 |
dynamic application = Interaction.GetObject("", "PIDAutomation.Application"); |
|
1121 |
//WrapperApplication wApp = new WrapperApplication(application.Application); |
|
1122 |
//Ingr.RAD2D.Application radApp = wApp.RADApplication; |
|
1123 |
dynamic drawing = application.Drawings.Add("Unit1", "D-Size.pid", i.ToString(), i.ToString());//application.Drawings.OpenDrawing("123"); |
|
1124 |
|
|
1125 |
Thread.Sleep(5000); |
|
1126 |
|
|
1127 |
drawing.CloseDrawing(true); |
|
1128 |
|
|
1129 |
//application.Quit(); |
|
1130 |
ReleaseCOMObjects(application); |
|
1131 |
application = null; |
|
1132 |
ReleaseCOMObjects(drawing); |
|
1133 |
drawing = null; |
|
1134 |
Thread.Sleep(5000); |
|
1135 |
}); |
|
1136 |
thread.Start(); |
|
1137 |
thread.Join(); |
|
1138 |
} |
|
1139 |
}); |
|
1140 |
outThread.Start(); |
|
1141 |
|
|
1142 |
|
|
1143 |
|
|
1144 |
|
|
1145 |
|
|
1146 |
//radApp.Documents.Add(@"\\server70\DEVDOF1Site\GS\PLANT\PLANT1\Unit1\11111.pid"); |
|
1147 |
|
|
1148 |
//radApp.ActiveDocument.Close(true); |
|
1149 |
//drawing.CloseDrawing(true); |
|
1150 |
|
|
1151 |
//ReleaseCOMObjects(application); |
|
1152 |
//ReleaseCOMObjects(drawing); |
|
1153 |
//application = null; |
|
1154 |
//wApp = null; |
|
1155 |
//radApp = null; |
|
1156 |
//drawing = null; |
|
1157 | 1081 |
} |
1158 | 1082 |
|
1159 | 1083 |
private void AutoJoinPipeRun() |
내보내기 Unified diff