How can I pull a variable from the module/routine with pc sdk?

I set up a variable in my module - var time. How can I pull this variable info from that module/routine with pc sdk?

Answers

  • scottMHAscottMHA Luton, United Kingdom
     This should do what you want, it will return all rob targets for each task.
    RsTaskCollection tasks = irc5controller.Tasks;
                foreach (RsTask task in tasks)
                {
                    RsDataDeclaration[] datadecls = task.FindDataDeclarationsByType(typeof(RsRobTarget));
                }
    You just need to change the RsRobTarget for what ever data type your variable is.
  • EugeneBEugeneB USA
    RsTaskCollection is ABB.Robotics.RobotStudio.Stations class and irc5controller is an instance of the Controller class correct? It given me an error in this line: RsTaskCollection tasks = irc5controller.Tasks - problem with Tasks - "irc5controller" does not contain a definition for the Tasks. How can I do this without of using RobotStudio classes?
  • DenisFRDenisFR FRANCE ✭✭
    Here what I've post to EugeneB for other:
    You can found in GetModule() how I do to find data.
    //First prepare search
                        RapidSymbolSearchProperties rssp = RapidSymbolSearchProperties.CreateDefault();
                        rssp.GlobalSymbols = true;
                        rssp.InUse = false;
                        rssp.LocalSymbols = true;
                        rssp.Recursive = false;
                        rssp.SearchMethod = SymbolSearchMethod.Block;
                        rssp.Types = SymbolTypes.Data;
    //Then look at all data in module
                        string typeName = "";// "GfxShapeData"; Don't find GfxShapeData Directly.
                        RapidSymbol[] rsArray = module.SearchRapidSymbol(rssp, typeName, string.Empty);
                        foreach (RapidSymbol rs in rsArray)
                        {
                            RapidData rd = module.GetRapidData(rs);
                            RapidDataType rdt = controller.Rapid.GetRapidDataType(rs);//Only grabe GfxShapeData, here you can do what you want like read rd.Name                        if (rd.RapidType == "GfxShapeData")
                            {
                                sDatasList += ";" + rs.Name;
                            }
                        }

    In GetGfxShapeData I pull data, it's more complicated as it's a record type.
                        RapidData rd = module.GetRapidData(sDataName);
                        if (rd.RapidType == "GfxShapeData")
                        {
                            RapidDataType rdt = controller.Rapid.GetRapidDataType(task.Name, module.Name, rd.Name);

                            sd = new GfxShapeData(rdt, rd);
                            if (sd.IsNotNull)
                            {
                                //Update Properties
                                component.Properties["ShapeType"].Value = (sd.ShapeType == GfxShapeData.ShapeTypes.Box) ? "Box" : "Capsule";
                                component.Properties["ParentAxis"].Value = sd.ParentAxis.Value;
    Here a simple example to get a PERS bool bTest:=FALSE; value:
                        RapidData test = module.GetRapidData("bTest");
                        string s = test.StringValue;
                        Bool bTest = (Bool)test.Value;

    Bool is on namespace ABB.Robotics.Controllers.RapidDomain.

Sign In or Register to comment.