LDraw.org Discussion Forums

Full Version: [LDView?] Programatically generate snapshots
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I've never worked with LDView before, but after installing it and playing around with it, it looks like it fulfills a need I have for a project I'm working on.

I'd like to generate rendered snapshots (either in memory or saved to disk) of a part (.DAT file) from different camera angles by making calls to a DLL (LDVLib.dll I think).

The application I'm working with is C#, so if there's any existing wrapper that exposes library calls then having that would be a great start. Otherwise I'll probably end up writing my own, so long as it looks possible to do after I look at the header files.

Any guidance, experiences, or even questions would be greatly appreciated.

LDVLib.dll can definitely be accessed from C#. That's what my personal test program used. But there's no public wrapper, just the C header file, which people who know how to do C#/C interop can use to create the C# DllImport declarations necessary to make it work.

However, the point is probably moot, because it doesn't support snapshots. They are definitely something that's on my list if I ever get around to working on it again, but that functionality doesn't exist right now.
Jon Carbone Wrote:I'd like to generate rendered snapshots (either in memory or saved to disk) of a part (.DAT file) from different camera angles

If it is just for the snapshots you're looking for batchfiling LDView might helps:


Willy has a point. If the command line camera support works, then you can take that route.

I tracked down my old C# test program for LDVLib. I'm not sure if it still works, but its VS2010 source code is here:


Note that you have to manually copy LDVLib.dll into the same directory that the .exe file is in before you run the program. As I already mentioned, LDVLib itself won't let you take snapshots. You can do a screen capture of the LDVLib rendering window, but you have to be absolutely sure that nothing else is obscuring it, and you would be limited to image sizes that fit on the screen.