Add-in for RS 5.07
AlexLu
✭
in RobotStudio
My RS 5.07 does not offer RS API help. It is grey in the menu.
Need help on how to build Add-in in RS 5.07. What's the difference from RS 3.2?
0
Comments
-
Hi Alex.
Documentation of the RobotStudio API will be included in the next release (5.08). For now, I can provide you with some auto-generated documentation. Note that it is unsupported, incomplete and possibly incorrect!
2006-07-14_110219_APIDoc.zip
The RobotStudio 5.x API is .NET based and you need Visual Studio 2005 to build an addin. Typically you would program in C# or VB.NET. The requirements for an addin are very simple:
1) It must contain a public, static and parameterless method called AddinMain
2) The DLL must be placed in the RobotStudioBinAddins directory
To use the RS API you need to reference the ABB.Robotics.*.dll assemblies. These are:
ABB.Robotics.Math - Vector and matrix math
ABB.Robotics.RobotStudio - General and top-level (e.g. non-Station specific) classes
ABB.Robotics.RobotStudio.Environment - For manipulating the GUI, e.g. adding menus and buttons etc.
ABB.Robotics.RobotStudio.Stations - For manipulating stations and their contents
ABB.Robotics.RobotStudio.Stations.Forms - GUI controls used by RS
Below is an example of a basic addin written in C#:
using System;
using ABB.Robotics.RobotStudio;
using ABB.Robotics.RobotStudio.Environment;
using ABB.Robotics.RobotStudio.Stations;
using System.Windows.Forms;
namespace MyAddin
{
public class MyAddin
{
// This method is called when RS starts
public static void AddinMain()
{
// Create a new command button
CommandBarButton button = new CommandBarButton("HelloMyAddin", "Hello MyAddin!");
// Add the button to the "Tools" menu
// The IDs of predefined menus and commands are found in "RobotStudioIDSummary.html"
CommandBarPopup.FromID("MenuTools").Controls.Add(button);
// Connect the command events
button.UpdateCommandUI += new UpdateCommandUIEventHandler(button_UpdateCommandUI);
button.ExecuteCommand += new ExecuteCommandEventHandler(button_ExecuteCommand);
}
static void button_UpdateCommandUI(object sender, UpdateCommandUIEventArgs e)
{
// Enable the button
e.Enabled = true;
}
static void button_ExecuteCommand(object sender, ExecuteCommandEventArgs e)
{
// Do something
MessageBox.Show("Hello MyAddin!");
}
}
}
regards,
Johannes
Johannes Weiman2006-7-14 12:34:40Johannes Weiman
Software Engineer
ABB Robotics0 -
I am trying to use this to build an addin that will update positions of targets.
When i try to compile
CommandBarButton buttonGantryUpdate = new CommandBarButton("GantryUpdate", "Gantry Update");
buttonGantryUpdate.UpdateCommandUI += new UpdateCommandUIEventHandler(buttonGantryUpdate_UpdateCommand UI);
buttonGantryUpdate.ExecuteCommand += new ExecuteCommandEventHandler(buttonGantryUpdate_ExecuteCommand );
i get
An Object reference is required for the nostatic field, method or property. I am using all the suggested ABB.Robotics items and have referenced the dll files in the SDK directory
Any ideas?
0 -
[QUOTE=mattdavis]
buttonGantryUpdate.UpdateCommandUI += new UpdateCommandUIEventHandler(buttonGantryUpdate_UpdateCommand UI);
[/QUOTE]Hi,
There is a white space in the argumentlist between "UpdateCommand" and "UI". Is that expected?
Henrik Berlin
ABB0 -
thats a weirdness of the forum i think. I cut and paste that from my code and theres no space in the code. Thanks for the suggestion and damm good spotting.
0 -
Is buttonGantryUpdate_UpdateCommandUI and buttonGantryUpdate_ExecuteCommand static? Try to make them static, and see if that works.
0 -
yes that works.
Thanks alot for that, im confused as to why it works but.. it does.
0
This discussion has been closed.
Categories
- All Categories
- 5.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 249 ScreenMaker
- 2.7K Robot Controller
- 310 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 786 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings