I'm developing a VB.NET framework 4.0 that must works with Inventor 2013 and Vault.
My *BIG* problem is to obtain a simply image (bmp, jpeg, whatever you want) of the ActiveDocument in Inventor when the user add the file inside Vault (VaultCheckinTop) - my goal is to create a detail technical pdf report and store it in our database.
I'm able to create ALL (get iProperties, etc) but i cannot take a snapshot of the ActiveDocument.
I've tried both Apprentice way and ClientView way registering the old-know "InventorThumbnailViewLib", without success.
I cannot (and i don't want!!) use the VisualBasic.Compatibility method because it's ultra-deprecated, and i cannot use too the VBA scripting because my application it's create in VB.NET.
An idea (but i don't know how to do) is to replicate in "silent mode" at runtime the "Export to Immage" command of Inventor.
I have read all similar post found on the net, without success
thanks for the solution. Your is a good solution, but it's too heavy for a automation procedure.
I solved it grabbing first the thumbnail of the Inventor file as stdole.iPicture, and then convert it from iPicture to a valid image. This way it's the better for my scenario because i have "exactly" what Inventor stores, and at the same time the Designer must do NOTHING because the grabbing is done silently at substrate-level! (....and most of all i have no human errors :-D )
Also i don't have problem with 32 bit/ 64 bit machines and i don't need the terrible VB6.Compatibility!!!
Here there is my piece of code:
''''get the ActiveDocument Thumbnail Dim oThumb As stdole.IPictureDisp = m_App.ActiveDocument.Thumbnail Dim oMF As New Metafile(New IntPtr(oThumb.Handle), New WmfPlaceableFileHeader()) Dim oCallBack As New Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback) Dim org As Image = oMF.GetThumbnailImage(400, 400, oCallBack, IntPtr.Zero)
''''a color image imgThumb = New Bitmap(org.Width, org.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) imgThumb.SetResolution(org.HorizontalResolution, org.VerticalResolution) Dim g As Graphics = Graphics.FromImage(imgThumb) g.DrawImage(org, 0, 0) g.Dispose()
''' now imgThumb is a normal image that it can be saved, printed o loaded into a PictureBox