应用程序:ImportExport

Revit 平台:所有平台

Revit 版本:2011.0

首次发布于:2008.0

编程语言:C#

技能水平:高级

类别:数据交换

类型:ExternalCommand(外部命令)

主题:导入和导出数据。

摘要:

本示例演示如何将当前项目导出为 dwgsatdxfdwf(x)gbxmlfbxdgn 或图像文件,以及如何将 dwg、图像、GBXML Inventor 文件导入到 Revit 中。

:

Autodesk.Revit.UI.IExternalCommand

Autodesk.Revit.DB.GBXMLExportOptions

Autodesk.Revit.DB.DWFExportOptions

Autodesk.Revit.DB.DWFXExportOptions

Autodesk.Revit.DB.DWGExportOptions

Autodesk.Revit.DB.FBXExportOptions

Autodesk.Revit.DB.DGNExportOptions

Autodesk.Revit.DB.DWGImportOptions

Autodesk.Revit.DB.ImageImportOptions

Autodesk.Revit.DB.GBXMLImportOptions

Autodesk.Revit.DB.InventorImportOptions

Autodesk.Revit.DB.DXFExportOptions

Autodesk.Revit.DB.SATExportOptions

Autodesk.Revit.DB.ImageExportOptions

项目文件:

Command.cs

该文件包含实现 IExternalCommand 接口的 Command 类。

 

MainData.cs

数据类包含外部命令数据。

 

MainForm.cs

该对话框允许用户选择操作和格式。

 

ExportBaseOptionsData.cs

DWGDXF 导出的存储基本信息的基础数据类。

 

ExportBaseOptionsForm.cs

该对话框提供了与 DWGDXF 导出视图相关的公共信息选项。

 

ExportDXFData.cs

存储导出 dxf 格式的主要信息的数据类。

 

ExportDXFOptionsForm.cs

派生自 ExportBaseOptionsForm 类。

 

ExportSATData.cs

存储导出 sat 格式的主要信息的数据类。

 

ExportIMGData.cs

存储导出图像格式的主要信息的数据类。

 

ExportIMGOptionsForm.cs

该对话框提供与导出视图相关的公共信息选项。

 

ExportData.cs

存储导出的基本信息的基础数据类。

 

ExportDataWithViews.cs

存储用于导出视图相关格式的基本信息的基础数据类。

 

ExportWithViewsForm.cs

该对话框提供与导出视图相关格式的公共信息选项。

 

ExportDWGData.cs

存储导出 dwg 格式的主要信息的数据类。

 

ExportDWGOptionsData.cs

存储用于导出 dwg 格式的低优先级信息的数据类。

 

ExportDWGOptionsForm.cs

派生自 ExportBaseOptionsForm 类。

 

ExportDWFData.cs

存储导出 DWF(x) 格式的信息的数据类。

 

ExportDWFOptionForm.cs

该对话框提供导出二维 DWF(x) 格式的低优先级信息的选项。

 

ExportFBXData.cs

存储导出 fbx 格式的信息的数据类。

 

ExportGBXMLData.cs

存储导出 gbxml 格式的信息的数据类。

 

ExportDGNData.cs

存储导出 dgn 格式的信息的数据类。

 

ExportDGNOptionsForm.cs

该对话框提供导出 dgn 格式的选项。

 

SelectViewsData.cs

存储导出视图信息的数据类。

 

SelectViewsForm.cs

该对话框允许用户选择要导出的视图。

 

ImportData.cs

存储导入的基本信息的基础数据类。

 

ImportDWGData.cs

存储导入 dwg 格式的信息的数据类。

 

ImportDWGForm.cs

该对话框提供导入 dwg 格式的选项。

 

ImportImageData.cs

存储导入图像格式的信息的数据类。

 

ImportGBXMLData.cs

存储导入 GBXML 格式的信息的数据类。

 

ImportInventorData.cs

存储导入 Inventor 格式的信息的数据类。

描述:

该示例提供以下功能。

- 允许用户指定导出选项,并将当前项目导出为 dwgdwf(x)gbxmlfbx dgn 文件。

- 允许用户指定导入选项,并将 dwg、图像、GBXML Inventor 文件导入到 Revit 中。

指导步骤:

1. 打开Revit应用程序并执行命令。

2. 要导出,请选中“导出”单选按钮,选择要导出的格式并单击“确定”按钮。只有当前视图为3D视图时,3D DWF(x)fbx格式才可用。

- 要导出dwgDWF(x)dgn格式

指定要导出的文件名,设置常见选项,单击“选项”按钮设置较低优先级选项,单击“选择”按钮选择要导出的多视图。然后单击“保存”按钮执行导出。

- 要导出GBXMLfbx格式

指定要导出的文件名,然后单击“保存”按钮执行导出。

[注意]要成功导出fbx格式,必须已安装Revit渲染外观库。

 

3. 要导入,请选中“导入”单选按钮,然后单击“确定”按钮。只有当前视图不是3D视图时,图像格式才可用。

- 要导入dwg格式

指定要导入的dwg文件并设置其他选项。然后单击“打开”按钮执行导入。

- 要导入图像、GBXMLInventor格式

指定要导入的文件,然后单击“打开”按钮执行导入。

源代码

完整的源代码请加入QQ群649037449,在群文件中下载RevitSDK.exe,解压后在文件夹中搜索本文中应用程序名称即可获得完整源码

MainData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Windows.Forms;

using Autodesk.Revit;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Export formats
    /// </summary>
    public enum ExportFormat
    {
        /// <summary>
        /// DWG format
        /// </summary>
        DWG,
        /// <summary>
        /// DXF format
        /// </summary>
        DXF,
        /// <summary>
        /// SAT format
        /// </summary> 
        SAT,
        /// <summary>
        /// DWF format
        /// </summary>
        DWF,
        /// <summary>
        /// DWFx format
        /// </summary>
        DWFx,
        /// <summary>
        /// GBXML format
        /// </summary>
        GBXML,
        /// <summary>
        /// FBX format
        /// </summary>
        FBX,
        /// <summary>
        /// DGN format
        /// </summary>
        DGN,
        /// <summary>
        /// IMG format
        /// </summary>
        Image
    }

    /// <summary>
    /// Import formats
    /// </summary>
    public enum ImportFormat
    {
        /// <summary>
        /// DWF format
        /// </summary>
        DWG,
        /// <summary>
        /// IMAGE format
        /// </summary>
        IMAGE,
        /// <summary>
        /// GBXML format
        /// </summary>
        GBXML,
        /// <summary>
        /// Inventor format
        /// </summary>
        Inventor
    }

    /// <summary>
    /// Data class contains the external command data.
    /// </summary>
    public class MainData
    {
        // Revit command data
        private ExternalCommandData m_commandData;

        // Whether current view is a 3D view
        private bool m_is3DView;

        /// <summary>
        /// Revit command data
        /// </summary>
        public ExternalCommandData CommandData
        {
            get
            {
                return m_commandData;
            }
        }

        /// <summary>
        /// Whether current view is a 3D view
        /// </summary>
        public bool Is3DView
        {
            get
            {
                return m_is3DView;
            }
            set
            {
                m_is3DView = value;
            }
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        public MainData(ExternalCommandData commandData)
        {
            m_commandData = commandData;

            //Whether current active view is 3D view
            if (commandData.Application.ActiveUIDocument.Document.ActiveView.ViewType == Autodesk.Revit.DB.ViewType.ThreeD)
            {
                m_is3DView = true;
            }
            else
            {
                m_is3DView = false;
            }
        }

        /// <summary>
        /// Get the format to export
        /// </summary>
        /// <param name="selectedFormat">Selected format in format selecting dialog</param>
        /// <returns>The format to export</returns>
        private static ExportFormat GetSelectedExportFormat(string selectedFormat)
        {
            ExportFormat format = ExportFormat.DWG;
            switch (selectedFormat)
            {
                case "DWG":
                    format = ExportFormat.DWG;
                    break;
                case "DXF":
                    format = ExportFormat.DXF;
                    break;
                case "SAT":
                    format = ExportFormat.SAT;
                    break;
                case "DWF":
                    format = ExportFormat.DWF;
                    break;
                case "DWFx":
                    format = ExportFormat.DWFx;
                    break;
                case "GBXML":
                    format = ExportFormat.GBXML;
                    break;
                case "FBX":
                    format = ExportFormat.FBX;
                    break;
                case "DGN":
                    format = ExportFormat.DGN;
                    break;
                case "IMAGE":
                    format = ExportFormat.Image;
                    break;
                default:
                    break;
            }

            return format;
        }

        /// <summary>
        /// Export according to selected format
        /// </summary>
        /// <param name="selectedFormat">Selected format</param>
        public DialogResult Export(string selectedFormat)
        {
            ExportFormat format = GetSelectedExportFormat(selectedFormat);
            DialogResult dialogResult = DialogResult.OK;

            try
            {
                switch (format)
                {
                    case ExportFormat.DWG:
                        ExportDWGData exportDWGData = new ExportDWGData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDWGData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.DXF:
                        ExportDXFData exportDXFData = new ExportDXFData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDXFData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.SAT:
                        ExportSATData exportSATData = new ExportSATData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportSATData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.DWF:
                    case ExportFormat.DWFx:
                        ExportDWFData exportDWFData = new ExportDWFData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDWFData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.GBXML:
                        ExportGBXMLData exportGBXMLData = new ExportGBXMLData(m_commandData, format);
                        dialogResult = Export(exportGBXMLData);
                        break;
                    case ExportFormat.FBX:
                        ExportFBXData exportFBXData = new ExportFBXData(m_commandData, format);
                        dialogResult = Export(exportFBXData);
                        break;
                    case ExportFormat.DGN:
                        ExportDGNData exportDGNData = new ExportDGNData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportDGNData))
                        {
                            dialogResult = exportForm.ShowDialog();
                        }
                        break;
                    case ExportFormat.Image:
                        ExportIMGData exportIMGdata = new ExportIMGData(m_commandData, format);
                        using (ExportWithViewsForm exportForm = new ExportWithViewsForm(exportIMGdata))
                        {
                            dialogResult = DialogResult.OK;
                        }
                        break;
                    default:
                        break;
                }
            }
            catch (Exception ex)
            {
                String errorMessage = "Failed to export " + format + " format" + ex.ToString(); ;
                TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok);
            }

            return dialogResult;
        }

        /// <summary>
        /// Export
        /// </summary>
        /// <param name="data"></param>
        private static DialogResult Export(ExportData data)
        {
            String returnFilename = String.Empty;
            int filterIndex = -1;

            DialogResult result = ShowSaveDialog(data, ref returnFilename, ref filterIndex);
            if (result != DialogResult.Cancel)
            {
                data.ExportFileName = Path.GetFileName(returnFilename);
                data.ExportFolder = Path.GetDirectoryName(returnFilename);
                if (!data.Export())
                {
                    TaskDialog.Show("Export", "This project cannot be exported to " + data.ExportFileName +
                        " in current settings.", TaskDialogCommonButtons.Ok);
                }
            }

            return result;
        }

        /// <summary>
        /// Show Save dialog
        /// </summary>
        /// <param name="exportData">Data to export</param>
        /// <param name="returnFileName">File name will be returned</param>
        /// <param name="filterIndex">Selected filter index will be returned</param>
        /// <returns></returns>
        public static DialogResult ShowSaveDialog(ExportData exportData, ref String returnFileName,
            ref int filterIndex)
        {
            using (SaveFileDialog saveDialog = new SaveFileDialog())
            {
                saveDialog.Title = exportData.Title;
                saveDialog.InitialDirectory = exportData.ExportFolder;
                saveDialog.FileName = exportData.ExportFileName;
                saveDialog.Filter = exportData.Filter;
                saveDialog.FilterIndex = 1;
                saveDialog.RestoreDirectory = true;

                DialogResult result = saveDialog.ShowDialog();
                if (result != DialogResult.Cancel)
                {
                    returnFileName = saveDialog.FileName;
                    filterIndex = saveDialog.FilterIndex;
                }

                return result;
            }
        }

        /// <summary>
        /// Get the format to import
        /// </summary>
        /// <param name="selectedFormat">Selected format in format selecting dialog</param>
        /// <returns>The format to import</returns>
        private static ImportFormat GetSelectedImportFormat(string selectedFormat)
        {
            ImportFormat format = ImportFormat.DWG;
            switch (selectedFormat)
            {
                case "DWG":
                    format = ImportFormat.DWG;
                    break;
                case "IMAGE":
                    format = ImportFormat.IMAGE;
                    break;
                case "GBXML":
                    format = ImportFormat.GBXML;
                    break;
                case "Inventor":
                    format = ImportFormat.Inventor;
                    break;
                default:
                    break;
            }

            return format;
        }

        /// <summary>
        /// Export according to selected format
        /// </summary>
        /// <param name="selectedFormat">Selected format</param>
        /// <returns></returns>
        public DialogResult Import(string selectedFormat)
        {
            DialogResult dialogResult = DialogResult.OK;
            ImportFormat format = GetSelectedImportFormat(selectedFormat);

            try
            {
                switch (format)
                {
                    case ImportFormat.DWG:
                        ImportDWGData importDWGData = new ImportDWGData(m_commandData, format);
                        using (ImportDWGForm importForm = new ImportDWGForm(importDWGData))
                        {
                            dialogResult = importForm.ShowDialog();
                        }
                        break;
                    case ImportFormat.IMAGE:
                        ImportImageData importIMAGEData = new ImportImageData(m_commandData, format);
                        dialogResult = Import(importIMAGEData);
                        break;
                    case ImportFormat.GBXML:
                        ImportGBXMLData importGBXMLData = new ImportGBXMLData(m_commandData, format);
                        dialogResult = Import(importGBXMLData);
                        break;
                    case ImportFormat.Inventor:
                        ImportInventorData importInventorData = new ImportInventorData(m_commandData, format);
                        dialogResult = Import(importInventorData);
                        break;
                    default:
                        break;
                }
            }
            catch (Exception)
            {
                String errorMessage = "Failed to import " + format + " format";
                TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok);
            }

            return dialogResult;
        }

        /// <summary>
        /// Import
        /// </summary>
        /// <param name="data"></param>
        private static DialogResult Import(ImportData data)
        {
            String returnFilename = String.Empty;
            DialogResult result = ShowOpenDialog(data, ref returnFilename);
            if (result != DialogResult.Cancel)
            {
                data.ImportFileFullName = returnFilename;
                if (!data.Import())
                {
                    TaskDialog.Show("Import", "Cannot import " + Path.GetFileName(data.ImportFileFullName) +
                        " in current settings.", TaskDialogCommonButtons.Ok);
                }
            }

            return result;
        }

        /// <summary>
        /// Show Open File dialog
        /// </summary>
        /// <param name="importData">Data to import</param>
        /// <param name="returnFileName">File name will be returned</param>
        /// <returns>Dialog result</returns>
        public static DialogResult ShowOpenDialog(ImportData importData, ref String returnFileName)
        {
            using (OpenFileDialog importDialog = new OpenFileDialog())
            {
                importDialog.Title = importData.Title;
                importDialog.InitialDirectory = importData.ImportFolder;
                importDialog.Filter = importData.Filter;
                importDialog.RestoreDirectory = true;

                DialogResult result = importDialog.ShowDialog();
                if (result != DialogResult.Cancel)
                {
                    returnFileName = importDialog.FileName;
                }

                return result;
            }
        }
    }
}

MainForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Provide a dialog which lets user choose the operation(export or import)
    /// </summary>
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;


        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.buttonOK = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.groupBoxOperation = new System.Windows.Forms.GroupBox();
            this.comboBoxImport = new System.Windows.Forms.ComboBox();
            this.comboBoxExport = new System.Windows.Forms.ComboBox();
            this.radioButtonImport = new System.Windows.Forms.RadioButton();
            this.radioButtonExport = new System.Windows.Forms.RadioButton();
            this.groupBoxOperation.SuspendLayout();
            this.SuspendLayout();
            // 
            // buttonOK
            // 
            this.buttonOK.Location = new System.Drawing.Point(103, 112);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(75, 23);
            this.buttonOK.TabIndex = 0;
            this.buttonOK.Text = "&OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(188, 112);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
            this.buttonCancel.TabIndex = 1;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
            // 
            // groupBoxOperation
            // 
            this.groupBoxOperation.Controls.Add(this.comboBoxImport);
            this.groupBoxOperation.Controls.Add(this.comboBoxExport);
            this.groupBoxOperation.Controls.Add(this.radioButtonImport);
            this.groupBoxOperation.Controls.Add(this.radioButtonExport);
            this.groupBoxOperation.Location = new System.Drawing.Point(12, 12);
            this.groupBoxOperation.Name = "groupBoxOperation";
            this.groupBoxOperation.Size = new System.Drawing.Size(251, 81);
            this.groupBoxOperation.TabIndex = 2;
            this.groupBoxOperation.TabStop = false;
            this.groupBoxOperation.Text = "Operation";
            // 
            // comboBoxImport
            // 
            this.comboBoxImport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxImport.FormattingEnabled = true;
            this.comboBoxImport.Location = new System.Drawing.Point(72, 51);
            this.comboBoxImport.Name = "comboBoxImport";
            this.comboBoxImport.Size = new System.Drawing.Size(161, 21);
            this.comboBoxImport.TabIndex = 2;
            // 
            // comboBoxExport
            // 
            this.comboBoxExport.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxExport.FormattingEnabled = true;
            this.comboBoxExport.Location = new System.Drawing.Point(72, 19);
            this.comboBoxExport.Name = "comboBoxExport";
            this.comboBoxExport.Size = new System.Drawing.Size(161, 21);
            this.comboBoxExport.TabIndex = 2;
            // 
            // radioButtonImport
            // 
            this.radioButtonImport.AutoSize = true;
            this.radioButtonImport.Location = new System.Drawing.Point(7, 52);
            this.radioButtonImport.Name = "radioButtonImport";
            this.radioButtonImport.Size = new System.Drawing.Size(54, 17);
            this.radioButtonImport.TabIndex = 1;
            this.radioButtonImport.TabStop = true;
            this.radioButtonImport.Text = "Import";
            this.radioButtonImport.UseVisualStyleBackColor = true;
            // 
            // radioButtonExport
            // 
            this.radioButtonExport.AutoSize = true;
            this.radioButtonExport.Checked = true;
            this.radioButtonExport.Location = new System.Drawing.Point(7, 21);
            this.radioButtonExport.Name = "radioButtonExport";
            this.radioButtonExport.Size = new System.Drawing.Size(58, 17);
            this.radioButtonExport.TabIndex = 0;
            this.radioButtonExport.TabStop = true;
            this.radioButtonExport.Text = "Export ";
            this.radioButtonExport.UseVisualStyleBackColor = true;
            this.radioButtonExport.CheckedChanged += new System.EventHandler(this.radioButtonExport_CheckedChanged);
            // 
            // MainForm
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(278, 145);
            this.Controls.Add(this.groupBoxOperation);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "MainForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Export/Import";
            this.groupBoxOperation.ResumeLayout(false);
            this.groupBoxOperation.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.GroupBox groupBoxOperation;
        private System.Windows.Forms.RadioButton radioButtonImport;
        private System.Windows.Forms.RadioButton radioButtonExport;
        private System.Windows.Forms.ComboBox comboBoxImport;
        private System.Windows.Forms.ComboBox comboBoxExport;
    }
}

