BuildingCoder.CmdExportImage.ExportToImage3 C# (CSharp) Метод

ExportToImage3() статический приватный Метод

New code as described in Revit API discussion forum thread on how to export an image from a specific view using Revit API C#, http://forums.autodesk.com/t5/revit-api/how-to-export-an-image-from-a-specific-view-using-revit-api-c/m-p/6424418
static private ExportToImage3 ( Document doc ) : System.Result
doc Document
Результат System.Result
    static Result ExportToImage3( Document doc )
    {
      Result r = Result.Failed;

      using( Transaction tx = new Transaction( doc ) )
      {
        tx.Start( "Export Image" );

        string desktop_path = Environment.GetFolderPath( 
          Environment.SpecialFolder.Desktop );

        View view = doc.ActiveView;

        string filepath = Path.Combine( desktop_path, 
          view.Name );

        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;
        img.FilePath = filepath;
        img.ShadowViewsFileType = ImageFileType.PNG;

        doc.ExportImage( img );

        tx.RollBack();

        filepath = Path.ChangeExtension( 
          filepath, "png" );

        Process.Start( filepath );

        r = Result.Succeeded;
      }
      return r;
    }