List all projects in Visual Studio

List all projects in Visual Studio

rbertoletti
Enthusiast Enthusiast
419 Views
3 Replies
Message 1 of 4

List all projects in Visual Studio

rbertoletti
Enthusiast
Enthusiast

Hi everyone,

i'm creating a form where by clicking a button i'm able to list all the inventor projects in flowlayoutpanel in order to select one to work on.

Someone knows how to write the code?

 

Thanks in advance for the support.

0 Likes
Accepted solutions (1)
420 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor

Do you run your Form inside Inventor process (in AddIn) or outside (standalone EXE)?

In the first case you can use DesignProjectManager Object to obtain all available projects

In the second case I recommend you to use Ipj.exe from Inventor installation folder to switch projects. Default path: "C:\Program Files\Autodesk\Inventor 2023\Bin\Ipj.exe"

Or you can try to use ApprenticeServer, but I have no experience with switching projects this way.

 

Message 3 of 4

rbertoletti
Enthusiast
Enthusiast

I'm managing inventor through an exe file.

My intention is to show in the indicated area all the projects in order to select one and after press the button confirm.

 

001.PNG

0 Likes
Message 4 of 4

JelteDeJong
Mentor
Mentor
Accepted solution

Not sure if it helps you but if Inventor is not running you can set the active project by setting the registry key with the path of the project file:

HKEY_CURRENT_USER\Software\Autodesk\Inventor\RegistryVersionXX.0\System\Preferences\FileDialog\LastProjectFile

(Replace XX with the version number of your Inventor version)

I would not know how to get the list of projects without an Inventor.application object. But maybe you know that they are all saved in 1 directory and leverage that knowledge?

 

if you have the Inventor.Application object then it's easy. This is how you get the list:

For Each projectFile As DesignProject In ThisApplication.DesignProjectManager.DesignProjects
    logger.Info(projectFile.Name & " - " & projectFile.FullFileName)
Next

activating a project file is as simple as getting the project object and activating it:

ThisApplication.DesignProjectManager.DesignProjects.ItemByName("MyProject").Activate()

This will only work if there are none documents open.

 

 

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