<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Batch Export Images with transparent background in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249570#M35722</link>
    <description>&lt;P&gt;Hello! I am currently using an iLogic rule I found from some years back on this forum to batch export a large group of images. It would be ideal if these images could already have a transparent background when I export them, so I don't have to run another photoshop script to accomplish this. I know that some compression formats of .bmp support an alpha channel, but I'm not sure what all can be accomplished in Inventor, or if there's a rule to export as PNG which would make it much easier potentially. Any feedback would be greatly appreciated!&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports System.Windows.Forms
Imports System.IO

Sub Main
sResultPathImage = SelFolder(ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath) 'oDefaultPathImage)
sResultPathBatch = SelFolder(ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath) 'oDefaultPathBatch)

'Dim oHolderList As String
If sResultPathBatch &amp;lt;&amp;gt; "" Then
    Dim oFiles = Directory.GetFiles(sResultPathBatch, "*.IAM")
    For Each FileName As String In oFiles
        On Error Resume Next
        oDoc = ThisApplication.Documents.Open(FileName, True)
        Dim sPartNumber As String = oDoc.PropertySets("Design Tracking Properties")("Part Number").Value
        oCamera = InventorVb.Application.ActiveView.Camera
        oCamera.Fit
        oCamera.Apply
        oCamera.SaveAsBitmap(sResultPathImage &amp;amp; "\" &amp;amp; sPartNumber &amp;amp; ".bmp",2800,2000)
        oDoc.Close()
        oHolderList = oHolderList &amp;amp; sPartNumber &amp;amp; vbLf
    Next
End If
MessageBox.Show(oHolderList)
End Sub


Private Function SelFolder(sPath As String) As String
On Error Resume Next
    If sPath = "" Then sPath = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
    Dim FBrowserDialog As New FolderBrowserDialog
    FBrowserDialog.SelectedPath = sPath
    Dim result As DialogResult = FBrowserDialog.ShowDialog()
    SelFolder = ""
    If ( result = DialogResult.OK ) Then 'And ( FBrowserDialog.SelectedPath &amp;lt;&amp;gt; sPath ) Then
        SelFolder = FBrowserDialog.SelectedPath
    End If
End Function&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 21 Jun 2022 19:38:57 GMT</pubDate>
    <dc:creator>patioroofriser</dc:creator>
    <dc:date>2022-06-21T19:38:57Z</dc:date>
    <item>
      <title>Batch Export Images with transparent background</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249570#M35722</link>
      <description>&lt;P&gt;Hello! I am currently using an iLogic rule I found from some years back on this forum to batch export a large group of images. It would be ideal if these images could already have a transparent background when I export them, so I don't have to run another photoshop script to accomplish this. I know that some compression formats of .bmp support an alpha channel, but I'm not sure what all can be accomplished in Inventor, or if there's a rule to export as PNG which would make it much easier potentially. Any feedback would be greatly appreciated!&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports System.Windows.Forms
Imports System.IO

Sub Main
sResultPathImage = SelFolder(ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath) 'oDefaultPathImage)
sResultPathBatch = SelFolder(ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath) 'oDefaultPathBatch)

'Dim oHolderList As String
If sResultPathBatch &amp;lt;&amp;gt; "" Then
    Dim oFiles = Directory.GetFiles(sResultPathBatch, "*.IAM")
    For Each FileName As String In oFiles
        On Error Resume Next
        oDoc = ThisApplication.Documents.Open(FileName, True)
        Dim sPartNumber As String = oDoc.PropertySets("Design Tracking Properties")("Part Number").Value
        oCamera = InventorVb.Application.ActiveView.Camera
        oCamera.Fit
        oCamera.Apply
        oCamera.SaveAsBitmap(sResultPathImage &amp;amp; "\" &amp;amp; sPartNumber &amp;amp; ".bmp",2800,2000)
        oDoc.Close()
        oHolderList = oHolderList &amp;amp; sPartNumber &amp;amp; vbLf
    Next
End If
MessageBox.Show(oHolderList)
End Sub


Private Function SelFolder(sPath As String) As String
On Error Resume Next
    If sPath = "" Then sPath = ThisApplication.DesignProjectManager.ActiveDesignProject.WorkspacePath
    Dim FBrowserDialog As New FolderBrowserDialog
    FBrowserDialog.SelectedPath = sPath
    Dim result As DialogResult = FBrowserDialog.ShowDialog()
    SelFolder = ""
    If ( result = DialogResult.OK ) Then 'And ( FBrowserDialog.SelectedPath &amp;lt;&amp;gt; sPath ) Then
        SelFolder = FBrowserDialog.SelectedPath
    End If
End Function&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 21 Jun 2022 19:38:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249570#M35722</guid>
      <dc:creator>patioroofriser</dc:creator>
      <dc:date>2022-06-21T19:38:57Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export Images with transparent background</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249733#M35723</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Edit: this doesn't work woops&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;There's a transparency option when creating a color:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oColor&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Color&lt;/SPAN&gt;
&lt;SPAN&gt;oColor&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateColor&lt;/SPAN&gt;(255, 255, 255, 0)
&lt;SPAN&gt;'---&lt;/SPAN&gt;
&lt;SPAN&gt;'-------&lt;/SPAN&gt;
&lt;SPAN&gt;'----------&lt;/SPAN&gt;
&lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oCamera&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Camera&lt;/SPAN&gt;
&lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;sResultPathImage&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;sPartNumber&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".png"&lt;/SPAN&gt;, 2800, 2800, &lt;SPAN&gt;oColor&lt;/SPAN&gt;)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 21:40:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249733#M35723</guid>
      <dc:creator>dalton98</dc:creator>
      <dc:date>2022-06-21T21:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export Images with transparent background</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249753#M35724</link>
      <description>&lt;P&gt;This won't export with a transparent background though because it's a 24x bitmap. only 32x bitmaps have a transparency layer.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 21:11:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11249753#M35724</guid>
      <dc:creator>patioroofriser</dc:creator>
      <dc:date>2022-06-21T21:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export Images with transparent background</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11252433#M35725</link>
      <description>&lt;P&gt;If you use the function:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Camera_CreateImageWithOptions" target="_blank" rel="noopener"&gt;Camera.&lt;STRONG&gt;CreateImageWithOptions&lt;/STRONG&gt;( &lt;STRONG&gt;&lt;I&gt;Width&lt;/I&gt;&lt;/STRONG&gt; As Long, &lt;STRONG&gt;&lt;I&gt;Height&lt;/I&gt;&lt;/STRONG&gt; As Long, &lt;STRONG&gt;&lt;I&gt;Options&lt;/I&gt;&lt;/STRONG&gt; As NameValueMap ) As IPictureDisp&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;then there is an option according to the help files.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this will not give you a picture file but just an IPictureDisp object. You can convert those objects to Bitmap objects check this post:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://adndevblog.typepad.com/manufacturing/2012/06/how-to-convert-iconbitmap-to-ipicturedisp-without-visualbasiccompatibilityvb6supporticontoipicture.html" target="_blank"&gt;https://adndevblog.typepad.com/manufacturing/2012/06/how-to-convert-iconbitmap-to-ipicturedisp-without-visualbasiccompatibilityvb6supporticontoipicture.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe then it's possible to save the picture to a file. But I'm afraid this will be too much for an iLogic rule. I would suggest that you create an addin for this. You can find a tutorial for this on my blog.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.hjalte.nl/60-creating-an-inventor-addin" target="_blank"&gt;http://www.hjalte.nl/60-creating-an-inventor-addin&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;And in the follow-up post a converter Bitmap &amp;lt;-&amp;gt; IPictureDisp is used for creating buttons. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.hjalte.nl/61-adding-icons-to-your-buttons" target="_blank"&gt;http://www.hjalte.nl/61-adding-icons-to-your-buttons&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe it will help you but I guess it won't be easy and in the end I'm not sure it will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jun 2022 20:46:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11252433#M35725</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2022-06-22T20:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: Batch Export Images with transparent background</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11252945#M35726</link>
      <description>&lt;P&gt;This might be helpful to you:-&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;'Get the active view.&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oView&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;
&lt;SPAN&gt;'Create a new NameValueMap Object&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oOptions&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;NameValueMap&lt;/SPAN&gt;
    &lt;SPAN&gt;oOptions&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;TransientObjects&lt;/SPAN&gt;.&lt;SPAN&gt;CreateNameValueMap&lt;/SPAN&gt; &lt;SPAN&gt;'.TransientObjects.CreateNameValueMap&lt;/SPAN&gt;
    &lt;SPAN&gt;oOptions&lt;/SPAN&gt;.&lt;SPAN&gt;Value&lt;/SPAN&gt;(&lt;SPAN&gt;"TransparentBackground"&lt;/SPAN&gt;) = &lt;SPAN&gt;True&lt;/SPAN&gt;

&lt;SPAN&gt;'save screenshot &lt;/SPAN&gt;
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oView&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmapWithOptions&lt;/SPAN&gt;(&lt;SPAN&gt;CurrentFile&lt;/SPAN&gt;, 0, 0, &lt;SPAN&gt;oOptions&lt;/SPAN&gt;)&lt;/PRE&gt;</description>
      <pubDate>Thu, 23 Jun 2022 03:31:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/batch-export-images-with-transparent-background/m-p/11252945#M35726</guid>
      <dc:creator>Tony_Yates</dc:creator>
      <dc:date>2022-06-23T03:31:42Z</dc:date>
    </item>
  </channel>
</rss>

