Get Inventor Thumbnail image from webservice
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am trying to get Inventor Thumbnail image from files in a server using a webservice.
I have found in web the following article:
http://modthemachine.typepad.com/my_weblog/2010/06/accessing-thumbnail-images.html
And the code in this article works perfect when I tested it from a local Windows Application. I developed an sample in C# similar to the ones in VB and VB.NET available in article and works perfect. Here is my code:
private void button1_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = "Inventor Files (*.iam; *.idw; *.ide; *.ipt; *.ipn)|*.iam;*.idw;*.ide;*.ipt;*.ipn|Assembly Fiels (*.iam)|*.iam|Drawing Files (*.idw)|*.idw|iFeature Files (*.ide)|*.ide|Part Files (*.ipt)|*.ipt|Presentation Files (*.ipn)|*.ipn|All Files (*.*)|*.*"; dlg.ShowDialog(); string ls_sourceFileName = dlg.FileName; if (icl_thumbnailProvider == null) icl_thumbnailProvider = new InventorThumbnailViewLib.ThumbnailProvider(); if (icl_thumbnailProvider == null) return; int lcl_hCode = icl_thumbnailProvider.GetHashCode(); stdole.IPictureDisp lcl_pictureThumbnail = icl_thumbnailProvider.GetThumbnail(ls_sourceFileName); Image lcl_image = Microsoft.VisualBasic.Compatibility.VB6.Support.IPictureDispToImage(lcl_pictureThumbnail); pictureBox1.Image = lcl_image; }
The problem starts when I try to call the fuction GetThumbnail directly from an Webservice, that gives me the error "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))". Here is my code:
InventorThumbnailViewLib.ThumbnailProvider icl_thumbnailProvider = new InventorThumbnailViewLib.ThumbnailProvider(); if (icl_thumbnailProvider == null) return null; stdole.IPictureDisp lcl_pictureThumbnail = icl_thumbnailProvider.GetThumbnail(ls_sourceFileName); Image lcl_image = Microsoft.VisualBasic.Compatibility.VB6.Support.IPictureDispToImage(lcl_pictureThumbnail); MemoryStream ms = new MemoryStream(); lcl_image.Save(ms, System.Drawing.Imaging.ImageFormat.Gif); return ms.ToArray();
and the error appears exactly in line:
stdole.IPictureDisp lcl_pictureThumbnail = icl_thumbnailProvider.GetThumbnail(ls_sourceFileName);
What could be? There are some limitation of use this library from a webservice?
Thanks & Regards,
Rui