Hi to everybody
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
http://discussion.autodesk.com/thread.jspa?threadID=421943
Anyone has an idea? I do not have walls on which way to turn 😞
My scenario is: VS2K10 - Framework 4.0 - Windows 7 @ 64bit - Inventor 2K13 @ 64bit with Update 2 - last DeveloperTool @ 64bit
Thanks in advance
Dave
Solved! Go to Solution.
Solved by DaviPregna. Go to Solution.
Hi Dave,
You can try the Screenshot plug-in from the Exchange Store. It is provided with full source code and written in Vb.Net:
Regards,
Philippe.
Hi Philippe,
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 😄 )
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
Hope this helps,
Dave