Getting Thumbnail from BOM Row

Getting Thumbnail from BOM Row

Raider_71
Collaborator Collaborator
699 Views
4 Replies
Message 1 of 5

Getting Thumbnail from BOM Row

Raider_71
Collaborator
Collaborator

Hi,

 

Any idea why I cant get the Thumbnail iProperty from a document object derived from a BOM row? If I do this then it does not work:

 

oCompDef = oRow.ComponentDefinitions.Item(1)

Dim oDoc As Inventor.Document = oCompDef.Document

Dim thumbnail As stdole.IPictureDisp

thumbnail = oDoc.Thumbnail

If I use apprentice then it works:

 

oCompDef = oRow.ComponentDefinitions.Item(1)

Dim oDoc As Inventor.Document = oCompDef.Document
Dim strFilename As String = oDoc.FullFileName.ToString

Dim oApprentice As New Inventor.ApprenticeServerComponent
Dim oApprDoc As ApprenticeServerDocument
oApprDoc = oApprentice.Open(strFilename)

Dim thumbnail As stdole.IPictureDisp

thumbnail  = oApprDoc.Thumbnail

Using apprentice is not a problem but I feel that it could slow my program down having to use apprentice.

 

Any idea why I cant use the Document object derived from a BOMRow object like I have above?

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

Owner2229
Advisor
Advisor

Hi, I believe you have to open the document in order to get it's thumbnail, so:

 

 

oCompDef = oRow.ComponentDefinitions.Item(1)
Dim oDoc As Inventor.Document = oCompDef.Document
Dim strFilename As String = oDoc.FullFileName
Dim oTempDoc As Inventor.Document oTempDoc = InventorApplication.Documents.Open(strFilename, False) Dim thumbnail As stdole.IPictureDisp thumbnail = oTempDoc.Thumbnail oTempDoc.Close

 

Anyway Apprentice does actualy work faster with documents, but it ofc. depends on what else you're doing with the documents.

There's been test for it. E.g. For reading iProperties it should work 10x faster then visible Inventor and 2x faster then invisible Inventor.

 

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
- - - - - - - - - - - - - - -
Regards,
Mike

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
0 Likes
Message 3 of 5

Raider_71
Collaborator
Collaborator

Hi thanks for the feedabck.

 

I was hoping to not open the document at all and just work from the component definition as I am able to extract all the other properties that way. Was hoping to extract the Thumbnail that way as well.

Its strange that the Thumbnail property is there but it does not work. Why have it there at all then...

0 Likes
Message 4 of 5

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

1) What do you mean by "does not work"? Do you get an error? Or the returned value is simply "Nothing"?

 

2) Is your program an add-in or a standalone application? Because you cannot access IPictureDisp from a separate process, and it's nothing Inventor specific, it's just a limitation of IPictureDisp: https://msdn.microsoft.com/en-us/library/office/ff864458.aspx

 

Cheers, 



Adam Nagy
Autodesk Platform Services
0 Likes
Message 5 of 5

Raider_71
Collaborator
Collaborator
Accepted solution

Hi Adam,

 

Ok thats the answer then. Cant call it from another process - its a standalone application. My app is running out of process...

 

Thanks for getting back to me!

0 Likes