I createt a program that checks out files from the vault, to synchronize some properties in the inventor files. But when a part inserted from a library I get an error (E_NOINTERFACE) what can be wrong. All other parts and assemblies are checked out fine. See pictures.
When I right click the part in the browser and select checkout the part from the library is checked out fine.
Any suggestions on how to solve this? Please help. see attachment
private sub DoSomeThing() bla. bla. bla. Dim fileData As Byte() = Nothing oVaultFile = DocSrv.CheckoutFile(ThisFileFolderID, ThisFileID, CheckoutFileOptions.Master, strHostName, strLocalFilePathWithFileName, "Ax2009 Properties sync.", False, False, fileData) Dim mfilepath As String = (strLocalFilePathWithoutFileName & oVaultFileName) SetFileReadAccess(oVaultFile, mfilepath) end sub ' Sets the read-only value of a file. Sub SetFileReadAccess(ByVal LocalVaultfile As Autodesk.Connectivity.WebServices.File, ByVal LocalVaultFilePath As String) ', ByVal SetReadOnly As Boolean'ByVal LocalPath As String, Try Dim info As System.IO.FileInfo = New FileInfo(LocalVaultFilePath) info.IsReadOnly = False info.CreationTime = LocalVaultfile.CreateDate 'info.Attributes = info.Attributes Or FileAttributes.[ReadOnly] Catch ex As Exception MsgBox(ex.Message) End Try
I am not sure what the problem is. What is the file that is downloaded? The error indicates that there is a problem casting the object to an AssemblyDocument. This would make sense if the com object was an .ipt file. Is this error occurring on a line in the code that is the post? The error seems like it would occurring when using the Inventor API.
Also I searched and found this post. (not sure if it applies to this issue)
Developer needs to use both Inventor and Vault API:
- use Vault API (either DocumentService.DownloadFile or IExplorerUtil.DownloadFile) to download file from Vault to local workspace. IExplorerUtil is preferred way because it handles couple of things for developer (i.e. finding our correct file location, resolving file references, setting attributes for local file). - use Inventor API to place library part into assembly (various ComponentOccurrence.Add.. methods).
When new assembly is added to Vault later then the library part will be automatically recognized by Vault and used for references.
Thanks for your reply Wayne
This was actually a "Error 40”. 40 cm. from the keyboard :-(, my own fault I did not think about that the library files comes from a different share than the default workspace. It works now
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register