Notifications
Clear all

[Closed] Retrieving the 3dsMax File Thumbnail via DotNet

Hello All,

 I have just posted an article on my website sharing my research on trying to demonstrate the use of a thumbnail class for 3dsMax applications. 

 Please bear in mind it's just the solution I have found, and is by no means a perfect one. If you need any help getting it working, please ask, as I have not found it terribly straight forward myself when deploying on different computers. That said, I find the file thumbnail very useful. I have also considered extending it to be able to write summary info to maxfiles. Please let me know if that is something you would need and I can try to add it. 
 
 I hope it is of use to someone. I myself am using it in a few products I am hoping to release to the Max community in the near future. Unfortunately It's not x64 compatible yet, but I am hoping to add this functionality very soon and will provide updates when I can. The article explains a bit about this.
 
 read the info here -
 
 [ http://www.lonerobot.com/Thumb.html ]( http://www.lonerobot.com/Thumb.html) 
16 Replies

Awesome stuff… I needed a way to do this a while ago for something I can’t remember, but I’ll keep this in mind if I remember or if I need to do it again.

EDIT: 2 months later, now I remember! Thanks!

Nice Pete, interesting stuff, and not at ALL how I was trying to figure out how to do it. lol.

Great work!
I would love to be able to get the thumbnail but without registering external files…
Any way to do it?

Hi Jordan,

Unfortunately, The thumb is buried into the max file using structured storage, a lower level, unmanaged codebase that has not been granted acces to the dotnet framework currently. Because dsofile is a COM assembly it is unmanaged. The wrapper dll uses an interop assembly to expose the unmanaged resources to it’s managed dotnetframework environment. There have been similar issues in using the photoshop object library, another COM assembly.

Even using the interop assembly directly in max, you are forced with the prospect of at some point, it is not going to return the managed object you need and the interop gives you a reference to a system_COMobject.

I assume photoshop registers it’s object/type library when you install – it is possible i think to get visual studio to do this with an installer but i dont know how to do it.

I thought the new file menu in 2010 had implemented something to do with this, on perusal it appears it’s just caching the viewport to a bitmap and storing it in a folder in the max install folder.

So my wrapper dll is the only way I have seen of doing this with dotnet currently and or with any speed. Unless anyone was a bit nifty with the SDK and OLE structured storage.

Hi Pete,
I wanted to do this for a long time, thank you.
The problem is, on my computer everything works great
but on other computers I get this error message:

MAXScript Rollout Handler Exception: -- Runtime error: dotNet runtime exception: Could not load file or assembly 'stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. <<

do you have any idea what am I doing wrong?
thanks, Matan.

Hi Matan,

I had this problem on a few computers – stdole.dll should be on most. Try a search for it an copy it into the folder with the maxfile assembly I made.
They’re not x64 OS are they, by any chance?

actually, i’d just read the article again – it’s been a while! you might need to import
visualbasic.compatibility.dll also.

(It’s the bit of code in the assembly that converts the StdPicture object into a dotnetbitmap)

That was quick!
I already have stdole.dll in the folder
Some of the computers are x64 and some are not
I get the error on your example script too which has these lines on the top:

dotnet.LoadAssembly @"C:\Documents and Settings\Amir.VFX\Desktop	set\Interop.DSOFile.dll"
dotnet.LoadAssembly @"C:\Documents and Settings\Amir.VFX\Desktop	set\MaxFileInfo.dll"
dotnet.LoadAssembly @"C:\Documents and Settings\Amir.VFX\Desktop	set\Microsoft.VisualBasic.Compatibility.dll"

by the way, after getting this error message, the file is getting corrupted!

Ouch! Good job I put that disclaimer on eh?

I guess if something is going wrong, as the thumbnail is embedded into it, it’s creating the issue.

Did the step where you register DSOfile.dll go okay?

Page 1 / 2