개정판 ac78b508
dev issue #000 : End Break 수정, Slope각도 수정, ChildSymbol 수정
Change-Id: Iafa6186dda4110fd24fb4c03be92388a08b3cecd
DTI_PID/SPPIDConverter/AutoModeling.cs | ||
---|---|---|
308 | 308 |
{ |
309 | 309 |
_LMSymbol.Commit(); |
310 | 310 |
symbol.SPPID.RepresentationId = _LMSymbol.AsLMRepresentation().Id; |
311 |
|
|
312 |
//foreach (var item in symbol.ChildSymbols) |
|
313 |
// CreateChildSymbol(item, _LMSymbol, x, y); |
|
311 | 314 |
} |
312 | 315 |
|
313 | 316 |
ReleaseCOMObjects(_LMSymbol); |
314 | 317 |
} |
315 | 318 |
|
319 |
private void CreateChildSymbol(ChildSymbol childSymbol, LMSymbol parentSymbol, double x, double y) |
|
320 |
{ |
|
321 |
LMSymbol _LMSymbol = _placement.PIDPlaceSymbol(childSymbol.SPPID.MAPPINGNAME, x, y, TargetItem: parentSymbol); |
|
322 |
foreach (var item in childSymbol.ChildSymbols) |
|
323 |
CreateChildSymbol(item, _LMSymbol, x, y); |
|
324 |
|
|
325 |
ReleaseCOMObjects(_LMSymbol); |
|
326 |
} |
|
327 |
|
|
316 | 328 |
private bool IsSameLineNumber(object item, object targetItem) |
317 | 329 |
{ |
318 | 330 |
foreach (var lineNumber in document.LINENUMBERS) |
... | ... | |
709 | 721 |
private void EndBreakModeling(EndBreak endBreak) |
710 | 722 |
{ |
711 | 723 |
Line ownerLine = SPPIDUtil.FindObjectByUID(document, endBreak.OWNER) as Line; |
712 |
Line connLine = null; |
|
713 |
Property property = endBreak.PROPERTIES.Find(x => x.ATTRIBUTE == "Connected Item"); |
|
714 |
if (property != null) |
|
715 |
connLine = SPPIDUtil.FindObjectByUID(document, property.VALUE) as Line; |
|
716 |
|
|
717 |
if (ownerLine != null && connLine != null) |
|
724 |
|
|
725 |
if (ownerLine != null) |
|
718 | 726 |
{ |
719 | 727 |
LMLabelPersist _LmLabelPersist = null; |
728 |
Dictionary<LMConnector, List<double[]>> connectorVertices = GetPipeRunVertices(ownerLine.SPPID.ModelItemId); |
|
720 | 729 |
|
721 |
string lineModelId = ownerLine.SPPID.ModelItemId; |
|
722 |
LMPipeRun _LMPipeRun = _placement.PIDDataSource.GetPipeRun(lineModelId); |
|
723 |
LMPipeRun _ConnLMPipeRun = _placement.PIDDataSource.GetPipeRun(connLine.SPPID.ModelItemId); |
|
724 |
LMConnector connectedLMConnector = null; |
|
725 |
|
|
726 |
if (_LMPipeRun != null && _ConnLMPipeRun != null) |
|
730 |
LMConnector connectedLMConnector = FindTargetLMConnectorByPoint(connectorVertices, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y); |
|
731 |
if (connectedLMConnector != null) |
|
727 | 732 |
{ |
728 |
foreach (LMRepresentation rep in _LMPipeRun.Representations) |
|
729 |
{ |
|
730 |
if (rep.Attributes["RepresentationType"].get_Value() == "Connector" && rep.Attributes["ItemStatus"].get_Value() == "Active") |
|
731 |
{ |
|
732 |
LMConnector _LMConnector = _placement.PIDDataSource.GetConnector(rep.Id); |
|
733 |
if (_LMConnector.ConnectItem1SymbolID != null && !DBNull.Value.Equals(_LMConnector.ConnectItem1SymbolID) && ExistConnItem(_ConnLMPipeRun, _LMConnector.ConnectItem1SymbolID)) |
|
734 |
{ |
|
735 |
connectedLMConnector = _LMConnector; |
|
736 |
break; |
|
737 |
} |
|
738 |
else if (_LMConnector.ConnectItem2SymbolID != null && !DBNull.Value.Equals(_LMConnector.ConnectItem2SymbolID) && ExistConnItem(_ConnLMPipeRun, _LMConnector.ConnectItem2SymbolID)) |
|
739 |
{ |
|
740 |
connectedLMConnector = _LMConnector; |
|
741 |
break; |
|
742 |
} |
|
743 |
else |
|
744 |
{ |
|
745 |
ReleaseCOMObjects(_LMConnector); |
|
746 |
} |
|
747 |
} |
|
748 |
} |
|
749 |
if (connectedLMConnector != null) |
|
750 |
{ |
|
751 |
Array array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y }; |
|
752 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, Rotation: 0, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: true); |
|
753 |
ReleaseCOMObjects(connectedLMConnector); |
|
754 |
} |
|
733 |
Array array = new double[] { 0, endBreak.SPPID.ORIGINAL_X, endBreak.SPPID.ORIGINAL_Y }; |
|
734 |
_LmLabelPersist = _placement.PIDPlaceLabel(endBreak.SPPID.MAPPINGNAME, ref array, Rotation: 0, LabeledItem: connectedLMConnector.AsLMRepresentation(), IsLeaderVisible: true); |
|
735 |
ReleaseCOMObjects(connectedLMConnector); |
|
736 |
} |
|
755 | 737 |
|
756 |
ReleaseCOMObjects(_LMPipeRun);
|
|
757 |
ReleaseCOMObjects(_ConnLMPipeRun);
|
|
758 |
if (_LmLabelPersist != null)
|
|
759 |
ReleaseCOMObjects(_LmLabelPersist);
|
|
738 |
if (_LmLabelPersist != null)
|
|
739 |
{
|
|
740 |
_LmLabelPersist.Commit();
|
|
741 |
ReleaseCOMObjects(_LmLabelPersist); |
|
760 | 742 |
} |
743 |
foreach (var item in connectorVertices) |
|
744 |
ReleaseCOMObjects(item.Key); |
|
761 | 745 |
} |
762 | 746 |
} |
763 | 747 |
|
... | ... | |
944 | 928 |
return targetConnector; |
945 | 929 |
} |
946 | 930 |
|
931 |
private LMConnector FindTargetLMConnectorByPoint(Dictionary<LMConnector, List<double[]>> connectorVertices, double connX, double connY) |
|
932 |
{ |
|
933 |
double length = double.MaxValue; |
|
934 |
LMConnector targetConnector = null; |
|
935 |
foreach (var item in connectorVertices) |
|
936 |
{ |
|
937 |
List<double[]> points = item.Value; |
|
938 |
|
|
939 |
foreach (double[] point in points) |
|
940 |
{ |
|
941 |
double distance = SPPIDUtil.CalcPointToPointdDistance(point[0], point[1], connX, connY); |
|
942 |
if (length >= distance) |
|
943 |
{ |
|
944 |
targetConnector = item.Key; |
|
945 |
length = distance; |
|
946 |
} |
|
947 |
} |
|
948 |
} |
|
949 |
|
|
950 |
return targetConnector; |
|
951 |
} |
|
952 |
|
|
947 | 953 |
private void LineNumberModeling(LineNumber lineNumber) |
948 | 954 |
{ |
949 | 955 |
Line line = null; |
... | ... | |
1028 | 1034 |
|
1029 | 1035 |
private void InputSymbolAttribute(Symbol symbol) |
1030 | 1036 |
{ |
1031 |
if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
|
|
1037 |
try
|
|
1032 | 1038 |
{ |
1033 |
LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
|
1034 |
LMPipingComp _LMPipingComp = null; |
|
1035 |
LMInstrument _LMInstrument = null; |
|
1036 |
LMAAttributes _Attributes = null; |
|
1037 |
|
|
1038 |
if (_LMSymbol.get_FileName().Contains("Instrumentation")) |
|
1039 |
{ |
|
1040 |
_LMInstrument = dataSource.GetInstrument(_LMSymbol.ModelItemID); |
|
1041 |
_Attributes = _LMInstrument.Attributes; |
|
1042 |
} |
|
1043 |
else |
|
1039 |
if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId)) |
|
1044 | 1040 |
{ |
1045 |
_LMPipingComp = dataSource.GetPipingComp(_LMSymbol.ModelItemID); |
|
1046 |
_Attributes = _LMPipingComp.Attributes; |
|
1047 |
} |
|
1041 |
LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId); |
|
1042 |
LMAAttributes _Attributes = null; |
|
1043 |
LMPipingComp _LMPipingComp = null; |
|
1044 |
LMInstrument _LMInstrument = null; |
|
1045 |
LMOPC _LMOPC = null; |
|
1046 |
LMNozzle _LMNozzle = null; |
|
1047 |
|
|
1048 |
if (_LMSymbol.get_FileName().Contains("Instrumentation")) |
|
1049 |
{ |
|
1050 |
_LMInstrument = dataSource.GetInstrument(_LMSymbol.ModelItemID); |
|
1051 |
_Attributes = _LMInstrument.Attributes; |
|
1052 |
} |
|
1053 |
else if (_LMSymbol.get_FileName().Contains("OPC")) |
|
1054 |
{ |
|
1055 |
_LMOPC = dataSource.GetOPC(_LMSymbol.ModelItemID); |
|
1056 |
_Attributes = _LMOPC.Attributes; |
|
1057 |
} |
|
1058 |
else if (_LMSymbol.get_FileName().Contains("Nozzle")) |
|
1059 |
{ |
|
1060 |
_LMNozzle = dataSource.GetNozzle(_LMSymbol.ModelItemID); |
|
1061 |
_Attributes = _LMNozzle.Attributes; |
|
1062 |
} |
|
1063 |
else |
|
1064 |
{ |
|
1065 |
_LMPipingComp = dataSource.GetPipingComp(_LMSymbol.ModelItemID); |
|
1066 |
_Attributes = _LMPipingComp.Attributes; |
|
1067 |
} |
|
1048 | 1068 |
|
1049 |
foreach (var item in symbol.PROPERTIES) |
|
1050 |
{ |
|
1051 |
|
|
1069 |
foreach (var item in symbol.PROPERTIES) |
|
1070 |
{ |
|
1052 | 1071 |
|
1053 |
} |
|
1054 | 1072 |
|
1055 |
foreach (var item in symbol.ATTRIBUTES) |
|
1056 |
{ |
|
1057 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID); |
|
1058 |
if (mapping != null) |
|
1073 |
} |
|
1074 |
|
|
1075 |
foreach (var item in symbol.ATTRIBUTES) |
|
1059 | 1076 |
{ |
1060 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
1061 |
if (_Attribute != null) |
|
1062 |
_Attribute.set_Value(item.VALUE); |
|
1077 |
AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID); |
|
1078 |
if (mapping != null) |
|
1079 |
{ |
|
1080 |
LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME]; |
|
1081 |
if (_Attribute != null) |
|
1082 |
_Attribute.set_Value(item.VALUE.Replace(" ", "")); |
|
1083 |
} |
|
1063 | 1084 |
} |
1064 |
} |
|
1065 | 1085 |
|
1066 |
foreach (var item in symbol.ASSOCIATIONS) |
|
1067 |
{ |
|
1068 |
|
|
1069 |
} |
|
1086 |
foreach (var item in symbol.ASSOCIATIONS) |
|
1087 |
{ |
|
1088 |
|
|
1089 |
} |
|
1090 |
|
|
1091 |
ReleaseCOMObjects(_LMSymbol); |
|
1092 |
if (_LMPipingComp != null) |
|
1093 |
{ |
|
1094 |
_LMPipingComp.Commit(); |
|
1095 |
ReleaseCOMObjects(_LMPipingComp); |
|
1096 |
} |
|
1097 |
if (_LMInstrument != null) |
|
1098 |
{ |
|
1099 |
_LMInstrument.Commit(); |
|
1100 |
ReleaseCOMObjects(_LMInstrument); |
|
1101 |
} |
|
1102 |
if (_LMOPC != null) |
|
1103 |
{ |
|
1104 |
_LMOPC.Commit(); |
|
1105 |
ReleaseCOMObjects(_LMOPC); |
|
1106 |
} |
|
1107 |
if (_LMNozzle != null) |
|
1108 |
{ |
|
1109 |
_LMNozzle.Commit(); |
|
1110 |
ReleaseCOMObjects(_LMNozzle); |
|
1111 |
} |
|
1070 | 1112 |
|
1071 |
ReleaseCOMObjects(_LMSymbol); |
|
1072 |
if (_LMPipingComp != null) |
|
1073 |
{ |
|
1074 |
_LMPipingComp.Commit(); |
|
1075 |
ReleaseCOMObjects(_LMPipingComp); |
|
1076 |
} |
|
1077 |
if (_LMInstrument != null) |
|
1078 |
{ |
|
1079 |
_LMInstrument.Commit(); |
|
1080 |
ReleaseCOMObjects(_LMInstrument); |
|
1081 |
} |
|
1082 |
|
|
1083 | 1113 |
|
1114 |
} |
|
1115 |
} |
|
1116 |
catch (Exception ex) |
|
1117 |
{ |
|
1118 |
System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace); |
|
1084 | 1119 |
} |
1085 | 1120 |
} |
1086 | 1121 |
|
DTI_PID/SPPIDConverter/ConverterForm.cs | ||
---|---|---|
519 | 519 |
#if DEBUG |
520 | 520 |
this.Visible = false; |
521 | 521 |
|
522 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml"); |
|
522 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\11111.xml");
|
|
523 | 523 |
//SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\zIsocynates-325_Page75.xml"); |
524 |
SPPID_Document document = new SPPID_Document(@"Z:\HanKyouHo\temp\Isocynates\Temp\Isocynates-325_Page49.xml"); |
|
524 | 525 |
document.SymbolMappings = symbolMappings; |
525 | 526 |
document.LineMappings = lineMappings; |
526 | 527 |
document.LineNumberMappings = lineNumberMappings; |
DTI_PID/SPPIDConverter/Util/SPPIDUtil.cs | ||
---|---|---|
121 | 121 |
else |
122 | 122 |
{ |
123 | 123 |
double angle = Math.Atan(Math.Abs(y2 - y1) / Math.Abs(x2 - x1)) * 180 / Math.PI; |
124 |
if (angle < 5)
|
|
124 |
if (angle <= 1)
|
|
125 | 125 |
return SlopeType.HORIZONTAL; |
126 |
else if (angle > 85)
|
|
126 |
else if (angle >= 89)
|
|
127 | 127 |
return SlopeType.VERTICAL; |
128 | 128 |
else |
129 | 129 |
return SlopeType.Slope; |
내보내기 Unified diff