ExportBaseOptionsData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using Autodesk.Revit;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores lower priority information for exporting dwg or dxf format
    /// </summary>
    public class ExportBaseOptionsData
    {
        #region Class Member Variables
        /// <summary>
        /// String list of Layers and properties used in UI
        /// </summary>
        List<String> m_layersAndProperties;

        /// <summary>
        /// List of Autodesk.Revit.DB.PropOverrideMode
        /// </summary>
        List<Autodesk.Revit.DB.PropOverrideMode> m_enumLayersAndProperties;

        /// <summary>
        /// String list of Layer Settings used in UI
        /// </summary>
        List<String> m_layerMapping;

        /// <summary>
        /// String list of layer settings values defined in Revit 
        /// </summary>
        List<String> m_enumLayerMapping;

        /// <summary>
        /// Layer setting option to export
        /// </summary>
        String m_exportLayerMapping;

        /// <summary>
        /// String list of Linetype scaling used in UI
        /// </summary>
        List<String> m_lineScaling;

        /// <summary>
        /// PropOverrideMode Option to export
        /// </summary>
        Autodesk.Revit.DB.PropOverrideMode m_exportLayersAndProperties;

        /// <summary>
        /// List of Autodesk.Revit.DB.LineScaling defined in Revit
        /// </summary>
        List<Autodesk.Revit.DB.LineScaling> m_enumLineScaling;

        /// <summary>
        /// Line scaling option to export
        /// </summary>
        Autodesk.Revit.DB.LineScaling m_exportLineScaling;

        /// <summary>
        /// String list of Coordinate system basis
        /// </summary>
        List<String> m_coorSystem;

        /// <summary>
        /// List of values whether to use shared coordinate system
        /// </summary>
        List<bool> m_enumCoorSystem;

        /// <summary>
        /// Coordinate system basis option to export
        /// </summary>
        bool m_exportCoorSystem;

        /// <summary>
        /// String list of DWG or DXF unit
        /// </summary>
        List<String> m_units;

        /// <summary>
        /// List of Autodesk.Revit.DB.ExportUnit values defined in Revit
        /// </summary>
        List<Autodesk.Revit.DB.ExportUnit> m_enumUnits;

        /// <summary>
        /// Export unit option to export
        /// </summary>
        Autodesk.Revit.DB.ExportUnit m_exportUnit;

        /// <summary>
        /// String list of solid used in UI
        /// </summary>
        List<String> m_solids;

        /// <summary>
        /// List of Autodesk.Revit.DB.SolidGeometry defined in Revit
        /// </summary>
        List<Autodesk.Revit.DB.SolidGeometry> m_enumSolids;

        /// <summary>
        /// Solid geometry option to export
        /// </summary>
        Autodesk.Revit.DB.SolidGeometry m_exportSolid;

        /// <summary>
        /// Whether to create separate files for each view/sheet
        /// </summary>
        bool m_exportMergeFiles;

        //Export rooms and areas as polylines
        bool m_exportAreas;
        #endregion

        #region Class Properties
        /// <summary>
        /// String collection of Layers and properties used in UI
        /// </summary>
        public ReadOnlyCollection<String> LayersAndProperties
        {
            get 
            { 
                return new ReadOnlyCollection<String>(m_layersAndProperties); 
            }
        }        

        /// <summary>
        /// Collection of Autodesk.Revit.DB.PropOverrideMode
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.PropOverrideMode> EnumLayersAndProperties
        {
            get 
            { 
                return new ReadOnlyCollection<Autodesk.Revit.DB.PropOverrideMode>(m_enumLayersAndProperties); 
            }
        } 

        /// <summary>
        /// PropOverrideMode Option to export
        /// </summary>
        public Autodesk.Revit.DB.PropOverrideMode ExportLayersAndProperties
        {
            get 
            { 
                return m_exportLayersAndProperties; 
            }
            set 
            { 
                m_exportLayersAndProperties = value; 
            }
        }

        /// <summary>
        /// String collection of Layer Settings used in UI
        /// </summary>
        public ReadOnlyCollection<String> LayerMapping
        {
            get 
            {
                return new ReadOnlyCollection<String>(m_layerMapping); 
            }
        }  

        /// <summary>
        /// String collection of layer settings values defined in Revit  
        /// </summary>
        public ReadOnlyCollection<String> EnumLayerMapping
        {
            get 
            {
                return new ReadOnlyCollection<String>(m_enumLayerMapping); 
            }
        }

        /// <summary>
        /// Layer setting option to export
        /// </summary>
        public String ExportLayerMapping
        {
            get 
            { 
                return m_exportLayerMapping; 
            }
            set 
            { 
                m_exportLayerMapping = value;
            }
        }

        /// <summary>
        /// String collection of Linetype scaling used in UI
        /// </summary>
        public ReadOnlyCollection<String> LineScaling
        {
            get 
            {
                return new ReadOnlyCollection<String>(m_lineScaling); 
            }
        }

        /// <summary>
        /// Collection of Autodesk.Revit.DB.LineScaling defined in Revit
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.LineScaling> EnumLineScaling
        {
            get 
            { 
                return new ReadOnlyCollection<Autodesk.Revit.DB.LineScaling>(m_enumLineScaling); 
            }
        }      

        /// <summary>
        /// Line scaling option to export
        /// </summary>
        public Autodesk.Revit.DB.LineScaling ExportLineScaling
        {
            get 
            { 
                return m_exportLineScaling; 
            }
            set 
            { 
                m_exportLineScaling = value;
            }
        }

        /// <summary>
        /// String collection of Coordinate system basis
        /// </summary>
        public ReadOnlyCollection<String> CoorSystem
        {
            get 
            {
                return new ReadOnlyCollection<String>(m_coorSystem); 
            }
        }

        /// <summary>
        /// Collection of values whether to use shared coordinate system
        /// </summary>
        public ReadOnlyCollection<bool> EnumCoorSystem
        {
            get 
            { 
                return new ReadOnlyCollection<bool>(m_enumCoorSystem); 
            }
        }   

        /// <summary>
        /// Coordinate system basis option to export
        /// </summary>
        public bool ExportCoorSystem
        {
            get 
            { 
                return m_exportCoorSystem; 
            }
            set 
            { 
                m_exportCoorSystem = value;
            }
        } 

        /// <summary>
        /// String collection of DWG unit
        /// </summary>
        public ReadOnlyCollection<String> Units
        {
            get 
            {
                return new ReadOnlyCollection<String>(m_units); 
            }
        }

        /// <summary>
        /// Collection of Autodesk.Revit.DB.ExportUnit values defined in Revit
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.ExportUnit> EnumUnits
        {
            get 
            { 
                return new ReadOnlyCollection<Autodesk.Revit.DB.ExportUnit>(m_enumUnits); 
            }
        }  

        /// <summary>
        /// Export unit option to export
        /// </summary>
        public Autodesk.Revit.DB.ExportUnit ExportUnit
        {
            get 
            { 
                return m_exportUnit; 
            }
            set 
            { 
                m_exportUnit = value; 
            }
        }    

        /// <summary>
        /// String collection of solid used in UI
        /// </summary>
        public ReadOnlyCollection<String> Solids
        {
            get
            {
                return new ReadOnlyCollection<String>(m_solids);
            }
        }

        /// <summary>
        /// Collection of Autodesk.Revit.DB.SolidGeometry defined in Revit
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.SolidGeometry> EnumSolids
        {
            get 
            { 
                return new ReadOnlyCollection<Autodesk.Revit.DB.SolidGeometry>(m_enumSolids);
            }
        }

        /// <summary>
        /// Property of solid geometry option to export
        /// </summary>
        public Autodesk.Revit.DB.SolidGeometry ExportSolid
        {
            get 
            {
                return m_exportSolid; 
            }
            set 
            { 
                m_exportSolid = value;
            }
        }

        /// <summary>
        /// Export rooms and areas as polylines
        /// </summary>
        public bool ExportAreas
        {
            get 
            { 
                return m_exportAreas;
            }
            set 
            {
                m_exportAreas = value; 
            }
        }

        /// <summary>
        /// Whether to create separate files for each view/sheet
        /// </summary>
        public bool ExportMergeFiles
        {
            get
            {
                return m_exportMergeFiles;
            }
            set
            {
                m_exportMergeFiles = value;
            }
        } 
        #endregion


        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        public ExportBaseOptionsData()
        {
            Initialize();
        }

        /// <summary>
        /// Initialize values
        /// </summary>
        void Initialize()
        {
            //Layers and properties:
            m_layersAndProperties = new List<String>();
            m_enumLayersAndProperties = new List<Autodesk.Revit.DB.PropOverrideMode>();
            m_layersAndProperties.Add("Category properties BYLAYER, overrides BYENTITY");
            m_enumLayersAndProperties.Add(Autodesk.Revit.DB.PropOverrideMode.ByEntity);
            m_layersAndProperties.Add("All properties BYLAYER, no overrides");
            m_enumLayersAndProperties.Add(Autodesk.Revit.DB.PropOverrideMode.ByLayer);
            m_layersAndProperties.Add("All properties BYLAYER, new Layers for overrides");
            m_enumLayersAndProperties.Add(Autodesk.Revit.DB.PropOverrideMode.NewLayer);
            

            //Layer Settings:
            m_layerMapping = new List<String>();
            m_enumLayerMapping = new List<String>();
            m_layerMapping.Add("AIA - American Institute of Architects standard");
            m_enumLayerMapping.Add("AIA");
            m_layerMapping.Add("ISO13567 - ISO standard 13567");
            m_enumLayerMapping.Add("ISO13567");
            m_layerMapping.Add("CP83 - Singapore standard 83");
            m_enumLayerMapping.Add("CP83");
            m_layerMapping.Add("BS1192 - British standard 1192");
            m_enumLayerMapping.Add("BS1192");

            //Linetype scaling:
            m_lineScaling = new List<String>();
            m_enumLineScaling = new List<Autodesk.Revit.DB.LineScaling>();
            m_lineScaling.Add("Scaled Linetype definitions");
            m_enumLineScaling.Add(Autodesk.Revit.DB.LineScaling.ViewScale);
            m_lineScaling.Add("ModelSpace (PSLTSCALE = 0)");
            m_enumLineScaling.Add(Autodesk.Revit.DB.LineScaling.ModelSpace);
            m_lineScaling.Add("Paperspace (PSLTSCALE = 1)");
            m_enumLineScaling.Add(Autodesk.Revit.DB.LineScaling.PaperSpace);

            //Coordinate system basis
            m_coorSystem = new List<String>();
            m_enumCoorSystem = new List<bool>();
            m_coorSystem.Add("Project Internal");
            m_enumCoorSystem.Add(false);
            m_coorSystem.Add("Shared");
            m_enumCoorSystem.Add(true);

            //One DWG unit
            m_units = new List<String>();
            m_enumUnits = new List<Autodesk.Revit.DB.ExportUnit>();
            m_units.Add(Autodesk.Revit.DB.ExportUnit.Foot.ToString().ToLower());
            m_enumUnits.Add(Autodesk.Revit.DB.ExportUnit.Foot);
            m_units.Add(Autodesk.Revit.DB.ExportUnit.Inch.ToString().ToLower());
            m_enumUnits.Add(Autodesk.Revit.DB.ExportUnit.Inch);
            m_units.Add(Autodesk.Revit.DB.ExportUnit.Meter.ToString().ToLower());
            m_enumUnits.Add(Autodesk.Revit.DB.ExportUnit.Meter);
            m_units.Add(Autodesk.Revit.DB.ExportUnit.Centimeter.ToString().ToLower());
            m_enumUnits.Add(Autodesk.Revit.DB.ExportUnit.Centimeter);
            m_units.Add(Autodesk.Revit.DB.ExportUnit.Millimeter.ToString().ToLower());
            m_enumUnits.Add(Autodesk.Revit.DB.ExportUnit.Millimeter);

            m_solids = new List<String>();
            m_enumSolids = new List<Autodesk.Revit.DB.SolidGeometry>();
            m_solids.Add("Export as polymesh");
            m_enumSolids.Add(Autodesk.Revit.DB.SolidGeometry.Polymesh);
            m_solids.Add("Export as ACIS solids");
            m_enumSolids.Add(Autodesk.Revit.DB.SolidGeometry.ACIS);

            // Set default values
            m_exportAreas = false;
            m_exportSolid = Autodesk.Revit.DB.SolidGeometry.Polymesh;
            m_exportLayerMapping = "AIA";
            m_exportLayersAndProperties = Autodesk.Revit.DB.PropOverrideMode.ByEntity;
            m_exportLineScaling = Autodesk.Revit.DB.LineScaling.PaperSpace;
            m_exportMergeFiles = false;
            m_exportCoorSystem = EnumCoorSystem[0];
            m_exportUnit = Autodesk.Revit.DB.ExportUnit.Inch;
        }
        #endregion
    }
}

ExportBaseOptionsForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Provide a dialog which provides the options of lower priority information for export
    /// </summary>
    partial class ExportBaseOptionsForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.labelLayersAndProperties = new System.Windows.Forms.Label();
            this.comboBoxLayersAndProperties = new System.Windows.Forms.ComboBox();
            this.labelLinetypeScaling = new System.Windows.Forms.Label();
            this.comboBoxLinetypeScaling = new System.Windows.Forms.ComboBox();
            this.labelCoorSystem = new System.Windows.Forms.Label();
            this.comboBoxCoorSystem = new System.Windows.Forms.ComboBox();
            this.labelDWGUnit = new System.Windows.Forms.Label();
            this.comboBoxDWGUnit = new System.Windows.Forms.ComboBox();
            this.labelSolids = new System.Windows.Forms.Label();
            this.comboBoxSolids = new System.Windows.Forms.ComboBox();
            this.checkBoxExportingAreas = new System.Windows.Forms.CheckBox();
            this.buttonOK = new System.Windows.Forms.Button();
            this.labelLayerSettings = new System.Windows.Forms.Label();
            this.comboBoxLayerSettings = new System.Windows.Forms.ComboBox();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.checkBoxMergeViews = new System.Windows.Forms.CheckBox();
            this.SuspendLayout();
            // 
            // labelLayersAndProperties
            // 
            this.labelLayersAndProperties.AutoSize = true;
            this.labelLayersAndProperties.Location = new System.Drawing.Point(13, 13);
            this.labelLayersAndProperties.Name = "labelLayersAndProperties";
            this.labelLayersAndProperties.Size = new System.Drawing.Size(111, 13);
            this.labelLayersAndProperties.TabIndex = 0;
            this.labelLayersAndProperties.Text = "Layers and properties:";
            // 
            // comboBoxLayersAndProperties
            // 
            this.comboBoxLayersAndProperties.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxLayersAndProperties.FormattingEnabled = true;
            this.comboBoxLayersAndProperties.Location = new System.Drawing.Point(16, 30);
            this.comboBoxLayersAndProperties.Name = "comboBoxLayersAndProperties";
            this.comboBoxLayersAndProperties.Size = new System.Drawing.Size(301, 21);
            this.comboBoxLayersAndProperties.TabIndex = 1;
            // 
            // labelLinetypeScaling
            // 
            this.labelLinetypeScaling.AutoSize = true;
            this.labelLinetypeScaling.Location = new System.Drawing.Point(13, 96);
            this.labelLinetypeScaling.Name = "labelLinetypeScaling";
            this.labelLinetypeScaling.Size = new System.Drawing.Size(86, 13);
            this.labelLinetypeScaling.TabIndex = 0;
            this.labelLinetypeScaling.Text = "Linetype scaling:";
            // 
            // comboBoxLinetypeScaling
            // 
            this.comboBoxLinetypeScaling.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxLinetypeScaling.FormattingEnabled = true;
            this.comboBoxLinetypeScaling.Location = new System.Drawing.Point(16, 113);
            this.comboBoxLinetypeScaling.Name = "comboBoxLinetypeScaling";
            this.comboBoxLinetypeScaling.Size = new System.Drawing.Size(301, 21);
            this.comboBoxLinetypeScaling.TabIndex = 3;
            // 
            // labelCoorSystem
            // 
            this.labelCoorSystem.AutoSize = true;
            this.labelCoorSystem.Location = new System.Drawing.Point(13, 142);
            this.labelCoorSystem.Name = "labelCoorSystem";
            this.labelCoorSystem.Size = new System.Drawing.Size(123, 13);
            this.labelCoorSystem.TabIndex = 0;
            this.labelCoorSystem.Text = "Coordinate system basis:";
            // 
            // comboBoxCoorSystem
            // 
            this.comboBoxCoorSystem.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxCoorSystem.FormattingEnabled = true;
            this.comboBoxCoorSystem.Location = new System.Drawing.Point(16, 157);
            this.comboBoxCoorSystem.Name = "comboBoxCoorSystem";
            this.comboBoxCoorSystem.Size = new System.Drawing.Size(301, 21);
            this.comboBoxCoorSystem.TabIndex = 4;
            // 
            // labelDWGUnit
            // 
            this.labelDWGUnit.AutoSize = true;
            this.labelDWGUnit.Location = new System.Drawing.Point(13, 184);
            this.labelDWGUnit.Name = "labelDWGUnit";
            this.labelDWGUnit.Size = new System.Drawing.Size(90, 13);
            this.labelDWGUnit.TabIndex = 0;
            this.labelDWGUnit.Text = "One DWG unit is:";
            // 
            // comboBoxDWGUnit
            // 
            this.comboBoxDWGUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxDWGUnit.FormattingEnabled = true;
            this.comboBoxDWGUnit.Location = new System.Drawing.Point(16, 198);
            this.comboBoxDWGUnit.Name = "comboBoxDWGUnit";
            this.comboBoxDWGUnit.Size = new System.Drawing.Size(301, 21);
            this.comboBoxDWGUnit.TabIndex = 5;
            // 
            // labelSolids
            // 
            this.labelSolids.AutoSize = true;
            this.labelSolids.Location = new System.Drawing.Point(13, 224);
            this.labelSolids.Name = "labelSolids";
            this.labelSolids.Size = new System.Drawing.Size(113, 13);
            this.labelSolids.TabIndex = 0;
            this.labelSolids.Text = "Solids (3D views only):";
            // 
            // comboBoxSolids
            // 
            this.comboBoxSolids.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxSolids.FormattingEnabled = true;
            this.comboBoxSolids.Location = new System.Drawing.Point(16, 241);
            this.comboBoxSolids.Name = "comboBoxSolids";
            this.comboBoxSolids.Size = new System.Drawing.Size(301, 21);
            this.comboBoxSolids.TabIndex = 6;
            // 
            // checkBoxExportingAreas
            // 
            this.checkBoxExportingAreas.AutoSize = true;
            this.checkBoxExportingAreas.Location = new System.Drawing.Point(16, 271);
            this.checkBoxExportingAreas.Name = "checkBoxExportingAreas";
            this.checkBoxExportingAreas.Size = new System.Drawing.Size(194, 17);
            this.checkBoxExportingAreas.TabIndex = 7;
            this.checkBoxExportingAreas.Text = "Export rooms and areas as polylines";
            this.checkBoxExportingAreas.UseVisualStyleBackColor = true;
            // 
            // buttonOK
            // 
            this.buttonOK.Location = new System.Drawing.Point(161, 335);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(75, 23);
            this.buttonOK.TabIndex = 0;
            this.buttonOK.Text = "&OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // labelLayerSettings
            // 
            this.labelLayerSettings.AutoSize = true;
            this.labelLayerSettings.Location = new System.Drawing.Point(13, 55);
            this.labelLayerSettings.Name = "labelLayerSettings";
            this.labelLayerSettings.Size = new System.Drawing.Size(75, 13);
            this.labelLayerSettings.TabIndex = 0;
            this.labelLayerSettings.Text = "Layer settings:";
            // 
            // comboBoxLayerSettings
            // 
            this.comboBoxLayerSettings.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxLayerSettings.FormattingEnabled = true;
            this.comboBoxLayerSettings.Location = new System.Drawing.Point(16, 72);
            this.comboBoxLayerSettings.Name = "comboBoxLayerSettings";
            this.comboBoxLayerSettings.Size = new System.Drawing.Size(301, 21);
            this.comboBoxLayerSettings.TabIndex = 2;
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(242, 335);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
            this.buttonCancel.TabIndex = 8;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // checkBoxMergeViews
            // 
            this.checkBoxMergeViews.AutoSize = true;
            this.checkBoxMergeViews.Location = new System.Drawing.Point(16, 294);
            this.checkBoxMergeViews.Name = "checkBoxMergeViews";
            this.checkBoxMergeViews.Size = new System.Drawing.Size(220, 17);
            this.checkBoxMergeViews.TabIndex = 9;
            this.checkBoxMergeViews.Text = "Create separate files for each view/sheet";
            this.checkBoxMergeViews.UseVisualStyleBackColor = true;
            // 
            // ExportBaseOptionsForm
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(336, 368);
            this.Controls.Add(this.checkBoxMergeViews);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.checkBoxExportingAreas);
            this.Controls.Add(this.comboBoxSolids);
            this.Controls.Add(this.labelSolids);
            this.Controls.Add(this.comboBoxDWGUnit);
            this.Controls.Add(this.labelDWGUnit);
            this.Controls.Add(this.comboBoxCoorSystem);
            this.Controls.Add(this.labelCoorSystem);
            this.Controls.Add(this.comboBoxLinetypeScaling);
            this.Controls.Add(this.labelLinetypeScaling);
            this.Controls.Add(this.comboBoxLayerSettings);
            this.Controls.Add(this.labelLayerSettings);
            this.Controls.Add(this.comboBoxLayersAndProperties);
            this.Controls.Add(this.labelLayersAndProperties);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ExportBaseOptionsForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label labelLayersAndProperties;
        private System.Windows.Forms.ComboBox comboBoxLayersAndProperties;
        private System.Windows.Forms.Label labelLinetypeScaling;
        private System.Windows.Forms.ComboBox comboBoxLinetypeScaling;
        private System.Windows.Forms.Label labelCoorSystem;
        private System.Windows.Forms.ComboBox comboBoxCoorSystem;
        private System.Windows.Forms.Label labelDWGUnit;
        private System.Windows.Forms.ComboBox comboBoxDWGUnit;
        private System.Windows.Forms.Label labelSolids;
        private System.Windows.Forms.ComboBox comboBoxSolids;
        private System.Windows.Forms.CheckBox checkBoxExportingAreas;
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Label labelLayerSettings;
        private System.Windows.Forms.ComboBox comboBoxLayerSettings;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.CheckBox checkBoxMergeViews;
    }
}

ExportDXFData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.ObjectModel;using System.Windows.Forms;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the main information for exporting dxf format
    /// </summary>
    public class ExportDXFData : ExportDataWithViews
    {
        #region Class Member Variables
        /// <summary>
        /// Data class ExportOptionsData
        /// </summary>
        private ExportBaseOptionsData m_exportOptionsData;

        /// <summary>
        /// String list of AutoCAD versions
        /// </summary>
        private List<String> m_fileVersion;

        /// <summary>
        /// List of Autodesk.Revit.DB.ACADVersion defined in Revit
        /// </summary>
        private List<Autodesk.Revit.DB.ACADVersion> m_enumFileVersion;

        /// <summary>
        /// File version option to export
        /// </summary>
        private Autodesk.Revit.DB.ACADVersion m_exportFileVersion;
        #endregion

        #region Class Properties
        /// <summary>
        /// Data class ExportOptionsData
        /// </summary>
        public ExportBaseOptionsData ExportOptionsData
        {
            get 
            { 
                return m_exportOptionsData; 
            }
            set 
            { 
                m_exportOptionsData = value; 
            }
        }
  
        /// <summary>
        /// String collection of AutoCAD versions
        /// </summary>
        public ReadOnlyCollection<String> FileVersion
        {
            get 
            { 
                return new ReadOnlyCollection<String>(m_fileVersion); 
            }
        }

        /// <summary>
        /// Collection of Autodesk.Revit.DB.ACADVersion defined in Revit
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.ACADVersion> EnumFileVersion
        {            
            get 
            {
                return new ReadOnlyCollection<Autodesk.Revit.DB.ACADVersion>(m_enumFileVersion); 
            }
        }

        /// <summary>
        /// File version option to export
        /// </summary>
        public Autodesk.Revit.DB.ACADVersion ExportFileVersion
        {
            get 
            { 
                return m_exportFileVersion; 
            }
            set 
            { 
                m_exportFileVersion = value; 
            }
        }        
        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportDXFData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            m_exportOptionsData = new ExportBaseOptionsData();

            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //AutoCAD versions
            m_fileVersion = new List<String>();
            m_enumFileVersion = new List<Autodesk.Revit.DB.ACADVersion>();
            m_fileVersion.Add("AutoCAD 2013 DXF Files (*.dxf)");
            m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2013);
            m_fileVersion.Add("AutoCAD 2010 DXF Files (*.dxf)");
            m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2010);
            m_fileVersion.Add("AutoCAD 2007 DXF Files (*.dxf)");
            m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2007);

            StringBuilder tmp = new StringBuilder();
            foreach (String version in m_fileVersion)
            {
                tmp.Append(version + "|*.dxf|");
            }
            m_filter = tmp.ToString().TrimEnd('|');
            m_title = "Export DXF";
        }

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            base.Export();

            bool exported = false;

            //parameter :  views
            IList<ElementId> views = new List<ElementId>();
            if (m_currentViewOnly)
            {
                views.Add(m_activeDoc.ActiveView.Id);
            }
            else
            {
                foreach (Autodesk.Revit.DB.View view in m_selectViewsData.SelectedViews)
                {
                    views.Add(view.Id);
                }
            }
            // Default values
            m_exportFileVersion = ACADVersion.R2010;
            //parameter : DXFExportOptions dxfExportOptions
            DXFExportOptions dxfExportOptions = new DXFExportOptions();
            dxfExportOptions.ExportingAreas = m_exportOptionsData.ExportAreas;
            dxfExportOptions.ExportOfSolids = m_exportOptionsData.ExportSolid;
            dxfExportOptions.FileVersion = m_exportFileVersion;
            dxfExportOptions.LayerMapping = m_exportOptionsData.ExportLayerMapping;
            dxfExportOptions.LineScaling = m_exportOptionsData.ExportLineScaling;
            //dxfExportOptions.MergedViews = m_exportOptionsData.ExportMergeFiles;
            dxfExportOptions.PropOverrides = m_exportOptionsData.ExportLayersAndProperties;
            dxfExportOptions.SharedCoords = m_exportOptionsData.ExportCoorSystem;
            dxfExportOptions.TargetUnit = m_exportOptionsData.ExportUnit;

            //Export
            exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, dxfExportOptions);

            return exported;
        }
        #endregion
    }
}

ExportDXFOptionsForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Provide a dialog which provides the options of lower priority information 
    /// for export DWF format
    /// </summary>
    partial class ExportDWFOptionForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.checkBoxRoomsAndAreas = new System.Windows.Forms.CheckBox();
            this.checkBoxModelElements = new System.Windows.Forms.CheckBox();
            this.buttonOK = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.checkBoxMergeViews = new System.Windows.Forms.CheckBox();
            this.groupBoxGraphicsSetting = new System.Windows.Forms.GroupBox();
            this.comboBoxImageQuality = new System.Windows.Forms.ComboBox();
            this.labelImageQuality = new System.Windows.Forms.Label();
            this.radioButtonCompressedFormat = new System.Windows.Forms.RadioButton();
            this.radioButtonStandardFormat = new System.Windows.Forms.RadioButton();
            this.groupBox1.SuspendLayout();
            this.groupBoxGraphicsSetting.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.checkBoxRoomsAndAreas);
            this.groupBox1.Controls.Add(this.checkBoxModelElements);
            this.groupBox1.Location = new System.Drawing.Point(13, 13);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(308, 68);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Export Object Data";
            // 
            // checkBoxRoomsAndAreas
            // 
            this.checkBoxRoomsAndAreas.AutoSize = true;
            this.checkBoxRoomsAndAreas.Location = new System.Drawing.Point(10, 43);
            this.checkBoxRoomsAndAreas.Name = "checkBoxRoomsAndAreas";
            this.checkBoxRoomsAndAreas.Size = new System.Drawing.Size(110, 17);
            this.checkBoxRoomsAndAreas.TabIndex = 0;
            this.checkBoxRoomsAndAreas.Text = "Rooms and Areas";
            this.checkBoxRoomsAndAreas.UseVisualStyleBackColor = true;
            // 
            // checkBoxModelElements
            // 
            this.checkBoxModelElements.AutoSize = true;
            this.checkBoxModelElements.Location = new System.Drawing.Point(10, 20);
            this.checkBoxModelElements.Name = "checkBoxModelElements";
            this.checkBoxModelElements.Size = new System.Drawing.Size(100, 17);
            this.checkBoxModelElements.TabIndex = 0;
            this.checkBoxModelElements.Text = "Model Elements";
            this.checkBoxModelElements.UseVisualStyleBackColor = true;
            this.checkBoxModelElements.CheckedChanged += new System.EventHandler(this.checkBoxModelElements_CheckedChanged);
            // 
            // buttonOK
            // 
            this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonOK.Location = new System.Drawing.Point(114, 230);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(91, 23);
            this.buttonOK.TabIndex = 1;
            this.buttonOK.Text = "&OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(220, 230);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(101, 23);
            this.buttonCancel.TabIndex = 1;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // checkBoxMergeViews
            // 
            this.checkBoxMergeViews.AutoSize = true;
            this.checkBoxMergeViews.Location = new System.Drawing.Point(23, 195);
            this.checkBoxMergeViews.Name = "checkBoxMergeViews";
            this.checkBoxMergeViews.Size = new System.Drawing.Size(226, 17);
            this.checkBoxMergeViews.TabIndex = 4;
            this.checkBoxMergeViews.Text = "Create separate files for each view/sheet";
            this.checkBoxMergeViews.UseVisualStyleBackColor = true;
            // 
            // groupBoxGraphicsSetting
            // 
            this.groupBoxGraphicsSetting.Controls.Add(this.comboBoxImageQuality);
            this.groupBoxGraphicsSetting.Controls.Add(this.labelImageQuality);
            this.groupBoxGraphicsSetting.Controls.Add(this.radioButtonCompressedFormat);
            this.groupBoxGraphicsSetting.Controls.Add(this.radioButtonStandardFormat);
            this.groupBoxGraphicsSetting.Location = new System.Drawing.Point(13, 88);
            this.groupBoxGraphicsSetting.Name = "groupBoxGraphicsSetting";
            this.groupBoxGraphicsSetting.Size = new System.Drawing.Size(308, 100);
            this.groupBoxGraphicsSetting.TabIndex = 5;
            this.groupBoxGraphicsSetting.TabStop = false;
            this.groupBoxGraphicsSetting.Text = "Graphics Settings";
            // 
            // comboBoxImageQuality
            // 
            this.comboBoxImageQuality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxImageQuality.FormattingEnabled = true;
            this.comboBoxImageQuality.Location = new System.Drawing.Point(129, 66);
            this.comboBoxImageQuality.Name = "comboBoxImageQuality";
            this.comboBoxImageQuality.Size = new System.Drawing.Size(163, 21);
            this.comboBoxImageQuality.TabIndex = 3;
            // 
            // labelImageQuality
            // 
            this.labelImageQuality.AutoSize = true;
            this.labelImageQuality.Location = new System.Drawing.Point(54, 69);
            this.labelImageQuality.Name = "labelImageQuality";
            this.labelImageQuality.Size = new System.Drawing.Size(78, 13);
            this.labelImageQuality.TabIndex = 2;
            this.labelImageQuality.Text = "Image Quality:";
            // 
            // radioButtonCompressedFormat
            // 
            this.radioButtonCompressedFormat.AutoSize = true;
            this.radioButtonCompressedFormat.Location = new System.Drawing.Point(10, 41);
            this.radioButtonCompressedFormat.Name = "radioButtonCompressedFormat";
            this.radioButtonCompressedFormat.Size = new System.Drawing.Size(170, 17);
            this.radioButtonCompressedFormat.TabIndex = 0;
            this.radioButtonCompressedFormat.TabStop = true;
            this.radioButtonCompressedFormat.Text = "Use compressed raster format";
            this.radioButtonCompressedFormat.UseVisualStyleBackColor = true;
            this.radioButtonCompressedFormat.CheckedChanged += new System.EventHandler(this.radioButtonCompressedFormat_CheckedChanged);
            // 
            // radioButtonStandardFormat
            // 
            this.radioButtonStandardFormat.AutoSize = true;
            this.radioButtonStandardFormat.Location = new System.Drawing.Point(10, 20);
            this.radioButtonStandardFormat.Name = "radioButtonStandardFormat";
            this.radioButtonStandardFormat.Size = new System.Drawing.Size(124, 17);
            this.radioButtonStandardFormat.TabIndex = 0;
            this.radioButtonStandardFormat.TabStop = true;
            this.radioButtonStandardFormat.Text = "Use standard format";
            this.radioButtonStandardFormat.UseVisualStyleBackColor = true;
            // 
            // ExportDWFOptionForm
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(335, 262);
            this.Controls.Add(this.groupBoxGraphicsSetting);
            this.Controls.Add(this.checkBoxMergeViews);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.groupBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ExportDWFOptionForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Export DWF Options";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBoxGraphicsSetting.ResumeLayout(false);
            this.groupBoxGraphicsSetting.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.CheckBox checkBoxRoomsAndAreas;
        private System.Windows.Forms.CheckBox checkBoxModelElements;
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.CheckBox checkBoxMergeViews;
        private System.Windows.Forms.GroupBox groupBoxGraphicsSetting;
        private System.Windows.Forms.ComboBox comboBoxImageQuality;
        private System.Windows.Forms.Label labelImageQuality;
        private System.Windows.Forms.RadioButton radioButtonCompressedFormat;
        private System.Windows.Forms.RadioButton radioButtonStandardFormat;
    }
}

ExportSATData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
   /// <summary>
   /// Data class which stores the main information for exporting dxf format
   /// </summary>
   public class ExportSATData : ExportDataWithViews
   {
      #region Class Member Variables
      /// <summary>
      /// String list of AutoCAD versions
      /// </summary>
      private List<String> m_fileVersion;

      /// <summary>
      /// List of Autodesk.Revit.DB.ACADVersion defined in Revit
      /// </summary>
      private List<Autodesk.Revit.DB.ACADVersion> m_enumFileVersion;

      /// <summary>
      /// File version option to export
      /// </summary>
      private Autodesk.Revit.DB.ACADVersion m_exportFileVersion;
      #endregion

      #region Class Properties

      /// <summary>
      /// String collection of AutoCAD versions
      /// </summary>
      public ReadOnlyCollection<String> FileVersion
      {
         get
         {
            return new ReadOnlyCollection<String>(m_fileVersion);
         }
      }

      /// <summary>
      /// Collection of Autodesk.Revit.DB.ACADVersion defined in Revit
      /// </summary>
      public ReadOnlyCollection<Autodesk.Revit.DB.ACADVersion> EnumFileVersion
      {
         get
         {
            return new ReadOnlyCollection<Autodesk.Revit.DB.ACADVersion>(m_enumFileVersion);
         }
      }

      /// <summary>
      /// File version option to export
      /// </summary>
      public Autodesk.Revit.DB.ACADVersion ExportFileVersion
      {
         get
         {
            return m_exportFileVersion;
         }
         set
         {
            m_exportFileVersion = value;
         }
      }
      #endregion

      #region Class Member Methods
      /// <summary>
      /// Constructor
      /// </summary>
      /// <param name="commandData">Revit command data</param>
      /// <param name="exportFormat">Format to export</param>
      public ExportSATData(ExternalCommandData commandData, ExportFormat exportFormat)
         : base(commandData, exportFormat)
      {
         Initialize();
      }

      /// <summary>
      /// Initialize the variables
      /// </summary>
      private void Initialize()
      {
         //AutoCAD versions
         m_fileVersion = new List<String>();
         m_enumFileVersion = new List<Autodesk.Revit.DB.ACADVersion>();
         m_fileVersion.Add("AutoCAD 2013 DXF Files (*.sat)");
         m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2013);
         m_fileVersion.Add("AutoCAD 2010 DXF Files (*.sat)");
         m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2010);
         m_fileVersion.Add("AutoCAD 2007 DXF Files (*.sat)");
         m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2007);

         StringBuilder tmp = new StringBuilder();
         foreach (String version in m_fileVersion)
         {
            tmp.Append(version + "|*.sat|");
         }
         m_filter = tmp.ToString().TrimEnd('|');
         m_title = "Export SAT";
      }

      /// <summary>
      /// Collect the parameters and export
      /// </summary>
      /// <returns></returns>
      public override bool Export()
      {
         base.Export();

         bool exported = false;
         
         //parameter : ViewSet views
         ViewSet views = new ViewSet();
         if (m_currentViewOnly)
         {
            views.Insert(m_activeDoc.ActiveView);
         }
         else
         {
            views = m_selectViewsData.SelectedViews;
         }

         ICollection<ElementId> viewIds = new List<ElementId>();
         foreach (View view in views)
         {
            viewIds.Add(view.Id);
         }

         //parameter : DXFExportOptions dxfExportOptions
         SATExportOptions satExportOptions = new SATExportOptions();

         //Export
         exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, viewIds, satExportOptions);
         
         return exported;
      }
      #endregion
   }
}

ExportIMGData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Windows.Forms;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    class ExportIMGData : ExportDataWithViews
    {
        #region Class Member Variables

        /// <summary>
        /// String list of image type
        /// </summary>
        private List<String> m_imageType;

        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportIMGData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //Image type
            m_imageType = new List<String>();
            m_imageType.Add("(*.bmp)");
            m_imageType.Add("(*.jpeg)");
            m_imageType.Add("(*.png)");
            m_imageType.Add("(*.tga)");
            m_imageType.Add("(*.tif)");

            StringBuilder tmp = new StringBuilder();
            tmp.Append(m_imageType[0] + "|*.bmp|");
            tmp.Append(m_imageType[1] + "|*.jpeg|");
            tmp.Append(m_imageType[2] + "|*.png|");
            tmp.Append(m_imageType[3] + "|*.tga|");
            tmp.Append(m_imageType[4] + "|*.tif|");

            m_filter = tmp.ToString().TrimEnd('|');
            m_title = "Export IMG";
        }


        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            base.Export();
            return true;
        }

        #endregion
    }
}

ExportIMGOptionsForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    partial class ExportIMGOptionsForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.outputGroupBox = new System.Windows.Forms.GroupBox();
            this.saveAs = new System.Windows.Forms.TextBox();
            this.name = new System.Windows.Forms.Label();
            this.changePath = new System.Windows.Forms.Button();
            this.exportRangeGroupBox = new System.Windows.Forms.GroupBox();
            this.selectRange = new System.Windows.Forms.Button();
            this.viewsSheetsOption = new System.Windows.Forms.RadioButton();
            this.visiblePortionOption = new System.Windows.Forms.RadioButton();
            this.currentWindowOption = new System.Windows.Forms.RadioButton();
            this.imageSizeGroupBox = new System.Windows.Forms.GroupBox();
            this.pixels = new System.Windows.Forms.Label();
            this.pixelValue = new System.Windows.Forms.TextBox();
            this.panel1 = new System.Windows.Forms.Panel();
            this.verticalOption = new System.Windows.Forms.RadioButton();
            this.horizontalOption = new System.Windows.Forms.RadioButton();
            this.actual = new System.Windows.Forms.Label();
            this.zoomSize = new System.Windows.Forms.NumericUpDown();
            this.Direction = new System.Windows.Forms.Label();
            this.zoomOption = new System.Windows.Forms.RadioButton();
            this.fitToOption = new System.Windows.Forms.RadioButton();
            this.formatGroupBox = new System.Windows.Forms.GroupBox();
            this.RIQCom = new System.Windows.Forms.ComboBox();
            this.noShadedCom = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.Non = new System.Windows.Forms.Label();
            this.shadedCom = new System.Windows.Forms.ComboBox();
            this.shaded = new System.Windows.Forms.Label();
            this.okButton = new System.Windows.Forms.Button();
            this.cannelButton = new System.Windows.Forms.Button();
            this.outputGroupBox.SuspendLayout();
            this.exportRangeGroupBox.SuspendLayout();
            this.imageSizeGroupBox.SuspendLayout();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.zoomSize)).BeginInit();
            this.formatGroupBox.SuspendLayout();
            this.SuspendLayout();
            // 
            // outputGroupBox
            // 
            this.outputGroupBox.Controls.Add(this.saveAs);
            this.outputGroupBox.Controls.Add(this.name);
            this.outputGroupBox.Controls.Add(this.changePath);
            this.outputGroupBox.Location = new System.Drawing.Point(12, 12);
            this.outputGroupBox.Name = "outputGroupBox";
            this.outputGroupBox.Size = new System.Drawing.Size(489, 58);
            this.outputGroupBox.TabIndex = 0;
            this.outputGroupBox.TabStop = false;
            this.outputGroupBox.Text = "Output";
            // 
            // saveAs
            // 
            this.saveAs.Location = new System.Drawing.Point(55, 20);
            this.saveAs.Name = "saveAs";
            this.saveAs.Size = new System.Drawing.Size(385, 21);
            this.saveAs.TabIndex = 1;
            // 
            // name
            // 
            this.name.AutoSize = true;
            this.name.Location = new System.Drawing.Point(13, 24);
            this.name.Name = "name";
            this.name.Size = new System.Drawing.Size(38, 13);
            this.name.TabIndex = 1;
            this.name.Text = "Name:";
            // 
            // changePath
            // 
            this.changePath.Location = new System.Drawing.Point(443, 19);
            this.changePath.Name = "changePath";
            this.changePath.Size = new System.Drawing.Size(27, 23);
            this.changePath.TabIndex = 1;
            this.changePath.Text = "...";
            this.changePath.UseVisualStyleBackColor = true;
            this.changePath.Click += new System.EventHandler(this.Change_Click);
            // 
            // exportRangeGroupBox
            // 
            this.exportRangeGroupBox.Controls.Add(this.selectRange);
            this.exportRangeGroupBox.Controls.Add(this.viewsSheetsOption);
            this.exportRangeGroupBox.Controls.Add(this.visiblePortionOption);
            this.exportRangeGroupBox.Controls.Add(this.currentWindowOption);
            this.exportRangeGroupBox.Location = new System.Drawing.Point(12, 76);
            this.exportRangeGroupBox.Name = "exportRangeGroupBox";
            this.exportRangeGroupBox.Size = new System.Drawing.Size(489, 46);
            this.exportRangeGroupBox.TabIndex = 1;
            this.exportRangeGroupBox.TabStop = false;
            this.exportRangeGroupBox.Text = "Export Range";
            // 
            // selectRange
            // 
            this.selectRange.Location = new System.Drawing.Point(443, 16);
            this.selectRange.Name = "selectRange";
            this.selectRange.Size = new System.Drawing.Size(27, 23);
            this.selectRange.TabIndex = 9;
            this.selectRange.Text = "...";
            this.selectRange.UseVisualStyleBackColor = true;
            this.selectRange.Click += new System.EventHandler(this.Select_Click);
            // 
            // viewsSheetsOption
            // 
            this.viewsSheetsOption.AutoSize = true;
            this.viewsSheetsOption.Location = new System.Drawing.Point(307, 19);
            this.viewsSheetsOption.Name = "viewsSheetsOption";
            this.viewsSheetsOption.Size = new System.Drawing.Size(132, 17);
            this.viewsSheetsOption.TabIndex = 8;
            this.viewsSheetsOption.TabStop = true;
            this.viewsSheetsOption.Text = "Selected views/sheets";
            this.viewsSheetsOption.UseVisualStyleBackColor = true;
            this.viewsSheetsOption.CheckedChanged += new System.EventHandler(this.ViewsSheets_CheckedChanged);
            // 
            // visiblePortionOption
            // 
            this.visiblePortionOption.AutoSize = true;
            this.visiblePortionOption.Location = new System.Drawing.Point(124, 19);
            this.visiblePortionOption.Name = "visiblePortionOption";
            this.visiblePortionOption.Size = new System.Drawing.Size(181, 17);
            this.visiblePortionOption.TabIndex = 7;
            this.visiblePortionOption.TabStop = true;
            this.visiblePortionOption.Text = "Visible portion of current window";
            this.visiblePortionOption.UseVisualStyleBackColor = true;
            this.visiblePortionOption.CheckedChanged += new System.EventHandler(this.VisiblePortion_CheckedChanged);
            // 
            // currentWindowOption
            // 
            this.currentWindowOption.AutoSize = true;
            this.currentWindowOption.Location = new System.Drawing.Point(20, 19);
            this.currentWindowOption.Name = "currentWindowOption";
            this.currentWindowOption.Size = new System.Drawing.Size(101, 17);
            this.currentWindowOption.TabIndex = 6;
            this.currentWindowOption.TabStop = true;
            this.currentWindowOption.Text = "Current window";
            this.currentWindowOption.UseVisualStyleBackColor = true;
            this.currentWindowOption.CheckedChanged += new System.EventHandler(this.CurrentWindow_CheckedChanged);
            // 
            // imageSizeGroupBox
            // 
            this.imageSizeGroupBox.Controls.Add(this.pixels);
            this.imageSizeGroupBox.Controls.Add(this.pixelValue);
            this.imageSizeGroupBox.Controls.Add(this.panel1);
            this.imageSizeGroupBox.Controls.Add(this.actual);
            this.imageSizeGroupBox.Controls.Add(this.zoomSize);
            this.imageSizeGroupBox.Controls.Add(this.Direction);
            this.imageSizeGroupBox.Controls.Add(this.zoomOption);
            this.imageSizeGroupBox.Controls.Add(this.fitToOption);
            this.imageSizeGroupBox.Location = new System.Drawing.Point(12, 128);
            this.imageSizeGroupBox.Name = "imageSizeGroupBox";
            this.imageSizeGroupBox.Size = new System.Drawing.Size(489, 77);
            this.imageSizeGroupBox.TabIndex = 2;
            this.imageSizeGroupBox.TabStop = false;
            this.imageSizeGroupBox.Text = "Image size";
            // 
            // pixels
            // 
            this.pixels.AutoSize = true;
            this.pixels.Location = new System.Drawing.Point(169, 20);
            this.pixels.Name = "pixels";
            this.pixels.Size = new System.Drawing.Size(34, 13);
            this.pixels.TabIndex = 2;
            this.pixels.Text = "pixels";
            // 
            // pixelValue
            // 
            this.pixelValue.Location = new System.Drawing.Point(84, 16);
            this.pixelValue.Name = "pixelValue";
            this.pixelValue.Size = new System.Drawing.Size(78, 21);
            this.pixelValue.TabIndex = 8;
            // 
            // panel1
            // 
            this.panel1.Controls.Add(this.verticalOption);
            this.panel1.Controls.Add(this.horizontalOption);
            this.panel1.Location = new System.Drawing.Point(306, 16);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(162, 21);
            this.panel1.TabIndex = 7;
            // 
            // verticalOption
            // 
            this.verticalOption.AutoSize = true;
            this.verticalOption.Location = new System.Drawing.Point(3, 3);
            this.verticalOption.Name = "verticalOption";
            this.verticalOption.Size = new System.Drawing.Size(60, 17);
            this.verticalOption.TabIndex = 0;
            this.verticalOption.TabStop = true;
            this.verticalOption.Text = "Vertical";
            this.verticalOption.UseVisualStyleBackColor = true;
            this.verticalOption.CheckedChanged += new System.EventHandler(this.Vertical_CheckedChanged);
            // 
            // horizontalOption
            // 
            this.horizontalOption.AutoSize = true;
            this.horizontalOption.Location = new System.Drawing.Point(87, 3);
            this.horizontalOption.Name = "horizontalOption";
            this.horizontalOption.Size = new System.Drawing.Size(73, 17);
            this.horizontalOption.TabIndex = 1;
            this.horizontalOption.TabStop = true;
            this.horizontalOption.Text = "Horizontal";
            this.horizontalOption.UseVisualStyleBackColor = true;
            this.horizontalOption.CheckedChanged += new System.EventHandler(this.Horizontal_CheckedChanged);
            // 
            // actual
            // 
            this.actual.AutoSize = true;
            this.actual.Location = new System.Drawing.Point(169, 48);
            this.actual.Name = "actual";
            this.actual.Size = new System.Drawing.Size(84, 13);
            this.actual.TabIndex = 6;
            this.actual.Text = "% of actual size";
            // 
            // zoomSize
            // 
            this.zoomSize.Location = new System.Drawing.Point(84, 44);
            this.zoomSize.Maximum = new decimal(new int[] {
            32767,
            0,
            0,
            0});
            this.zoomSize.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
            this.zoomSize.Name = "zoomSize";
            this.zoomSize.Size = new System.Drawing.Size(78, 21);
            this.zoomSize.TabIndex = 5;
            this.zoomSize.Value = new decimal(new int[] {
            1,
            0,
            0,
            0});
            // 
            // Direction
            // 
            this.Direction.AutoSize = true;
            this.Direction.Location = new System.Drawing.Point(240, 20);
            this.Direction.Name = "Direction";
            this.Direction.Size = new System.Drawing.Size(53, 13);
            this.Direction.TabIndex = 2;
            this.Direction.Text = "Direction:";
            // 
            // zoomOption
            // 
            this.zoomOption.AutoSize = true;
            this.zoomOption.Location = new System.Drawing.Point(20, 46);
            this.zoomOption.Name = "zoomOption";
            this.zoomOption.Size = new System.Drawing.Size(64, 17);
            this.zoomOption.TabIndex = 1;
            this.zoomOption.TabStop = true;
            this.zoomOption.Text = "Zoom to";
            this.zoomOption.UseVisualStyleBackColor = true;
            this.zoomOption.CheckedChanged += new System.EventHandler(this.Zoom_CheckedChanged);
            // 
            // fitToOption
            // 
            this.fitToOption.AutoSize = true;
            this.fitToOption.Location = new System.Drawing.Point(20, 18);
            this.fitToOption.Name = "fitToOption";
            this.fitToOption.Size = new System.Drawing.Size(50, 17);
            this.fitToOption.TabIndex = 0;
            this.fitToOption.TabStop = true;
            this.fitToOption.Text = "Fit to";
            this.fitToOption.UseVisualStyleBackColor = true;
            this.fitToOption.CheckedChanged += new System.EventHandler(this.FitTo_CheckedChanged);
            // 
            // formatGroupBox
            // 
            this.formatGroupBox.Controls.Add(this.RIQCom);
            this.formatGroupBox.Controls.Add(this.noShadedCom);
            this.formatGroupBox.Controls.Add(this.label1);
            this.formatGroupBox.Controls.Add(this.Non);
            this.formatGroupBox.Controls.Add(this.shadedCom);
            this.formatGroupBox.Controls.Add(this.shaded);
            this.formatGroupBox.Location = new System.Drawing.Point(12, 211);
            this.formatGroupBox.Name = "formatGroupBox";
            this.formatGroupBox.Size = new System.Drawing.Size(489, 70);
            this.formatGroupBox.TabIndex = 4;
            this.formatGroupBox.TabStop = false;
            this.formatGroupBox.Text = "Format";
            // 
            // RIQCom
            // 
            this.RIQCom.FormattingEnabled = true;
            this.RIQCom.Location = new System.Drawing.Point(347, 32);
            this.RIQCom.Name = "RIQCom";
            this.RIQCom.Size = new System.Drawing.Size(121, 21);
            this.RIQCom.TabIndex = 10;
            // 
            // noShadedCom
            // 
            this.noShadedCom.FormattingEnabled = true;
            this.noShadedCom.Location = new System.Drawing.Point(180, 32);
            this.noShadedCom.Name = "noShadedCom";
            this.noShadedCom.Size = new System.Drawing.Size(121, 21);
            this.noShadedCom.TabIndex = 9;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(347, 16);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(109, 13);
            this.label1.TabIndex = 8;
            this.label1.Text = "Raster Image Quality";
            // 
            // Non
            // 
            this.Non.AutoSize = true;
            this.Non.Location = new System.Drawing.Point(180, 16);
            this.Non.Name = "Non";
            this.Non.Size = new System.Drawing.Size(98, 13);
            this.Non.TabIndex = 7;
            this.Non.Text = "Non shaded views:";
            // 
            // shadedCom
            // 
            this.shadedCom.FormattingEnabled = true;
            this.shadedCom.Location = new System.Drawing.Point(13, 32);
            this.shadedCom.Name = "shadedCom";
            this.shadedCom.Size = new System.Drawing.Size(121, 21);
            this.shadedCom.TabIndex = 6;
            // 
            // shaded
            // 
            this.shaded.AutoSize = true;
            this.shaded.Location = new System.Drawing.Point(13, 16);
            this.shaded.Name = "shaded";
            this.shaded.Size = new System.Drawing.Size(77, 13);
            this.shaded.TabIndex = 5;
            this.shaded.Text = "Shaded views:";
            // 
            // okButton
            // 
            this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.okButton.Location = new System.Drawing.Point(336, 307);
            this.okButton.Name = "okButton";
            this.okButton.Size = new System.Drawing.Size(75, 23);
            this.okButton.TabIndex = 0;
            this.okButton.Text = "OK";
            this.okButton.UseVisualStyleBackColor = true;
            this.okButton.Click += new System.EventHandler(this.OK_Click);
            // 
            // cannelButton
            // 
            this.cannelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.cannelButton.Location = new System.Drawing.Point(426, 307);
            this.cannelButton.Name = "cannelButton";
            this.cannelButton.Size = new System.Drawing.Size(75, 23);
            this.cannelButton.TabIndex = 5;
            this.cannelButton.Text = "Cannel";
            this.cannelButton.UseVisualStyleBackColor = true;
            this.cannelButton.Click += new System.EventHandler(this.Cannel_Click);
            // 
            // ExportIMGOptionsForm
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(516, 341);
            this.Controls.Add(this.outputGroupBox);
            this.Controls.Add(this.cannelButton);
            this.Controls.Add(this.okButton);
            this.Controls.Add(this.formatGroupBox);
            this.Controls.Add(this.imageSizeGroupBox);
            this.Controls.Add(this.exportRangeGroupBox);
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ExportIMGOptionsForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.Text = "Export Image";
            this.outputGroupBox.ResumeLayout(false);
            this.outputGroupBox.PerformLayout();
            this.exportRangeGroupBox.ResumeLayout(false);
            this.exportRangeGroupBox.PerformLayout();
            this.imageSizeGroupBox.ResumeLayout(false);
            this.imageSizeGroupBox.PerformLayout();
            this.panel1.ResumeLayout(false);
            this.panel1.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.zoomSize)).EndInit();
            this.formatGroupBox.ResumeLayout(false);
            this.formatGroupBox.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox outputGroupBox;
        private System.Windows.Forms.Button changePath;
        private System.Windows.Forms.TextBox saveAs;
        private System.Windows.Forms.Label name;
        private System.Windows.Forms.GroupBox exportRangeGroupBox;
        private System.Windows.Forms.GroupBox imageSizeGroupBox;
        private System.Windows.Forms.GroupBox formatGroupBox;
        private System.Windows.Forms.Button okButton;
        private System.Windows.Forms.Button cannelButton;
        private System.Windows.Forms.RadioButton viewsSheetsOption;
        private System.Windows.Forms.RadioButton visiblePortionOption;
        private System.Windows.Forms.RadioButton currentWindowOption;
        private System.Windows.Forms.Button selectRange;
        private System.Windows.Forms.RadioButton fitToOption;
        private System.Windows.Forms.RadioButton horizontalOption;
        private System.Windows.Forms.RadioButton verticalOption;
        private System.Windows.Forms.Label Direction;
        private System.Windows.Forms.RadioButton zoomOption;
        private System.Windows.Forms.NumericUpDown zoomSize;
        private System.Windows.Forms.Label actual;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label Non;
        private System.Windows.Forms.ComboBox shadedCom;
        private System.Windows.Forms.Label shaded;
        private System.Windows.Forms.ComboBox noShadedCom;
        private System.Windows.Forms.ComboBox RIQCom;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.TextBox pixelValue;
        private System.Windows.Forms.Label pixels;

    }
}

ExportData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Base data class which stores the basic information for export
    /// </summary>
    public class ExportData
    {
        #region Class Member Variables
        /// <summary>
        /// Revit command data
        /// </summary>
        protected ExternalCommandData m_commandData;

        /// <summary>
        /// Active document
        /// </summary>
        protected Document m_activeDoc;

        /// <summary>
        /// File Name or Prefix to be used
        /// </summary>
        protected String m_exportFileName;

        /// <summary>
        /// Directory to store the exported file
        /// </summary>
        protected String m_exportFolder;

        /// <summary>
        /// ActiveDocument Name
        /// </summary>
        protected String m_activeDocName;

        /// <summary>
        /// ActiveView Name
        /// </summary>
        protected String m_activeViewName;


        /// <summary>
        /// Whether current view is a 3D view
        /// </summary>
        protected bool m_is3DView;

        /// <summary>
        /// The format to be exported
        /// </summary>
        protected ExportFormat m_exportFormat;

        /// <summary>
        /// The filter which will be used in file saving dialog
        /// </summary>
        protected String m_filter;

        /// <summary>
        /// The title of exporting dialog
        /// </summary>
        protected String m_title;
        #endregion

        #region Class Properties
        /// <summary>
        /// Revit command data
        /// </summary>
        public ExternalCommandData CommandData
        {
            get 
            { 
                return m_commandData; 
            }
        }

        /// <summary>
        /// ActiveDocument
        /// </summary>
        public Document ActiveDocument
        {

            get
            {
                return m_activeDoc;
            }

        }

        /// <summary>
        /// File Name or Prefix to be used
        /// </summary>
        public String ExportFileName
        {
            get 
            { 
                return m_exportFileName; 
            }
            set 
            { 
                m_exportFileName = value; 
            }
        }  

        /// <summary>
        /// Directory to store the exported file
        /// </summary>
        public String ExportFolder
        {
            get 
            { 
                return m_exportFolder; 
            }
            set 
            { 
                m_exportFolder = value; 
            }
        }


        /// <summary>
        /// ActiveDocument Name
        /// </summary>
        public String ActiveDocName
        {
            get
            {
                return m_activeDocName;
            }
            set
            {
                m_activeDocName = value;
            }
        
        }

        /// <summary>
        /// ActiveView Name
        /// </summary>
        public String ActiveViewName
        {
            get
            {
                return m_activeViewName;
            }
            set
            {
                m_activeViewName = value;
            }
        }


        /// <summary>
        /// Whether current view is a 3D view
        /// </summary>
        public bool Is3DView
        {
            get
            {
                return m_is3DView;
            }
            set
            {
                m_is3DView = value;
            }
        }

        /// <summary>
        /// The format to be exported
        /// </summary>
        public ExportFormat ExportFormat
        {
            get 
            { 
                return m_exportFormat; 
            }
            set 
            { 
                m_exportFormat = value; 
            }
        }

        /// <summary>
        /// The filter which will be used in file saving dialog
        /// </summary>
        public String Filter
        {
            get 
            { 
                return m_filter; 
            }
        }

        /// <summary>
        /// The title of exporting dialog
        /// </summary>
        public String Title
        {
            get 
            { 
                return m_title; 
            }
        }
        #endregion


        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportData(ExternalCommandData commandData, ExportFormat exportFormat)
        {
            m_commandData = commandData;
            m_activeDoc = commandData.Application.ActiveUIDocument.Document;
            m_exportFormat = exportFormat;
            m_filter = String.Empty;
            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //The directory into which the file will be exported
            String dllFilePath = Assembly.GetExecutingAssembly().Location;
            m_exportFolder = Path.GetDirectoryName(dllFilePath);

            //The file name to be used by export
            m_activeDocName = m_activeDoc.Title;
            m_activeViewName = m_activeDoc.ActiveView.Name;
            String viewType = m_activeDoc.ActiveView.ViewType.ToString();
            m_exportFileName = m_activeDocName + "-" + viewType + "-" + m_activeViewName + "." + getExtension().ToString();

            //Whether current active view is 3D view
            if (m_activeDoc.ActiveView.ViewType == Autodesk.Revit.DB.ViewType.ThreeD)
            {
                m_is3DView = true;
            }
            else
            {
                m_is3DView = false;
            }
        }

        /// <summary>
        /// Get the extension of the file to export
        /// </summary>
        /// <returns></returns>
        private String getExtension()
        {
            String extension = null;
            switch (m_exportFormat)
            {
                case ExportFormat.DWG:
                    extension = "dwg";
                    break;
                case ExportFormat.DXF:
                    extension = "dxf";
                    break;
                case ExportFormat.SAT:
                    extension = "sat";
                    break;
                case ExportFormat.DWF:
                    extension = "dwf";
                    break;
                case ExportFormat.DWFx:
                    extension = "dwfx";
                    break;
                case ExportFormat.GBXML:
                    extension = "xml";
                    break;
                case ExportFormat.FBX:
                    extension = "fbx";
                    break;
                case ExportFormat.DGN:
                    extension = "dgn";
                    break;
                case ExportFormat.Image:
                    extension = "";
                    break;
                default:
                    break;
            }

            return extension;
        }

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public virtual bool Export()
        {
            if (m_exportFolder == null || m_exportFileName == null)
            {
                throw new NullReferenceException();
            }

            return true;
        }
        #endregion
    }
}

ExportDataWithViews.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Base data class which stores the common information for exporting view related format
    /// </summary>
    public class ExportDataWithViews : ExportData
    {
        #region Class Member Variables
        /// <summary>
        /// Data class SelectViewsData
        /// </summary>
        protected SelectViewsData m_selectViewsData;

        /// <summary>
        /// Views to export
        /// </summary>
        private ViewSet m_exportViews;

        /// <summary>
        /// Whether to export current view only
        /// </summary>
        protected bool m_currentViewOnly;
        #endregion

        #region Class Properties
        /// <summary>
        /// Data class SelectViewsData
        /// </summary>
        public SelectViewsData SelectViewsData
        {
            get 
            { 
                return m_selectViewsData; 
            }
            set 
            { 
                m_selectViewsData = value; 
            }
        }

        /// <summary>
        /// Views to export
        /// </summary>
        public ViewSet ExportViews
        {
            get 
            { 
                return m_exportViews; 
            }
            set 
            { 
                m_exportViews = value; 
            }
        } 

        /// <summary>
        /// Whether to export current view only
        /// </summary>
        public bool CurrentViewOnly
        {
            get 
            { 
                return m_currentViewOnly; 
            }
            set 
            { 
                m_currentViewOnly = value; 
            }
        }
        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportDataWithViews(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            m_selectViewsData = new SelectViewsData(commandData);

            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //Views to export
            m_exportViews = new ViewSet();
        }
        #endregion
    }
}

ExportWithViewsForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// It contains a dialog which provides the options of common information for export
    /// </summary>
    partial class ExportWithViewsForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.textBoxSaveAs = new System.Windows.Forms.TextBox();
            this.labelSaveAs = new System.Windows.Forms.Label();
            this.buttonSave = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.buttonOptions = new System.Windows.Forms.Button();
            this.buttonBrowser = new System.Windows.Forms.Button();
            this.groupBoxRange = new System.Windows.Forms.GroupBox();
            this.buttonSelectViews = new System.Windows.Forms.Button();
            this.radioButtonSelectView = new System.Windows.Forms.RadioButton();
            this.radioButtonCurrentView = new System.Windows.Forms.RadioButton();
            this.groupBoxRange.SuspendLayout();
            this.SuspendLayout();
            // 
            // textBoxSaveAs
            // 
            this.textBoxSaveAs.Location = new System.Drawing.Point(67, 19);
            this.textBoxSaveAs.Name = "textBoxSaveAs";
            this.textBoxSaveAs.Size = new System.Drawing.Size(308, 21);
            this.textBoxSaveAs.TabIndex = 1;
            // 
            // labelSaveAs
            // 
            this.labelSaveAs.AutoSize = true;
            this.labelSaveAs.Location = new System.Drawing.Point(14, 23);
            this.labelSaveAs.Name = "labelSaveAs";
            this.labelSaveAs.Size = new System.Drawing.Size(50, 13);
            this.labelSaveAs.TabIndex = 1;
            this.labelSaveAs.Text = "Save As:";
            // 
            // buttonSave
            // 
            this.buttonSave.Location = new System.Drawing.Point(235, 141);
            this.buttonSave.Name = "buttonSave";
            this.buttonSave.Size = new System.Drawing.Size(75, 21);
            this.buttonSave.TabIndex = 0;
            this.buttonSave.Text = "&Save";
            this.buttonSave.UseVisualStyleBackColor = true;
            this.buttonSave.Click += new System.EventHandler(this.buttonSave_Click);
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(320, 141);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 21);
            this.buttonCancel.TabIndex = 6;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // buttonOptions
            // 
            this.buttonOptions.Location = new System.Drawing.Point(150, 141);
            this.buttonOptions.Name = "buttonOptions";
            this.buttonOptions.Size = new System.Drawing.Size(75, 21);
            this.buttonOptions.TabIndex = 5;
            this.buttonOptions.Text = "&Options...";
            this.buttonOptions.UseVisualStyleBackColor = true;
            this.buttonOptions.Click += new System.EventHandler(this.buttonOptions_Click);
            // 
            // buttonBrowser
            // 
            this.buttonBrowser.Location = new System.Drawing.Point(375, 19);
            this.buttonBrowser.Name = "buttonBrowser";
            this.buttonBrowser.Size = new System.Drawing.Size(24, 20);
            this.buttonBrowser.TabIndex = 2;
            this.buttonBrowser.Text = "...";
            this.buttonBrowser.UseVisualStyleBackColor = true;
            this.buttonBrowser.Click += new System.EventHandler(this.buttonBrowser_Click);
            // 
            // groupBoxRange
            // 
            this.groupBoxRange.Controls.Add(this.buttonSelectViews);
            this.groupBoxRange.Controls.Add(this.radioButtonSelectView);
            this.groupBoxRange.Controls.Add(this.radioButtonCurrentView);
            this.groupBoxRange.Location = new System.Drawing.Point(17, 46);
            this.groupBoxRange.Name = "groupBoxRange";
            this.groupBoxRange.Size = new System.Drawing.Size(378, 73);
            this.groupBoxRange.TabIndex = 4;
            this.groupBoxRange.TabStop = false;
            this.groupBoxRange.Text = "Range";
            // 
            // buttonSelectViews
            // 
            this.buttonSelectViews.Enabled = false;
            this.buttonSelectViews.Location = new System.Drawing.Point(145, 42);
            this.buttonSelectViews.Name = "buttonSelectViews";
            this.buttonSelectViews.Size = new System.Drawing.Size(27, 21);
            this.buttonSelectViews.TabIndex = 2;
            this.buttonSelectViews.Text = "...";
            this.buttonSelectViews.UseVisualStyleBackColor = true;
            this.buttonSelectViews.Click += new System.EventHandler(this.buttonSelectViews_Click);
            // 
            // radioButtonSelectView
            // 
            this.radioButtonSelectView.AutoSize = true;
            this.radioButtonSelectView.Location = new System.Drawing.Point(9, 44);
            this.radioButtonSelectView.Name = "radioButtonSelectView";
            this.radioButtonSelectView.Size = new System.Drawing.Size(132, 17);
            this.radioButtonSelectView.TabIndex = 1;
            this.radioButtonSelectView.Text = "Selected views/sheets";
            this.radioButtonSelectView.UseVisualStyleBackColor = true;
            this.radioButtonSelectView.CheckedChanged += new System.EventHandler(this.radioButtonSelectView_CheckedChanged);
            // 
            // radioButtonCurrentView
            // 
            this.radioButtonCurrentView.AutoSize = true;
            this.radioButtonCurrentView.Checked = true;
            this.radioButtonCurrentView.Location = new System.Drawing.Point(9, 20);
            this.radioButtonCurrentView.Name = "radioButtonCurrentView";
            this.radioButtonCurrentView.Size = new System.Drawing.Size(87, 17);
            this.radioButtonCurrentView.TabIndex = 0;
            this.radioButtonCurrentView.TabStop = true;
            this.radioButtonCurrentView.Text = "Current view";
            this.radioButtonCurrentView.UseVisualStyleBackColor = true;
            // 
            // ExportWithViewsForm
            // 
            this.AcceptButton = this.buttonSave;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(411, 169);
            this.Controls.Add(this.groupBoxRange);
            this.Controls.Add(this.buttonOptions);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonBrowser);
            this.Controls.Add(this.buttonSave);
            this.Controls.Add(this.labelSaveAs);
            this.Controls.Add(this.textBoxSaveAs);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ExportWithViewsForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Export";
            this.groupBoxRange.ResumeLayout(false);
            this.groupBoxRange.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox textBoxSaveAs;
        private System.Windows.Forms.Label labelSaveAs;
        private System.Windows.Forms.Button buttonSave;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.Button buttonOptions;
        private System.Windows.Forms.Button buttonBrowser;
        private System.Windows.Forms.GroupBox groupBoxRange;
        private System.Windows.Forms.Button buttonSelectViews;
        private System.Windows.Forms.RadioButton radioButtonSelectView;
        private System.Windows.Forms.RadioButton radioButtonCurrentView;
    }
}

ExportDWGData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the main information for exporting dwg format
    /// </summary>
    public class ExportDWGData : ExportDataWithViews
    {
        #region Class Member Variables
        /// <summary>
        /// Data class ExportOptionsData
        /// </summary>
        private ExportBaseOptionsData m_exportOptionsData;

        /// <summary>
        /// String list of AutoCAD versions
        /// </summary>
        private List<String> m_fileVersion;

        /// <summary>
        /// List of Autodesk.Revit.DB.ACADVersion defined in Revit
        /// </summary>
        private List<Autodesk.Revit.DB.ACADVersion> m_enumFileVersion;

        /// <summary>
        /// File version option to export
        /// </summary>
        private Autodesk.Revit.DB.ACADVersion m_exportFileVersion;
        #endregion

        #region Class Properties
        /// <summary>
        /// Data class ExportOptionsData
        /// </summary>
        public ExportBaseOptionsData ExportOptionsData
        {
            get 
            { 
                return m_exportOptionsData; 
            }
            set 
            { 
                m_exportOptionsData = value; 
            }
        }
  
        /// <summary>
        /// String collection of AutoCAD versions
        /// </summary>
        public ReadOnlyCollection<String> FileVersion
        {
            get 
            { 
                return new ReadOnlyCollection<String>(m_fileVersion); 
            }
        }

        /// <summary>
        /// Collection of Autodesk.Revit.DB.ACADVersion defined in Revit
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.ACADVersion> EnumFileVersion
        {            
            get 
            {
                return new ReadOnlyCollection<Autodesk.Revit.DB.ACADVersion>(m_enumFileVersion); 
            }
        }

        /// <summary>
        /// File version option to export
        /// </summary>
        public Autodesk.Revit.DB.ACADVersion ExportFileVersion
        {
            get 
            { 
                return m_exportFileVersion; 
            }
            set 
            { 
                m_exportFileVersion = value; 
            }
        }        
        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportDWGData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            m_exportOptionsData = new ExportBaseOptionsData();

            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //AutoCAD versions
            m_fileVersion = new List<String>();
            m_enumFileVersion = new List<Autodesk.Revit.DB.ACADVersion>();
            m_fileVersion.Add("AutoCAD 2013 DWG Files (*.dwg)");
            m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2013);
            m_fileVersion.Add("AutoCAD 2010 DWG Files (*.dwg)");
            m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2010);
            m_fileVersion.Add("AutoCAD 2007 DWG Files (*.dwg)");
            m_enumFileVersion.Add(Autodesk.Revit.DB.ACADVersion.R2007);


            StringBuilder tmp = new StringBuilder();
            foreach (String version in m_fileVersion)
            {
                tmp.Append(version + "|*.dwg|");
            }
            m_filter = tmp.ToString().TrimEnd('|');
            m_title = "Export DWG";
        }

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            base.Export();

            bool exported = false;
            //parameter :  views
            IList<ElementId> views = new List<ElementId>();
            if (m_currentViewOnly)
            {
                views.Add(m_activeDoc.ActiveView.Id);
            }
            else
            {
                foreach (View view in m_selectViewsData.SelectedViews)
                {
                    views.Add(view.Id);
                }
            }

            // Default values
            m_exportFileVersion = ACADVersion.R2010;
            //parameter : DWGExportOptions dwgExportOptions
            DWGExportOptions dwgExportOptions = new DWGExportOptions();
            dwgExportOptions.ExportingAreas = m_exportOptionsData.ExportAreas;
            dwgExportOptions.ExportOfSolids = m_exportOptionsData.ExportSolid;
            dwgExportOptions.FileVersion = m_exportFileVersion;
            dwgExportOptions.LayerMapping = m_exportOptionsData.ExportLayerMapping;
            dwgExportOptions.LineScaling = m_exportOptionsData.ExportLineScaling;
            dwgExportOptions.MergedViews = m_exportOptionsData.ExportMergeFiles;
            dwgExportOptions.PropOverrides = m_exportOptionsData.ExportLayersAndProperties;
            dwgExportOptions.SharedCoords = m_exportOptionsData.ExportCoorSystem;
            dwgExportOptions.TargetUnit = m_exportOptionsData.ExportUnit;

            //Export
            exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, dwgExportOptions);

            return exported;
        }
        #endregion
    }
}

ExportDWFData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Reflection;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the information for exporting 2D DWF format
    /// </summary>
    public class ExportDWFData : ExportDataWithViews
    {
        #region Class Member Variables
        /// <summary>
        /// Whether export object data
        /// </summary>
        private bool m_exportObjectData;
        /// <summary>
        /// Whether export areas
        /// </summary>
        private bool m_exportAreas;
        /// <summary>
        /// Whether to create separate files for each view/sheet
        /// </summary>
        private bool m_exportMergeFiles;
        /// <summary>
        /// List of image quality for DWF export
        /// </summary>
        List<Autodesk.Revit.DB.DWFImageQuality> m_ImageQualities;
        /// <summary>
        /// Selected image quality for DWF export
        /// </summary>
        Autodesk.Revit.DB.DWFImageQuality m_dwfImageQuality;
        /// <summary>
        /// Selected image format for DWF export
        /// </summary>
        Autodesk.Revit.DB.DWFImageFormat m_dwfImageFormat;
        #endregion

        #region Class Properties
        /// <summary>
        /// Whether export object data
        /// </summary>
        public bool ExportObjectData
        {
            get 
            { 
                return m_exportObjectData; 
            }
            set 
            { 
                m_exportObjectData = value; 
            }
        }

        /// <summary>
        /// Whether to create separate files for each view/sheet
        /// </summary>
        public bool ExportMergeFiles
        {
            get
            {
                return m_exportMergeFiles;
            }
            set
            {
                m_exportMergeFiles = value;
            }
        }  

        /// <summary>
        /// Whether export areas
        /// </summary>
        public bool ExportAreas
        {
            get
            {
                return m_exportAreas;
            }
            set
            {
                m_exportAreas = value;
            }
        }

        /// <summary>
        /// Selected image format for DWF export
        /// </summary>
        public Autodesk.Revit.DB.DWFImageFormat DwfImageFormat
        {
            get 
            { 
                return m_dwfImageFormat; 
            }
            set 
            { 
                m_dwfImageFormat = value; 
            }
        }

        /// <summary>
        /// Selected image quality for DWF export
        /// </summary>
        public Autodesk.Revit.DB.DWFImageQuality DwfImageQuality
        {
            get 
            { 
                return m_dwfImageQuality; 
            }
            set 
            { 
                m_dwfImageQuality = value; 
            }
        }

        /// <summary>
        /// List of image quality for DWF export
        /// </summary>
        public List<Autodesk.Revit.DB.DWFImageQuality> ImageQualities
        {
            get 
            { 
                return m_ImageQualities; 
            }
            set 
            { 
                m_ImageQualities = value; 
            }
        }
        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportDWFData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            m_exportObjectData = true;
            m_exportAreas = false;
            m_exportMergeFiles = true;
            m_ImageQualities = new List<Autodesk.Revit.DB.DWFImageQuality>();
            m_ImageQualities.Add(Autodesk.Revit.DB.DWFImageQuality.Low);
            m_ImageQualities.Add(Autodesk.Revit.DB.DWFImageQuality.Medium);
            m_ImageQualities.Add(Autodesk.Revit.DB.DWFImageQuality.High);

            // Export DWF
            if (m_exportFormat == ExportFormat.DWF)
            {
                m_filter = "DWF Files |*.dwf";
                m_title = "Export DWF";
            }
            // Export DWFx
            else
            {
                m_filter = "DWFx Files |*.dwfx";
                m_title = "Export DWFx";
            }
        }

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            Transaction transaction = new Transaction(m_activeDoc, "Export_To_DWF");
            transaction.Start();
            bool exported = false;
            base.Export();

            //parameter : ViewSet views
            ViewSet views = new ViewSet();
            if (m_currentViewOnly)
            {
                views.Insert(m_activeDoc.ActiveView);
            }
            else
            {
                views = m_selectViewsData.SelectedViews;
            }

            // Export DWFx
            if (m_exportFormat == ExportFormat.DWFx)
            {
                DWFXExportOptions options = new DWFXExportOptions();
                options.ExportObjectData = m_exportObjectData;
                options.ExportingAreas = m_exportAreas;
                options.MergedViews = m_exportMergeFiles;
                options.ImageFormat = m_dwfImageFormat;
                options.ImageQuality = m_dwfImageQuality;
                exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, options);
            }
            // Export DWF
            else
            {
                DWFExportOptions options = new DWFExportOptions();
                options.ExportObjectData = m_exportObjectData;
                options.ExportingAreas = m_exportAreas;
                options.MergedViews = m_exportMergeFiles;
                options.ImageFormat = m_dwfImageFormat;
                options.ImageQuality = m_dwfImageQuality;
                exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, options);
            }
            transaction.Commit();

            return exported;
        }
        #endregion
    }
}

ExportDWFOptionForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Provide a dialog which provides the options of lower priority information 
    /// for export DWF format
    /// </summary>
    partial class ExportDWFOptionForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.checkBoxRoomsAndAreas = new System.Windows.Forms.CheckBox();
            this.checkBoxModelElements = new System.Windows.Forms.CheckBox();
            this.buttonOK = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.checkBoxMergeViews = new System.Windows.Forms.CheckBox();
            this.groupBoxGraphicsSetting = new System.Windows.Forms.GroupBox();
            this.comboBoxImageQuality = new System.Windows.Forms.ComboBox();
            this.labelImageQuality = new System.Windows.Forms.Label();
            this.radioButtonCompressedFormat = new System.Windows.Forms.RadioButton();
            this.radioButtonStandardFormat = new System.Windows.Forms.RadioButton();
            this.groupBox1.SuspendLayout();
            this.groupBoxGraphicsSetting.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.checkBoxRoomsAndAreas);
            this.groupBox1.Controls.Add(this.checkBoxModelElements);
            this.groupBox1.Location = new System.Drawing.Point(13, 13);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(308, 68);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Export Object Data";
            // 
            // checkBoxRoomsAndAreas
            // 
            this.checkBoxRoomsAndAreas.AutoSize = true;
            this.checkBoxRoomsAndAreas.Location = new System.Drawing.Point(10, 43);
            this.checkBoxRoomsAndAreas.Name = "checkBoxRoomsAndAreas";
            this.checkBoxRoomsAndAreas.Size = new System.Drawing.Size(110, 17);
            this.checkBoxRoomsAndAreas.TabIndex = 0;
            this.checkBoxRoomsAndAreas.Text = "Rooms and Areas";
            this.checkBoxRoomsAndAreas.UseVisualStyleBackColor = true;
            // 
            // checkBoxModelElements
            // 
            this.checkBoxModelElements.AutoSize = true;
            this.checkBoxModelElements.Location = new System.Drawing.Point(10, 20);
            this.checkBoxModelElements.Name = "checkBoxModelElements";
            this.checkBoxModelElements.Size = new System.Drawing.Size(100, 17);
            this.checkBoxModelElements.TabIndex = 0;
            this.checkBoxModelElements.Text = "Model Elements";
            this.checkBoxModelElements.UseVisualStyleBackColor = true;
            this.checkBoxModelElements.CheckedChanged += new System.EventHandler(this.checkBoxModelElements_CheckedChanged);
            // 
            // buttonOK
            // 
            this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonOK.Location = new System.Drawing.Point(114, 230);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(91, 23);
            this.buttonOK.TabIndex = 1;
            this.buttonOK.Text = "&OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(220, 230);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(101, 23);
            this.buttonCancel.TabIndex = 1;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // checkBoxMergeViews
            // 
            this.checkBoxMergeViews.AutoSize = true;
            this.checkBoxMergeViews.Location = new System.Drawing.Point(23, 195);
            this.checkBoxMergeViews.Name = "checkBoxMergeViews";
            this.checkBoxMergeViews.Size = new System.Drawing.Size(226, 17);
            this.checkBoxMergeViews.TabIndex = 4;
            this.checkBoxMergeViews.Text = "Create separate files for each view/sheet";
            this.checkBoxMergeViews.UseVisualStyleBackColor = true;
            // 
            // groupBoxGraphicsSetting
            // 
            this.groupBoxGraphicsSetting.Controls.Add(this.comboBoxImageQuality);
            this.groupBoxGraphicsSetting.Controls.Add(this.labelImageQuality);
            this.groupBoxGraphicsSetting.Controls.Add(this.radioButtonCompressedFormat);
            this.groupBoxGraphicsSetting.Controls.Add(this.radioButtonStandardFormat);
            this.groupBoxGraphicsSetting.Location = new System.Drawing.Point(13, 88);
            this.groupBoxGraphicsSetting.Name = "groupBoxGraphicsSetting";
            this.groupBoxGraphicsSetting.Size = new System.Drawing.Size(308, 100);
            this.groupBoxGraphicsSetting.TabIndex = 5;
            this.groupBoxGraphicsSetting.TabStop = false;
            this.groupBoxGraphicsSetting.Text = "Graphics Settings";
            // 
            // comboBoxImageQuality
            // 
            this.comboBoxImageQuality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxImageQuality.FormattingEnabled = true;
            this.comboBoxImageQuality.Location = new System.Drawing.Point(129, 66);
            this.comboBoxImageQuality.Name = "comboBoxImageQuality";
            this.comboBoxImageQuality.Size = new System.Drawing.Size(163, 21);
            this.comboBoxImageQuality.TabIndex = 3;
            // 
            // labelImageQuality
            // 
            this.labelImageQuality.AutoSize = true;
            this.labelImageQuality.Location = new System.Drawing.Point(54, 69);
            this.labelImageQuality.Name = "labelImageQuality";
            this.labelImageQuality.Size = new System.Drawing.Size(78, 13);
            this.labelImageQuality.TabIndex = 2;
            this.labelImageQuality.Text = "Image Quality:";
            // 
            // radioButtonCompressedFormat
            // 
            this.radioButtonCompressedFormat.AutoSize = true;
            this.radioButtonCompressedFormat.Location = new System.Drawing.Point(10, 41);
            this.radioButtonCompressedFormat.Name = "radioButtonCompressedFormat";
            this.radioButtonCompressedFormat.Size = new System.Drawing.Size(170, 17);
            this.radioButtonCompressedFormat.TabIndex = 0;
            this.radioButtonCompressedFormat.TabStop = true;
            this.radioButtonCompressedFormat.Text = "Use compressed raster format";
            this.radioButtonCompressedFormat.UseVisualStyleBackColor = true;
            this.radioButtonCompressedFormat.CheckedChanged += new System.EventHandler(this.radioButtonCompressedFormat_CheckedChanged);
            // 
            // radioButtonStandardFormat
            // 
            this.radioButtonStandardFormat.AutoSize = true;
            this.radioButtonStandardFormat.Location = new System.Drawing.Point(10, 20);
            this.radioButtonStandardFormat.Name = "radioButtonStandardFormat";
            this.radioButtonStandardFormat.Size = new System.Drawing.Size(124, 17);
            this.radioButtonStandardFormat.TabIndex = 0;
            this.radioButtonStandardFormat.TabStop = true;
            this.radioButtonStandardFormat.Text = "Use standard format";
            this.radioButtonStandardFormat.UseVisualStyleBackColor = true;
            // 
            // ExportDWFOptionForm
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(335, 262);
            this.Controls.Add(this.groupBoxGraphicsSetting);
            this.Controls.Add(this.checkBoxMergeViews);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.groupBox1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ExportDWFOptionForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Export DWF Options";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.groupBoxGraphicsSetting.ResumeLayout(false);
            this.groupBoxGraphicsSetting.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.CheckBox checkBoxRoomsAndAreas;
        private System.Windows.Forms.CheckBox checkBoxModelElements;
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.CheckBox checkBoxMergeViews;
        private System.Windows.Forms.GroupBox groupBoxGraphicsSetting;
        private System.Windows.Forms.ComboBox comboBoxImageQuality;
        private System.Windows.Forms.Label labelImageQuality;
        private System.Windows.Forms.RadioButton radioButtonCompressedFormat;
        private System.Windows.Forms.RadioButton radioButtonStandardFormat;
    }
}

ExportFBXData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the information for exporting fbx format
    /// </summary>
    class ExportFBXData : ExportData
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportFBXData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            m_filter = "FBX Files |*.fbx";
            m_title = "Export FBX";
        }

        /// <summary>
        /// Export FBX format
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            base.Export();

            bool exported = false;
            //parameter : ViewSet views
            ViewSet views = new ViewSet();
            views.Insert(m_activeDoc.ActiveView);

            FBXExportOptions options = new FBXExportOptions();
            exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, options);

            return exported;
        }
    }
}

ExportGBXMLData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the information for exporting gbxml format
    /// </summary>
    class ExportGBXMLData : ExportData
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportGBXMLData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            m_filter = "XML Documents |*.xml";
            m_title = "Export GBXML";
        }

        /// <summary>
        /// Export GBXML format
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            Transaction transaction = new Transaction(m_activeDoc, "Export_To_GBXML");
            transaction.Start();
            base.Export();

            GBXMLExportOptions options = new GBXMLExportOptions();
            bool exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, options);
            transaction.Commit();

            return exported;
        }
    }
}

ExportDGNData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System.Diagnostics;
using System.IO;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the main information for exporting dgn format
    /// </summary>
    public class ExportDGNData : ExportDataWithViews
    {
        #region Class Member Variables
        /// <summary>
        /// String list of Layer Settings used in UI
        /// </summary>
        List<String> m_layerMapping;
        /// <summary>
        /// String list of layer settings values defined in Revit 
        /// </summary>
        List<String> m_enumLayerMapping;
        /// <summary>
        /// String list of exported format version defined in Revit 
        /// </summary>
        List<String> m_exportFileVersions;
      
        /// <summary>
        /// Layer setting option to export
        /// </summary>
        private String m_exportLayerMapping;
        /// <summary>
        /// Exported format version
        /// </summary>
        private String m_exportFileVersion;
        /// <summary>
        /// Whether to hide scope box
        /// </summary>
        private Boolean m_hideScopeBox;
        /// <summary>
        /// Whether to hide unreference view tags
        /// </summary>
        private Boolean m_hideUnreferenceViewTags;
        /// <summary>
        /// Whether to hide reference plane
        /// </summary>
        private Boolean m_hideReferencePlane;
        #endregion

        #region Class Properties
        /// <summary>
        /// Layer setting option to export
        /// </summary>
        public String ExportLayerMapping
        {
            get
            {
                return m_exportLayerMapping;
            }
            set
            {
                m_exportLayerMapping = value;
            }
        }

        /// <summary>
        /// Whether to hide scope box
        /// </summary>
        public Boolean HideScopeBox
        {
            get 
            { 
                return m_hideScopeBox; 
            }
            set 
            {
                m_hideScopeBox = value; 
            }
        }

        /// <summary>
        /// Whether to hide unreference view tags
        /// </summary>
        public Boolean HideUnreferenceViewTags
        {
            get 
            { 
                return m_hideUnreferenceViewTags;
            }
            set 
            { 
                m_hideUnreferenceViewTags = value;
            }
        }

        /// <summary>
        /// Whether to hide reference plane
        /// </summary>
        public Boolean HideReferencePlane
        {
            get 
            { 
                return m_hideReferencePlane;
            }
            set 
            { 
                m_hideReferencePlane = value; 
            }
        }

        /// <summary>
        /// Exported format version
        /// </summary>
        public String ExportFileVersion
        {
            get 
            { 
                return m_exportFileVersion; 
            }
            set 
            { 
                m_exportFileVersion = value; 
            }
        }

        /// <summary>
        /// String collection of Layer Settings used in UI
        /// </summary>
        public ReadOnlyCollection<String> LayerMapping
        {
            get
            {
                return new ReadOnlyCollection<String>(m_layerMapping);
            }
        }

        /// <summary>
        /// String list of exported format version defined in Revit 
        /// </summary>
        public List<String> ExportFileVersions
        {
            get 
            { 
                return m_exportFileVersions; 
            }
        }

        /// <summary>
        /// String collection of layer settings values defined in Revit  
        /// </summary>
        public ReadOnlyCollection<String> EnumLayerMapping
        {
            get
            {
                return new ReadOnlyCollection<String>(m_enumLayerMapping);
            }
        }

        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="exportFormat">Format to export</param>
        public ExportDGNData(ExternalCommandData commandData, ExportFormat exportFormat)
            : base(commandData, exportFormat)
        {
            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //Layer Settings:
            m_layerMapping = new List<String>();
            m_enumLayerMapping = new List<String>();
            m_layerMapping.Add("AIA - American Institute of Architects standard");
            m_enumLayerMapping.Add("AIA");
            m_layerMapping.Add("ISO13567 - ISO standard 13567");
            m_enumLayerMapping.Add("ISO13567");
            m_layerMapping.Add("CP83 - Singapore standard 83");
            m_enumLayerMapping.Add("CP83");
            m_layerMapping.Add("BS1192 - British standard 1192");
            m_enumLayerMapping.Add("BS1192");

            //Export format:
            m_exportFileVersions = new List<string>();
            m_exportFileVersions.Add("MicroStation V8 Format");
            m_exportFileVersions.Add("MicroStation V7 Format");

            m_filter = "Microstation DGN Files |*.dgn";
            m_title = "Export DGN";
        }

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Export()
        {
            base.Export();

            bool exported = false;
            ICollection<ElementId> views = new List<ElementId>();
            if (m_currentViewOnly)
            {
                views.Add(m_activeDoc.ActiveView.Id);
            }
            else
            {
                foreach (View view in m_selectViewsData.SelectedViews)
                {
                   views.Add(view.Id);
                }
            }

            //parameter : DWGExportOptions dwgExportOptions
            DGNExportOptions dgnExportOptions = new DGNExportOptions();
            // default values
            dgnExportOptions.FileVersion = DGNFileFormat.DGNVersion8;
            m_exportLayerMapping = m_enumLayerMapping[0];

            // set values from selected options
            dgnExportOptions.LayerMapping = m_exportLayerMapping;
            if (m_exportFileVersion == "MicroStation V7 Format")
            {
                dgnExportOptions.FileVersion = DGNFileFormat.DGNVersion7;
            }
            else
            {
                dgnExportOptions.FileVersion = DGNFileFormat.DGNVersion8;
            }
            dgnExportOptions.HideScopeBox = m_hideScopeBox;
            dgnExportOptions.HideUnreferenceViewTags = m_hideUnreferenceViewTags;
            dgnExportOptions.HideReferencePlane = m_hideReferencePlane;
            ProcessModule mainModule = Process.GetCurrentProcess().MainModule;
            String RevitFolder = Path.GetDirectoryName( mainModule.FileName );
            dgnExportOptions.SeedName = Path.Combine(RevitFolder, @"ACADInterop\V8-Imperial-Seed3D.dgn");
            
            //Export
            exported = m_activeDoc.Export(m_exportFolder, m_exportFileName, views, dgnExportOptions);
            return exported;
        }
        #endregion
    }
}

ExportDGNOptionsForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    partial class ExportDGNOptionsForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.labelLayerMapping = new System.Windows.Forms.Label();
            this.comboBoxLayerSettings = new System.Windows.Forms.ComboBox();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.buttonOK = new System.Windows.Forms.Button();
            this.comboBoxExportFileFormat = new System.Windows.Forms.ComboBox();
            this.labelExportFormat = new System.Windows.Forms.Label();
            this.checkBoxHideScopeBoxes = new System.Windows.Forms.CheckBox();
            this.checkBoxHideReferencePlanes = new System.Windows.Forms.CheckBox();
            this.checkBoxHideUnrefereceViewTag = new System.Windows.Forms.CheckBox();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.label1 = new System.Windows.Forms.Label();
            this.textBox2DSeedFile = new System.Windows.Forms.TextBox();
            this.button2DSeedFile = new System.Windows.Forms.Button();
            this.label2 = new System.Windows.Forms.Label();
            this.textBox3DSeedFile = new System.Windows.Forms.TextBox();
            this.button3DSeedFile = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            // 
            // labelLayerMapping
            // 
            this.labelLayerMapping.AutoSize = true;
            this.labelLayerMapping.Location = new System.Drawing.Point(11, 15);
            this.labelLayerMapping.Name = "labelLayerMapping";
            this.labelLayerMapping.Size = new System.Drawing.Size(77, 13);
            this.labelLayerMapping.TabIndex = 14;
            this.labelLayerMapping.Text = "Layer Settings:";
            // 
            // comboBoxLayerSettings
            // 
            this.comboBoxLayerSettings.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxLayerSettings.FormattingEnabled = true;
            this.comboBoxLayerSettings.Location = new System.Drawing.Point(14, 31);
            this.comboBoxLayerSettings.Name = "comboBoxLayerSettings";
            this.comboBoxLayerSettings.Size = new System.Drawing.Size(419, 21);
            this.comboBoxLayerSettings.TabIndex = 15;
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(358, 332);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 23);
            this.buttonCancel.TabIndex = 17;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // buttonOK
            // 
            this.buttonOK.Location = new System.Drawing.Point(275, 332);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(75, 23);
            this.buttonOK.TabIndex = 16;
            this.buttonOK.Text = "&OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // comboBoxExportFileFormat
            // 
            this.comboBoxExportFileFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxExportFileFormat.FormattingEnabled = true;
            this.comboBoxExportFileFormat.Location = new System.Drawing.Point(17, 82);
            this.comboBoxExportFileFormat.Name = "comboBoxExportFileFormat";
            this.comboBoxExportFileFormat.Size = new System.Drawing.Size(416, 21);
            this.comboBoxExportFileFormat.TabIndex = 18;
            // 
            // labelExportFormat
            // 
            this.labelExportFormat.AutoSize = true;
            this.labelExportFormat.Location = new System.Drawing.Point(14, 64);
            this.labelExportFormat.Name = "labelExportFormat";
            this.labelExportFormat.Size = new System.Drawing.Size(100, 13);
            this.labelExportFormat.TabIndex = 19;
            this.labelExportFormat.Text = "Export to file format:";
            // 
            // checkBoxHideScopeBoxes
            // 
            this.checkBoxHideScopeBoxes.AutoSize = true;
            this.checkBoxHideScopeBoxes.Location = new System.Drawing.Point(17, 244);
            this.checkBoxHideScopeBoxes.Name = "checkBoxHideScopeBoxes";
            this.checkBoxHideScopeBoxes.Size = new System.Drawing.Size(111, 17);
            this.checkBoxHideScopeBoxes.TabIndex = 20;
            this.checkBoxHideScopeBoxes.Text = "Hide scope boxes";
            this.checkBoxHideScopeBoxes.UseVisualStyleBackColor = true;
            // 
            // checkBoxHideReferencePlanes
            // 
            this.checkBoxHideReferencePlanes.AutoSize = true;
            this.checkBoxHideReferencePlanes.Location = new System.Drawing.Point(17, 267);
            this.checkBoxHideReferencePlanes.Name = "checkBoxHideReferencePlanes";
            this.checkBoxHideReferencePlanes.Size = new System.Drawing.Size(130, 17);
            this.checkBoxHideReferencePlanes.TabIndex = 20;
            this.checkBoxHideReferencePlanes.Text = "Hide reference planes";
            this.checkBoxHideReferencePlanes.UseVisualStyleBackColor = true;
            // 
            // checkBoxHideUnrefereceViewTag
            // 
            this.checkBoxHideUnrefereceViewTag.AutoSize = true;
            this.checkBoxHideUnrefereceViewTag.Location = new System.Drawing.Point(17, 290);
            this.checkBoxHideUnrefereceViewTag.Name = "checkBoxHideUnrefereceViewTag";
            this.checkBoxHideUnrefereceViewTag.Size = new System.Drawing.Size(162, 17);
            this.checkBoxHideUnrefereceViewTag.TabIndex = 20;
            this.checkBoxHideUnrefereceViewTag.Text = "Hide unreferenced view tags";
            this.checkBoxHideUnrefereceViewTag.UseVisualStyleBackColor = true;
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.button3DSeedFile);
            this.groupBox1.Controls.Add(this.button2DSeedFile);
            this.groupBox1.Controls.Add(this.textBox3DSeedFile);
            this.groupBox1.Controls.Add(this.label2);
            this.groupBox1.Controls.Add(this.textBox2DSeedFile);
            this.groupBox1.Controls.Add(this.label1);
            this.groupBox1.Location = new System.Drawing.Point(14, 119);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(419, 116);
            this.groupBox1.TabIndex = 21;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Specify seed file for";
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(7, 20);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(54, 13);
            this.label1.TabIndex = 0;
            this.label1.Text = "2D views:";
            // 
            // textBox2DSeedFile
            // 
            this.textBox2DSeedFile.Location = new System.Drawing.Point(10, 37);
            this.textBox2DSeedFile.Name = "textBox2DSeedFile";
            this.textBox2DSeedFile.Size = new System.Drawing.Size(371, 20);
            this.textBox2DSeedFile.TabIndex = 1;
            // 
            // button2DSeedFile
            // 
            this.button2DSeedFile.Location = new System.Drawing.Point(387, 36);
            this.button2DSeedFile.Name = "button2DSeedFile";
            this.button2DSeedFile.Size = new System.Drawing.Size(26, 20);
            this.button2DSeedFile.TabIndex = 2;
            this.button2DSeedFile.Text = "...";
            this.button2DSeedFile.UseVisualStyleBackColor = true;
            this.button2DSeedFile.Click += new System.EventHandler(this.button2DSeedFile_Click);
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(7, 67);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(54, 13);
            this.label2.TabIndex = 0;
            this.label2.Text = "3D views:";
            // 
            // textBox3DSeedFile
            // 
            this.textBox3DSeedFile.Location = new System.Drawing.Point(10, 84);
            this.textBox3DSeedFile.Name = "textBox3DSeedFile";
            this.textBox3DSeedFile.Size = new System.Drawing.Size(371, 20);
            this.textBox3DSeedFile.TabIndex = 1;
            // 
            // button3DSeedFile
            // 
            this.button3DSeedFile.Location = new System.Drawing.Point(387, 83);
            this.button3DSeedFile.Name = "button3DSeedFile";
            this.button3DSeedFile.Size = new System.Drawing.Size(26, 20);
            this.button3DSeedFile.TabIndex = 2;
            this.button3DSeedFile.Text = "...";
            this.button3DSeedFile.UseVisualStyleBackColor = true;
            this.button3DSeedFile.Click += new System.EventHandler(this.button3DSeedFile_Click);
            // 
            // ExportDGNOptionsForm
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(448, 372);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.checkBoxHideUnrefereceViewTag);
            this.Controls.Add(this.checkBoxHideReferencePlanes);
            this.Controls.Add(this.checkBoxHideScopeBoxes);
            this.Controls.Add(this.labelExportFormat);
            this.Controls.Add(this.comboBoxExportFileFormat);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.comboBoxLayerSettings);
            this.Controls.Add(this.labelLayerMapping);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ExportDGNOptionsForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Export DGN Options";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label labelLayerMapping;
        private System.Windows.Forms.ComboBox comboBoxLayerSettings;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.ComboBox comboBoxExportFileFormat;
        private System.Windows.Forms.Label labelExportFormat;
        private System.Windows.Forms.CheckBox checkBoxHideScopeBoxes;
        private System.Windows.Forms.CheckBox checkBoxHideReferencePlanes;
        private System.Windows.Forms.CheckBox checkBoxHideUnrefereceViewTag;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Button button3DSeedFile;
        private System.Windows.Forms.Button button2DSeedFile;
        private System.Windows.Forms.TextBox textBox3DSeedFile;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox textBox2DSeedFile;
        private System.Windows.Forms.Label label1;
    }
}

SelectViewsData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores views information for export
    /// </summary>
    public class SelectViewsData
    {
        #region Class Member Variables
        /// <summary>
        /// Revit command data
        /// </summary>
        private ExternalCommandData m_commandData;

        /// <summary>
        /// All printable views(except sheets)
        /// </summary>
        private ViewSet m_printableViews;

        /// <summary>
        /// All printable sheets
        /// </summary>
        private ViewSet m_printableSheets;

        /// <summary>
        /// All selected views in UI
        /// </summary>
        private ViewSet m_selectedViews;

        /// <summary>
        /// Whether contain 3D view in selected views
        /// </summary>
        private bool m_contain3DView;
        #endregion

        #region Class Properties
        /// <summary>
        /// All printable views(except sheets)
        /// </summary>
        public ViewSet PrintableViews
        {
            get 
            { 
                return m_printableViews; 
            }
            set 
            { 
                m_printableViews = value; 
            }
        }

        /// <summary>
        /// All printable sheets
        /// </summary>
        public ViewSet PrintableSheets
        {
            get 
            { 
                return m_printableSheets; 
            }
            set 
            { 
                m_printableSheets = value;
            }
        }      

        /// <summary>
        /// All selected views in UI
        /// </summary>
        public ViewSet SelectedViews
        {
            get 
            {
                return m_selectedViews;
            }
            set 
            { 
                m_selectedViews = value;
            }
        }

        /// <summary>
        /// Whether contain 3D view in selected views
        /// </summary>
        public bool Contain3DView
        {
            get 
            { 
                return m_contain3DView; 
            }
            set 
            { 
                m_contain3DView = value; 
            }
        }
        #endregion

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData"></param>
        public SelectViewsData(ExternalCommandData commandData)
        {
            m_commandData = commandData;
            m_printableViews = new ViewSet();
            m_printableSheets = new ViewSet();
            m_selectedViews = new ViewSet();

            GetAllPrintableViews();
        }

        /// <summary>
        /// Get all printable views and sheets
        /// </summary>
        private void GetAllPrintableViews()
        {
            FilteredElementCollector collector = new FilteredElementCollector(m_commandData.Application.ActiveUIDocument.Document);
            FilteredElementIterator itor = collector.OfClass(typeof(View)).GetElementIterator();
            itor.Reset();
            m_printableViews.Clear();
            m_printableSheets.Clear();

            while (itor.MoveNext())
            {
                View view = itor.Current as View;
                // skip view templates because they're invisible in project browser, invalid for print
                if (null == view || view.IsTemplate || !view.CanBePrinted)
                {
                    continue;
                }
                else if(view.ViewType == Autodesk.Revit.DB.ViewType.DrawingSheet)
                {
                    m_printableSheets.Insert(view);
                }
                else
                {
                    m_printableViews.Insert(view);
                }
            }
        }
    }
}

SelectViewsForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Provide a dialog which lets users choose views to export.
    /// </summary>
    partial class SelectViewsForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBoxShow = new System.Windows.Forms.GroupBox();
            this.checkBoxViews = new System.Windows.Forms.CheckBox();
            this.checkBoxSheets = new System.Windows.Forms.CheckBox();
            this.buttonCheckAll = new System.Windows.Forms.Button();
            this.buttonCheckNone = new System.Windows.Forms.Button();
            this.buttonOK = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.checkedListBoxViews = new System.Windows.Forms.CheckedListBox();
            this.groupBoxShow.SuspendLayout();
            this.SuspendLayout();
            // 
            // groupBoxShow
            // 
            this.groupBoxShow.Controls.Add(this.checkBoxViews);
            this.groupBoxShow.Controls.Add(this.checkBoxSheets);
            this.groupBoxShow.Location = new System.Drawing.Point(12, 288);
            this.groupBoxShow.Name = "groupBoxShow";
            this.groupBoxShow.Size = new System.Drawing.Size(311, 41);
            this.groupBoxShow.TabIndex = 1;
            this.groupBoxShow.TabStop = false;
            this.groupBoxShow.Text = "Show";
            // 
            // checkBoxViews
            // 
            this.checkBoxViews.AutoSize = true;
            this.checkBoxViews.Checked = true;
            this.checkBoxViews.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBoxViews.Location = new System.Drawing.Point(148, 18);
            this.checkBoxViews.Name = "checkBoxViews";
            this.checkBoxViews.Size = new System.Drawing.Size(54, 17);
            this.checkBoxViews.TabIndex = 1;
            this.checkBoxViews.Text = "Views";
            this.checkBoxViews.UseVisualStyleBackColor = true;
            this.checkBoxViews.CheckedChanged += new System.EventHandler(this.checkBoxViews_CheckedChanged);
            // 
            // checkBoxSheets
            // 
            this.checkBoxSheets.AutoSize = true;
            this.checkBoxSheets.Checked = true;
            this.checkBoxSheets.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBoxSheets.Location = new System.Drawing.Point(7, 19);
            this.checkBoxSheets.Name = "checkBoxSheets";
            this.checkBoxSheets.Size = new System.Drawing.Size(59, 17);
            this.checkBoxSheets.TabIndex = 0;
            this.checkBoxSheets.Text = "Sheets";
            this.checkBoxSheets.UseVisualStyleBackColor = true;
            this.checkBoxSheets.CheckedChanged += new System.EventHandler(this.checkBoxSheets_CheckedChanged);
            // 
            // buttonCheckAll
            // 
            this.buttonCheckAll.Location = new System.Drawing.Point(333, 24);
            this.buttonCheckAll.Name = "buttonCheckAll";
            this.buttonCheckAll.Size = new System.Drawing.Size(85, 23);
            this.buttonCheckAll.TabIndex = 0;
            this.buttonCheckAll.Text = "Check &All";
            this.buttonCheckAll.UseVisualStyleBackColor = true;
            this.buttonCheckAll.Click += new System.EventHandler(this.buttonCheckAll_Click);
            // 
            // buttonCheckNone
            // 
            this.buttonCheckNone.Location = new System.Drawing.Point(333, 65);
            this.buttonCheckNone.Name = "buttonCheckNone";
            this.buttonCheckNone.Size = new System.Drawing.Size(85, 23);
            this.buttonCheckNone.TabIndex = 1;
            this.buttonCheckNone.Text = "Check &None";
            this.buttonCheckNone.UseVisualStyleBackColor = true;
            this.buttonCheckNone.Click += new System.EventHandler(this.buttonCheckNone_Click);
            // 
            // buttonOK
            // 
            this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.buttonOK.Location = new System.Drawing.Point(238, 361);
            this.buttonOK.Name = "buttonOK";
            this.buttonOK.Size = new System.Drawing.Size(85, 23);
            this.buttonOK.TabIndex = 2;
            this.buttonOK.Text = "&OK";
            this.buttonOK.UseVisualStyleBackColor = true;
            this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(333, 361);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(85, 23);
            this.buttonCancel.TabIndex = 3;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // checkedListBoxViews
            // 
            this.checkedListBoxViews.CheckOnClick = true;
            this.checkedListBoxViews.FormattingEnabled = true;
            this.checkedListBoxViews.Location = new System.Drawing.Point(12, 12);
            this.checkedListBoxViews.Name = "checkedListBoxViews";
            this.checkedListBoxViews.Size = new System.Drawing.Size(311, 274);
            this.checkedListBoxViews.TabIndex = 3;
            // 
            // SelectViewsForm
            // 
            this.AcceptButton = this.buttonOK;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(432, 394);
            this.Controls.Add(this.checkedListBoxViews);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOK);
            this.Controls.Add(this.buttonCheckNone);
            this.Controls.Add(this.buttonCheckAll);
            this.Controls.Add(this.groupBoxShow);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "SelectViewsForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "View/Sheet Set";
            this.groupBoxShow.ResumeLayout(false);
            this.groupBoxShow.PerformLayout();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.GroupBox groupBoxShow;
        private System.Windows.Forms.CheckBox checkBoxViews;
        private System.Windows.Forms.CheckBox checkBoxSheets;
        private System.Windows.Forms.Button buttonCheckAll;
        private System.Windows.Forms.Button buttonCheckNone;
        private System.Windows.Forms.Button buttonOK;
        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.CheckedListBox checkedListBoxViews;
    }
}

ImportData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.IO;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Base data class which stores the basic information for import
    /// </summary>
    public class ImportData
    {
        #region Class Member Variables
        /// <summary>
        /// Revit command data
        /// </summary>
        protected ExternalCommandData m_commandData;
        /// <summary>
        /// Active document
        /// </summary>
        protected Document m_activeDoc;

        /// <summary>
        /// Directory where to import the file
        /// </summary>
        protected String m_importFolder;
        /// <summary>
        /// File Name or Prefix to be used
        /// </summary>
        protected String m_importFileFullName;

        /// <summary>
        /// The format to be exported
        /// </summary>
        protected ImportFormat m_importFormat;

        /// <summary>
        /// The filter which will be used in file saving dialog
        /// </summary>
        protected String m_filter;

        /// <summary>
        /// The title of importing dialog
        /// </summary>
        protected String m_title;
        #endregion

        #region Class Properties
        /// <summary>
        /// Revit command data
        /// </summary>
        public ExternalCommandData CommandData
        {
            get 
            { 
                return m_commandData; 
            }
        }

        /// <summary>
        /// File Name or Prefix to be used
        /// </summary>
        public String ImportFileFullName
        {
            get 
            {
                return m_importFileFullName; 
            }
            set 
            {
                m_importFileFullName = value; 
            }
        }  

        /// <summary>
        /// The format to be imported
        /// </summary>
        public ImportFormat ImportFormat
        {
            get 
            { 
                return m_importFormat; 
            }
            set 
            { 
                m_importFormat = value; 
            }
        }

        /// <summary>
        /// The filter which will be used in file saving dialog
        /// </summary>
        public String Filter
        {
            get 
            { 
                return m_filter; 
            }
        }

        /// <summary>
        /// Directory where to import the file
        /// </summary>
        public String ImportFolder
        {
            get
            {
                return m_importFolder;
            }
            set
            {
                m_importFolder = value;
            }
        }

        /// <summary>
        /// The title of importing dialog
        /// </summary>
        public String Title
        {
            get
            {
                return m_title;
            }
        }
        #endregion

        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="importFormat">Format to import</param>
        public ImportData(ExternalCommandData commandData, ImportFormat importFormat)
        {
            m_commandData = commandData;
            m_activeDoc = commandData.Application.ActiveUIDocument.Document;
            m_importFormat = importFormat;
            m_filter = String.Empty;
            Initialize();
        }

        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //The directory into which the file will be imported
            String dllFilePath = Assembly.GetExecutingAssembly().Location;
            m_importFolder = Path.GetDirectoryName(dllFilePath);
            m_importFileFullName = String.Empty;
        }

        /// <summary>
        /// Collect the parameters and import
        /// </summary>
        /// <returns></returns>
        public virtual bool Import()
        {
            if (m_importFileFullName == null)
            {
                throw new NullReferenceException();
            }

            return true;
        }
        #endregion
    }
}

ImportDWGData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Text;
using System.Collections.Generic;
using System.Collections.ObjectModel;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the information for importing dwg format
    /// </summary>
    public class ImportDWGData : ImportData
    {
        #region Class Member Variables
        /// <summary>
        /// ThisViewOnly
        /// </summary>
        private bool m_importThisViewOnly;

        /// <summary>
        /// All views
        /// </summary>
        private ViewSet m_views;

        /// <summary>
        /// Import view
        /// </summary>
        private View m_importView;

        /// <summary>
        /// ColorMode for import
        /// </summary>
        private List<String> m_colorMode;

        /// <summary>
        /// All available import color modes
        /// </summary>
        private List<Autodesk.Revit.DB.ImportColorMode> m_enumColorMode;

        /// <summary>
        /// Import color mode
        /// </summary>
        private Autodesk.Revit.DB.ImportColorMode m_importColorMode;

        /// <summary>
        /// Custom scale for import
        /// </summary>
        private double m_importCustomScale;

        /// <summary>
        /// OrientToView
        /// </summary>
        private bool m_importOrientToView;

        /// <summary>
        /// Placement
        /// </summary>
        private List<String> m_placement;

        /// <summary>
        /// All placement for layers to be imported
        /// </summary>
        private List<Autodesk.Revit.DB.ImportPlacement> m_enumPlacement;

        /// <summary>
        /// Placement for import
        /// </summary>
        private Autodesk.Revit.DB.ImportPlacement m_importPlacement;

        /// <summary>
        /// All units for layer to be imported
        /// </summary>
        private List<String> m_unit;

        /// <summary>
        /// All import unit for import layers
        /// </summary>
        private List<Autodesk.Revit.DB.ImportUnit> m_enumUnit;

        /// <summary>
        /// Import unit
        /// </summary>
        private Autodesk.Revit.DB.ImportUnit m_importUnit;

        /// <summary>
        /// All available layers only 
        /// </summary>
        private List<String> m_visibleLayersOnly;

        /// <summary>
        /// All boolean values for available visible layers
        /// </summary>
        private List<bool> m_enumVisibleLayersOnly;

        /// <summary>
        /// Whether import visible layer only
        /// </summary>
        private bool m_importVisibleLayersOnly;

        /// <summary>
        /// Whether active view is 3D
        /// </summary>
        private bool m_is3DView;
        #endregion


        #region Class Properties
        /// <summary>
        /// Get or set whether import this view only
        /// </summary>
        public bool ImportThisViewOnly
        {
            get
            {
                return m_importThisViewOnly;
            }
            set
            {
                m_importThisViewOnly = value;
            }
        }


        /// <summary>
        /// all views for import
        /// </summary>
        public ViewSet Views
        {
            get
            {
                return m_views;
            }
            set
            {
                m_views = value;
            }
        }


        /// <summary>
        /// Import view
        /// </summary>
        public View ImportView
        {
            get
            {
                return m_importView;
            }
            set
            {
                m_importView = value;
            }
        }


        /// <summary>
        /// All available color modes for import
        /// </summary>
        public ReadOnlyCollection<String> ColorMode
        {
            get
            {
                return new ReadOnlyCollection<String>(m_colorMode);
            }
        }


        /// <summary>
        /// All available import color modes
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.ImportColorMode> EnumColorMode
        {
            get
            {
                return new ReadOnlyCollection<Autodesk.Revit.DB.ImportColorMode>(m_enumColorMode);
            }
        }


        /// <summary>
        /// Import color mode
        /// </summary>
        public Autodesk.Revit.DB.ImportColorMode ImportColorMode
        {
            get
            {
                return m_importColorMode;
            }
            set
            {
                m_importColorMode = value;
            }
        }


        /// <summary>
        /// Custom scale for import
        /// </summary>
        public double ImportCustomScale
        {
            get
            {
                return m_importCustomScale;
            }
            set
            {
                m_importCustomScale = value;
            }
        }


        /// <summary>
        /// Whether import orient to view
        /// </summary>
        public bool ImportOrientToView
        {
            get
            {
                return m_importOrientToView;
            }
            set
            {
                m_importOrientToView = value;
            }
        }


        /// <summary>
        /// All placement for layers to be imported
        /// </summary>
        public ReadOnlyCollection<String> Placement
        {
            get
            {
                return new ReadOnlyCollection<String>(m_placement);
            }
        }


        /// <summary>
        /// All ImportPlacements for all layers to be imported
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.ImportPlacement> EnumPlacement
        {
            get
            {
                return new ReadOnlyCollection<Autodesk.Revit.DB.ImportPlacement>(m_enumPlacement);
            }
        }


        /// <summary>
        /// Import placement for import
        /// </summary>
        public Autodesk.Revit.DB.ImportPlacement ImportPlacement
        {
            get
            {
                return m_importPlacement;
            }
            set
            {
                m_importPlacement = value;
            }
        }


        /// <summary>
        /// All units for layer to be imported
        /// </summary>
        public ReadOnlyCollection<String> Unit
        {
            get
            {
                return new ReadOnlyCollection<string>(m_unit);
            }
        }


        /// <summary>
        /// All import unit for import layers
        /// </summary>
        public ReadOnlyCollection<Autodesk.Revit.DB.ImportUnit> EnumUnit
        {
            get
            {
                return new ReadOnlyCollection<Autodesk.Revit.DB.ImportUnit>(m_enumUnit);
            }
        }


        /// <summary>
        /// Get or set import unit
        /// </summary>
        public Autodesk.Revit.DB.ImportUnit ImportUnit
        {
            get
            {
                return m_importUnit;
            }
            set
            {
                m_importUnit = value;
            }
        }


        /// <summary>
        /// All available layers only 
        /// </summary>
        public ReadOnlyCollection<String> VisibleLayersOnly
        {
            get
            {
                return new ReadOnlyCollection<String>(m_visibleLayersOnly);
            }
        }


        /// <summary>
        /// All boolean values for available visible layers
        /// </summary>
        public ReadOnlyCollection<bool> EnumVisibleLayersOnly
        {
            get
            {
                return new ReadOnlyCollection<bool>(m_enumVisibleLayersOnly);
            }
        }


        /// <summary>
        /// Whether import visible layer only
        /// </summary>
        public bool ImportVisibleLayersOnly
        {
            get
            {
                return m_importVisibleLayersOnly;
            }
            set
            {
                m_importVisibleLayersOnly = value;
            }
        }

        /// <summary>
        /// Whether active view is 3D
        /// </summary>
        public bool Is3DView
        {
            get 
            { 
                return m_is3DView; 
            }
            set 
            { 
                m_is3DView = value; 
            }
        }
        #endregion


        #region Class Member Methods
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="format">Format to import</param>
        public ImportDWGData(ExternalCommandData commandData, ImportFormat format)
            : base(commandData, format)
        {
            Initialize();
        }


        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {
            bool imported = false;

            //parameter: DWGImportOptions
            DWGImportOptions dwgImportOption = new DWGImportOptions();
            dwgImportOption.ColorMode = m_importColorMode;
            dwgImportOption.CustomScale = m_importCustomScale;
            dwgImportOption.OrientToView = m_importOrientToView;
            dwgImportOption.Placement = m_importPlacement;
            dwgImportOption.ThisViewOnly = m_importThisViewOnly;
            View view = null;
            if (!m_importThisViewOnly)
            {
                view = m_importView;
            }
            else
            {
                view = m_activeDoc.ActiveView;
            }
            dwgImportOption.Unit = m_importUnit;
            dwgImportOption.VisibleLayersOnly = m_importVisibleLayersOnly;

            //parameter: ElementId
            ElementId elementId = null;

            //Import
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import");
            t.Start();
            imported = m_activeDoc.Import(m_importFileFullName, dwgImportOption, view, out elementId);
            t.Commit();

            return imported;
        }
        #endregion


        #region Class Implementation
        /// <summary>
        /// Initialize the variables
        /// </summary>
        private void Initialize()
        {
            //ColorMode
            m_colorMode = new List<String>();
            m_enumColorMode = new List<Autodesk.Revit.DB.ImportColorMode>();
            m_colorMode.Add("Black and white");
            m_enumColorMode.Add(Autodesk.Revit.DB.ImportColorMode.BlackAndWhite);
            m_colorMode.Add("Preserve colors");
            m_enumColorMode.Add(Autodesk.Revit.DB.ImportColorMode.Preserved);
            m_colorMode.Add("Invert colors");
            m_enumColorMode.Add(Autodesk.Revit.DB.ImportColorMode.Inverted);

            //Placement
            m_placement = new List<String>();
            m_enumPlacement = new List<Autodesk.Revit.DB.ImportPlacement>();
            m_placement.Add("Center-to-center");
            m_enumPlacement.Add(Autodesk.Revit.DB.ImportPlacement.Centered);
            m_placement.Add("Origin-to-origin");
            m_enumPlacement.Add(Autodesk.Revit.DB.ImportPlacement.Origin);

            //Unit
            m_unit = new List<String>();
            m_enumUnit = new List<Autodesk.Revit.DB.ImportUnit>();
            m_unit.Add("Auto-Detect");
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Default);
            m_unit.Add(Autodesk.Revit.DB.ImportUnit.Foot.ToString());
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Foot);
            m_unit.Add(Autodesk.Revit.DB.ImportUnit.Inch.ToString());
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Inch);
            m_unit.Add(Autodesk.Revit.DB.ImportUnit.Meter.ToString());
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Meter);
            m_unit.Add(Autodesk.Revit.DB.ImportUnit.Decimeter.ToString());
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Decimeter);
            m_unit.Add(Autodesk.Revit.DB.ImportUnit.Centimeter.ToString());
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Centimeter);
            m_unit.Add(Autodesk.Revit.DB.ImportUnit.Millimeter.ToString());
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Millimeter);
            m_unit.Add("Custom");
            m_enumUnit.Add(Autodesk.Revit.DB.ImportUnit.Default);

            //VisibleLayersOnly
            m_visibleLayersOnly = new List<String>();
            m_enumVisibleLayersOnly = new List<bool>();
            m_visibleLayersOnly.Add("All");
            m_enumVisibleLayersOnly.Add(false);
            m_visibleLayersOnly.Add("Visible");
            m_enumVisibleLayersOnly.Add(true);

            //Whether active view is 3D
            m_is3DView = false;
            if (m_activeDoc.ActiveView.ViewType == Autodesk.Revit.DB.ViewType.ThreeD)
            {
                m_is3DView = true;
            }            

            //Views
            m_views = new ViewSet();
            GetViews();

            m_importCustomScale = 0.0;
            m_importOrientToView = true;
            m_importUnit = Autodesk.Revit.DB.ImportUnit.Default;
            m_importThisViewOnly = false;
            m_importView = m_activeDoc.ActiveView;
            m_importColorMode = Autodesk.Revit.DB.ImportColorMode.Inverted;
            m_importPlacement = Autodesk.Revit.DB.ImportPlacement.Centered;
            m_importVisibleLayersOnly = false;

            m_filter = "DWG Files (*.dwg)|*.dwg";
            m_title = "Import DWG";
        }


        /// <summary>
        /// Get all the views to be displayed
        /// </summary>
        private void GetViews()
        {
            FilteredElementCollector collector = new FilteredElementCollector(m_activeDoc);
            FilteredElementIterator itor = collector.OfClass(typeof(View)).GetElementIterator();
            itor.Reset();
            ViewSet views = new ViewSet();
            ViewSet floorPlans = new ViewSet();
            ViewSet ceilingPlans = new ViewSet();
            ViewSet engineeringPlans = new ViewSet();
            while (itor.MoveNext())
            {
                View view = itor.Current as View;
                // skip view templates because they're invalid for import/export
                if (view == null || view.IsTemplate)
                {
                    continue;
                }
                else if (view.ViewType == Autodesk.Revit.DB.ViewType.FloorPlan)
                {
                    floorPlans.Insert(view);
                }
                else if (view.ViewType == Autodesk.Revit.DB.ViewType.CeilingPlan)
                {
                    ceilingPlans.Insert(view);
                }
                else if (view.ViewType == Autodesk.Revit.DB.ViewType.EngineeringPlan)
                {
                    engineeringPlans.Insert(view);
                }
            }

            foreach (View floorPlan in floorPlans)
            {
                foreach (View ceilingPlan in ceilingPlans)
                {
                    if (floorPlan.Name == ceilingPlan.Name)
                    {
                        views.Insert(floorPlan);
                    }
                }
            }

            foreach (View engineeringPlan in engineeringPlans)
            {
                if (engineeringPlan.Name == engineeringPlan.GenLevel.Name)
                {
                    views.Insert(engineeringPlan);
                }
            }

            View activeView = m_activeDoc.ActiveView;
            Autodesk.Revit.DB.ViewType viewType = activeView.ViewType;
            if (viewType == Autodesk.Revit.DB.ViewType.FloorPlan ||
                viewType == Autodesk.Revit.DB.ViewType.CeilingPlan)
            {
                m_views.Insert(activeView);
                foreach (View view in views)
                {
                    if (view.GenLevel.Elevation < activeView.GenLevel.Elevation)
                    {
                        m_views.Insert(view);
                    }
                }
            }
            else if (viewType == Autodesk.Revit.DB.ViewType.EngineeringPlan)
            {
                if (views.Contains(activeView))
                {
                    m_views.Insert(activeView);
                }
                foreach (View view in views)
                {
                    if (view.GenLevel.Elevation < activeView.GenLevel.Elevation)
                    {
                        m_views.Insert(view);
                    }
                }
            }
            else//Get view of the lowest elevation
            {
                int i = 0;
                double elevation = 0;
                View viewLowestElevation = null;
                foreach (View view in views)
                {
                    if (i == 0)
                    {
                        elevation = view.GenLevel.Elevation;
                        viewLowestElevation = view;
                    }
                    else
                    {
                        if (view.GenLevel.Elevation <= elevation)
                        {
                            elevation = view.GenLevel.Elevation;
                            viewLowestElevation = view;
                        }
                    }

                    i++;
                }
                m_views.Insert(viewLowestElevation);
            }
        }
        #endregion
    }
}

