프로젝트

일반

사용자정보

개정판 1ed39474

ID1ed39474258430dd776780537f1843aeb2128e0a
상위 7dcb95df
하위 892bd8a2

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

dev issue #000 : Modeling bug fix / ZeroLength로 인한 ModelItem ID 꼬임현상 수정

Change-Id: I43efe6bdc339c07480653909266980c9db972930

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling_OPC.cs
30 30
        Placement _placement;
31 31
        LMADataSource dataSource;
32 32
        dynamic application;
33
        string SPPID_DrawingName;
34 33
        Ingr.RAD2D.Application radApp;
35
        SPPID_Document document;
34
        List<SPPID_Document> allDocuments;
36 35

  
37
        public AutoModeling_OPC(SPPID_Document document, dynamic application, Ingr.RAD2D.Application radApp, string SPPID_DrawingName)
36
        public AutoModeling_OPC(List<SPPID_Document> allDocuments, dynamic application, Ingr.RAD2D.Application radApp)
38 37
        {
39
            this.document = document;
40 38
            this.application = application;
41 39
            this.radApp = radApp;
42
            this.SPPID_DrawingName = SPPID_DrawingName;
40
            this.allDocuments = allDocuments;
43 41
        }
44 42

  
45 43
        public void Run()
46 44
        {
47
            Placement _placement = new Placement();
48
            LMADataSource dataSource = _placement.PIDDataSource;
49

  
50

  
45
            _placement = new Placement();
46
            dataSource = _placement.PIDDataSource;
51 47

  
48
            foreach (var document in allDocuments)
49
            {
50
                foreach (var opc in document.SYMBOLS)
51
                {
52
                    if ((opc.TYPE == "Piping OPC's" ||
53
                        opc.TYPE == "Instrument OPC's") &&
54
                        !string.IsNullOrEmpty(opc.SPPID.ModelItemID))
55
                    {
56
                        PairedOPCModeling(opc);
57
                    }
58
                }
59
            }
52 60

  
61
            ReleaseCOMObjects(_placement);
62
            ReleaseCOMObjects(dataSource);
63
        }
53 64

  
65
        public void PairedOPCModeling(Symbol opc)
66
        {
67
            bool result = false;
68
            LMOPC _LMOPC = dataSource.GetOPC(opc.SPPID.ModelItemID);
69
            LMOPC pairOPC = _LMOPC.pairedWithOPCObject;
54 70

  
71
            foreach (LMRepresentation rep in pairOPC.Representations)
72
                if (rep.DrawingID != "0")
73
                    result = true;
55 74

  
75
            if (!result)
76
            {
77
                // OPC Pair 찾아서 도면 오픈후 Pair 모델링
78
                OpenDrawing("");
79
            }
56 80

  
81
            
82
            
57 83

  
58
            ReleaseCOMObjects(_placement);
59
            ReleaseCOMObjects(dataSource);
84
            ReleaseCOMObjects(_LMOPC);
85
            ReleaseCOMObjects(pairOPC);
60 86
        }
61 87

  
62 88
        public void ReleaseCOMObjects(params object[] objVars)
......
68 94
                    intNewRefCount = intNewRefCount + System.Runtime.InteropServices.Marshal.FinalReleaseComObject(obj);
69 95
            }
70 96
        }
97

  
98
        private void OpenDrawing(string drawingName)
99
        {
100
            dynamic doc = application.Drawings.OpenDrawing(drawingName);
101
            doc.Activate();
102

  
103
        }
71 104
    }
72 105
}

내보내기 Unified diff

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