RobotStudio event

How can I capture the events?

I developed a VB addin program with robotstudio API. now I want to capture the events when a target or a path been created?

This is to say, when I create a target from RobotStudio by click menu "Create" ->"Target...", after click "OK", a target with a default name will be insert in current activestation. Now I need to capture the event. I means is that in my Addin program, i need to automatically know that a target has been added in current activestation. How can I realize this?

thank you for your help.

Comments

  • John Wiberg
    John Wiberg ✭✭✭

    Hmm, that's a tricky one.

    There is no such event that you could trigger on.
    I'm guessing that you'd have to use the RSE click event to catch all user clicks and keep track of the number of targets in the station. But that would be both difficult and then if they delete targets you would get problems.

    It would be much better to build your own create target dialog.
    Which is quite easy. In form design mode right click the Toolbox (Controls) and add the RsTransformBox class. This will give you an ActiveX control with both position and orientation.
    Then add whatever extra functionality you require to the form.

    Here is a small sample code to get your MyCreateTarget next to the standard one:

    Dim WithEvents TheRSE As RSEXT.RSE
    Dim MenuControlId1 As Long
    Dim cbcMenu As RSEXT.CommandBarControl

    Sub RSE_Init()
    'Run this first
        'Let's you catch the click event
        Set TheRSE = Application.RSE
        'Setting which menu to add your item in
        Set cbcMenu = Application.RSE.CommandBars("Menu Bar").Controls("Create")
        'Creates your menu item
        'if you use 14000 it will be before the ordinary create with 14016 after
        MenuControlId1 = cbcMenu.Controls.Add(rsControlButton, "MyCreateTarget", , 14016).Id
        'After running this sub test the menu in the UI
    End Sub

    Sub CleanUp()
        cbcMenu.Controls("MyCreateTarget").Delete
        Set cbcMenu = Nothing
        Set TheRSE = Nothing
    End Sub

    Private Sub TheRSE_CommandBarControlClick(ByVal CommandID As Long, CancelDefault As Boolean)
    'This is where we cathc the clickevent
        If CommandID = MenuControlId1 Then
            ActiveStation.PrintLog "Log", "You have selected the Custom Menu"
            'This is where you would run your own create target form
        End If
    End Sub

  • Hi, John Wiberg:

        Thand you very much for your help in time. But I still a question to ask.

       I install Robotstudio 3.0 bulid 2135 on my PC. After finished installation, there where be some addins in the C:Program FilesABB RoboticsAddins (if you install RobotStudio in C:Program Files).

       Look at the COM Addin: RsShowBlankBrowser.dll in C:Program FilesABB RoboticsAddinsBlankBrowserExtension.

       After you load RsShowBlankBrowser.dll form RobotStudio "Tools" - > "AddIns...", A new page will be appear on Browser, it very wonderful functioin. I can do this to create my own page by call "Application.AddBrowserTab", try it.

       Now you can add a path form main menu "Create" - > "Path", then the path name will be appear in the "Show/Blank" page, or load a robot for library by "Ctrl + M", the robot name will be appear in the "Show/Blank" page too, delete the path or robot, it will disappear according.

       So my question is how to realize this function??

  • John Wiberg
    John Wiberg ✭✭✭

    Still there is no such event.
    image

    The Show/Blank browser does it with a timer. Every 500 milliseconds it checks if the tab is active and if it is it repopulates itself.

    You can see this if you open an empty station, activate the show/blank browser, then start clicking furiosly at the create path toolbar button. You'll notice it populates the list in intervals not in a steady stream.
    image

    Now I don't know what your application would be doing but to me again it sounds much easier to have your own create target/path function.

  • Got it, thanks again.
  • John Wiberg
    John Wiberg ✭✭✭

    Here to help.

    image