<?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: How to export an image from a specific view using Revit API C# ? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6211443#M74525</link>
    <description>&lt;P&gt;No, an external application does not automatically provide a valid Reivt API context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nothing in the universe&amp;nbsp;&lt;SPAN&gt;provides a valid Reivt API context at all times.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;A&amp;nbsp;valid Reivt API context only exists temporarily within callback functions called from Revit, i.e. officially registered Revit event handlers, such as an external command Execute method or an external application ApplicationInitialized event handler.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I hop this clarifies.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Mar 2016 17:19:47 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2016-03-11T17:19:47Z</dc:date>
    <item>
      <title>How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5457965#M74513</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I have to export a specific view &amp;nbsp;to an Image using the API ( C# )&lt;/P&gt;&lt;P&gt;I have opened the models using "uiApp.Application.OpenDocumentFile..."&lt;/P&gt;&lt;P&gt;But I don't want to export the default view.&lt;/P&gt;&lt;P&gt;I have found the name of the view I want to export, I have set the Path, Pixels etc. but&lt;/P&gt;&lt;P&gt;how to get the right view exported ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anders Kaas&lt;/P&gt;</description>
      <pubDate>Sun, 04 Jan 2015 13:49:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5457965#M74513</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-04T13:49:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458365#M74514</link>
      <description>&lt;P&gt;Dear Anders,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Happy New Year to you!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a description of a sample command that creates a new view to export an image from:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2013/12/setting-the-view-display-background.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2013/12/setting-the-view-display-background.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is included in The Building Coder sample collection:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should provide a starting point, at least.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2015 07:18:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458365#M74514</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-01-05T07:18:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458465#M74515</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hi Jeremy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you for Your answer, but I still can't get it to work !&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have this Imageexportoption but want only a view called e.g. "Level 1" in "OpenDoc" exportet as an image&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have opened a dafault template and are using the API to open others models but it is only the current view that are exportet&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var&lt;/SPAN&gt;&lt;SPAN&gt; BilledeExportOptions = &lt;/SPAN&gt;&lt;SPAN&gt;new&lt;/SPAN&gt; &lt;SPAN&gt;ImageExportOptions&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;ZoomType = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;ZoomFitType&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;.FitToPage,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;PixelSize = 2024,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;FilePath = DistFolder + &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;@"\Images\"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt; + CSVTxt[ActRow][3].ToString(),&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;FitDirection = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;FitDirectionType&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;.Horizontal,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;HLRandWFViewsFileType = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;ImageFileType&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;.JPEGLossless,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;ImageResolution = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;ImageResolution&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;.DPI_600,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OpenDoc.ExportImage(BilledeExportOptions);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anders&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2015 10:32:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458465#M74515</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-05T10:32:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458470#M74516</link>
      <description>&lt;P&gt;Dear Anders,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds to me as if you are answering your own question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You say "the current view is exported".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ok, in that case, how about making the view that you wish to export current before launching the process?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2015 10:38:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458470#M74516</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-01-05T10:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458483#M74517</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; But it is the current view in the file I have opened before I run the code whitch opens an other model with the view I want to export, And I know I want to export several views in models in the future, if they have the right name, right values in&amp;nbsp;specifics parameters etc.&lt;/P&gt;&lt;P&gt;Can't I specifie the view to be exportet ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anders&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2015 11:01:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458483#M74517</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-05T11:01:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458542#M74518</link>
      <description>&lt;P&gt;Dear Anders,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you RTFM?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tested the&amp;nbsp;ImageExportOptions.ViewName property?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Oh no, I see that "This field is used only to save an image to a project as a new view."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Reading further, though, I immediately discover the&amp;nbsp;ImageExportOptions.SetViewsAndSheets method: "Sets a list of views and sheets to be exported. Used only when ExportRange is SetOfViews."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should try reading as well:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://en.wikipedia.org/wiki/Reading_(process)" target="_blank"&gt;https://en.wikipedia.org/wiki/Reading_(process)&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Revit API help documentation is in RevitAPI.chm that is part of the Revit SDK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you installed that and do you keep it handy as a desktop shortcut or something?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, please do!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2015 12:30:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5458542#M74518</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2015-01-05T12:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5459010#M74519</link>
      <description>&lt;P&gt;Thanks a lot it worked&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the full code maybe it can be usefull to others &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IList&amp;lt;ElementId&amp;gt; ImageExportList = new List&amp;lt;ElementId&amp;gt;();&lt;BR /&gt;&lt;BR /&gt;ImageExportList.Add(View.Id);&lt;BR /&gt;&lt;BR /&gt;var BilledeExportOptions = new ImageExportOptions&lt;BR /&gt;{&lt;BR /&gt;ZoomType = ZoomFitType.FitToPage,&lt;BR /&gt;PixelSize = 1024,&lt;BR /&gt;FilePath = DistFolder + @"\Images\" + ImageName.ToString(),&lt;BR /&gt;FitDirection = FitDirectionType.Horizontal,&lt;BR /&gt;HLRandWFViewsFileType = ImageFileType.JPEGLossless,&lt;BR /&gt;ImageResolution = ImageResolution.DPI_600,&lt;BR /&gt;ExportRange = ExportRange.SetOfViews,&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BilledeExportOptions.SetViewsAndSheets(ImageExportList);&lt;BR /&gt;&lt;BR /&gt;OpenDoc.ExportImage(BilledeExportOptions);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anders&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jan 2015 17:19:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/5459010#M74519</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-01-05T17:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6209924#M74520</link>
      <description>&lt;P&gt;I am trying to export image for an ExternalApplication and it does not work. Here is the error I get "a managed exception was thrown by Revit or by one of its external applications". What does that mean? Is it not allowed to call ExportImage from an external Application?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;                var uidoc = uiapp.ActiveUIDocument;
                var doc = uidoc.Document;
                var ieo = new ImageExportOptions
                {
                    ZoomType = ZoomFitType.Zoom,
                    PixelSize = 512,
                    FilePath = @"c:\temp\images\",
                    FitDirection = FitDirectionType.Horizontal,
                    HLRandWFViewsFileType = ImageFileType.PNG,
                    ImageResolution = ImageResolution.DPI_72,
                    ExportRange = ExportRange.SetOfViews,
                };

                ElementCategoryFilter filter = new ElementCategoryFilter(BuiltInCategory.OST_Views);
                FilteredElementCollector views = new FilteredElementCollector(doc);
                views.WherePasses(filter).WhereElementIsNotElementType().ToElements();
                IList&amp;lt;ElementId&amp;gt; ImageExportList = null;

                foreach (View view in views)
                {
                    if (view.ViewType == ViewType.FloorPlan)
                    {
                        try
                        {
                            ImageExportList = new List&amp;lt;ElementId&amp;gt;();
                            ImageExportList.Add(view.Id);
                            ieo.SetViewsAndSheets(ImageExportList);
                            doc.ExportImage(ieo);
                        }
                        catch (Exception ex)
                        {
                            System.IO.File.WriteAllText(@"C:\Temp\Errors.txt", view.Name + " " + ex.Message);
                        }
                    }
                }&lt;/PRE&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>Thu, 10 Mar 2016 22:05:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6209924#M74520</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-10T22:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210008#M74521</link>
      <description>&lt;P&gt;No, you are not per se allowed to make any Revit API calls whatsoever from an external application, or anywhere else either, for that matter, &lt;U&gt;&lt;STRONG&gt;except&lt;/STRONG&gt;&lt;/U&gt; from within a &lt;U&gt;&lt;STRONG&gt;valid Revit API context&lt;/STRONG&gt;&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds to me as if you are not within a valid Revit API context when your code above is executed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please read the detailed description of what a valid Revit API context is and how to obtain it here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 10 Mar 2016 22:41:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210008#M74521</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-03-10T22:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210480#M74522</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;may it be that at least one view is not valid for export, e.g. view.IsTemplate ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 08:06:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210480#M74522</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2016-03-11T08:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210634#M74523</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is also a view.CanBePrinted property that may be checked before exporting or printing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Revitalizer&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 10:10:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210634#M74523</guid>
      <dc:creator>Revitalizer</dc:creator>
      <dc:date>2016-03-11T10:10:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210802#M74524</link>
      <description>Sorry I meant I am calling it from a class that implements IExternalApplication instead of a class that implements IExternalCommand. This is a revit addin so it should still have a valid revit api context&lt;BR /&gt;&lt;BR /&gt;Sent from my iPhone</description>
      <pubDate>Fri, 11 Mar 2016 12:21:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6210802#M74524</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-11T12:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6211443#M74525</link>
      <description>&lt;P&gt;No, an external application does not automatically provide a valid Reivt API context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Nothing in the universe&amp;nbsp;&lt;SPAN&gt;provides a valid Reivt API context at all times.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;A&amp;nbsp;valid Reivt API context only exists temporarily within callback functions called from Revit, i.e. officially registered Revit event handlers, such as an external command Execute method or an external application ApplicationInitialized event handler.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;I hop this clarifies.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Mar 2016 17:19:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6211443#M74525</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-03-11T17:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424278#M74526</link>
      <description>&lt;P&gt;Hello! &amp;nbsp;Sorry if this is resurrecting an old thread, but I'm trying to generate a basic thumbnail of a view via the API using your code, and all I'm getting is a white rectangle. &amp;nbsp;It's of the correct size, so obviously some of my options are going through, but for some reason no data. &amp;nbsp;Is this a known thing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;-= Chris&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 18:33:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424278#M74526</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-07T18:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424294#M74527</link>
      <description>That happened to me if the Graphic display option had the Stype set to hidden lines. Change that to wireframe and then it will work like a charm&lt;BR /&gt;&lt;BR /&gt;Sahana Pindikuri&lt;BR /&gt;Associate, Tech Solutions | Enstoa&lt;BR /&gt;Direct: +1 (212) 913 0870 x 133&lt;BR /&gt;Mobile: +1 (269) 599 5607&lt;BR /&gt;Enstoa launches Strategy &amp;amp; Consulting Business Unit</description>
      <pubDate>Thu, 07 Jul 2016 18:37:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424294#M74527</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-07T18:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424301#M74528</link>
      <description>&lt;P&gt;Thanks for the quick reply,&amp;nbsp;&lt;SPAN&gt;Sahana!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried as you suggested, and sadly, that did not resolve my issue. &amp;nbsp;I also tried setting the background color to&amp;nbsp;green&amp;nbsp;and it's&amp;nbsp;still writing out just a blank white rectangle jpeg. &amp;nbsp;Also oddly, it's always writing out a jpg file, even if I tell it to write out a png file by setting HLRandWFViewsFileType to ImageFileType.PNG.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 18:42:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424301#M74528</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-07T18:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424418#M74529</link>
      <description>&lt;P&gt;Replace&amp;nbsp;&lt;SPAN&gt;HLRandWFViewsFileType = ImageFileType.JPEGLossless,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;HLRandWFViewsFileType &lt;/SPAN&gt;= ImageFileType.PNG;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for PNG&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;here is a code snippet&amp;nbsp;that you can use on macros it will save the image as PNG on your Desktop.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;	UIDocument uidoc = this.ActiveUIDocument;
    Document doc = uidoc.Document;
    Autodesk.Revit.DB.View view = doc.ActiveView; 
    
                Transaction tx3 = new Transaction(doc, "apply Filter");
                tx3.Start();

                ImageExportOptions img = new ImageExportOptions();



                img.ZoomType= ZoomFitType.FitToPage;
                img.PixelSize = 32;
                

                
                img.ImageResolution = ImageResolution.DPI_600;

                img.FitDirection = FitDirectionType.Horizontal;

               
                img.ExportRange = ExportRange.CurrentView;
                 img.HLRandWFViewsFileType = ImageFileType.PNG;
                 string DEsktoppath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                img.FilePath = DEsktoppath +@"\"+ view.Name;
                    img.ShadowViewsFileType = ImageFileType.PNG;
               
                doc.ExportImage(img);
             
                tx3.Commit();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 19:28:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424418#M74529</guid>
      <dc:creator>FaustoMendezcom</dc:creator>
      <dc:date>2016-07-07T19:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424710#M74530</link>
      <description>&lt;P&gt;I confirm that this works perfectly well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I implemented and tested it in The Building Coder samples release 2017.0.127.7:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/releases/tag/2017.0.127.7" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/releases/tag/2017.0.127.7&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdExportImage.cs#L199-L244" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/CmdExportImage.cs#L199-L244&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;SPAN style="color: gray;"&gt;///&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;summary&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN style="color: gray;"&gt;///&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;&amp;nbsp;New&amp;nbsp;code&amp;nbsp;as&amp;nbsp;described&amp;nbsp;in&amp;nbsp;Revit&amp;nbsp;API&amp;nbsp;discussion&amp;nbsp;&lt;/SPAN&gt;
&lt;SPAN style="color: gray;"&gt;///&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;&amp;nbsp;forum&amp;nbsp;thread&amp;nbsp;on&amp;nbsp;how&amp;nbsp;to&amp;nbsp;export&amp;nbsp;an&amp;nbsp;image&amp;nbsp;from&amp;nbsp;a&amp;nbsp;&lt;/SPAN&gt;
&lt;SPAN style="color: gray;"&gt;///&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;&amp;nbsp;specific&amp;nbsp;view&amp;nbsp;using&amp;nbsp;Revit&amp;nbsp;API&amp;nbsp;C#,&lt;/SPAN&gt;
&lt;SPAN style="color: gray;"&gt;///&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;&amp;nbsp;http://forums.autodesk.com/t5/revit-api/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424418&lt;/SPAN&gt;
&lt;SPAN style="color: gray;"&gt;///&lt;/SPAN&gt;&lt;SPAN style="color: green;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;summary&lt;/SPAN&gt;&lt;SPAN style="color: gray;"&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN style="color: blue;"&gt;static&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Result&lt;/SPAN&gt;&amp;nbsp;ExportToImage3(&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Document&lt;/SPAN&gt;&amp;nbsp;doc&amp;nbsp;)
{
&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Result&lt;/SPAN&gt;&amp;nbsp;r&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Result&lt;/SPAN&gt;.Failed;
 
&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: blue;"&gt;using&lt;/SPAN&gt;(&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Transaction&lt;/SPAN&gt;&amp;nbsp;tx&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Transaction&lt;/SPAN&gt;(&amp;nbsp;doc&amp;nbsp;)&amp;nbsp;)
&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tx.Start(&amp;nbsp;&lt;SPAN style="color: #a31515;"&gt;"Export&amp;nbsp;Image"&lt;/SPAN&gt;&amp;nbsp;);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;&amp;nbsp;desktop_path&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Environment&lt;/SPAN&gt;.GetFolderPath(&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Environment&lt;/SPAN&gt;.&lt;SPAN style="color: #2b91af;"&gt;SpecialFolder&lt;/SPAN&gt;.Desktop&amp;nbsp;);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;View&lt;/SPAN&gt;&amp;nbsp;view&amp;nbsp;=&amp;nbsp;doc.ActiveView;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: blue;"&gt;string&lt;/SPAN&gt;&amp;nbsp;filepath&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Path&lt;/SPAN&gt;.Combine(&amp;nbsp;desktop_path,&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;view.Name&amp;nbsp;);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ImageExportOptions&lt;/SPAN&gt;&amp;nbsp;img&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ImageExportOptions&lt;/SPAN&gt;();
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.ZoomType&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ZoomFitType&lt;/SPAN&gt;.FitToPage;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.PixelSize&amp;nbsp;=&amp;nbsp;32;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.ImageResolution&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ImageResolution&lt;/SPAN&gt;.DPI_600;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.FitDirection&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;FitDirectionType&lt;/SPAN&gt;.Horizontal;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.ExportRange&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ExportRange&lt;/SPAN&gt;.CurrentView;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.HLRandWFViewsFileType&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ImageFileType&lt;/SPAN&gt;.PNG;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.FilePath&amp;nbsp;=&amp;nbsp;filepath;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;img.ShadowViewsFileType&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;ImageFileType&lt;/SPAN&gt;.PNG;
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;doc.ExportImage(&amp;nbsp;img&amp;nbsp;);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tx.RollBack();
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filepath&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Path&lt;/SPAN&gt;.ChangeExtension(&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;filepath,&amp;nbsp;&lt;SPAN style="color: #a31515;"&gt;"png"&lt;/SPAN&gt;&amp;nbsp;);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Process&lt;/SPAN&gt;.Start(&amp;nbsp;filepath&amp;nbsp;);
 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;r&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;Result&lt;/SPAN&gt;.Succeeded;
&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: blue;"&gt;return&lt;/SPAN&gt;&amp;nbsp;r;
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the transaction really needed at all?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2016 22:15:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424710#M74530</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2016-07-07T22:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to export an image from a specific view using Revit API C# ?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6426701#M74531</link>
      <description>&lt;P&gt;I got it working. &amp;nbsp;Not sure what the problem was, but&amp;nbsp;I solved it by moving the method out of the larger (threaded) routine it was a part of up to the parent&amp;nbsp;method. &amp;nbsp;Thanks for all the advice and code snippets! &amp;nbsp;I think I ended up using and modifying bits of all of them.&lt;/P&gt;</description>
      <pubDate>Sat, 09 Jul 2016 00:27:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6426701#M74531</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-07-09T00:27:21Z</dc:date>
    </item>
  </channel>
</rss>

