Dears,
I'm working with our client's add-ins. They're set active a project after Inventor started and Add-ins loaded. Please help me the VB.NET Code that can open select project dialog box after everything loaded (Or set my project active after everything loaded). I'm coding in VS.
Thank you very much!
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
Thanks @JelteDeJong
Your code take the very good result - But when we active the client's addin the project reactive to client's project.
I mean we're using 2 Addins (one of our client, one of ourself) - The client's addin always active their project after Inventor started (That I can't change because we haven't source code). I wanna change project after everything loaded (auto open project dialog or auto active our project). Could you please help me. Thanks!
@ngnam1988 : If you have no use for the client's addin project file, I would just overwrite it with your preferred project file.
Hi @jjstr8
Actually I don't need the client's default project for working. But with out it, the client's add-in can't load so that why I only need the dialog project box prompt after everything loaded, so we'll active our project for current job. Could you share your code, so I can try it. Thanks
Can't find what you're looking for? Ask the community or share your knowledge.