RobotStudio event

Johns (tool) Bar

image

Hi everyone I was thinking that I would have a recurring thing here on the forum. JohnsBar, as in Johns toolbar.

It is a VB project, that creates a dll that anyone can use as an add-in for RobotStudio. So anyone who has a good macro or an easy wish for a toolbar button can post here and I might add it to the toolbar.

This is the first version so it has only some simple buttons:
(Hopefully I will create more advanced later on image).

Please write what you think of this idea and what you think of the buttons. Now if this becomes a success I will continually add to it and perhaps create several toolbars for specific purposes.

I will also provide the sourcecode, so if you have MS Visual Studio you can see how I have created the toolbar.

John image

«1

Comments

  • Here I will always post the latest version:

    Johnsbar v1.5

    Just the addin (for RS version 3.0+ English):
    Johnsbar_dll.zip

    With sourcecode as well (must have Visual Studio and RS v 2.0+ English):
    Johnsbar_source.zip

    To add an add-in to RS:
    1. Extract the folder to ABB RoboticsAddins
    2. Open RS
    3. Tools>Add-ins
    4. Add, browse to the dll (you need to have dll visible in MS Windows)
    5. OK
    =imageimageimageimageimage

    Right now these are the buttons:

    Floor
    Visible on/off

    MultiRename
    First, select any number of objects you wish to rename (like a whole list of targets), then click the MultiRename button. It will rename them in the order selected so you can ctrl+click in any order you wish.
    There are three fields:
    Name: Fill in the Name that all targets should get
    Start: Fill in the number of the first object
    Step: Fill in the number to add to each consecutive object
    (example: If you select four targets and fill in "p","10", "10", they would be renamed to p10, p20, p30 and p40)
    Do not click while running a simulation.

    SaveAsLibrary
    First select a Part, Assembly or Mechanism. This opens up the SaveAsLibrary dialog. (If this one is popular I intend to add a second File toolbar with Import:Library, Import:Geometry, etc)
    Do not click while running a simulation.

    Update rate
    Here you can increase or decrease the Update rate, ie the simulation speed. It also works during Simulation so that you can "Fastforward".
    (The idea for this one was stolen from Henrik)

    TCP View Center
    Click to change the view to the TCP. (You can click this during simulation to jump to the TCP). The TCP is the one that you currently have selected in the Elements toolbar. So as long as it is in the list you can change to any tool in the station.

    MultiVisible
    Select any number of objects and click to toggle Visible On/Off.
    Right now there is no check for illegal objects, I will add that later. image

    PartVisible
    Select a part in the browser and click the button. A form will open up that lists all enteties in the part and if they are visible or not. There are three buttons in the form:
    Make All Visible, that makes all enteties visible.
    Make None Visible, that makes all enteties not visible.
    Reverse Visible, that reverses the visible setting for all the enteties.
    The form is not that beautiful but it works.
    Do not click while runnning a simulation.

    PartReverse
    Select a path in the browser and click the button. It will now create a reverse of that path. Including reversing circular motion and retaining all motion data. (Thanks to Per S, Martin L and Thomas J who all supplied code... Pers didn't copy process data, Thomas didn't copy circular and Martin's didn't copy but got the data. But the mix of them all helped me get it right.) Right now the reversing of a path doesn't reverse circular as well as intended, will fix this later.
    Don't click during simulation.

    Save As with Controller and Program
    This will make a Save As (easier for version handling), then into that station's supporting files it will put the current controller and the current program. Now since the copy of the controller is from the start of your current session, so you need to import the program to get your most recent changes.
    Only works with RW4.0.
    Don't click during simulation.

    Via Target Copier
    This was done by request.
    Select a target that you want Via targets to, then click the button. You will get a small form, where you can say how many targets etc. The when you click the ViaTarget button you can fill in a position relative to the target. The new targets will inherit, orientation and ext axis values from the selected target.
    Don't click during simulation.

    Array Copy imageNEWimage
    This was done by request.
    Select a Part that you want an array of, then click the button.
    You will get questions about the number of copies and the XYZ displacement between the copies.
    Remember that if the part is heavy with gfx it could take a while...image
    Don't click during simulation.

    John Wiberg38524,6980902778
  •  

    John Wiberg38117,7073726852
  • Hello John,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

    I think that your idea "Johns toolbar" on the forum is brilliant. image

    These functions were really needed and they really make it easier to work with RobotStudio.

    Thank You for a nice toolbar.  image

    Thomas Andersson
    Support Engineer
    ABB Automation Technologies
    ATMA/RO/AIS
  • When I want to install Add-in, RS notify: Run-time error '13': Type mismatch. RS run on Windows XP Professional Version 2002.

    Gregor

  • [QUOTE=GPetak]

    When I want to install Add-in, RS notify: Run-time error '13': Type mismatch. RS run on Windows XP Professional Version 2002.

    Gregor

    [/QUOTE]

    Hi Gregor,

    Hmm, that is not good.image
    Lets see if we can pinpoint what it is. Here are some questions.

    Which version of RS are you running?
    The add-in was built on RS 3.0 build 2135.

    Do you have any programming environment installed? (like visual studio, delphi, etc)

    Do you have excel/powerpoint installed? (I've noticed that VBA usually takes it for granted that the whole suite of MS office is available).

    Hopefully I should be able to solve it for you.

    image

  • Hello John,

    I have RS 2.1, no programming environment installed and whole suite of MS office 2002.

    Gregor

  • OK.

    ->GPetak

    Finally I'm back. image

    Did some checking, talked to some developers, took a seperate pc and installed 2.1 etc.

    So I have some good and some bad news.

    The good news is that I found the problem, it is the references in VB that auto-connects to the local version of RobotStudio. This means that add-ins always will be forward compatible but not backwards compatible. Which leads us to the bad news: I usually won't have the time to use a seperate machine to create a specific version of the Johnsbar that is compatible with older versions of RS. image

    I created one this time though so you can at least get some benefit for your troublesimage:

    JohnsBar_21.zip

    But for all of you out there that has a programmer environment for Visual Basic (like MS:Visual Studio) you can just open the sourcecode and recompile the project and it will autodetect your local version of RobotStudio and build the add-in accordingly.

    (I will edit the former posts accordingly).

  • Oh, and by the way people, I still haven't received any suggestions for more buttons...

    image

  • I might have TWO for you  Wink

    I often have to make a bunch of entities of a part invisible. But when using CAD-models with 1000 or more entities, it's difficult to make just one of the entities visible again. I have to write down alle entities i made invisible so i can find the one i'm looking for more easy.

    So how about a window or listing-function which shows which entities (per part seperately) are made invisible?

    And the second thing:

    Normally you have to make entities invisible or visible one by one. How about a function that allows you to select multiple entities, and make them invisible/visible all at once?

    Melk38024,1190046296
    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • And yet another.. How about a button which allows you to change the sequence of a path (path moves from A to B, and can be changed so it moves from B to A) (The add-in "Mechanical Cut Power Pac" can do this). Right now you have to drag&drop every target manually in the correct place. And when you have paths containing over 100 targets (like i do frequently), this consumes lots of time.

     

    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • New version available. Go to the last page.

    John Wiberg38033,4603819444
  • Hello Melk and welcome to the bar... image

    I added a MultiVisible button for your conveniance.

    The 'list' of current Visible etc is in the Plus+Pac. So I might do one that is limited otherwise marketing will have my head... image

    I will look into what the reverse feature of mechanical cut does and then I will see what I can do while retaining the value of that add-in.

    I will probably create those buttons by next week...

    So longimage

  • I feel welcome already, and wow that was quick... I gave it a try today and i must say it works like a charm. And to please the marketing departement: When my boss bought me RobotStudio, I also talked him into buying me the Plus+Pac and the Mechanical Cut Power pacBig smile  

    Like i said the mechanical cut power pac is able to change the sequence of a path, but not by simply clicking just one button. And that would make my life even more easy. 

    And although the Plus+pac has the "Show/Blank-tab", it hasn't got a function which lets you select a part, and see which of its entities are invisible. So i really hope the marketing departement wouldn't oppose to the creation of a function of this kind.

    Melk

    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • I don't think that there will be any problems but it's usually best to check before than after...
    image
    Especially when placing things in a public forum.
    image

    The visible enteties in a part: do you want it to open as a dialog with some buttons like
    Visible:AllEnteties
    Visible:NoEntities
    Visible:ReverseEnteties
    Or is it just a list in the output windowimage

  • In an ideal situation I would be able to click a button of your bar, and a window opens. Then, when i click on a part in the object brouwser, the invisible entities of that part are listed in the window. Then i would be able to select a couple (or all) of entities and make them visible again. I've illustrated this "scenario" in an edited picture below. But ofcourse even the smallest effort towards this goal is much appreciated

    image

     

     

    Melk38028,0399421296
    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • Later version available. Go to the last page.

    John Wiberg38037,6747106481
  • ->Melk

    Made a simple version of the 'select part with visbile enteties'.

    Right now the limitations are that you have to select the part first so you have to close the form before being able to select the next part.

    The list is only in the form, I will add a Export to output window button as well.

    You can't select single enteties since that would take too long to make, maybe if I have a free moment some time... image

    Have the code for a reverse path button that I stole from Per Svensson. I will make a button of that later in the week.

  • Yet again.. thanks alot Cool To bad i'm not at work at the moment, so i have to wait until tomorrow to try it out. I'll let you know...
    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • ->Melk

    The reverse path is a bit hard to do if you want to keep the motion data. There is no specific command to copy this.

    Here is a small recommendation meanwhile:

    In the Object Browser select all TargetRefs from the bottom up. Then drag and drop them to the path they are in=reversed. Quite simple.

  • Hello John and Melk

    Here is a little form to reverse a path and it includes an example on how to include the motion data. I do not believe all is lost when you do this, but give it a try and let me know if more needs to be "reserved" when reversing the path.

    It is crude and a little unorthodox, but this is the only thing I could come up with that worked.image

    Z46_frmRev.zip

    Thomas J38037,5451388889
    Thomas H. Johnston
    PACs Application Engineer
  • Hi Thomas and welcome to the bar.

    Got errors loading your form.

    image

    Line 8: Property OleObjectBlob in frmRev had an invalid file reference.
    Line 2: Cannot load control frmRev.

    But if you'd tell me what trick you used I could take it from there?

    image

  • Hello John -

     

    Forgot to include that all important .frx file that comes with the .frm file - I updated the zip file with it in the original reply.

    Basically - the form contains two controls, a list box of paths in the active station, and a command button that performs the following:

     

    Private Sub cbReversePath_Click()
     
      Dim i As Integer
      Dim p1 As Path
      Dim p2 As Path
      Dim tr As TargetRef
      Dim strName As String

      'remove any path named "Reversed"
      On Error Resume Next
      ActiveStation.Paths("Reversed").Delete
      On Error GoTo 0
     
      If Me.cmbPath.Text <> "" Then
        Set p1 = ActiveStation.Paths(Me.cmbPath.Text)
        Set p2 = ActiveStation.Paths.Add()
        p2.Name = "Reversed"
       
        For i = p1.TargetRefs.Count To 1 Step -1
          Set tr = p2.Insert(p1.TargetRefs.Item(i).Target)
          tr.MotionType = p1.TargetRefs.Item(i).MotionType
        Next i
     
        'remove any path named "DeleteMe"
        strName = p1.Name
        On Error Resume Next
        ActiveStation.Paths("DeleteMe").Delete
        On Error GoTo 0
       
        'renname the paths
        p1.Name = "DeleteMe"
        p2.Name = strName
       
        'remove the source path
        ActiveStation.Paths("DeleteMe").Delete
      End If
     
    End Sub


    Private Sub UserForm_Initialize()

      Dim sPath As Path
     
      For Each sPath In ActiveStation.Paths
        Me.cmbPath.AddItem sPath.Name
      Next
    End Sub

    Thomas H. Johnston
    PACs Application Engineer
  • I haven't tested this, but I think that you loose the motion properties in this example. There is an old topic "VBA Example: Config Path" which includes a routine that copies a path including all motion properties. This is what you have to do also when reversing the path.

    /Martin Lundh
    Product manager
    ABB Robotics
  • Here is Johnsbar v1.3

    Just the addin (for RS version 3.0+ English):
    Johnsbar_dll.zip

    With sourcecode as well (must have VB and RS v 2.0+ English):
    Johnsbar_source.zip

    To add an add-in to RS:
    1. Extract the folder to ABB RoboticsAddins
    2. Open RS
    3. Tools>Add-ins
    4. Add, browse to the dll (you need to have dll visible in MS Windows)
    5. OK
    =imageimageimageimageimage

    Right now these are the buttons:

    Floor
    Visible on/off

    MultiRename
    First, select any number of objects you wish to rename (like a whole list of targets), then click the MultiRename button. It will rename them in the order selected so you can ctrl+click in any order you wish.
    There are three fields:
    Name: Fill in the Name that all targets should get
    Start: Fill in the number of the first object
    Step: Fill in the number to add to each consecutive object
    (example: If you select four targets and fill in "p","10", "10", they would be renamed to p10, p20, p30 and p40)
    Do not click while running a simulation.

    SaveAsLibrary
    First select a Part, Assembly or Mechanism. This opens up the SaveAsLibrary dialog. (If this one is popular I intend to add a second File toolbar with Import:Library, Import:Geometry, etc)
    Do not click while running a simulation.

    Update rate
    Here you can increase or decrease the Update rate, ie the simulation speed. It also works during Simulation so that you can "Fastforward".
    (The idea for this one was stolen from Henrik)

    TCP View Center
    Click to change the view to the TCP. (You can click this during simulation to jump to the TCP). The TCP is the one that you currently have selected in the Elements toolbar. So as long as it is in the list you can change to any tool in the station.

    MultiVisible imageNewimage
    Select any number of objects and click to toggle Visible On/Off.
    Right now there is no check for illegal objects, I will add that later. image

    PartVisible imageNewimage
    Select a part in the browser and click the button. A form will open up that lists all enteties in the part and if they are visible or not. There are three buttons in the form:
    Make All Visible, that makes all enteties visible.
    Make None Visible, that makes all enteties not visible.
    Reverse Visible, that reverses the visible setting for all the enteties.
    The form is not that beautiful but it works.

    PartReverse imageNewimage
    Select a path in the browser and click the button. It will now create a reverse of that path. Including reversing circular motion and retaining all motion data. (Thanks to Per S, Martin L and Thomas J who all supplied code... Pers didn't copy process data, Thomas didn't copy circular and Martin's didn't copy but got the data. But the mix of them all helped me get it right.)
    Don't click during simulation.

  • I'm sorry it took me so long to check out the new multi/partVisible option, but i finally got some free time to spend trying it. And.. it works :D.. Most of my former problems with retrieving invisible entities are history. I hope to be able to look further into this option this week. I'll let you know...
    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • Oh, and i almost forgot.. John if you ever experiance the feeling of "what the hell should i do now", I might have another time-spender for you. But it's going to be difficult..

    I frequently need to take a close look at the movements of the tool. And to be able to take a good look at the tool while it travels along a path, i have to reposition the viewing-angle multiple times during the execution of the program.

    Now here comes the nifty part.. What about a function that lets you follow the TCP. With this i mean that the graphics area of RobotStudio follows the TCP-movements at a certain distance and/or angle..

    And although i suspect that this isn't possible with VBA, I'd really like to hear your thoughts about this.  

    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • ->Melk

    Difficult? No, no, no. That's easy.

    If you look at the toolbar right now you'll see the TCP View Center button. You can click it during simulation and 'follow' the TCP around.

    But if you want it to be done automatically then just create a simulation controller (like the 'How to move it' example) and in the simulation.tick event just set the view center to be the tcp. If you want you could have a user option form that adds distance and angle if you wish.

  • I've certainly noticed the TCP View Center button, but if it could be automated, and with an option form that allows you to change distance and angle.. Well.. that would be super! Too bad i'm a total loss when it comes VBA..
    <@Logan&gt; I spent a minute looking at my own code by accident.
    <Beeth> And your point is?
    <@Logan&gt; I was thinking "What the hell is this guy doing?"
  • image

    Go to the http://forums.robotstudio.com/forum_posts.asp?TID=82&PN=1 "How to move it" post and download the instruction.

    But instead of moving a box you want to move along with the TCP.
    So replace the controller code with this:

    'This code should be pasted into the controller
    'to create one right click theRobotStudioProject select Insert>Controller Class
    'In this example the controller is named Movement so you need to name yours that as well
    Dim tmpVector As RsMathVector
    Dim tmpMatrix As RsMathMatrix
    Private Sub Controller_AfterTick(ByVal Time As Double)
        ActiveView.LookAt.x = ActiveStation.ActiveMechanism.ActiveToolFrame.Transform.x
        ActiveView.LookAt.y = ActiveStation.ActiveMechanism.ActiveToolFrame.Transform.y
        ActiveView.LookAt.z = ActiveStation.ActiveMechanism.ActiveToolFrame.Transform.z
        tmpMatrix = RsMath_TransformToMatrix(ActiveStation.ActiveMechanism.ActiveToolFrame.Transform)
        tmpVector.z = 1
        tmpVector.x = 2
        tmpMatrix.pos = RsMath_mult_mat_vec(tmpMatrix, tmpVector)
        ActiveView.LookFrom.x = RsMath_MatrixToTransform(tmpMatrix).Position.x
        ActiveView.LookFrom.y = RsMath_MatrixToTransform(tmpMatrix).Position.y
        ActiveView.LookFrom.z = RsMath_MatrixToTransform(tmpMatrix).Position.z
    End Sub

    image

    John Wiberg38072,6002777778
  • Oh, and you would need a really good graphics engine to run that...

    image

    image