Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Open Select Projects Dialog Box after Add-ins Loaded

5 REPLIES 5
Reply
Message 1 of 6
ngnam1988
353 Views, 5 Replies

Open Select Projects Dialog Box after Add-ins Loaded

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!

Tags (2)
5 REPLIES 5
Message 2 of 6
JelteDeJong
in reply to: ngnam1988

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.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 6
ngnam1988
in reply to: JelteDeJong

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!

Message 4 of 6
jjstr8
in reply to: ngnam1988

@ngnam1988 :  If you have no use for the client's addin project file, I would just overwrite it with your preferred project file.

Message 5 of 6
ngnam1988
in reply to: jjstr8

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

Message 6 of 6
jjstr8
in reply to: ngnam1988

There's no code. It seemed like you're only using one project file. If so, save it under the client's add-in project file name. When the client's add-in loads that project file, it will actually have your project file settings. I'm not sure of any options if you're using multiple project files and the client's add-in does not load automatically on startup.

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

Post to forums  

Autodesk Design & Make Report