Largely due to the efforts of Mick Deck this fix is possible.
As stated in other threads 64 bit Inventor runs VBA as a sub 32 bit process. The iPictureDisp format of the document thumbnail cannot be accessed across this barrier.
The solution is to use VBA code to cause Inventor to fire an event that we can capture with an Add-in, Inside the event we convert the thumbnail data into string data and pass it back to VBA where it is reconstitued into a stdPicture object for our use.
The Windows clipboard is used for input and output to the add-in event process.
Attached is the VB.NET project to create the add-in dll.
The standard version of VB.NET 2010 was used to create this project. If you are using VB.NET 2010 express then you will have to use Notepad to open and copy the relavent code to your express project.
If you do not need the source code then the compiled dll is under the ThumbNailFix64Bit\ThumbNailFix64Bit\bin\Release Folder in the project folders. Likewise the Autodesk.ThumbNailFix64Bit.Inventor.addin file is located under the ThumbNailFix64Bit\ThumbNailFix64Bit project folder.
As I was working with Inventor 2011 that is the version this fix addresses. If you are using 2012 then you will have to change the Inventor.Interop file to point to 2012 and recompile.
Copy the dll to your Autodesk\Inventor 2011 bin folder and the .addin file to your 2011 Addin folder.
Make sure the addin shows up in inventor when inventor is opened. Make sure the Load/Unload checkbox is checked.
Open your VBA edtor and create a new Module. I name mine bas_64bit _tools. Paste the text from the attached text file into the module. Call the Get64BitPicture(() function from anywhere inside your VBA project.
For use on both 32 bit and 64 workstations I use the the following snippet..
Set oDoc = ThisApplication.Documents.ItemByName(Path)
If ThisApplication.SoftwareVersion.Is64BitVersion Then
Set Pic1.Picture = Get64BitPicture(oDoc.FullFileName)
Else
Set Pic1.Picture = oDoc.Thumbnail
End If
Thanks for a lot of hardwork to fix this, may I ask for a favour, since I dont have access to VB to recompile for 2012, is there any chance that you could make this to work with inventor pro 2012 (factory design suite)? I'm in a bad situation to make it work , I'm using VBA and I badly need thumbnail , otherwise the user have serious issue to figure out which part/assembly he is dealing with when using VBA interface. I tried to use this for 2012, but it didnt work, ad it didnt even appeared in add in list, I tried to register the dll manually, it didint work either, so I guess the only way is recomplie one for 2012.
any help is appreciated in advance.
p.s. I know you spent a fair amount of time on this for a solution, how ever, I was thinking if ilogic was capable of capturing thumbnail and save it into a file as bmp or jpeg, this would considered as internal process (64bit), not a second thread or host, then it was easy to read that created image file in VBA into a image control and once you are done with it , kill it. would you mind enlighten me if I'm wrong or this would never work due to ilogic capacity?
Thanks a million
Ali
hi,
just wondering where addin folder in inventor 2010? i spent half day and can not see it. anyone can point me out? thanks
invetnor 2010 & windwo 7
3DAli:
Thanks a lot Gruff, I really appreciate your help and I highly value what you have done so far as I read all those back and forth between you and Autodesk gurus. just a heads up on location of addins in 2012, I found then here "C:\Program Files\Autodesk\AutoCAD Mechanical 2012\Inventor Server\Bin\Addins" its a bit odd to me though.
All the bets
Sincerely
Ali
thanks for reply. everything runs well in inventor 2012 and 2011.
but i have another machine with inventor 2010. I dont see any addin folder. maybe you are right, they dont have addin folder in inventor 2010. thanks again.
I have just tested this and it works fine in 2012 and should have no problems in 2011 either, as far as 2010 goes you will have to have this converted to be a non registry free add-in for that to work. I did recompile it in .NET 3.5 and attached it and the attached also works in 2012 + 1 as well.
Thanks a lot, I'm goanna try it right now, its 12:24 Toronto time, but I'm up and working on it and so excited to see it works. the older version posted previously for 2011 is giving me some problem with this runtime error code 800401d0 which it's related to clipboard, but when I hit the debug and run again it works, some times even without any problem, but some time it gives me hassle, hope the one that you just sent works fine, cause I know this is a problem with Netframe, lets see, will get back to you shortly.
Cheers
Ali
just added this delay and now it runs problem free, funny though but it works,
"Public Function ClipGet() As String
' Read from the Windows Clipboard from VBA
Dim DataObj As New msforms.DataObject
Dim PauseTime, Start
PauseTime = 0.25 ' Set duration in seconds
Start = Timer ' Set start time.
Do While Timer < Start + PauseTime
DoEvents ' Yield to other processes.
Loop
DataObj.GetFromClipboard
ClipGet = DataObj.GetText(1)
End Function"
hi,
thanks for your help. it works great on 2012.
where should i put addin file into for inventor 2010? on the readme, i dont see any instruction for inventor 2010
All programs for Wkndows needed to be registered for windows until recently.
When you compiled the old style DLL addin, or when the DLL was regestered with windows when you ran a program install package. You could also manually register a program with RegSvr32.exe,.
Autodesk came up with the Registration Free system where you do not need to jump through those hoops.
You simply put the compiled DLL in the Inventor Bin folder and the Addin in the Addin folder.
If 2010 still uses the old registration method then you do not manually move any files at all.
On the machine you compiled the DLL on you should be able to see it inside Inventor under the addins menu.
The same if you created an install package and installed the DLL to another PC.
thanks for the clarification.
In inventor 2010, I have to use Registration then. there will be a little more work but can be done.
thanks again.
P.S. Do not run VB.NET and Inventor at the same time when testing out your addin. Close the one your not curently using.
Pretty sure Autodesk went to 64 bit VBA in 2014 or 2015. The addin is no longer needed as far as I know.
P.S. 64 bit VBA 7 will require you to use some new data types if you make any Windows API calls via declare statements.
Thank you Gruff, thats right, everything went back to normal now, just the way we used to do back in 32 bit days 🙂 I fixed my codes and they work just fine. I would like to share couple of cool macros that I have developed over the years with you guys , I was wondering if you can connect me to some one at Autodesk lab.