RobotStudio event

Convert VSTA AddIn to Standard AddIn

Hi!

In http://forums.robotstudio.com/forum_posts.asp?T ID=2007 "Henrik Berlin" wrote this:
[quote]A rule of thumb:

Small, basic add-in: VSTA
Advanced add-in: Standard add-in written in, say, VS 2005 Express...[/quote]

I started my programming in VSTA but encountered several difficulties and comments in the API-documentation telling that some features are not usable within VSTA.

So I decided to try converting my existing project into a "Standard add-in" and took my VSTA-code to VS 2005.

In my project I work in the first place on the one hand with RAB to control robots and on the other hand with RobotStudio classes ABB.Robotics.RobotStudio.Stations.RsIrc5Controller and Station.ActiveProject to get the Robot's MechanicalUnits and for creating parts and copying some the robot's geometries.

For initializing communication with the station in VSTA I used "Station.ActiveProject as Station" which now throws an exception in the Standard add-in. What do I have to do to gain control of the RobotStudio station in this case?

2nd question: How can I debug a Standard add-in? At the moment I build my program and place it into RobotStudio/bin/Addins/  - therefore I do have to restart RobotStudio each time I want to change something and debugging is not possible.

Btw: Please tell me if I the idea to change to Standard AddIn to get more control is rubbish.

Comments

  • Hi,

    First of all make sure you do NOT reference ABB.Robotics.RobotStudio.Proxy.dll in you standard add-in; it is only intended for VSTA!
    Also as you noted before the API is not thread safe (except for some standalone stuff like the Math classes). You should only call the API from the main thread (e.g. the same thread that calls your AddinMain()).

    To debug your add-in you should configure your project debug settings to "Start external program" RobotStudio.exe.

    It is true that you have to restart RobotStudio when you rebuild your add-in. This is perhaps the main disadvantage when compared to VSTA, but on the other hand you get much better performance and functionality in a standard add-in.

    regards,
    Johannes

    Johannes Weiman
    Software Engineer
    ABB Robotics
  • Thank you for your reply. image

    I changed the reference to RobotStudio.Proxy.dll to the other dlls and now it works.

    Will the rebuild-and-restart constraint be solved in future releases of RobotStudio or is there any workaround? My station takes about 2 minutes to be loaded completely. image
  • The restart limitation will probably never be solved, simply because .NET doesn't allow a assembly to be unloaded once it has been loaded into an application domain.

    A VSTA add-in runs in a different application domain than RS itself, therefore it is possible to unload. But it also means all method calls must be marshaled across domain boundaries, and that is the root of all problems with VSTA.

    Johannes Weiman
    Software Engineer
    ABB Robotics
  • And what about "API is not thread safe"? This also took me several days thinking I wrote wrong code. Will this change in upcoming releases?

    Btw: Is there any updated API-documentation? My docs are from 2008-01-28.




  • RS 5.11 will have complete API documentation including many examples: Download

    I have suggested that methods that aren't thread safe should throw an explicit exception if they are called from the wrong thread. But that probably won't make it into 5.11.

    Johannes Weiman2008-9-5 14:13:24
    Johannes Weiman
    Software Engineer
    ABB Robotics