Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API Crash on exit

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
d.robin
330 Views, 5 Replies

API Crash on exit

Hi,

 

I'm using vb.net 2010 with Robot RSA 2011 sp6 and 2012 sp5

 

I've got a crash on exiting Robot when my programm exit or when I call closeRobot like that :

 

 

Public Shared gRobotApplication As RobotOM.RobotApplication = New RobotOM.RobotApplication()
        Private Shared gProjet As RobotOM.RobotProject = Nothing

 

 Public Shared Sub closeRobot()
                If gProjet IsNot Nothing Then
                    gProjet.Close()
                    gProjet = Nothing
                End If
                If gRobotApplication IsNot Nothing Then
                    gRobotApplication.Quit(IRobotQuitOption.I_QO_DISCARD_CHANGES)
                    gRobotApplication = Nothing
                End If
        End Sub

5 REPLIES 5
Message 2 of 6
Mirko.Jurcevic
in reply to: d.robin

Have you tried by using interfaces:

 

Public Shared gRobotApplication As RobotOM.IRobotApplication = New RobotOM.IRobotApplication()
Private Shared gProjet As RobotOM.IRobotProject = Nothing

If this solved your issue, please Accept it as Solution help other forum users with similar issues to find answers easily.
  
Mirko Jurcevic


My blog: www.engipedia.com
Try my Revit add-ins: Autodesk App Store
Message 3 of 6
d.robin
in reply to: d.robin

Hi,

 

thx

it doesn't works... error :

Impossible d'effectuer un cast d'un objet COM de type 'System.__ComObject' en type d'interface 'RobotOM.IRobotApplication'. Cette opération a échoué, car l'appel QueryInterface sur le composant COM pour l'interface avec l'IID '{F787078F-CDE5-11D1-8FF1-00A02447BAAE}' a échoué en raison de l'erreur suivante : Cette interface n’est pas prise en charge (Exception de HRESULT : 0x80004002 (E_NOINTERFACE)).

Message 4 of 6
Mirko.Jurcevic
in reply to: d.robin

You're right. My answer was wrong.

 

Have you set reference to RobotOM?

 

I've tested this code and works for me:

 

Public Class Form1

    Public Shared gRobotApplication As RobotOM.RobotApplication = New RobotOM.RobotApplication()
    Private Shared gProjet As RobotOM.RobotProject = Nothing

    Public Shared Sub closeRobot()
        If gProjet IsNot Nothing Then
            gProjet.Close()
            gProjet = Nothing
        End If
        If gRobotApplication IsNot Nothing Then
            gRobotApplication.Quit(RobotOM.IRobotQuitOption.I_QO_DISCARD_CHANGES)
            gRobotApplication = Nothing
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        closeRobot()
    End Sub
End Class

 

I use C#, I'm not so much used to VB.NET ...

If this solved your issue, please Accept it as Solution help other forum users with similar issues to find answers easily.
  
Mirko Jurcevic


My blog: www.engipedia.com
Try my Revit add-ins: Autodesk App Store
Message 5 of 6

Try this approach to register / reregister interfaces:
http://forums.autodesk.com/t5/Robot-Structural-Analysis/VBA-Excel-macro-for-any-object-geometry-modi...


Rafal Gaweda
Message 6 of 6
d.robin
in reply to: Rafal.Gaweda

I've a solution that works, all others I've tried do not work

Public Shared gRobotApplication As RobotOM.IRobotApplication = Nothing
Public Shared Sub killRobot()
Try
Dim PR As Process() = Process.GetProcessesByName("robot")
If PR.Length > 0 Then
For Each P As Process In PR
Try
gRobotApplication = New RobotOM.RobotApplication
gRobotApplication.Interactive = CInt(False)
gRobotApplication.Project.Close()
gRobotApplication = Nothing
P.CloseMainWindow()
Catch ex As Exception
addError(ex)
End Try
Next
End If
Catch ex As Exception
addError(ex)
End Try
End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report