RobotStudio event

Teach target with a macro

I need to make an event that teach a tagets each time i trigg an Output from my rapid code.

How du i du that with VB.

 "Set t2 = Application.ActiveStation.Targets.Add"
makes a new target but it have to be with the CRobT().

Please help.

Best regards klaus

Best Regards

Klaus Soenderhegn
www.cadalysator.dk

Comments

  • Hi
    Like this

    t2.Transform = Application.ActiveStation.Mechanisms(1).ActiveToolFrame.Tran sform

    Where 1 is the index of the mechanism in the station, can exist more than one depending how your station looks like.
    ActiveToolFrame is the one you choosen in the elements toolbar.
    You could also use ToolFrames(x) if you want to control which toolframe to use if you have several.

    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • Klaus
    Klaus ✭✭

    hei Per thanks alot it works in rs3.2 with this code


    Dim t1 As Target
    Dim trans As New Transform

    't1 = trans     '

    Set t1 = Application.ActiveStation.Targets.Add
    trans.Position = Application.ActiveStation.Mechanisms(2).ActiveToolFrame.Tran sform.Position
    trans.Orientation = Application.ActiveStation.Mechanisms(2).ActiveToolFrame.Tran sform.Orientation
    'Application.ActiveStation.Mechanisms(0).ActiveToolFrame.Tra nsform
    t1.Transform = trans

    If i use the same code in vsta a get errors on these names that is underlined.


    Dim
    t1 As target
    Dim trans As New Transform
    t1 = Application.ActiveStation.Targets.Add
    Logger.AddMessage(
    New LogMessage("Macro_Sample1 output window message."))
    i have improted these references.
    Imports
    System
    Imports
    ABB.Robotics.Math
    Imports
    ABB.Robotics.RobotStudio
    Imports
    ABB.Robotics.RobotStudio.Stations
    Imports
    ABB.Robotics.RobotStudio.Environment
    i must miss somethings
    Best regards klaus
     

     

     

    Best Regards

    Klaus Soenderhegn
    www.cadalysator.dk
  • Hi Klaus
    The object model in RS5 is totally different from the one in RS4.
    Take a look at the vsta example supplied there is a macro for creating targets.

    You could also take a look on this topic where I have written some info regarding creating addins for RS5, may give you some hints on the object model (haven't tested them on RS5.08 but I think the object model haven't changed since then)
    http://forums.robotstudio.com/forum_posts.asp?T ID=621&PN=9

    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering