<?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 Re: Save as bmp in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615380#M12840</link>
    <description>&lt;P&gt;I actually tried it, but to be honest I do most of my coding with ChatGPT. It was deleted during the changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an error when I try to add the code. When I write it this way, I get this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; "Error on line 42 in rule: Rule12, in document: Assembly1.iam&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; No public member 'PathAndFileName' of type 'AssemblyDocument' was found."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I'm doing something wrong somewhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt;
    &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

    &lt;SPAN&gt;' If the active document is not an assembly file, display a warning and exit the subroutine&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"This rule can only be run from an assembly file."&lt;/SPAN&gt;, &lt;SPAN&gt;vbExclamation&lt;/SPAN&gt;, &lt;SPAN&gt;"Error"&lt;/SPAN&gt;)
        &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

    &lt;SPAN&gt;' Get the name and path of the assembly file&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPath&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;oPath&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Get the view of the assembly&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;View&lt;/SPAN&gt;
    &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;

    &lt;SPAN&gt;' Configure camera settings&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;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Camera&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ViewOrientationType&lt;/SPAN&gt; = &lt;SPAN&gt;kIsoTopRightViewOrientation&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ApplyWithoutTransition&lt;/SPAN&gt;
    &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Fit&lt;/SPAN&gt;

    &lt;SPAN&gt;' Save the view as a BMP image with specific resolution&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; = 350
    &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; = 270
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;saveName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;saveName&lt;/SPAN&gt; = &lt;SPAN&gt;oPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_AssemblyImage.bmp"&lt;/SPAN&gt;
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;saveName&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionX&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionY&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Save the view using the camera settings&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ViewOrientationType&lt;/SPAN&gt; = &lt;SPAN&gt;ViewOrientationTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kIsoTopRightViewOrientation&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ApplyWithoutTransition&lt;/SPAN&gt;()
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;Fit&lt;/SPAN&gt;()
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PathAndFileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;) &amp;amp; &lt;SPAN&gt;".bmp"&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionX&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionY&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 05 Mar 2024 10:24:18 GMT</pubDate>
    <dc:creator>ebaras</dc:creator>
    <dc:date>2024-03-05T10:24:18Z</dc:date>
    <item>
      <title>Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12610927#M12833</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello everyone. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I created a code based on the following topic and ChatGPT. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-programming-ilogic/save-as-jpeg/m-p/11311121#M140470" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;Save as jpeg"&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;saveName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;PartDocument&lt;/SPAN&gt;
    &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;View&lt;/SPAN&gt;
    &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&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;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Camera&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ViewOrientationType&lt;/SPAN&gt; = &lt;SPAN&gt;kIsoTopRightViewOrientation&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ApplyWithoutTransition&lt;/SPAN&gt;
    &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Fit&lt;/SPAN&gt;

    &lt;SPAN&gt;saveName&lt;/SPAN&gt; = &lt;SPAN&gt;Left$&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullDocumentName&lt;/SPAN&gt;, &lt;SPAN&gt;Len&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullDocumentName&lt;/SPAN&gt;) -4)
	
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; = 350
    &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; = 270

    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;saveName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;".bmp"&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionX&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionY&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;With this code, I currently have two issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;I cannot run this code in the assembly file.&amp;nbsp;How can we adjust the code to work in assembly files as well?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;The quality of the images I'm getting as output is poor. It's important for the output images to have dimensions of 350x270 px, but they look bad at this size. Can we fix this?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;I think that's all for now. If I can find solutions to these, I'd like to add the functionality to extract images from tables as well, but that's a job for later, I guess.&amp;nbsp;But if you have any knowledge about this, please share.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 13:52:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12610927#M12833</guid>
      <dc:creator>ebaras</dc:creator>
      <dc:date>2024-03-04T13:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12611045#M12834</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10544300"&gt;@ebaras&lt;/a&gt;.&amp;nbsp; Why is that exact size so important?&amp;nbsp; If it is super important, then you may have to scale and/or crop the image after capturing it, instead of as you are capturing it.&amp;nbsp; It is usually best to maintain the aspect ratio of the view window's size (&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=View_Height" target="_blank" rel="noopener"&gt;View.Height&lt;/A&gt;&amp;nbsp;&amp;amp; &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=View_Width" target="_blank" rel="noopener"&gt;View.Width&lt;/A&gt;) in the output image file, otherwise the output image may get squished in one direction, or both directions, making it not look good.&amp;nbsp; You could also try using the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=Camera_SaveAsBitmap" target="_blank" rel="noopener"&gt;Camera.SaveAsBitmap&lt;/A&gt;&amp;nbsp;method, instead of the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=View_SaveAsBitmap" target="_blank" rel="noopener"&gt;View.SaveAsBitmap&lt;/A&gt; method, but I do not recall if that would make much difference in a situation like that.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 14:39:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12611045#M12834</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-03-04T14:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12611401#M12835</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10544300"&gt;@ebaras&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;With this code, I currently have two issues.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;SPAN&gt;I cannot run this code in the assembly file.&amp;nbsp;How can we adjust the code to work in assembly files as well?&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;The quality of the images I'm getting as output is poor. It's important for the output images to have dimensions of 350x270 px, but they look bad at this size. Can we fix this?&lt;/LI&gt;&lt;/OL&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10544300"&gt;@ebaras&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I'm answering your question about first point ("code in the assembly"), I did a cleanup of your original code taking care about &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;suggestions (this doesn't change anything about what already said &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;on image resolution).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim oCamera As Camera = ThisApplication.ActiveView.Camera
