Apprentice vs Full Inv API

Apprentice vs Full Inv API

Raider_71
Collaborator Collaborator
901 Views
2 Replies
Message 1 of 3

Apprentice vs Full Inv API

Raider_71
Collaborator
Collaborator

Hi I wonder if anyone could shed some light on a small issue I am experiencing.

 

Basically what I need to do is extract the current Workspace path and current Project Name during my external application load event. So I am also trying to make the application not reliant on Inventor running in the background so I opted for using apprentice. The problem is that apprentice does not quite work that well when trying to get this information.

 

If I use the full Inventor API then all works fine.

 

'Get current project file info
            Dim oInvApp As Inventor.Application = Nothing
        Try
            oInvApp = Marshal.GetActiveObject("Inventor.Application")
            strWorkspacePath = oInvApp.FileLocations.Workspace
            strWorkspaceName = oInvApp.DesignProjectManager.ActiveDesignProject.Name
        Catch
            
        End Try

 

When using apprentice like this then it does not actually retrieves the last active project info.

 

'Get current project file info
        Dim oInvApp As New Inventor.ApprenticeServerComponent
        Try            
            strWorkspacePath = oInvApp.FileLocations.Workspace
            strWorkspaceName = oInvApp.DesignProjectManager.ActiveDesignProject.Name
        Catch
            
        End Try

 

So here is the procedure I am following:

 

Start Inventor

Current project = "Project A" with workspace "c:\temp\A"

I then activate "Project B" with workspace "c:\temp\B"

 

If I run my app with full Inventor API I get the correct info.

If I run my app with using apprentice I get project A's info

 

Why would this be happening? Its almost like the app has not updated the registry with the new active project information??

 

Thanks.

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

Jon.Dean
Alumni
Alumni

Great question Pieter,

I'm sure the current project is saved to the registry because I tested using the Task Scheduler and that found the current project file.

I have asked one of the developers, hopefully they will come back to me.

In the meantime I will do some testing.

Jon.



Jon Dean

0 Likes
Message 3 of 3

Jon.Dean
Alumni
Alumni
Accepted solution

Hi Raider_007,

 

Have you checked the 2015 API Object Model; see below:

2015_Api.png

Here you can see where the project path is defined.

Jon.



Jon Dean

0 Likes