RobotStudio event

HOW TO FAST CREATE ARRAY OF TARGETS? RS 5.13 API

Hello
 
 We are use robot for milling purpose so need operate with huge array of targets (30.000-60.000). How to fast create with API array of targets? Standart way take about few hours
 
 Standart way example: 
   for (x = 0 ; x < 60000 ; x++ )
    {
Station stn = Project.ActiveProject as Station; 
stn.ActiveTask.ActiveWorkObject;
RsRobTarget robTarget = new RsRobTarget(); 
robTarget.Name = stn.ActiveTask.GetValidRapidName("MyRobTarget", "_", 10);
stn.ActiveTask.DataDeclarations.Add(robTarget); 
RobTarget.
RsTarget target = new RsTarget(wobj, robTarget);
target.Name = robTarget.Name;
stn.ActiveTask.Targets.Add(target);
}

Please, somebody, give us some recomendation or solution ?!

Regards, Roman

Comments

  • Hi LukcyHunter welcome to the forum,

    When you create targets like that in RobotStudio they become a graphical object which is displayed in the graphics window. That is what is slowing you down.
    I'd suggest a rethink here, why would you add all targets to the RobotStudio station at once? When instead you can use the PC SDK to create them in the controller directly, divide them up, maybe 1k targets in each module, then if you need them in RobotStudio you can sync a module at a time to the station and when you are done with that module sync it back and remove it from the station before starting on the next one. That way you don't have tens of thousands of graphical objects in the station at once.

    By the way, your code sample contains errors so for the lurkers here is a working macro instead.
            public void Macro_GimmeTargets()
            {
                Logger.AddMessage(new LogMessage("Start targets"));
                Station stn = Project.ActiveProject as Station;
                if (stn == null) return;
                for (int x = 0; x < 100; x++)
                {
                    RsRobTarget robTarget = new RsRobTarget();
                    robTarget.Name = stn.ActiveTask.GetValidRapidName("MyRobTarget", "_", 10);
                    stn.ActiveTask.DataDeclarations.Add(robTarget);
                    RsTarget target = new RsTarget(stn.ActiveTask.ActiveWorkObject, robTarget);
                    stn.ActiveTask.Targets.Add(target);

                }
                Logger.AddMessage(new LogMessage("Stop targets"));
            }




  • Hi LuckyHunter,
     
    I think the call GetValidRapidName() can be quite time consuming also.
    But anyway, for such a large amount of targets I agree with John.

    Niklas Skoglund2011-06-28 13:53:09

    Best Regards, Niklas Skoglund
    ABB Robotics

    Developer Center
    RobotStudio Blog
  • Thanks for answers. 
     Will try it.. 
     By the way, are there any example how to create targets controller directly with PC SDK ? 


    Regards, Roman
  • [Quote]PC SDK Application Manual

    Using the PC SDK

    Motion domain[/quote]

    Note that using the PC SDK you could insert RAPID directly from string which would be even faster, however you would then not get the check for duplicate names and syntax.
    John Wiberg2011-06-29 14:38:01


  • I remember back then :-)  John and skogis
    I had kind of the same problem doing plasma spraying for PraxAir in US but on RS4 but it took like a day(at least it felt like that) to create all the targets and the total was just only like 4000-5000. And basically a plasma path(a lot of them, but usally you just work on one path at a time ) was only around 100 targets.
    So I created an addin(and RS5 is much more powerfull now than back then) where you where able to create/sync/delete each path, and a lot of other functions, so that you only had the targets you wanted to work with in RS.
    I know this won't solve your problem but maybe it will give you a hint to approach the problem in another direction.
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • Thanks 










    ---------------------------------------------------------