프로젝트

일반

사용자정보

개정판 ea80efaa

IDea80efaa4ce8de758bdd1948619da42be71c2f29
상위 f4880c6a
하위 310aeb31

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #000 : Association Text Item 모델링 안하고 특정 Item으로 Modeling

Change-Id: Ia9a61a4d319c60a53f04abc9e33e11c791f65ea6

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
1047 1047
                if (!string.IsNullOrEmpty(symbol.SPPID.RepresentationId))
1048 1048
                {
1049 1049
                    LMSymbol _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
1050
                    LMAAttributes _Attributes = null;
1051
                    LMPipingComp _LMPipingComp = null;
1052
                    LMInstrument _LMInstrument = null;
1053
                    LMOPC _LMOPC = null;
1054
                    LMNozzle _LMNozzle = null;
1055

  
1056
                    if (_LMSymbol.get_FileName().Contains("Instrumentation"))
1057
                    {
1058
                        _LMInstrument = dataSource.GetInstrument(_LMSymbol.ModelItemID);
1059
                        _Attributes = _LMInstrument.Attributes;
1060
                    }
1061
                    else if (_LMSymbol.get_FileName().Contains("OPC"))
1062
                    { 
1063
                        _LMOPC = dataSource.GetOPC(_LMSymbol.ModelItemID);
1064
                        _Attributes = _LMOPC.Attributes;
1065
                    }
1066
                    else if (_LMSymbol.get_FileName().Contains("Nozzle"))
1067
                    {
1068
                        _LMNozzle = dataSource.GetNozzle(_LMSymbol.ModelItemID);
1069
                        _Attributes = _LMNozzle.Attributes;
1070
                    }
1071
                    else
1072
                    {
1073
                        _LMPipingComp = dataSource.GetPipingComp(_LMSymbol.ModelItemID);
1074
                        _Attributes = _LMPipingComp.Attributes;
1075
                    }
1050
                    dynamic _LMModelItem = ((dynamic)_LMSymbol).ModelItemObject;
1051
                    LMAAttributes _Attributes = _LMModelItem.Attributes;
1076 1052

  
1077 1053
                    foreach (var item in symbol.PROPERTIES)
1078 1054
                    {
......
1097 1073
                    }
1098 1074

  
1099 1075
                    ReleaseCOMObjects(_LMSymbol);
1100
                    if (_LMPipingComp != null)
1101
                    {
1102
                        _LMPipingComp.Commit();
1103
                        ReleaseCOMObjects(_LMPipingComp);
1104
                    }
1105
                    if (_LMInstrument != null)
1106
                    {
1107
                        _LMInstrument.Commit();
1108
                        ReleaseCOMObjects(_LMInstrument);
1109
                    }
1110
                    if (_LMOPC != null)
1111
                    {
1112
                        _LMOPC.Commit();
1113
                        ReleaseCOMObjects(_LMOPC);
1114
                    }
1115
                    if (_LMNozzle != null)
1116
                    {
1117
                        _LMNozzle.Commit();
1118
                        ReleaseCOMObjects(_LMNozzle);
1119
                    }
1120

  
1121

  
1076
                    ReleaseCOMObjects(_Attributes);
1077
                    ReleaseCOMObjects(_LMModelItem);
1122 1078
                }
1123 1079
            }
1124 1080
            catch (Exception ex)
......
1130 1086
        private void TextModeling(Text text)
1131 1087
        {
1132 1088
            LMSymbol _LMSymbol = null;
1133
            LMItemNote _LMItemNote = null;
1134
            LMAAttribute _LMAAttribute = null;
1135

  
1136 1089
            try
1137 1090
            {
1138
                _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y);
1139
                _LMSymbol.Commit();
1140
                _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1141
                _LMItemNote.Commit();
1142
                _LMAAttribute = _LMItemNote.Attributes["Note.Body"];
1143
                _LMAAttribute.set_Value(text.VALUE);
1144
                _LMItemNote.Commit();
1091
                if (text.ASSOCIATION && !string.IsNullOrEmpty(text.OWNER) && text.OWNER != "None")
1092
                {
1093
                    object owner = SPPIDUtil.FindObjectByUID(document, text.OWNER);
1094
                    if (owner.GetType() == typeof(Symbol))
1095
                    {
1096
                        Symbol symbol = owner as Symbol;
1097
                        _LMSymbol = dataSource.GetSymbol(symbol.SPPID.RepresentationId);
1098
                        if (_LMSymbol != null)
1099
                        {
1100
                            Association association = symbol.ASSOCIATIONS.Find(x => x.VALUE == text.UID);
1101
                            List<BaseModel.Attribute> attributes = symbol.ATTRIBUTES.FindAll(x => x.ATTRIBUTETYPE == association.TYPE);
1102
                            AttributeMapping mapping = null;
1103
                            foreach (var attribute in attributes)
1104
                            {
1105
                                 mapping = document.AttributeMappings.Find(x => x.UID == attribute.UID && !string.IsNullOrEmpty(x.SPPIDSYMBOLNAME));
1106
                                if (mapping != null)
1107
                                    break;  
1108
                            }
1109

  
1110
                            if (mapping != null)
1111
                            {
1112
                                Array array = new double[] { 0, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y };
1113
                                LMLabelPersist _LMLabelPersist = _placement.PIDPlaceLabel(mapping.SPPIDSYMBOLNAME, ref array, Rotation: text.ANGLE, LabeledItem: _LMSymbol.AsLMRepresentation(), IsLeaderVisible: true);
1114
                                if (_LMLabelPersist!=null)
1115
                                {
1116
                                    _LMLabelPersist.Commit();
1117
                                    ReleaseCOMObjects(_LMLabelPersist);
1118
                                }
1119
                            }
1120
                        }
1121
                    }
1122
                    else if (owner.GetType() == typeof(Line))
1123
                    {
1124

  
1125
                    }
1126
                }
1127
                else
1128
                {
1129
                    LMItemNote _LMItemNote = null;
1130
                    LMAAttribute _LMAAttribute = null;
1131

  
1132
                    _LMSymbol = _placement.PIDPlaceSymbol(text.SPPID.MAPPINGNAME, text.SPPID.ORIGINAL_X, text.SPPID.ORIGINAL_Y);
1133
                    _LMSymbol.Commit();
1134
                    _LMItemNote = _placement.PIDDataSource.GetItemNote(_LMSymbol.ModelItemID);
1135
                    _LMItemNote.Commit();
1136
                    _LMAAttribute = _LMItemNote.Attributes["Note.Body"];
1137
                    _LMAAttribute.set_Value(text.VALUE);
1138
                    _LMItemNote.Commit();
1139

  
1140
                    if (_LMAAttribute != null)
1141
                        ReleaseCOMObjects(_LMAAttribute);
1142
                    if (_LMItemNote != null)
1143
                        ReleaseCOMObjects(_LMItemNote);
1144
                }
1145 1145
            }
1146 1146
            catch (Exception ex)
1147 1147
            {
......
1149 1149
            }
1150 1150
            finally
1151 1151
            {
1152
                if (_LMAAttribute != null)
1153
                    ReleaseCOMObjects(_LMAAttribute);
1154
                if (_LMItemNote != null)
1155
                    ReleaseCOMObjects(_LMItemNote);
1156 1152
                if (_LMSymbol != null)
1157 1153
                    ReleaseCOMObjects(_LMSymbol);
1158 1154
            }

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)