프로젝트

일반

사용자정보

개정판 65a1ed4b

ID65a1ed4b54811d0d76870d439767f9999bea5e33
상위 ad8328eb
하위 845dc1dd

gaqhf 이(가) 약 6년 전에 추가함

dev issue #000 : 라인 Join으로 인한 Attribute Bug 수정 / Input Line Number Attribute

Change-Id: I8a749c89b2bb048554680e7804c72d83c9da759e

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling.cs
47 47
            //Thread.Sleep(100);
48 48
            //application.ActiveWindow.Zoom = 60;
49 49
            //Thread.Sleep(100);
50

  
51

  
50 52
            try
51 53
            {
52 54
                // Equipment Modeling
53 55
                foreach (Equipment equipment in document.Equipments)
54 56
                    SymbolModeling(equipment as Symbol, null, null);
57
                
55 58
                // LineRun Symbol Modeling
56 59
                foreach (LineNumber lineNumber in document.LINENUMBERS)
57 60
                    foreach (LineRun run in lineNumber.RUNS)
58 61
                        SymbolModelingByRun(run);
62
                
59 63
                // TrimLineRun Symbol Modeling
60 64
                foreach (TrimLine trimLine in document.TRIMLINES)
61 65
                    foreach (LineRun run in trimLine.RUNS)
62 66
                        SymbolModelingByRun(run);
67
                
63 68
                // LineRun Line Modeling
64 69
                foreach (LineNumber lineNumber in document.LINENUMBERS)
65 70
                    foreach (LineRun run in lineNumber.RUNS)
66 71
                        LineModelingByRun(run);
72
                
67 73
                // TrimLineRun Line Modeling
68 74
                foreach (TrimLine trimLine in document.TRIMLINES)
69 75
                    foreach (LineRun run in trimLine.RUNS)
70 76
                        LineModelingByRun(run);
77
                
71 78
                // Branch Line Modeling
72 79
                foreach (var item in BranchLines)
73 80
                    BranchLineModeling(item);
81
                
74 82
                // EndBreak Modeling
75 83
                foreach (var item in document.EndBreaks)
76 84
                    EndBreakModeling(item);
85
                
77 86
                // LineNumber Modeling
78 87
                foreach (var item in document.LINENUMBERS)
79 88
                    LineNumberModeling(item);
80
                // Input Symbol Attribute
81
                foreach (var item in document.SYMBOLS)
82
                    InputSymbolAttribute(item);
83
                // Input Line Attribute
84

  
85
                // Input LineNumber Attribute
86

  
87
                // Note Modeling
88
                foreach (var item in document.NOTES)
89
                    NoteModeling(item);
90
                // Text Modeling
91
                foreach (var item in document.TEXTINFOS)
92
                    TextModeling(item);
89
                
93 90
                // LineRun Line Join
94 91
                foreach (LineNumber lineNumber in document.LINENUMBERS)
95
                {
96

  
97 92
                    foreach (LineRun run in lineNumber.RUNS)
98
                    {
99 93
                        JoinRunLine(run);
100
                    }
101
                }
94
                
102 95
                // TrimLineRun Line Join
103 96
                foreach (TrimLine trimLine in document.TRIMLINES)
104
                {
105 97
                    foreach (LineRun run in trimLine.RUNS)
106
                    {
107 98
                        JoinRunLine(run);
108
                    }
109
                }
99

  
100
                // Note Modeling
101
                foreach (var item in document.NOTES)
102
                    NoteModeling(item);
103
                
104
                // Text Modeling
105
                foreach (var item in document.TEXTINFOS)
106
                    TextModeling(item);
107

  
108
                // Input LineNumber Attribute
109
                foreach (var item in document.LINENUMBERS)
110
                    InputLineNumberAttribute(item);
111

  
112
                // Input Symbol Attribute
113
                foreach (var item in document.SYMBOLS)
114
                    InputSymbolAttribute(item);
110 115
            }
111 116
            catch (Exception ex)
112

  
113 117
            {
114 118
                System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
115 119
            }
......
118 122
                ReleaseCOMObjects(dataSource);
119 123
                ReleaseCOMObjects(_placement);
120 124
            }
121
           
122
            System.Windows.Forms.MessageBox.Show("end");
125

  
126
            //System.Windows.Forms.MessageBox.Show("end");
127
        }
128

  
129
        public void Test()
130
        {
131
            _placement = new Placement();
132
            dataSource = _placement.PIDDataSource;
133

  
134
            DependencyObject drawingObject = radApp.ActiveDocument.SelectSet[0] as DependencyObject;
135
            if (drawingObject != null)
136
            {
137
                string modelitemID = drawingObject.AttributeSets[0][5].GetValue().ToString();
138
                radApp.ActiveDocument.SelectSet.RemoveAll();
139
                LMPipeRun run = dataSource.GetPipeRun(modelitemID);
140
                _LMAItem item = run.AsLMAItem();
141
                string modelitemID2 = item.Id;
142
                _placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item);
143
                string afterModelItemID = item.Id;
144
                if (modelitemID2 != afterModelItemID)
145
                {
146

  
147
                }
148
            }
123 149
        }
124 150

  
125 151
        private void LineModelingByRun(LineRun run)
......
622 648
                    {
623 649
                        if (_SameRunTargetConnector != null)
624 650
                            placeRunInputs.AddConnectorTarget(_SameRunTargetConnector, point[0], point[1]);
625
                        else if (_SameRunTargetConnector != null)
651
                        else if (_SameRunTargetSymbol != null)
626 652
                            placeRunInputs.AddSymbolTarget(_SameRunTargetSymbol, point[0], point[1]);
627 653
                        else
628 654
                            placeRunInputs.AddPoint(point[0], point[1]);
......
773 799
                _LMAItem item2 = run2.AsLMAItem();
774 800

  
775 801
                _placement.PIDJoinRuns(ref item1, ref item2);
776
                List<Line> lines = SPPIDUtil.FindLinesByModelId(document, fromModelItemId);
777
                foreach (var line in lines)
778
                    line.SPPID.ModelItemId = toModelItemId;
779

  
802
                item1.Commit();
803
                item2.Commit();
780 804
            }
781 805
            catch (Exception ex)
782 806
            {
......
792 816
        private void AutoJoinPipeRun(string modelItemId)
793 817
        {
794 818
            LMPipeRun run = dataSource.GetPipeRun(modelItemId);
795
            _LMAItem item = run.AsLMAItem();
796
            _placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item);
819
            try
820
            {
821
                _LMAItem item = run.AsLMAItem();
822
                string modelitemID = item.Id;
823
                _placement.PIDAutoJoin(item, AutoJoinEndConstants.autoJoin_Both, ref item);
824
                string afterModelItemID = item.Id;
825
                if (modelitemID != afterModelItemID)
826
                {
827
                    List<Line> lines = SPPIDUtil.FindLinesByModelId(document, modelitemID);
828
                    foreach (var line in lines)
829
                        line.SPPID.ModelItemId = afterModelItemID;
830
                }
831
                item.Commit();
832
            }
833
            catch (Exception ex)
834
            {
835
                System.Windows.Forms.MessageBox.Show(ex.Message + "\r\n" + ex.StackTrace);
836
            }
837
            finally
838
            {
839
                ReleaseCOMObjects(run);
840
            }
797 841
        }
798 842

  
799 843
        private void JoinRunLine(LineRun run)
......
809 853
                        AutoJoinPipeRun(line.SPPID.ModelItemId);
810 854
                        modelItemId = line.SPPID.ModelItemId;
811 855
                    }
812
                    //if (string.IsNullOrEmpty(modelItemId))
813
                    //{
814
                    //    modelItemId = line.SPPID.ModelItemId;
815
                    //}
816
                    //else if(modelItemId != line.SPPID.ModelItemId)
817
                    //{
818
                    //    JoinPipeRun(line.SPPID.ModelItemId, modelItemId);
819
                    //}
820 856
                }
821 857
            }
822 858
        }
......
984 1020
                foreach (var item in symbol.ATTRIBUTES)
985 1021
                {
986 1022
                    AttributeMapping mapping = document.AttributeMappings.Find(x => x.UID == item.UID);
987
                    LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
988
                    if (_Attribute != null)
989
                        _Attribute.set_Value(item.VALUE);
1023
                    if (mapping != null)
1024
                    {
1025
                        LMAAttribute _Attribute = _Attributes[mapping.SPPIDATTRIBUTENAME];
1026
                        if (_Attribute != null)
1027
                            _Attribute.set_Value(item.VALUE);
1028
                    }
990 1029
                }
991 1030

  
992 1031
                foreach (var item in symbol.ASSOCIATIONS)
......
1010 1049
            }
1011 1050
        }
1012 1051

  
1052
        private void InputLineNumberAttribute(LineNumber lineNumber)
1053
        {
1054
            foreach (var run in lineNumber.RUNS)
1055
            {
1056
                foreach (var item in run.RUNITEMS)
1057
                {
1058
                    if (item.GetType() == typeof(Line))
1059
                    {
1060
                        Line line = item as Line;
1061
                        LMPipeRun _LMPipeRun = dataSource.GetPipeRun(line.SPPID.ModelItemId);
1062
                        foreach (var attribute in lineNumber.ATTRIBUTES)
1063
                        {
1064
                            LineNumberMapping mapping = document.LineNumberMappings.Find(x => x.UID == attribute.UID);
1065
                            if (mapping != null)
1066
                            {
1067
                                LMAAttribute _LMAAttribute = _LMPipeRun.Attributes[mapping.SPPIDATTRIBUTENAME];
1068
                                if (_LMAAttribute != null)
1069
                                {
1070
                                    if (DBNull.Value.Equals(_LMAAttribute.get_Value()))
1071
                                        _LMAAttribute.set_Value(attribute.VALUE);
1072
                                    else if (_LMAAttribute.get_Value() != attribute.VALUE)
1073
                                        _LMAAttribute.set_Value(attribute.VALUE);
1074
                                }
1075
                            }
1076
                        }
1077

  
1078
                        _LMPipeRun.Commit();
1079
                        ReleaseCOMObjects(_LMPipeRun);
1080
                        break;
1081
                    }
1082
                }
1083
            }
1084
        }
1085

  
1013 1086
        private void TextModeling(Text text)
1014 1087
        {
1015 1088
            LMSymbol _LMSymbol = null;

내보내기 Unified diff

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