oCamera.ViewOrientationType = ViewOrientationTypeEnum.kIsoTopRightViewOrientation
oCamera.ApplyWithoutTransition()
oCamera.Fit()

Dim resolutionX As Integer = 350
Dim resolutionY As Integer = 270

Call oCamera.SaveAsBitmap(ThisDoc.PathAndFileName(False) &amp;amp; ".bmp", resolutionX, resolutionY)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 15:28:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12611401#M12835</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2024-03-04T15:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12611512#M12836</link>
      <description>&lt;P&gt;Yes, that would work pretty well, if the only need is to capture an image of the main assembly or of a part.&amp;nbsp; But if images of all the assembly's referenced model documents are also needed, that would complicate things a lot more, because each of those referenced model documents would need to be 'visibly' opened as the active document on your screen before capturing the images.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2024 15:45:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12611512#M12836</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-03-04T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12614739#M12837</link>
      <description>&lt;P&gt;First of all, thank you both for your responses. :))&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Size matters because I'll be uploading the outputs to another system. But as you said, you've given me some ideas about scaling. I've tried scaling a few times, but I got an 'unsupported' error in the outputs. The issue might not be related to scaling, I'm not sure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Additionally, I found the attached code online. The code opens each product in the assembly file, extracts their profiles, and saves them in DXF format.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is what I want. That is, to open the models in the assembly file, capture their images from specific -or home- angles, and save them in BMP format.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm trying some things but I'm curious if it'll work...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 06:46:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12614739#M12837</guid>
      <dc:creator>ebaras</dc:creator>
      <dc:date>2024-03-05T06:46:13Z</dc:date>
    </item>
    <item>
      <title>Ynt: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12614822#M12838</link>
      <description>&lt;P&gt;The code line seems a bit more understandable compared to yesterday. However, functionally, it's still the same. I'll try more today.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried scaling attempts, but kept getting errors each time.&lt;/P&gt;&lt;P&gt;Also, I still haven't figured out how to open and close the models in the tables within the assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here's the final version;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt;
    &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

    &lt;SPAN&gt;' If the active document is not an assembly file, display a warning and exit the subroutine&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"This rule can only be run from an assembly file."&lt;/SPAN&gt;, &lt;SPAN&gt;vbExclamation&lt;/SPAN&gt;, &lt;SPAN&gt;"Error"&lt;/SPAN&gt;)
        &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

    &lt;SPAN&gt;' Get the name and path of the assembly file&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPath&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;oPath&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Get the view of the assembly&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;View&lt;/SPAN&gt;
    &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;

    &lt;SPAN&gt;' Configure camera settings&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;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Camera&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ViewOrientationType&lt;/SPAN&gt; = &lt;SPAN&gt;kIsoTopRightViewOrientation&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ApplyWithoutTransition&lt;/SPAN&gt;
    &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Fit&lt;/SPAN&gt;

    &lt;SPAN&gt;' Save the view as a BMP image with specific resolution&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; = 350
    &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; = 270
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;saveName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;saveName&lt;/SPAN&gt; = &lt;SPAN&gt;oPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_AssemblyImage.bmp"&lt;/SPAN&gt;
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;saveName&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionX&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionY&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 07:37:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12614822#M12838</guid>
      <dc:creator>ebaras</dc:creator>
      <dc:date>2024-03-05T07:37:30Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615070#M12839</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10544300"&gt;@ebaras&lt;/a&gt;&amp;nbsp;&amp;nbsp;you assigned "ActiveDocument" to "oDoc" before checking out "DocumentType" and this is not a good idea.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tought to suggest you some adjustments to your code, but you didn't use anything about my last code tips.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 09:12:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615070#M12839</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2024-03-05T09:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615380#M12840</link>
      <description>&lt;P&gt;I actually tried it, but to be honest I do most of my coding with ChatGPT. It was deleted during the changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get an error when I try to add the code. When I write it this way, I get this error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; "Error on line 42 in rule: Rule12, in document: Assembly1.iam&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; No public member 'PathAndFileName' of type 'AssemblyDocument' was found."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think I'm doing something wrong somewhere.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;Sub&lt;/SPAN&gt; &lt;SPAN&gt;Main&lt;/SPAN&gt;()
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;AssemblyDocument&lt;/SPAN&gt;
    &lt;SPAN&gt;oDoc&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveDocument&lt;/SPAN&gt;

    &lt;SPAN&gt;' If the active document is not an assembly file, display a warning and exit the subroutine&lt;/SPAN&gt;
    &lt;SPAN&gt;If&lt;/SPAN&gt; &lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;DocumentType&lt;/SPAN&gt; &amp;lt;&amp;gt; &lt;SPAN&gt;kAssemblyDocumentObject&lt;/SPAN&gt; &lt;SPAN&gt;Then&lt;/SPAN&gt;
        &lt;SPAN&gt;MsgBox&lt;/SPAN&gt;(&lt;SPAN&gt;"This rule can only be run from an assembly file."&lt;/SPAN&gt;, &lt;SPAN&gt;vbExclamation&lt;/SPAN&gt;, &lt;SPAN&gt;"Error"&lt;/SPAN&gt;)
        &lt;SPAN&gt;Exit&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;
    &lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;If&lt;/SPAN&gt;

    &lt;SPAN&gt;' Get the name and path of the assembly file&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetFileNameWithoutExtension&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oPath&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;oPath&lt;/SPAN&gt; = &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;IO&lt;/SPAN&gt;.&lt;SPAN&gt;Path&lt;/SPAN&gt;.&lt;SPAN&gt;GetDirectoryName&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;FullFileName&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Get the view of the assembly&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;View&lt;/SPAN&gt;
    &lt;SPAN&gt;oActiveView&lt;/SPAN&gt; = &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;

    &lt;SPAN&gt;' Configure camera settings&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;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Camera&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ViewOrientationType&lt;/SPAN&gt; = &lt;SPAN&gt;kIsoTopRightViewOrientation&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ApplyWithoutTransition&lt;/SPAN&gt;
    &lt;SPAN&gt;ThisApplication&lt;/SPAN&gt;.&lt;SPAN&gt;ActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;Fit&lt;/SPAN&gt;

    &lt;SPAN&gt;' Save the view as a BMP image with specific resolution&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;Integer&lt;/SPAN&gt;
    &lt;SPAN&gt;resolutionX&lt;/SPAN&gt; = 350
    &lt;SPAN&gt;resolutionY&lt;/SPAN&gt; = 270
    &lt;SPAN&gt;Dim&lt;/SPAN&gt; &lt;SPAN&gt;saveName&lt;/SPAN&gt; &lt;SPAN&gt;As&lt;/SPAN&gt; &lt;SPAN&gt;String&lt;/SPAN&gt;
    &lt;SPAN&gt;saveName&lt;/SPAN&gt; = &lt;SPAN&gt;oPath&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"\"&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;oAsmName&lt;/SPAN&gt; &amp;amp; &lt;SPAN&gt;"_AssemblyImage.bmp"&lt;/SPAN&gt;
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oActiveView&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;saveName&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionX&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionY&lt;/SPAN&gt;)

    &lt;SPAN&gt;' Save the view using the camera settings&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ViewOrientationType&lt;/SPAN&gt; = &lt;SPAN&gt;ViewOrientationTypeEnum&lt;/SPAN&gt;.&lt;SPAN&gt;kIsoTopRightViewOrientation&lt;/SPAN&gt;
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;ApplyWithoutTransition&lt;/SPAN&gt;()
    &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;Fit&lt;/SPAN&gt;()
    &lt;SPAN&gt;Call&lt;/SPAN&gt; &lt;SPAN&gt;oCamera&lt;/SPAN&gt;.&lt;SPAN&gt;SaveAsBitmap&lt;/SPAN&gt;(&lt;SPAN&gt;oDoc&lt;/SPAN&gt;.&lt;SPAN&gt;PathAndFileName&lt;/SPAN&gt;(&lt;SPAN&gt;False&lt;/SPAN&gt;) &amp;amp; &lt;SPAN&gt;".bmp"&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionX&lt;/SPAN&gt;, &lt;SPAN&gt;resolutionY&lt;/SPAN&gt;)
&lt;SPAN&gt;End&lt;/SPAN&gt; &lt;SPAN&gt;Sub&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 10:24:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615380#M12840</guid>
      <dc:creator>ebaras</dc:creator>
      <dc:date>2024-03-05T10:24:18Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615900#M12841</link>
      <description>&lt;P&gt;I did tests of my code before submission and work perfectly, but if chatGPT is the Master.... Ok, go with it and good luck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 12:06:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615900#M12841</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2024-03-05T12:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615955#M12842</link>
      <description>&lt;P&gt;It sounds like I've been misunderstanding myself. I really don't understand the iLogic, and I'm trying to do something.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, the code you provided helps me to take a pic, but it doesn't do the other things I want. As I try to add more things, the values change.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I saw your code and that's why I'm grateful. But I'm trying to add other things as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for your well wishes and contribution.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2024 12:20:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12615955#M12842</guid>
      <dc:creator>ebaras</dc:creator>
      <dc:date>2024-03-05T12:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12616374#M12843</link>
      <description>&lt;P&gt;Ok, have a nice day.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2024 18:17:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/12616374#M12843</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2024-03-06T18:17:45Z</dc:date>
    </item>
    <item>
      <title>Ynt: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/13383579#M12844</link>
      <description>&lt;P&gt;After all this time I finally found a solution. It will be almost 1 year. :d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sharing it below. Maybe it will be useful for someone. :))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;' Autodesk Inventor BMP Generation for IAM
' 14.03.2025 - ebaras - v2
Dim BMPFolder As String = "C:\Inventor_BMPs\"
Dim oAssemblyDoc As AssemblyDocument = ThisApplication.ActiveDocument
Dim oFactory As iAssemblyFactory = oAssemblyDoc.ComponentDefinition.iAssemblyFactory
Dim rowCount As Integer = oFactory.TableRows.Count
Dim oCompDef As ComponentDefinition = oAssemblyDoc.ComponentDefinition

' Create BMP folder if it doesn't exist
If Not System.IO.Directory.Exists(BMPFolder) Then
    System.IO.Directory.CreateDirectory(BMPFolder)
End If

' Temporarily hide origin and work features
Dim origPlaneVis As New Dictionary(Of WorkPlane, Boolean)
For Each plane As WorkPlane In oCompDef.WorkPlanes
    origPlaneVis.Add(plane, plane.Visible)
    plane.Visible = False
Next

Dim origAxisVis As New Dictionary(Of WorkAxis, Boolean)
For Each axis As WorkAxis In oCompDef.WorkAxes
    origAxisVis.Add(axis, axis.Visible)
    axis.Visible = False
Next

Dim origPointVis As New Dictionary(Of WorkPoint, Boolean)
For Each point As WorkPoint In oCompDef.WorkPoints
    origPointVis.Add(point, point.Visible)
    point.Visible = False
Next

' Only hide the Origin Indicator (bottom-left XYZ axis)
Dim oDisplayOptions As DisplayOptions = ThisApplication.DisplayOptions
Dim origOriginIndicator As Boolean = oDisplayOptions.Show3DIndicator
oDisplayOptions.Show3DIndicator = False

' Process each iAssembly member
For i As Integer = 1 To rowCount
    oFactory.DefaultRow = oFactory.TableRows.Item(i)
    oAssemblyDoc.Update()
    ThisApplication.ActiveView.Update()

    ' Fit camera view to model
    Dim oCamera As Camera = ThisApplication.ActiveView.Camera
    oCamera.Fit()
    oCamera.Apply()
    ThisApplication.ActiveView.Update()

    ' Save BMP
    Dim currentMemberName As String = oFactory.DefaultRow.MemberName
    Dim BMPName As String = BMPFolder &amp;amp; currentMemberName &amp;amp; ".bmp"
    ThisApplication.ActiveView.SaveAsBitmap(BMPName, 1920, 1080)
Next

' Restore visibility of origin and work features
For Each plane As WorkPlane In oCompDef.WorkPlanes
    plane.Visible = origPlaneVis(plane)
Next

For Each axis As WorkAxis In oCompDef.WorkAxes
    axis.Visible = origAxisVis(axis)
Next

For Each point As WorkPoint In oCompDef.WorkPoints
    point.Visible = origPointVis(point)
Next

' Restore Origin Indicator visibility
oDisplayOptions.Show3DIndicator = origOriginIndicator

' Completion message
MessageBox.Show("BMP files created successfully without Origin Indicator!", "Completed")&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 21 Mar 2025 13:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/13383579#M12844</guid>
      <dc:creator>ebaras</dc:creator>
      <dc:date>2025-03-21T13:53:10Z</dc:date>
    </item>
    <item>
      <title>Ynt: Save as bmp</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/13386932#M12845</link>
      <description>&lt;P&gt;I would like to suggest you to add some checks to your code, to make it more stable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;' Autodesk Inventor BMP Generation for IAM
' 14.03.2025 - ebaras - v2
' -
' 24.03.2025 - Rossano Praderi - Some suggestions to make your code more stable

Dim BMPFolder As String = "C:\Inventor_BMPs\"

' suggestion: A good practice is to check the document type before proceed
If ThisApplication.ActiveDocumentType.Equals(Inventor.DocumentTypeEnum.kAssemblyDocumentObject) Then
	Dim oAssemblyDoc As AssemblyDocument = ThisApplication.ActiveDocument
	
	' suggestion: A good practice is to check if is an IAssemblyFactory before proceed
	If oAssemblyDoc.ComponentDefinition.IsiAssemblyFactory Then
		Dim oFactory As iAssemblyFactory = oAssemblyDoc.ComponentDefinition.iAssemblyFactory
		Dim rowCount As Integer = oFactory.TableRows.Count
		Dim oCompDef As ComponentDefinition = oAssemblyDoc.ComponentDefinition

