개정판 d7341835
dev issue #000 : For GS
DTI_PID/SPPIDConverter_AutoModeling/DB/DB.cs | ||
---|---|---|
424 | 424 |
|
425 | 425 |
return attributes.Distinct().ToList(); |
426 | 426 |
} |
427 |
|
|
428 |
public static bool CheckFluidCode(string value, out string code) |
|
429 |
{ |
|
430 |
bool bResult = false; |
|
431 |
code = ""; |
|
432 |
|
|
433 |
DBInformation dbInfo = DBInformation.GetInstance(); |
|
434 |
try |
|
435 |
{ |
|
436 |
if (dbInfo.DBType == "ORACLE") |
|
437 |
{ |
|
438 |
string connString = string.Format(oConnString, dbInfo.ServerIP, dbInfo.Port, dbInfo.Service); |
|
439 |
connString = "Data Source=" + connString + ";User Id=" + dbInfo.DBUser + ";Password=" + dbInfo.DBPassword; |
|
440 |
|
|
441 |
using (OracleConnection conn = new OracleConnection(connString)) |
|
442 |
{ |
|
443 |
conn.Open(); |
|
444 |
if (conn.State == System.Data.ConnectionState.Open) |
|
445 |
{ |
|
446 |
using (OracleCommand cmd = new OracleCommand()) |
|
447 |
{ |
|
448 |
cmd.Connection = conn; |
|
449 |
cmd.CommandText = string.Format(CultureInfo.CurrentCulture, "SELECT CODELIST_INDEX FROM {0}.CODELISTS WHERE CODELIST_NUMBER = 19 AND CODELIST_TEXT = '{1}'", dbInfo.PlantPIDDic, value); |
|
450 |
|
|
451 |
using (OracleDataReader reader = cmd.ExecuteReader()) |
|
452 |
{ |
|
453 |
while (reader.Read()) |
|
454 |
{ |
|
455 |
code = reader["CODELIST_INDEX"].ToString(); |
|
456 |
bResult = true; |
|
457 |
break; |
|
458 |
} |
|
459 |
} |
|
460 |
} |
|
461 |
} |
|
462 |
} |
|
463 |
} |
|
464 |
else |
|
465 |
{ |
|
466 |
|
|
467 |
} |
|
468 |
} |
|
469 |
catch (Exception ex) |
|
470 |
{ |
|
471 |
|
|
472 |
} |
|
473 |
|
|
474 |
return bResult; |
|
475 |
} |
|
427 | 476 |
} |
428 | 477 |
} |
DTI_PID/SPPIDConverter_AutoModeling/MainControl2.cs | ||
---|---|---|
292 | 292 |
} |
293 | 293 |
|
294 | 294 |
needSymbolMapping = needSymbolMapping.Distinct().ToList(); |
295 |
needSymbolMapping.Add(SPPID.Model.Text.pipingCompSize); |
|
296 |
needSymbolMapping.Add(SPPID.Model.Text.instrumentSize); |
|
295 | 297 |
foreach (string item in needSymbolMapping) |
296 | 298 |
{ |
297 | 299 |
if (!symbolMapping.ContainsKey(item)) |
... | ... | |
403 | 405 |
dynamic newDrawing = application.Drawings.Add(sUnit, sTemplate, sDrawingNumber, sDrawingName); |
404 | 406 |
application.ActiveWindow.Fit(); |
405 | 407 |
Thread.Sleep(100); |
406 |
application.ActiveWindow.Zoom = 2000;
|
|
408 |
application.ActiveWindow.Zoom = 60;
|
|
407 | 409 |
Thread.Sleep(100); |
408 | 410 |
// |
409 |
|
|
411 |
|
|
410 | 412 |
Document document = dicDocument[gridViewConverter.GetRowCellDisplayText(rowHandle, "colUID")]; |
411 | 413 |
autoModelingThread = new Thread(Func => |
412 | 414 |
{ |
... | ... | |
428 | 430 |
gridViewConverter.SetRowCellValue(rowHandle, "colStatus", _EndProcess); |
429 | 431 |
RefreshGridViewDrawingList(); |
430 | 432 |
application.ActiveWindow.Fit(); |
431 |
Thread.Sleep(100); |
|
432 |
newDrawing.CloseDrawing(true); |
|
433 |
Thread.Sleep(100); |
|
433 |
//Thread.Sleep(100);
|
|
434 |
//newDrawing.CloseDrawing(true);
|
|
435 |
//Thread.Sleep(100);
|
|
434 | 436 |
} |
435 | 437 |
} |
436 | 438 |
catch (Exception ex) |
... | ... | |
709 | 711 |
attributeMapping.Add("SmallSize", radioGroupReducer.Properties.Items[0].Tag.ToString()); |
710 | 712 |
} |
711 | 713 |
|
712 |
symbolMapping.Add("FittingSymbolPath", textBoxFittingSymbolPath.EditValue.ToString()); |
|
714 |
if (textBoxFittingSymbolPath.EditValue != null) |
|
715 |
symbolMapping.Add("FittingSymbolPath", textBoxFittingSymbolPath.EditValue.ToString()); |
|
716 |
|
|
713 | 717 |
|
714 | 718 |
SPPIDUtill.SaveMapping(symbolMapping, attributeMapping); |
715 | 719 |
|
DTI_PID/SPPIDConverter_AutoModeling/Model/SPPID/Document.cs | ||
---|---|---|
245 | 245 |
ANGLE = Convert.ToDouble(item.Element("ANGLE").Value), |
246 | 246 |
AREA = item.Element("AREA").Value, |
247 | 247 |
}; |
248 |
|
|
248 | 249 |
text.AfterSetting(this); |
249 | 250 |
} |
250 | 251 |
catch (Exception ex) |
DTI_PID/SPPIDConverter_AutoModeling/Model/SPPID/LineNumber.cs | ||
---|---|---|
117 | 117 |
{ |
118 | 118 |
if (string.IsNullOrEmpty(attr.VALUE)) |
119 | 119 |
continue; |
120 |
|
|
121 |
LMAAttribute lMAAttribute = _pipeRun.Attributes[attr.Attribute]; |
|
122 |
if (lMAAttribute != null) |
|
120 |
if (document.AttributeMapping.ContainsKey(attr.Attribute)) |
|
123 | 121 |
{ |
124 |
if (DBNull.Value.Equals(lMAAttribute.get_Value())) |
|
125 |
lMAAttribute.set_Value(attr.VALUE); |
|
126 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
|
127 |
lMAAttribute.set_Value(attr.VALUE); |
|
122 |
string attrName = document.AttributeMapping[attr.Attribute]; |
|
123 |
|
|
124 |
LMAAttribute lMAAttribute = _pipeRun.Attributes[attrName]; |
|
125 |
if (lMAAttribute != null) |
|
126 |
{ |
|
127 |
if (DBNull.Value.Equals(lMAAttribute.get_Value())) |
|
128 |
lMAAttribute.set_Value(attr.VALUE); |
|
129 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
|
130 |
lMAAttribute.set_Value(attr.VALUE); |
|
131 |
} |
|
128 | 132 |
} |
129 | 133 |
} |
130 | 134 |
_pipeRun.Commit(); |
DTI_PID/SPPIDConverter_AutoModeling/Model/SPPID/Symbol.cs | ||
---|---|---|
57 | 57 |
|
58 | 58 |
// Angle Setting |
59 | 59 |
if (ANGLE == 1.57) |
60 |
ANGLE = 270 * Math.PI / 180; |
|
61 |
//ANGLE = 90 * Math.PI / 180;
|
|
60 |
//ANGLE = 270 * Math.PI / 180;
|
|
61 |
ANGLE = 90 * Math.PI / 180; |
|
62 | 62 |
else if (ANGLE == 3.14) |
63 | 63 |
ANGLE = Math.PI; |
64 | 64 |
else if (ANGLE == 4.71) |
65 |
ANGLE = 90 * Math.PI / 180; |
|
66 |
//ANGLE = 270 * Math.PI / 180;
|
|
65 |
//ANGLE = 90 * Math.PI / 180;
|
|
66 |
ANGLE = 270 * Math.PI / 180; |
|
67 | 67 |
else |
68 | 68 |
ANGLE = 0; |
69 | 69 |
// End |
... | ... | |
157 | 157 |
string sMappingName = symoblChild.SPPIDMAPPINGNAME; |
158 | 158 |
|
159 | 159 |
double dChildAngle = 0; |
160 |
if (sArrow == "UP") |
|
161 |
dChildAngle = 0; |
|
162 |
else if (sArrow == "RIGHT") |
|
163 |
dChildAngle = 270 * Math.PI / 180; |
|
164 |
//dChildAngle = 90 * Math.PI / 180; |
|
165 |
else if (sArrow == "DOWN") |
|
166 |
dChildAngle = Math.PI; |
|
167 |
else |
|
168 |
dChildAngle = 90 * Math.PI / 180; |
|
169 |
//dChildAngle = 270 * Math.PI / 180; |
|
160 |
//if (sArrow == "UP")
|
|
161 |
// dChildAngle = 0;
|
|
162 |
//else if (sArrow == "RIGHT")
|
|
163 |
// dChildAngle = 270 * Math.PI / 180;
|
|
164 |
// //dChildAngle = 90 * Math.PI / 180;
|
|
165 |
//else if (sArrow == "DOWN")
|
|
166 |
// dChildAngle = Math.PI;
|
|
167 |
//else
|
|
168 |
// dChildAngle = 90 * Math.PI / 180;
|
|
169 |
// //dChildAngle = 270 * Math.PI / 180;
|
|
170 | 170 |
|
171 | 171 |
LMSymbol _childLmSymbol = _placement.PIDPlaceSymbol(sMappingName, LOCATION_X, LOCATION_Y, Mirror: 0, Rotation: dChildAngle, TargetItem: SPPID_ITEM_OBJECT); |
172 | 172 |
_childLmSymbol.Commit(); |
... | ... | |
216 | 216 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
217 | 217 |
_LmPipingComp.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
218 | 218 |
} |
219 |
_LmPipingComp.Commit(); |
|
219 | 220 |
} |
220 |
_LmPipingComp.Commit(); |
|
221 | 221 |
} |
222 | 222 |
} |
223 | 223 |
else if (fileName.Contains("Instrumentation")) |
... | ... | |
238 | 238 |
else if (lMAAttribute.get_Value() != attr.VALUE) |
239 | 239 |
_LmInstrument.Attributes[attr.SPPIDMAPPINGNAME].set_Value(attr.VALUE); |
240 | 240 |
} |
241 |
_LmInstrument.Commit(); |
|
241 | 242 |
} |
242 |
_LmInstrument.Commit(); |
|
243 | 243 |
} |
244 | 244 |
} |
245 | 245 |
|
DTI_PID/SPPIDConverter_AutoModeling/Model/SPPID/Text.cs | ||
---|---|---|
114 | 114 |
SPPIDMAPPINGNAME = SPPIDUtill.GetSPPIDSymbolMappingName(Text.instrumentSize, document.SymbolMapping);// @"\Instrumentation\Labels - General Instrument\Nominal Diameter.sym"; |
115 | 115 |
|
116 | 116 |
if (fileName.Contains("Fitting")) |
117 |
{ |
|
118 |
|
|
119 |
} |
|
117 |
SPPIDMAPPINGNAME = SPPIDUtill.GetSPPIDSymbolMappingName("FittingSymbolPath", document.SymbolMapping); |
|
120 | 118 |
|
121 | 119 |
LMLabelPersist _LmLabelPersist = _placement.PIDPlaceLabel(SPPIDMAPPINGNAME, ref array, Rotation: ANGLE, LabeledItem: _LmSymbol.AsLMRepresentation(), IsLeaderVisible: true); |
122 | 120 |
if (_LmLabelPersist != null) |
... | ... | |
154 | 152 |
if (_LmSymbol != null) |
155 | 153 |
{ |
156 | 154 |
string fileName = _LmSymbol.get_FileName(); |
157 |
if (fileName.Contains("Piping")) |
|
155 |
if (fileName.Contains("Fitting")) |
|
156 |
{ |
|
157 |
LMPipingComp _LmPipingComp = _placement.PIDDataSource.GetPipingComp(_LmSymbol.ModelItemID); |
|
158 |
if (_LmPipingComp != null) |
|
159 |
{ |
|
160 |
LMAAttribute attribute = _LmPipingComp.Attributes[document.AttributeMapping["LargeSize"]]; |
|
161 |
if (attribute != null && DBNull.Value.Equals(attribute.get_Value())) |
|
162 |
{ |
|
163 |
attribute.set_Value(_symbol.ATTRIBUTES.Find(x => x.DisplayAttribute == "Main Size").VALUE); |
|
164 |
_LmPipingComp.Commit(); |
|
165 |
} |
|
166 |
|
|
167 |
attribute = _LmPipingComp.Attributes[document.AttributeMapping["SmallSize"]]; |
|
168 |
if (attribute != null && DBNull.Value.Equals(attribute.get_Value())) |
|
169 |
{ |
|
170 |
attribute.set_Value(_symbol.ATTRIBUTES.Find(x => x.DisplayAttribute == "Sub Size").VALUE); |
|
171 |
_LmPipingComp.Commit(); |
|
172 |
} |
|
173 |
} |
|
174 |
} |
|
175 |
else if (fileName.Contains("Piping")) |
|
158 | 176 |
{ |
159 | 177 |
LMPipingComp _LmPipingComp = _placement.PIDDataSource.GetPipingComp(_LmSymbol.ModelItemID); |
160 | 178 |
if (_LmPipingComp!=null) |
... | ... | |
166 | 184 |
_LmPipingComp.Commit(); |
167 | 185 |
} |
168 | 186 |
} |
169 |
|
|
170 | 187 |
} |
171 | 188 |
else if (fileName.Contains("Instrumentation")) |
172 | 189 |
{ |
DTI_PID/SPPIDConverter_AutoModeling/SPPIDConverter_AutoModeling.csproj | ||
---|---|---|
47 | 47 |
<SpecificVersion>False</SpecificVersion> |
48 | 48 |
<HintPath>..\..\..\S-MAP\GemBox.Spreadsheet.dll</HintPath> |
49 | 49 |
</Reference> |
50 |
<Reference Include="Interop.RAD2D"> |
|
51 |
<HintPath>C:\Program Files (x86)\SmartPlant\P&ID Workstation\bin\Interop.RAD2D.dll</HintPath> |
|
52 |
<EmbedInteropTypes>True</EmbedInteropTypes> |
|
53 |
</Reference> |
|
50 | 54 |
<Reference Include="Microsoft.VisualBasic" /> |
51 | 55 |
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"> |
52 | 56 |
<HintPath>..\..\..\TestSolution\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath> |
... | ... | |
54 | 58 |
<Reference Include="Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL"> |
55 | 59 |
<HintPath>..\..\..\TestSolution\packages\Oracle.ManagedDataAccess.18.3.0\lib\net40\Oracle.ManagedDataAccess.dll</HintPath> |
56 | 60 |
</Reference> |
61 |
<Reference Include="RadNetAutomation"> |
|
62 |
<HintPath>C:\Program Files (x86)\SmartPlant\P&ID Workstation\bin\RadNetAutomation.dll</HintPath> |
|
63 |
</Reference> |
|
57 | 64 |
<Reference Include="System" /> |
58 | 65 |
<Reference Include="System.Core" /> |
59 | 66 |
<Reference Include="System.Drawing" /> |
DTI_PID/SPPIDConverter_AutoModeling/Utill/SPPIDUtill.cs | ||
---|---|---|
14 | 14 |
{ |
15 | 15 |
public static class SPPIDUtill |
16 | 16 |
{ |
17 |
private static readonly double _DWG_X = 0.875; |
|
18 |
private static readonly double _DWG_Y = 0.617; |
|
17 |
private static readonly double _DWG_X = 0.8175;//0.875;
|
|
18 |
private static readonly double _DWG_Y = 0.5853;//0.617;
|
|
19 | 19 |
public static string defaultPath = ""; |
20 | 20 |
public static string mappingFilePath = ""; |
21 | 21 |
public static string dbFilePath = ""; |
... | ... | |
116 | 116 |
} |
117 | 117 |
} |
118 | 118 |
|
119 |
if (true) |
|
120 |
{ |
|
121 |
|
|
122 |
} |
|
123 |
|
|
119 | 124 |
if (symbolMapping.ContainsKey(name)) |
120 | 125 |
return symbolMapping[name]; |
121 | 126 |
else |
내보내기 Unified diff