Issue
We use automation to start the Navisworks manage and then create a snapshot by CreatePicture. This program worked on 32bits, but failed on 64bits OS.
Solution CreatePicture can only be used by in-process application because the output is IPictureDisp which cannot be passed across process boundaries. The MSDN knowledge base tells more: http://support.microsoft.com/kb/150034/en-us Following is the code snippet of a .NET plugin.
using Autodesk.Navisworks.Api;
using Autodesk.Navisworks.Api.Plugins;
using ComApi = Autodesk.Navisworks.Api.Interop.ComApi;
using ComApiBridge = Autodesk.Navisworks.Api.ComApi;
void createPic()
{
ComApi.InwOpState10 state;
state = ComApiBridge.ComApiBridge.State;
stdole.IPictureDisp img;
IntPtr hbitmap;
System.Drawing.Bitmap bm = null;
img = (stdole.IPictureDisp)state.CreatePicture(state.CurrentView, null, 640, 800);
if (img.Handle != 0)
{
hbitmap = new System.IntPtr(img.Handle);
bm = System.Drawing.Bitmap.FromHbitmap(hbitmap);
bm.Save("c:\\dem_test.bmp");
}
img = null;
}