ImportDWGForm.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// It contains a dialog which provides the options of import
    /// </summary>
    partial class ImportDWGForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.buttonCancel = new System.Windows.Forms.Button();
            this.buttonOpen = new System.Windows.Forms.Button();
            this.labelFileName = new System.Windows.Forms.Label();
            this.textBoxFileSource = new System.Windows.Forms.TextBox();
            this.buttonBrowser = new System.Windows.Forms.Button();
            this.groupBoxPositioning = new System.Windows.Forms.GroupBox();
            this.labelAutomaticallyPlace = new System.Windows.Forms.Label();
            this.labelPlaceLevel = new System.Windows.Forms.Label();
            this.radioButtonOrigin2Origin = new System.Windows.Forms.RadioButton();
            this.radioButtonCenter2Center = new System.Windows.Forms.RadioButton();
            this.comboBoxLevel = new System.Windows.Forms.ComboBox();
            this.checkBoxOrient2View = new System.Windows.Forms.CheckBox();
            this.groupBoxScaling = new System.Windows.Forms.GroupBox();
            this.comboBoxUnits = new System.Windows.Forms.ComboBox();
            this.textBoxScale = new System.Windows.Forms.TextBox();
            this.labelScaleFactor = new System.Windows.Forms.Label();
            this.labelUnits = new System.Windows.Forms.Label();
            this.groupBoxColors = new System.Windows.Forms.GroupBox();
            this.radioButtonInvertColor = new System.Windows.Forms.RadioButton();
            this.radioButtonPreserve = new System.Windows.Forms.RadioButton();
            this.radioButtonBlackWhite = new System.Windows.Forms.RadioButton();
            this.checkBoxCurrentViewOnly = new System.Windows.Forms.CheckBox();
            this.comboBoxLayers = new System.Windows.Forms.ComboBox();
            this.labelLayers = new System.Windows.Forms.Label();
            this.groupBoxPositioning.SuspendLayout();
            this.groupBoxScaling.SuspendLayout();
            this.groupBoxColors.SuspendLayout();
            this.SuspendLayout();
            // 
            // buttonCancel
            // 
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.Location = new System.Drawing.Point(390, 285);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(75, 21);
            this.buttonCancel.TabIndex = 8;
            this.buttonCancel.Text = "&Cancel";
            this.buttonCancel.UseVisualStyleBackColor = true;
            // 
            // buttonOpen
            // 
            this.buttonOpen.Location = new System.Drawing.Point(303, 285);
            this.buttonOpen.Name = "buttonOpen";
            this.buttonOpen.Size = new System.Drawing.Size(75, 21);
            this.buttonOpen.TabIndex = 7;
            this.buttonOpen.Text = "&Open";
            this.buttonOpen.UseVisualStyleBackColor = true;
            this.buttonOpen.Click += new System.EventHandler(this.buttonOpen_Click);
            // 
            // labelFileName
            // 
            this.labelFileName.AutoSize = true;
            this.labelFileName.Location = new System.Drawing.Point(10, 15);
            this.labelFileName.Name = "labelFileName";
            this.labelFileName.Size = new System.Drawing.Size(61, 13);
            this.labelFileName.TabIndex = 10;
            this.labelFileName.Text = "File source:";
            // 
            // textBoxFileSource
            // 
            this.textBoxFileSource.Location = new System.Drawing.Point(73, 11);
            this.textBoxFileSource.Name = "textBoxFileSource";
            this.textBoxFileSource.Size = new System.Drawing.Size(369, 20);
            this.textBoxFileSource.TabIndex = 1;
            // 
            // buttonBrowser
            // 
            this.buttonBrowser.Location = new System.Drawing.Point(442, 11);
            this.buttonBrowser.Name = "buttonBrowser";
            this.buttonBrowser.Size = new System.Drawing.Size(24, 20);
            this.buttonBrowser.TabIndex = 0;
            this.buttonBrowser.Text = "...";
            this.buttonBrowser.UseVisualStyleBackColor = true;
            this.buttonBrowser.Click += new System.EventHandler(this.buttonBrowser_Click);
            // 
            // groupBoxPositioning
            // 
            this.groupBoxPositioning.Controls.Add(this.labelAutomaticallyPlace);
            this.groupBoxPositioning.Controls.Add(this.labelPlaceLevel);
            this.groupBoxPositioning.Controls.Add(this.radioButtonOrigin2Origin);
            this.groupBoxPositioning.Controls.Add(this.radioButtonCenter2Center);
            this.groupBoxPositioning.Controls.Add(this.comboBoxLevel);
            this.groupBoxPositioning.Controls.Add(this.checkBoxOrient2View);
            this.groupBoxPositioning.Location = new System.Drawing.Point(229, 43);
            this.groupBoxPositioning.Name = "groupBoxPositioning";
            this.groupBoxPositioning.Size = new System.Drawing.Size(237, 157);
            this.groupBoxPositioning.TabIndex = 5;
            this.groupBoxPositioning.TabStop = false;
            this.groupBoxPositioning.Text = "Positioning";
            // 
            // labelAutomaticallyPlace
            // 
            this.labelAutomaticallyPlace.AutoSize = true;
            this.labelAutomaticallyPlace.Location = new System.Drawing.Point(15, 18);
            this.labelAutomaticallyPlace.Name = "labelAutomaticallyPlace";
            this.labelAutomaticallyPlace.Size = new System.Drawing.Size(98, 13);
            this.labelAutomaticallyPlace.TabIndex = 0;
            this.labelAutomaticallyPlace.Text = "Automatically place";
            // 
            // labelPlaceLevel
            // 
            this.labelPlaceLevel.AutoSize = true;
            this.labelPlaceLevel.Location = new System.Drawing.Point(14, 129);
            this.labelPlaceLevel.Name = "labelPlaceLevel";
            this.labelPlaceLevel.Size = new System.Drawing.Size(74, 13);
            this.labelPlaceLevel.TabIndex = 5;
            this.labelPlaceLevel.Text = "Place at level:";
            // 
            // radioButtonOrigin2Origin
            // 
            this.radioButtonOrigin2Origin.AutoSize = true;
            this.radioButtonOrigin2Origin.Location = new System.Drawing.Point(19, 60);
            this.radioButtonOrigin2Origin.Name = "radioButtonOrigin2Origin";
            this.radioButtonOrigin2Origin.Size = new System.Drawing.Size(92, 17);
            this.radioButtonOrigin2Origin.TabIndex = 2;
            this.radioButtonOrigin2Origin.TabStop = true;
            this.radioButtonOrigin2Origin.Text = "Origin-to-origin";
            this.radioButtonOrigin2Origin.UseVisualStyleBackColor = true;
            // 
            // radioButtonCenter2Center
            // 
            this.radioButtonCenter2Center.AutoSize = true;
            this.radioButtonCenter2Center.Checked = true;
            this.radioButtonCenter2Center.Location = new System.Drawing.Point(19, 37);
            this.radioButtonCenter2Center.Name = "radioButtonCenter2Center";
            this.radioButtonCenter2Center.Size = new System.Drawing.Size(101, 17);
            this.radioButtonCenter2Center.TabIndex = 1;
            this.radioButtonCenter2Center.TabStop = true;
            this.radioButtonCenter2Center.Text = "Center-to-center";
            this.radioButtonCenter2Center.UseVisualStyleBackColor = true;
            // 
            // comboBoxLevel
            // 
            this.comboBoxLevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxLevel.FormattingEnabled = true;
            this.comboBoxLevel.Location = new System.Drawing.Point(91, 125);
            this.comboBoxLevel.Name = "comboBoxLevel";
            this.comboBoxLevel.Size = new System.Drawing.Size(122, 21);
            this.comboBoxLevel.TabIndex = 4;
            // 
            // checkBoxOrient2View
            // 
            this.checkBoxOrient2View.AutoSize = true;
            this.checkBoxOrient2View.Checked = true;
            this.checkBoxOrient2View.CheckState = System.Windows.Forms.CheckState.Checked;
            this.checkBoxOrient2View.Location = new System.Drawing.Point(17, 104);
            this.checkBoxOrient2View.Name = "checkBoxOrient2View";
            this.checkBoxOrient2View.Size = new System.Drawing.Size(92, 17);
            this.checkBoxOrient2View.TabIndex = 3;
            this.checkBoxOrient2View.Text = "Orient to View";
            this.checkBoxOrient2View.UseVisualStyleBackColor = true;
            // 
            // groupBoxScaling
            // 
            this.groupBoxScaling.Controls.Add(this.comboBoxUnits);
            this.groupBoxScaling.Controls.Add(this.textBoxScale);
            this.groupBoxScaling.Controls.Add(this.labelScaleFactor);
            this.groupBoxScaling.Controls.Add(this.labelUnits);
            this.groupBoxScaling.Location = new System.Drawing.Point(10, 202);
            this.groupBoxScaling.Name = "groupBoxScaling";
            this.groupBoxScaling.Size = new System.Drawing.Size(456, 50);
            this.groupBoxScaling.TabIndex = 6;
            this.groupBoxScaling.TabStop = false;
            this.groupBoxScaling.Text = "Scaling";
            // 
            // comboBoxUnits
            // 
            this.comboBoxUnits.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxUnits.FormattingEnabled = true;
            this.comboBoxUnits.Location = new System.Drawing.Point(79, 18);
            this.comboBoxUnits.Name = "comboBoxUnits";
            this.comboBoxUnits.Size = new System.Drawing.Size(121, 21);
            this.comboBoxUnits.TabIndex = 0;
            this.comboBoxUnits.SelectedIndexChanged += new System.EventHandler(this.comboBoxUnits_SelectedIndexChanged);
            // 
            // textBoxScale
            // 
            this.textBoxScale.Enabled = false;
            this.textBoxScale.Location = new System.Drawing.Point(310, 19);
            this.textBoxScale.Name = "textBoxScale";
            this.textBoxScale.Size = new System.Drawing.Size(122, 20);
            this.textBoxScale.TabIndex = 1;
            this.textBoxScale.Text = 1.0.ToString("0.000000");
            this.textBoxScale.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxScale_KeyPress);
            this.textBoxScale.TextChanged += new System.EventHandler(this.textBoxScale_TextChanged);
            // 
            // labelScaleFactor
            // 
            this.labelScaleFactor.AutoSize = true;
            this.labelScaleFactor.Location = new System.Drawing.Point(234, 22);
            this.labelScaleFactor.Name = "labelScaleFactor";
            this.labelScaleFactor.Size = new System.Drawing.Size(67, 13);
            this.labelScaleFactor.TabIndex = 2;
            this.labelScaleFactor.Text = "Scale factor:";
            // 
            // labelUnits
            // 
            this.labelUnits.AutoSize = true;
            this.labelUnits.Location = new System.Drawing.Point(7, 22);
            this.labelUnits.Name = "labelUnits";
            this.labelUnits.Size = new System.Drawing.Size(64, 13);
            this.labelUnits.TabIndex = 0;
            this.labelUnits.Text = "Import units:";
            // 
            // groupBoxColors
            // 
            this.groupBoxColors.Controls.Add(this.radioButtonInvertColor);
            this.groupBoxColors.Controls.Add(this.radioButtonPreserve);
            this.groupBoxColors.Controls.Add(this.radioButtonBlackWhite);
            this.groupBoxColors.Location = new System.Drawing.Point(10, 43);
            this.groupBoxColors.Name = "groupBoxColors";
            this.groupBoxColors.Size = new System.Drawing.Size(200, 95);
            this.groupBoxColors.TabIndex = 2;
            this.groupBoxColors.TabStop = false;
            this.groupBoxColors.Text = "Layer/Level Colors";
            // 
            // radioButtonInvertColor
            // 
            this.radioButtonInvertColor.AutoSize = true;
            this.radioButtonInvertColor.Checked = true;
            this.radioButtonInvertColor.Location = new System.Drawing.Point(14, 66);
            this.radioButtonInvertColor.Name = "radioButtonInvertColor";
            this.radioButtonInvertColor.Size = new System.Drawing.Size(83, 17);
            this.radioButtonInvertColor.TabIndex = 2;
            this.radioButtonInvertColor.TabStop = true;
            this.radioButtonInvertColor.Text = "Invert colors";
            this.radioButtonInvertColor.UseVisualStyleBackColor = true;
            // 
            // radioButtonPreserve
            // 
            this.radioButtonPreserve.AutoSize = true;
            this.radioButtonPreserve.Location = new System.Drawing.Point(14, 43);
            this.radioButtonPreserve.Name = "radioButtonPreserve";
            this.radioButtonPreserve.Size = new System.Drawing.Size(98, 17);
            this.radioButtonPreserve.TabIndex = 1;
            this.radioButtonPreserve.Text = "Preserve colors";
            this.radioButtonPreserve.UseVisualStyleBackColor = true;
            // 
            // radioButtonBlackWhite
            // 
            this.radioButtonBlackWhite.AutoSize = true;
            this.radioButtonBlackWhite.Location = new System.Drawing.Point(15, 20);
            this.radioButtonBlackWhite.Name = "radioButtonBlackWhite";
            this.radioButtonBlackWhite.Size = new System.Drawing.Size(101, 17);
            this.radioButtonBlackWhite.TabIndex = 0;
            this.radioButtonBlackWhite.Text = "Black and white";
            this.radioButtonBlackWhite.UseVisualStyleBackColor = true;
            // 
            // checkBoxCurrentViewOnly
            // 
            this.checkBoxCurrentViewOnly.AutoSize = true;
            this.checkBoxCurrentViewOnly.Location = new System.Drawing.Point(17, 147);
            this.checkBoxCurrentViewOnly.Name = "checkBoxCurrentViewOnly";
            this.checkBoxCurrentViewOnly.Size = new System.Drawing.Size(107, 17);
            this.checkBoxCurrentViewOnly.TabIndex = 3;
            this.checkBoxCurrentViewOnly.Text = "Current view only";
            this.checkBoxCurrentViewOnly.UseVisualStyleBackColor = true;
            this.checkBoxCurrentViewOnly.CheckedChanged += new System.EventHandler(this.checkBoxCurrentViewOnly_CheckedChanged);
            // 
            // comboBoxLayers
            // 
            this.comboBoxLayers.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboBoxLayers.FormattingEnabled = true;
            this.comboBoxLayers.Location = new System.Drawing.Point(88, 168);
            this.comboBoxLayers.Name = "comboBoxLayers";
            this.comboBoxLayers.Size = new System.Drawing.Size(122, 21);
            this.comboBoxLayers.TabIndex = 4;
            // 
            // labelLayers
            // 
            this.labelLayers.AutoSize = true;
            this.labelLayers.Location = new System.Drawing.Point(14, 172);
            this.labelLayers.Name = "labelLayers";
            this.labelLayers.Size = new System.Drawing.Size(41, 13);
            this.labelLayers.TabIndex = 5;
            this.labelLayers.Text = "Layers:";
            // 
            // ImportDWGForm
            // 
            this.AcceptButton = this.buttonOpen;
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(480, 316);
            this.Controls.Add(this.checkBoxCurrentViewOnly);
            this.Controls.Add(this.groupBoxPositioning);
            this.Controls.Add(this.labelLayers);
            this.Controls.Add(this.groupBoxScaling);
            this.Controls.Add(this.groupBoxColors);
            this.Controls.Add(this.buttonBrowser);
            this.Controls.Add(this.comboBoxLayers);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonOpen);
            this.Controls.Add(this.labelFileName);
            this.Controls.Add(this.textBoxFileSource);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "ImportDWGForm";
            this.ShowIcon = false;
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Import";
            this.groupBoxPositioning.ResumeLayout(false);
            this.groupBoxPositioning.PerformLayout();
            this.groupBoxScaling.ResumeLayout(false);
            this.groupBoxScaling.PerformLayout();
            this.groupBoxColors.ResumeLayout(false);
            this.groupBoxColors.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Button buttonCancel;
        private System.Windows.Forms.Button buttonOpen;
        private System.Windows.Forms.Label labelFileName;
        private System.Windows.Forms.TextBox textBoxFileSource;
        private System.Windows.Forms.Button buttonBrowser;
        private System.Windows.Forms.GroupBox groupBoxPositioning;
        private System.Windows.Forms.RadioButton radioButtonOrigin2Origin;
        private System.Windows.Forms.RadioButton radioButtonCenter2Center;
        private System.Windows.Forms.CheckBox checkBoxCurrentViewOnly;
        private System.Windows.Forms.ComboBox comboBoxLevel;
        private System.Windows.Forms.CheckBox checkBoxOrient2View;
        private System.Windows.Forms.GroupBox groupBoxScaling;
        private System.Windows.Forms.TextBox textBoxScale;
        private System.Windows.Forms.Label labelScaleFactor;
        private System.Windows.Forms.Label labelUnits;
        private System.Windows.Forms.GroupBox groupBoxColors;
        private System.Windows.Forms.RadioButton radioButtonInvertColor;
        private System.Windows.Forms.RadioButton radioButtonPreserve;
        private System.Windows.Forms.RadioButton radioButtonBlackWhite;
        private System.Windows.Forms.Label labelAutomaticallyPlace;
        private System.Windows.Forms.Label labelPlaceLevel;
        private System.Windows.Forms.ComboBox comboBoxUnits;
        private System.Windows.Forms.ComboBox comboBoxLayers;
        private System.Windows.Forms.Label labelLayers;
    }
}

ImportImageData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
   /// <summary>
   /// Data class which stores the information for importing image format
   /// </summary>
   class ImportImageData : ImportData
   {
      /// <summary>
      /// Constructor
      /// </summary>
      /// <param name="commandData">Revit command data</param>
      /// <param name="importFormat">Format to import</param>
      public ImportImageData(ExternalCommandData commandData, ImportFormat importFormat)
          : base(commandData, importFormat)
      {
         if (OptionalFunctionalityUtils.IsPDFImportAvailable())
            m_filter = "All Image Files (*.bmp, *.gif, *.jpg, *.jpeg, *.pdf, *.png, *.tif)|*.bmp;*.gif;*.jpg;*.jpeg;*.pdf;*.png;*.tif";
         else
            m_filter = "All Image Files (*.bmp, *.gif, *.jpg, *.jpeg, *.png, *.tif)|*.bmp;*.gif;*.jpg;*.jpeg;*.png;*.tif";

         m_title = "Import Image";
      }

      /// <summary>
      /// Collect the parameters and export
      /// </summary>
      /// <returns></returns>
      public override bool Import()
      {
         using (Transaction t = new Transaction(m_activeDoc))
         {
            t.SetName("Import");
            t.Start();

            // Step 1: Create an ImageType 
            //ImageTypeOptions specify the source of the image
            // If the source is a PDF file then ImageTypeOptions can be used to:
            //   - Select a specific page from the PDF
            //   - Select a Resolution (in dots-per-inch) at which to rasterize the PDF
            // For other image types the page number should be 1, and the resolution is only used to determine the size of the image

            ImageTypeOptions typeOptions = new ImageTypeOptions(m_importFileFullName);
            ImageType imageType = ImageType.Create(m_activeDoc, typeOptions);

            // Step 2: Create an ImageInstance, but only if the active view is able to contain images.
            View view = CommandData.Application.ActiveUIDocument.Document.ActiveView;
            if (ImageInstance.IsValidView(view))
            {

               // ImagePlacementOptions
               ImagePlacementOptions placementOptions = new ImagePlacementOptions();
               placementOptions.PlacementPoint = Autodesk.Revit.DB.BoxPlacement.TopLeft;
               placementOptions.Location = new XYZ(1, 1, 1);

               ImageInstance imageInstance = ImageInstance.Create(m_activeDoc, view, imageType.Id, placementOptions);
            }

            t.Commit();
         }

         return true;
      }
   }
}

ImportGBXMLData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the information for importing GBXML format
    /// </summary>
    class ImportGBXMLData : ImportData
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="importFormat">Format to import</param>
        public ImportGBXMLData(ExternalCommandData commandData, ImportFormat importFormat)
            : base(commandData, importFormat)
        {
            m_filter = "XML Documents (*.xml)|*.xml";
            m_title = "Import GBXML";
        }

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {
            bool imported = false;

            //parameter: GBXMLImportOptions
            GBXMLImportOptions options = new GBXMLImportOptions();

            //Import
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import GBXML");
            t.Start();
            imported = m_activeDoc.Import(m_importFileFullName, options);
            t.Commit();

            return imported;
        }
    }
}


ImportInventorData.cs

//
// (C) Copyright 2003-2019 by Autodesk, Inc.
//
// Permission to use, copy, modify, and distribute this software in
// object code form for any purpose and without fee is hereby granted,
// provided that the above copyright notice appears in all copies and
// that both that copyright notice and the limited warranty and
// restricted rights notice below appear in all supporting
// documentation.
//
// AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
// AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
// MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
// DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
// UNINTERRUPTED OR ERROR FREE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer
// Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
// (Rights in Technical Data and Computer Software), as applicable.
// 

using System;
using System.Collections.Generic;
using System.Text;

using Autodesk.Revit;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace Revit.SDK.Samples.ImportExport.CS
{
    /// <summary>
    /// Data class which stores the information for importing image format
    /// </summary>
    class ImportInventorData : ImportData
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="commandData">Revit command data</param>
        /// <param name="importFormat">Format to import</param>
        public ImportInventorData(ExternalCommandData commandData, ImportFormat importFormat)
            : base(commandData, importFormat)
        {
            m_filter = "Autodesk Exchange Files (*.adsk)|*.adsk";
            m_title = "Import Inventor File";
        }

        /// <summary>
        /// Collect the parameters and import
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {

            //Import	
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import");
            t.Start();
            Document doc =m_commandData.Application.Application.OpenBuildingComponentDocument(m_importFileFullName);
            t.Commit();

            return doc == null ? false : true;
        }
    }
}