Change active Project file via .net

Change active Project file via .net

Anonymous
Not applicable
838 Views
1 Reply
Message 1 of 2

Change active Project file via .net

Anonymous
Not applicable

Hi,

 

the following situation. If we open a file from Vault, from time to time, we got this message:

 

"Value cannot be null. Parameter name: path 1"

 

It's a problem you can solve, by uninstall the complete Autodesk package and install it again (says a thread at Autodesk). The Problem is, the problem comes again after a specific time.

 

I was searching for a solution much simpler and faster than uninstalling everything and installing it again.

 

If you change the Project file from the specific one, we're using to default, and back to the one, we're using, everything is fine.

 

Now, my idea was to set the project file to default and back to the specific one.

 

Let's call it Project_A.ipj

 

The manual procedure is:

 

1. Start Inventor

2. Open the projects manager

3. Switch the project file to "Default"

4. Click on "Done"

5. Again open the projects manager

6. Change the Projectfile to "Project_A.ipj"

7. Click on "Done"

 

That's it.

 

If I change the project file via .net (here vb)

 

Inventor1.FileLocations.FileLocationFile = "C:\Users\Public\Documents\Autodesk\Inventor 2017\Projects\Default.ipj"

Inventor1.FileLocations.FileLocationFile = "C:\Autodesk\Project_A.ipj"

 

This doesn't have the same effect.

 

The problem is, the manual way, especially 4. "Done" is doing something inside Inventor and it is not automatically triggered by the "FileLocationFile" procedure.

 

Do you have any idea, how to produce the same effect the "manual way" did in vb.net?

 

Greetings

 

Passi

0 Likes
839 Views
1 Reply
Reply (1)
Message 2 of 2

b_sharanraj
Advocate
Advocate

hi @Anonymous

 

Try the below code 🙂

 

InvApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")

 

InvApp.DesignProjectManager.DesignProjects.Add(MultiUserModeEnum.kSingleUserMode, "Default.ipj","C:\Users\Public\Documents\Autodesk\Inventor 2017\Projects").Activate()

 

InvApp.DesignProjectManager.DesignProjects.Add(MultiUserModeEnum.kSingleUserMode, "Project_A.ipj","C:\Autodesk").Activate()

 

Between is there any specific reason is there to activate "Default.ipj" before activating "Project_A"

Regards

B.Sharan Raj