I am having a problem with inventor Apprentice.
When using apprentice to check the fullfilename property of a file that has been copied from its creation folder
to another. fullfilename reports the new folder as the path.
File Created as "C:\AAA\Sample1.idw"
File Copied to "G:\20110-003\Sample1.idw"
Full filename reports the latter.
I need to get the former.
This situation comes about when one of our many engineers manually copies a file from place to place.
I am trying to write a tool that will detect this sort of behavior and alert us to it.
I also looked at the iProperties but couldn't find the "Location" property.
Thanks in advance.
I don't think that the original path is stored in the Inventor document.
It only stores the original path of referenced files, so if they cannot be resolved you can see where they were found last time.
You could create an addin that automatically adds a property that stores the current file location of the document if this is of importance to you.
Uhmmmm I wrote a simple VB.NET app that loads the entire file into a single string buffer.
Made a search string variable where I padded each character with a zero byte.
sBuffer.IndexOf(sFind) finds it if it exists. This has worked pretty much as I want.
I think it is looking at one of the properties that can be displayed in the titleblock or border of the drawing.
I was hoping for a native autodesk value, but if there is no way then I will continue to use the above technique.
Hmm, nice catch
Turns out there is actually a non-public API method of ApprenticeServerDocument which returns the information:
Inventor.ApprenticeServerComponent appr = new Inventor.ApprenticeServerComponent(); Inventor.ApprenticeServerDocument appd = appr.Open(@"C:\Temp3\test.idw"); string DatabaseRevisionId, LastSavedLocation; object Indices, OldPaths, CurrentPaths; appd._GetReferenceInfo(out DatabaseRevisionId, out LastSavedLocation, out Indices, out OldPaths, out CurrentPaths, false);
Sorry I am not all that hot with C#
Would that be the following in VB.NET?
Dim oApp as Inventor.ApprenticeServerComponent = new Inventor.ApprenticeServerComponent
Dim oDwg as Inventor.ApprenticeServerDrawing = oApp.Open("C:\Temp3\test.idw")
Dim DatabaseRevisionId as string
Dim LastSavedLocation as string
Dim Indices as object
Dim Oldpaths as object
Dim CurrentPaths as object
oDwg._GetReferencedInfo(DatabaseRevisionId, LastSavedLocation, Indices, OldPaths, CurrentPaths)
There are good conversion sites on the internet, e.g. http://www.developerfusion.com/tools/convert/cshar
But here it is:
Module Module1 Sub Main() Dim appr As New Inventor.ApprenticeServerComponent Dim appd As Inventor.ApprenticeServerDocument = appr.Open("C:\Temp3\Plate for Hole Table\Plate for Hole Table Rev A.idw") Dim DatabaseRevisionId As String = Nothing, LastSavedLocation As String = Nothing Dim Indices As Object = Nothing, OldPaths As Object = Nothing, CurrentPaths As Object = Nothing appd._GetReferenceInfo(DatabaseRevisionId, LastSavedLocation, Indices, OldPaths, CurrentPaths, False) MsgBox (LastSavedLocation) End Sub End Module
Errors out with:
Public member '_GetReferencedInfo' on type 'ApprenticeServerDocument' not found.
Ah nevermind. Somehow I slipped and put a "d" in GetReferenceInfo.
Works a treat!
You have a spelling mistake in it, it's not "Referenced", but "Reference" ... no "d" at the end of it.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.