• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    New Member
    Posts: 2
    Registered: ‎10-15-2012
    Accepted Solution

    HELP to get a snapshot of an .ipt file inside Inventor

    189 Views, 2 Replies
    10-15-2012 05:29 AM

    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://forums.autodesk.com/t5/Autodesk-Inventor-Customization/obtain-thumbnail-image/m-p/2664182/hig...

     

    http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Create-JPEG-of-Drawing-idw-through-Inv...

     

    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

    Please use plain text.
    ADN Support Specialist
    Posts: 176
    Registered: ‎06-02-2009

    Re: HELP to get a snapshot of an .ipt file inside Inventor

    10-22-2012 12:28 AM in reply to: DaviPregna

    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:

     

    http://apps.exchange.autodesk.com/INVNTOR/2013/en/Detail/Index?id=autodesk.appstore.exchange.autodes...

     

    Regards,

    Philippe.



    Philippe Leefsma
    Developer Technical Services
    Autodesk Developer Network

    Please use plain text.
    New Member
    Posts: 2
    Registered: ‎10-15-2012

    Re: HELP to get a snapshot of an .ipt file inside Inventor

    10-22-2012 02:03 AM in reply to: philippe.leefsma

    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 :-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

     

    Hope this helps,

    Dave

    Please use plain text.