Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: API question: GetObject() to link to a running Robot instance

  1. #1
    Member
    Join Date
    2009-05
    Posts
    35


    Default API question: GetObject() to link to a running Robot instance

    This VBA code:

    Dim Robot As New RobotApplication
    Set Robot = GetObject("Robot.Application")

    or

    Dim Robot As New RobotApplication
    Set Robot = CreateObject("Robot.Application")

    seems to be able to bind the already-started instance of Robot to the Robot object, or create an instance of the application.
    If there are different versions of the software present, how does one specify which one is to be linked to/created?

    Moreover, I'd be incredibly grateful for a link to a good Robot API guide.
    Alexander Bausk
    Structural assessment engineer, CAD/FEM coyote
    http://bausk.wordpress.com

  2. #2
    Forum Manager, Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,321


    Default Re: API question: GetObject() to link to a running Robot instance

    First, you will want to combine the two statements so that if an attempt to get a running instance fails, then a new instance will be created. Search this forum for samples. Second, the developer guide gives you the syntax for stricter definition. What it doesn't really elaborate on is that the name you are specifying, i.e. "Robot.Application", is a class name. You can find the class names of everything installed on your pc by examining the registry at HKEY_Classes_Root. Robot.Application is a broad reference and Robot.Application.17 is a narrower reference. API documentation is usually found at the ADN website. But, the vba help should be in the developer guide for your product.
    C:> ED WORKING....

  3. #3
    Member
    Join Date
    2009-10
    Posts
    15


    Default Re: API question: GetObject() to link to a running Robot instance

    Robot is a multiple-use server and it means that even if you call
    Set Robot = CreateObject("Robot.Application").
    you connect to the running instance of Robot if such exists.

    In another words, you can't start more that one instance of Robot by calling CreateObject.

    You can't chose the version of Robot you want to start via API - always the currently registered version is started. To register selected version of Robot go to Start menu and run Start/Programs/Autodesk/...Robot.../Tools/...Component Registration.

    To get some documentation you can install SDK from Robot DVD - in Tools part of installer. The "Robot API - Getting Started Guide" and "Tutorial of Robot API" may be helpful for you. There are also some examples installed with SDK.

  4. #4
    Member
    Join Date
    2009-05
    Posts
    35


    Default Re: API question: GetObject() to link to a running Robot instance

    Thank you for the replies. I will try and see how it burns out.
    Alexander Bausk
    Structural assessment engineer, CAD/FEM coyote
    http://bausk.wordpress.com

  5. #5
    Woo! Hoo! my 1st post
    Join Date
    2009-06
    Posts
    1


    Default Re: API question: GetObject() to link to a running Robot instance

    The version of Robot that opens is whichever one was the latest to be open. This is the code I use:

    Try
    'Try to use getobject to get the Robot application
    r = GetObject(, "Robot.Application")
    Catch
    'If the try fails then create a new instance of the application
    r = CreateObject("Robot.Application")
    If r.Project.IsActive = 0 Then
    r.Project.[New](IRobotProjectType.I_PT_FRAME_3D)
    End If
    End Try

  6. #6
    Member
    Join Date
    2009-05
    Posts
    35


    Default Re: API question: GetObject() to link to a running Robot instance

    I was guessing something of this kind was going on. Thanks for the code!
    Alexander Bausk
    Structural assessment engineer, CAD/FEM coyote
    http://bausk.wordpress.com

  7. #7


    Default Re: API question: GetObject() to link to a running Robot instance

    how to achieve the same in C#?

  8. #8
    Forum Manager, Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    5,321


    Default Re: API question: GetObject() to link to a running Robot instance

    That's pretty basic. Try looking up the CreateObject function in the C# documentation.
    C:> ED WORKING....

  9. #9
    Member
    Join Date
    2009-10
    Posts
    15


    Default Re: API question: GetObject() to link to a running Robot instance

    After you add a reference to Robot API type library in your project - robotom.tlb file located in Robot EXE folder - you can just call

    RobotOM.IRobotApplication RobApp = new RobotOM.RobotApplication();

    and that's it.

  10. #10


    Default Re: API question: GetObject() to link to a running Robot instance

    I've solve my problem it's
    IRobotApplication robApp;
    robApp=new robotApplicationClass();
    Standard procedure from guide, the problem was in somethin else - even more basic .
    I'm not a programer (I'm bridge designer) and I often have basic questions for example now:
    I built my first add in for robot, it work fine on my computer, but when I starting it on others, it throwing an exception:

    System.IO.FileNotFoundException: Could not load file or assembly 'Interop.RobotOM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'Interop.RobotOM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Hangers.Hangers_Form.button1_Click(Object sender, EventArgs e)
    at System.Windows.Forms.Control.OnClick(EventArgs e)
    ...???

Page 1 of 2 12 LastLast

Similar Threads

  1. 2013 Newbie Revit to Robot Question 2013
    By neb1998 in forum Robot Structural Analysis
    Replies: 1
    Last Post: 2013-03-12, 09:37 AM
  2. Lack of efficiency within Robot/Revit link?
    By dewi.todd-jones in forum Robot Structural Analysis
    Replies: 6
    Last Post: 2012-08-23, 10:12 AM
  3. link instance deleted :(
    By moliva in forum Revit MEP - General
    Replies: 11
    Last Post: 2009-12-09, 04:22 AM
  4. Linked Model Instance Location Question
    By AgentVlin in forum Revit Architecture - General
    Replies: 2
    Last Post: 2009-01-20, 03:58 AM
  5. Link Instance deleted
    By DaveP in forum Revit Architecture - General
    Replies: 3
    Last Post: 2008-10-02, 12:07 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •