How to get/set PPe property-values?
1 private Plant Create_Unteranlage(PpeData oPPET, Plant oPlantN, string sBez, string sPID) 2 { 3 try 4 { 5 Plant oPlantT = new Plant(); 6 MultiLangString mls = new MultiLangString(); 7 if (oPPET==null) 8 oPlantT.Create(oPlantN); 9 else 10 oPlantT.Create(oPPET); 11 12 mls.Clear(); 13 mls.AddString(ISOCode.Language.L_de_DE, sBez); 14 oPlantT.Designation = mls; 15 oPlantT.PICode = sPID; 16 17 return oPlantT; 18 19 } 20 catch (System.Exception ex) 21 { 22 MessageBox.Show("sss: " + ex.ToString()); 23 24 return null; 25 } 26 } 27 28 //======================= Create loop 29 PctLoop oPctLoop = new PctLoop(); 31 oPctLoop.Create(false, oPlant); 33 MultiLangString oMls = new MultiLangString(); 35 oMls.AddString(ISOCode.Language.L_de_DE, "???????????"); 37 oPctLoop.Comment = oMls; 41 oPctLoop.Function = ""; 45 oPctLoop.TechnicalFacility = ""; 49 oPctLoop.Measurand = "RM"; 50 51 // Nummer ="01"; 52 53 oPctLoop.Number = "01"; 54 55 oMls.Clear(); 56 57 oMls.AddString(ISOCode.Language.L_de_DE, "Bin"); 58 59 oPctLoop.SetPropertyValue(PctLoop.PropertyGroupType.Group8, 21000, oMls); 60 63 // ========== Cretae PCT - Element 64 PctElement oPctElement = new PctElement(); 65 oPctElement.Create(EplApi.Ppe.DeviceGroupType.Sensors, oPctLoop); 66 67 oMls.Clear(); 68 oMls.AddString(ISOCode.Language.L_de_DE, "asd"); 69 oPctElement.Type = oMls; 70 71 oPctElement.Component = "RM01"; 72 73 //=================================== 75 public Eplan.EplApi.Ppe.PctLoop Find_Loop(ref string sID, ref string sAKS, PpeData oPPE, string sBetr) 76 { 77 PctLoopFilter oPF = new PctLoopFilter(oPPE); 78 if (sID!="") 79 oPF.Number = sID; 80 81 82 if (sAKS!="") 83 oPF.Plant = sAKS; // AKS 84 85 PctLoop[] oLoops = oPPE.GetPctLoops(oPF); 86 // … 87 }
1 SelectionSet oSel = new SelectionSet(); 2 // EPLAN-Project 3 4 Project oProject = oSel.GetCurrentProject(true); 5 // PPE Project 6 7 PpeData oPPE = new PpeData(oProject); 8 9 String SpecNumber = "1-M-2"; 10 11 SpecificationFilter oFilter = new SpecificationFilter(oPPE); 12 13 oFilter.SpecificationNumber = SpecNumber; 14 15 Specification[] oSpezs = oPPE.GetSpecifications(oFilter); 16 17 foreach (Eplan.EplApi.Ppe.Specification oSpec in oSpezs) 18 { 19 20 String sManuf = oSpec.Manufacturer.Trim(); 21 oSpec.Manufacturer = "Klöckner-Moeller"; 22 23 // get – set property-values …. 24 int PropID =123; 25 // OR 26 PropID = oPPE.ExistProperty("树形结构"); 27 28 if (PropID > 0) 29 { 30 //oSpec.AddProperty(PropID); 31 MultiLangString oMls = new MultiLangString(); 32 oMls.AddString(ISOCode.Language.L___, "test"); 33 oSpec.SetPropertyValue(PropID, oMls); 34 } 35 36 MultiLangString ddd = oSpec.GetPropertyValue(PropID); 37 string a = GetMulValue(ddd); 38 }