' ORIGINAL CODE
'
		' Create BMP folder if it doesn't exist
'		If Not System.IO.Directory.Exists(BMPFolder) Then
'		    System.IO.Directory.CreateDirectory(BMPFolder)
'		End If
'
' suggested: Is not necessary to check if a Folder Exists
'			"CreateDirectory" create all the directories unless they already exists
'			good practice is to check it by catching exceptions
'			your original code doesn't catch exceptions, for reference see the follow link
'			https://learn.microsoft.com/en-us/dotnet/api/system.io.directory.createdirectory
' SUGGESTED CODE
'
		Dim result As Boolean
		Try 
			Dim di As System.IO.DirectoryInfo = System.IO.Directory.CreateDirectory(BMPFolder) 
			result = di.Exists
		Catch
			result = False
		End Try
		If result = True Then
' END OF SUGGESTED CODE
	
			' Temporarily hide origin and work features
			Dim origPlaneVis As New Dictionary(Of WorkPlane, Boolean)
			For Each plane As WorkPlane In oCompDef.WorkPlanes
			    origPlaneVis.Add(Plane, Plane.Visible)
			    Plane.Visible = False
			Next

			Dim origAxisVis As New Dictionary(Of WorkAxis, Boolean)
			For Each axis As WorkAxis In oCompDef.WorkAxes
			    origAxisVis.Add(axis, axis.Visible)
			    axis.Visible = False
			Next

			Dim origPointVis As New Dictionary(Of WorkPoint, Boolean)
			For Each point As WorkPoint In oCompDef.WorkPoints
			    origPointVis.Add(Point, Point.Visible)
			    Point.Visible = False
			Next

			' Only hide the Origin Indicator (bottom-left XYZ axis)
			Dim oDisplayOptions As DisplayOptions = ThisApplication.DisplayOptions
			Dim origOriginIndicator As Boolean = oDisplayOptions.Show3DIndicator
			oDisplayOptions.Show3DIndicator = False

			' Process each iAssembly member
			For i As Integer = 1 To rowCount
			    oFactory.DefaultRow = oFactory.TableRows.Item(i)
			    oAssemblyDoc.Update()
			    ThisApplication.ActiveView.Update()

			    ' Fit camera view to model
			    Dim oCamera As Camera = ThisApplication.ActiveView.Camera
			    oCamera.Fit()
			    oCamera.Apply()
			    ThisApplication.ActiveView.Update()

			    ' Save BMP
			    Dim currentMemberName As String = oFactory.DefaultRow.MemberName
			    Dim BMPName As String = BMPFolder &amp;amp; currentMemberName &amp;amp; ".bmp"
			    ThisApplication.ActiveView.SaveAsBitmap(BMPName, 1920, 1080)
			Next

			' Restore visibility of origin and work features
			For Each plane As WorkPlane In oCompDef.WorkPlanes
			    Plane.Visible = origPlaneVis(Plane)
			Next

			For Each axis As WorkAxis In oCompDef.WorkAxes
			    axis.Visible = origAxisVis(axis)
			Next

			For Each point As WorkPoint In oCompDef.WorkPoints
			    Point.Visible = origPointVis(Point)
			Next

			' Restore Origin Indicator visibility
			oDisplayOptions.Show3DIndicator = origOriginIndicator

			' Completion message
			MessageBox.Show("BMP files created successfully without Origin Indicator!", "Completed")
		Else
			MessageBox.Show("The process failed to create the directory!")
		End If
	Else
		MessageBox.Show("This is not an iAssembly!")
	End If
Else
	MessageBox.Show("This is not an Assembly!")
End If&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Mar 2025 11:39:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/save-as-bmp/m-p/13386932#M12845</guid>
      <dc:creator>rossano_praderi</dc:creator>
      <dc:date>2025-03-24T11:39:49Z</dc:date>
    </item>
  </channel>
</rss>

