You can use the ApplicationEvents.OnReady(..) event. The OnReady event notifies your addin when Inventor has completely initialized and is ready for interactive use.
In the event handler, you can set the project file. Your addin class would look something like this:
Public Class StandardAddInServer
Implements Inventor.ApplicationAddInServer
Private _appEvents As ApplicationEvents
Private _inventor As Inventor.Application
Private _designProjectName As String = "ProjectName"
Public Sub Activate(AddInSiteObject As ApplicationAddInSite, FirstTime As Boolean) Implements ApplicationAddInServer.Activate
_inventor = AddInSiteObject.Application
_appEvents = _inventor.ApplicationEvents
AddHandler _appEvents.OnReady, AddressOf AppEvents_OnReady
End Sub
Private Sub AppEvents_OnReady(BeforeOrAfter As EventTimingEnum, Context As NameValueMap, ByRef HandlingCode As HandlingCodeEnum)
Dim designProjects = _inventor.DesignProjectManager.DesignProjects
designProjects.ItemByName(_designProjectName).Activate()
End Sub
Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Blog: hjalte.nl - github.com