Change the project file

Change the project file

Anonymous
Not applicable
2,908 Views
4 Replies
Message 1 of 5

Change the project file

Anonymous
Not applicable

How can we change(open) the Project file(ipj) with inventor api using vb.net code?

0 Likes
Accepted solutions (1)
2,909 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Accepted solution

The following is right out of the API Help.  The code assumes that the project is already in the lsit of available projects.  If it is not then you will need to add it with the DesignProjects.AddExisting() method.

 

Public Sub SetActiveProject()
    ' Check to make sure a document isn't open.
    If ThisApplication.Documents.Count > 0 Then
        MsgBox "All documents must be closed before changing the project."
        Exit Sub
    End If

    ' Set a reference to the DesignProjectManager object.
    Dim oDesignProjectMgr As DesignProjectManager
    Set oDesignProjectMgr = ThisApplication.DesignProjectManager

    ' Show the current project.
    Debug.Print "Old active project: " & oDesignProjectMgr.ActiveDesignProject.FullFileName

    ' Get the project to activate
    ' This assumes that "C:\Temp\MyProject.ipj" exists.
    Dim oProject As DesignProject
    Set oProject = oDesignProjectMgr.DesignProjects.ItemByName("C:\temp\MyProject.ipj")

    ' Activate the project
    oProject.Activate

    ' Show the current project after making the project change.
    Debug.Print "New active project: " & oDesignProjectMgr.ActiveDesignProject.FullFileName
End Sub
 


Message 3 of 5

Anonymous
Not applicable

Hi Robert ,  Thanks a Lot.....  Working fine.....Smiley Happy

0 Likes
Message 4 of 5

warrentdo
Collaborator
Collaborator

This may be a shot in the dark but you know more about code than me!

Would it be possible to open a named version of inventor with a named project file outside of inventor in the windows environments?

 

Regards

Warren.

0 Likes
Message 5 of 5

Anonymous
Not applicable
personal , how do I open a project specifying the path using C # ? hugs Alessandro Ferraz 
0 Likes