프로젝트

일반

사용자정보

개정판 88bac50c

ID88bac50caa610803bfff237ee30dcc020551f04d
상위 83c14a07
하위 cefb31c4, 48c005af

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

dev issue #498 : OPC 연결 임의로 완료

Change-Id: I77059d9cf7c135e74218646ff360445eeac87c85

차이점 보기:

DTI_PID/SPPIDConverter/AutoModeling_OPC.cs
32 32
        dynamic application;
33 33
        Ingr.RAD2D.Application radApp;
34 34
        List<SPPID_Document> allDocuments;
35
        DataTable drawingTable;
36 35

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

  
45 43
        public void Run()
......
80 78
                BaseModel.Attribute pathAttribute = opc.ATTRIBUTES.Find(x => x.ATTRIBUTE == "PATH");
81 79
                BaseModel.Attribute linkOPCAttribute = opc.ATTRIBUTES.Find(x => x.ATTRIBUTE == "LinkOPC");
82 80

  
83
                DataRow[] rows = drawingTable.Select(string.Format("PATH = '{0}'", pathAttribute.VALUE));
84
                if (rows.Length == 1 && OpenDrawing(rows[0]["DRAWINGNAME"].ToString()))
81
                SPPID_Document targetDocument = allDocuments.Find(x => x.PATH == pathAttribute.VALUE);
82
                if (targetDocument != null)
85 83
                {
86

  
84
                    Symbol targetOPC = SPPIDUtil.FindObjectByUID(targetDocument, linkOPCAttribute.VALUE) as Symbol;
85
                    if (targetOPC != null && OpenDrawing(targetDocument.SPPID_DrawingName))
86
                    {
87
                        LMSymbol targetLMOPC = dataSource.GetSymbol(targetOPC.SPPID.RepresentationId);
88
                        if (targetLMOPC != null)
89
                        {
90
                            int mirror = targetLMOPC.get_IsMirroredIndex();
91
                            double angle = Convert.ToDouble(targetLMOPC.get_RotationAngle());
92
                            double x = targetLMOPC.get_XCoordinate();
93
                            double y = targetLMOPC.get_YCoordinate();
94
                            LMSymbol newOPC = null;
95
                            foreach (LMConnector LMConnector in targetLMOPC.Avoid1Connectors)
96
                            {
97
                                _placement.PIDRemovePlacement(targetLMOPC.AsLMRepresentation());
98
                                ReleaseCOMObjects(targetLMOPC);
99
                                newOPC = _placement.PIDPlaceSymbol(targetOPC.SPPID.MAPPINGNAME, x, y, Mirror: mirror, Rotation: angle, ExistingItem: pairOPC.AsLMAItem(), TargetItem: LMConnector);
100
                                break;
101
                            }
102

  
103
                            if (newOPC == null)
104
                            {
105
                                foreach (LMConnector LMConnector in targetLMOPC.Avoid2Connectors)
106
                                {
107
                                    _placement.PIDRemovePlacement(targetLMOPC.AsLMRepresentation());
108
                                    ReleaseCOMObjects(targetLMOPC);
109
                                    newOPC = _placement.PIDPlaceSymbol(targetOPC.SPPID.MAPPINGNAME, x, y, Mirror: mirror, Rotation: angle, ExistingItem: pairOPC.AsLMAItem(), TargetItem: LMConnector);
110
                                    break;
111
                                }
112
                            }
113
                        }
114
                    }
87 115
                }
88 116
            }
89 117

  
......
106 134
            bool result = false;
107 135
            try
108 136
            {
109

  
110

  
111
                //dynamic doc = application.Drawings.OpenDrawing(drawingName);
112
                //doc.Activate();
137
                dynamic doc = application.Drawings.OpenDrawing(drawingName);
138
                doc.Activate();
113 139

  
114 140
                result = true;
115 141
            }

내보내기 Unified diff

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