Message 1 of 2
Not applicable
11-06-2014
01:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm having some difficulty figuring out why ApprenticeServer will not read Inventor files migrated from 2013 to 2015 in my API code....
The code below reads a 2013 file just fine, but errors out on "doc = apprentice.Open(strFile)" with a migrated 2015 file.
The help file for the 2015 API looks the same as 2013 on this subject. The image below shows the error that is catched. Help!!!
Using Visual Studio 2012 and VB.NET.
Private Sub ShowThumbnail(ByVal strFile As String)
If Not System.IO.File.Exists(strFile) Then
MsgBox("File does not exist.")
Exit Sub
End If
' Create an instance of Apprentice.
Dim apprentice As New ApprenticeServerComponent
' Open a document.
Dim doc As ApprenticeServerDocument
Try
doc = apprentice.Open(strFile)
'doc = apprentice.OpenWithOptions(strFile, Nothing)
Catch ex As Exception
MsgBox(ex.ToString())
doc.Close()
Exit Sub
End Try
' Get the thumbnail image.
Dim thumbnail As stdole.IPictureDisp
thumbnail = doc.Thumbnail
' Convert the IPictureDisp object to an Image.
Dim img As System.Drawing.Image = AxHostConverter.PictureDispToImage(thumbnail)
With imgLogo
.ImageSource = ConvertDrawingToImagesource(img)
.Stretch = Stretch.Fill
End With
Label_Status_Comment.Content = "Selected Template: " & GetPhantomiPropertyByFileName(doc, "Keywords", _summaryProp)
SetGeneralAssemblyFields(GetPhantomiPropertyByFileName(doc, "FDCode", _customProp))
doc.Close()
End Sub
Solved! Go to Solution.