added Revit 2022 SDK minus except *rvt and *rfa

This commit is contained in:
Jeremy Tammik
2021-04-20 11:36:21 +02:00
parent 1133a82dc5
commit 7e327986e8
3034 changed files with 1245318 additions and 0 deletions
@@ -0,0 +1,480 @@
//
// (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
}
}
@@ -0,0 +1,276 @@
//
// (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;
}
}
@@ -0,0 +1,116 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Provide a dialog which provides the options of lower priority information for exporting dwg format
/// </summary>
public partial class ExportBaseOptionsForm : System.Windows.Forms.Form
{
/// <summary>
/// data class
/// </summary>
private ExportBaseOptionsData m_exportOptionsData;
/// <summary>
/// Whether export the current view only
/// </summary>
private bool m_contain3DView;
/// <summary>
/// Constructor
/// </summary>
/// <param name="exportOptionsData">Data class object</param>
/// <param name="contain3DView">If views to export contain 3D views</param>
/// <param name="exportFormat">export format</param>
public ExportBaseOptionsForm(ExportBaseOptionsData exportOptionsData, bool contain3DView, String exportFormat)
{
InitializeComponent();
m_exportOptionsData = exportOptionsData;
m_contain3DView = contain3DView;
this.Text = "Export " + exportFormat + " Options";
InitializeControl();
}
/// <summary>
/// Initialize values and status of controls
/// </summary>
private void InitializeControl()
{
comboBoxLayersAndProperties.DataSource = m_exportOptionsData.LayersAndProperties;
comboBoxLayersAndProperties.SelectedIndex = 0;
comboBoxLayerSettings.DataSource = m_exportOptionsData.LayerMapping;
comboBoxLayerSettings.SelectedIndex = 0;
comboBoxLinetypeScaling.DataSource = m_exportOptionsData.LineScaling;
comboBoxLinetypeScaling.SelectedIndex = 2;
comboBoxCoorSystem.DataSource = m_exportOptionsData.CoorSystem;
comboBoxCoorSystem.SelectedIndex = 0;
comboBoxDWGUnit.DataSource = m_exportOptionsData.Units;
comboBoxDWGUnit.SelectedIndex = 1;
comboBoxSolids.DataSource = m_exportOptionsData.Solids;
comboBoxSolids.SelectedIndex = 0;
checkBoxMergeViews.Checked = m_exportOptionsData.ExportMergeFiles;
checkBoxMergeViews.Text = "Merge all views in one file (via XRefs).";
if (m_contain3DView)
{
comboBoxSolids.Enabled = true;
}
else
{
comboBoxSolids.Enabled = false;
}
}
/// <summary>
/// Transfer information back to ExportOptionData class
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, EventArgs e)
{
m_exportOptionsData.ExportLayersAndProperties =
m_exportOptionsData.EnumLayersAndProperties[comboBoxLayersAndProperties.SelectedIndex];
m_exportOptionsData.ExportLayerMapping =
m_exportOptionsData.EnumLayerMapping[comboBoxLayerSettings.SelectedIndex];
m_exportOptionsData.ExportLineScaling =
m_exportOptionsData.EnumLineScaling[comboBoxLinetypeScaling.SelectedIndex];
m_exportOptionsData.ExportCoorSystem =
m_exportOptionsData.EnumCoorSystem[comboBoxCoorSystem.SelectedIndex];
m_exportOptionsData.ExportUnit = m_exportOptionsData.EnumUnits[comboBoxDWGUnit.SelectedIndex];
m_exportOptionsData.ExportSolid = m_exportOptionsData.EnumSolids[comboBoxSolids.SelectedIndex];
m_exportOptionsData.ExportAreas = checkBoxExportingAreas.Checked;
m_exportOptionsData.ExportMergeFiles = checkBoxMergeViews.Checked;
this.Close();
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,278 @@
//
// (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
}
}
@@ -0,0 +1,276 @@
//
// (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;
}
}
@@ -0,0 +1,175 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Diagnostics;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Provide a dialog which provides the options for exporting dgn format
/// </summary>
public partial class ExportDGNOptionsForm : System.Windows.Forms.Form
{
/// <summary>
/// data class
/// </summary>
private ExportDGNData m_data;
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">Data class object</param>
public ExportDGNOptionsForm(ExportDGNData data)
{
m_data = data;
InitializeComponent();
InitializeControl();
}
/// <summary>
/// Initialize values and status of controls
/// </summary>
private void InitializeControl()
{
comboBoxLayerSettings.DataSource = m_data.LayerMapping;
comboBoxLayerSettings.SelectedIndex = 0;
comboBoxExportFileFormat.DataSource = m_data.ExportFileVersions;
comboBoxExportFileFormat.SelectedIndex = 0;
checkBoxHideReferencePlanes.Checked = false;
checkBoxHideScopeBoxes.Checked = false;
checkBoxHideUnrefereceViewTag.Checked = false;
}
/// <summary>
/// OK button click event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(textBox2DSeedFile.Text))
{
TaskDialog.Show("Specify 2D seed file", "Please specify the 2D seed file.", TaskDialogCommonButtons.Ok);
button2DSeedFile.Focus();
return;
}
if (!File.Exists(textBox2DSeedFile.Text))
{
TaskDialog.Show("Specify 2D seed file", "The 2D seed file does not exist.", TaskDialogCommonButtons.Ok);
button2DSeedFile.Focus();
return;
}
if (String.IsNullOrEmpty(textBox3DSeedFile.Text))
{
TaskDialog.Show("Specify 3D seed file", "Please specify the 3D seed file.", TaskDialogCommonButtons.Ok);
button3DSeedFile.Focus();
return;
}
if (!File.Exists(textBox3DSeedFile.Text))
{
TaskDialog.Show("Specify 3D seed file", "The 3D seed file does not exist.", TaskDialogCommonButtons.Ok);
button3DSeedFile.Focus();
return;
}
m_data.ExportLayerMapping =
m_data.EnumLayerMapping[comboBoxLayerSettings.SelectedIndex];
m_data.ExportFileVersion = m_data.ExportFileVersions[comboBoxExportFileFormat.SelectedIndex];
m_data.HideScopeBox = checkBoxHideScopeBoxes.Checked;
m_data.HideReferencePlane = checkBoxHideReferencePlanes.Checked;
m_data.HideUnreferenceViewTags = checkBoxHideUnrefereceViewTag.Checked;
this.Close();
}
/// <summary>
/// button2DSeedFile click event
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2DSeedFile_Click(object sender, EventArgs e)
{
String fileName = String.Empty;
DialogResult result = ShowOpenDialog(ref fileName);
if (result != DialogResult.Cancel)
{
textBox2DSeedFile.Text = fileName;
}
}
/// <summary>
/// Show open file dialog
/// </summary>
/// <param name="returnFileName"></param>
/// <returns></returns>
public static DialogResult ShowOpenDialog(ref String returnFileName)
{
ProcessModule mainModule = Process.GetCurrentProcess().MainModule;
String folderRevit = Path.GetDirectoryName(mainModule.FileName);
String folderACADInterop = Path.Combine(folderRevit, "ACADInterop");
String initialDirectory = folderRevit;
if (Directory.Exists(folderACADInterop))
{
initialDirectory = folderACADInterop;
}
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Title = "Specify seed file";
openFileDialog.InitialDirectory = initialDirectory;
openFileDialog.Filter = "DGN Files |*.dgn";
openFileDialog.RestoreDirectory = true;
DialogResult result = openFileDialog.ShowDialog();
if (result != DialogResult.Cancel)
{
returnFileName = openFileDialog.FileName;
}
return result;
}
}
private void button3DSeedFile_Click(object sender, EventArgs e)
{
String fileName = String.Empty;
DialogResult result = ShowOpenDialog(ref fileName);
if (result != DialogResult.Cancel)
{
textBox3DSeedFile.Text = fileName;
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,248 @@
//
// (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
}
}
@@ -0,0 +1,232 @@
//
// (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;
}
}
@@ -0,0 +1,99 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Data class which stores information of lower priority for exporting DWF(x) format.
/// </summary>
public partial class ExportDWFOptionForm : System.Windows.Forms.Form
{
/// <summary>
/// ExportDWFData object
/// </summary>
private ExportDWFData m_data;
/// <summary>
/// Constructor
/// </summary>
/// <param name="data">Data class object</param>
public ExportDWFOptionForm(ExportDWFData data)
{
m_data = data;
InitializeComponent();
Initialize();
}
/// <summary>
/// Initialize controls
/// </summary>
private void Initialize()
{
checkBoxModelElements.Checked = m_data.ExportObjectData;
checkBoxRoomsAndAreas.Checked = m_data.ExportAreas;
radioButtonStandardFormat.Checked = true;
radioButtonCompressedFormat.Checked = false;
labelImageQuality.Enabled = false;
comboBoxImageQuality.Enabled = false;
comboBoxImageQuality.DataSource = m_data.ImageQualities;
checkBoxMergeViews.Enabled = !m_data.CurrentViewOnly;
checkBoxMergeViews.Checked = !m_data.CurrentViewOnly;
checkBoxMergeViews.Text = "Combine selected views and sheets into a single file";
}
private void buttonOK_Click(object sender, EventArgs e)
{
m_data.ExportObjectData = checkBoxModelElements.Checked;
m_data.ExportAreas = checkBoxRoomsAndAreas.Enabled ? checkBoxRoomsAndAreas.Checked : false;
m_data.ExportMergeFiles = checkBoxMergeViews.Checked;
if (radioButtonStandardFormat.Checked)
{
m_data.DwfImageFormat = Autodesk.Revit.DB.DWFImageFormat.Lossless;
m_data.DwfImageQuality = Autodesk.Revit.DB.DWFImageQuality.Default;
}
else
{
m_data.DwfImageFormat = Autodesk.Revit.DB.DWFImageFormat.Lossy;
m_data.DwfImageQuality = m_data.ImageQualities[comboBoxImageQuality.SelectedIndex];
}
}
private void checkBoxModelElements_CheckedChanged(object sender, EventArgs e)
{
checkBoxRoomsAndAreas.Enabled = checkBoxModelElements.Checked ? true : false;
}
private void radioButtonCompressedFormat_CheckedChanged(object sender, EventArgs e)
{
labelImageQuality.Enabled = radioButtonCompressedFormat.Checked;
comboBoxImageQuality.Enabled = radioButtonCompressedFormat.Checked;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,199 @@
//
// (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
}
}
@@ -0,0 +1,469 @@
//
// (C) Copyright 2003-2014 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 format
/// </summary>
public class ExportDWGOptionsData
{
#region Class Memeber 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 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 ExportDWGOptionsData()
{
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);
}
#endregion
}
}
@@ -0,0 +1,198 @@
//
// (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
}
}
@@ -0,0 +1,338 @@
//
// (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;
case ExportFormat.PDF:
extension = "pdf";
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
}
}
@@ -0,0 +1,126 @@
//
// (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
}
}
@@ -0,0 +1,69 @@
//
// (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;
}
}
}
@@ -0,0 +1,67 @@
//
// (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;
}
}
}
@@ -0,0 +1,96 @@
//
// (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
}
}
@@ -0,0 +1,470 @@
//
// (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;
}
}
@@ -0,0 +1,249 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Provide a dialog which provides the options of lower priority information for exporting image
/// </summary>
public partial class ExportIMGOptionsForm : System.Windows.Forms.Form
{
/// <summary>
/// Data class object of m_exportOptions
/// </summary>
private ImageExportOptions m_exportOptions;
/// <summary>
/// Data class object of ExportDataWithViews
/// </summary>
private ExportDataWithViews m_exportData;
/// <summary>
/// Constructor
/// </summary>
/// <param name="exportData">Data class object</param>
public ExportIMGOptionsForm(ExportDataWithViews exportData)
{
m_exportOptions = new ImageExportOptions();
InitializeComponent();
this.m_exportData = exportData;
InitializeFormats();
}
private void InitializeFormats()
{
// Initialize
currentWindowOption.Checked = true;
selectRange.Enabled = false;
fitToOption.Checked = true;
zoomOption.Checked = false;
verticalOption.Enabled = false;
horizontalOption.Enabled = true;
RIQCom.Enabled = false;
pixelValue.Text = "512";
zoomSize.Enabled = false;
zoomSize.Value = 50;
saveAs.Text = m_exportData.ExportFolder + "\\" + m_exportData.ActiveViewName;
shadedCom.Items.Add("BMP");
shadedCom.Items.Add("JPEG(lossless)");
shadedCom.Items.Add("JPEG(medium)");
shadedCom.Items.Add("JPEG(smallest)");
shadedCom.Items.Add("PNG");
shadedCom.Items.Add("TARGA");
shadedCom.Items.Add("TIFF");
shadedCom.SelectedIndex = 2;
noShadedCom.Items.Add("BMP");
noShadedCom.Items.Add("JPEG(lossless)");
noShadedCom.Items.Add("JPEG(medium)");
noShadedCom.Items.Add("JPEG(smallest");
noShadedCom.Items.Add("PNG");
noShadedCom.Items.Add("TARGA");
noShadedCom.Items.Add("TIFF");
noShadedCom.SelectedIndex = 2;
RIQCom.Items.Add("72");
RIQCom.Items.Add("150");
RIQCom.Items.Add("300");
RIQCom.Items.Add("600");
RIQCom.SelectedIndex = 0;
RIQCom.Enabled = false;
}
private void FitTo_CheckedChanged(object sender, EventArgs e)
{
verticalOption.Enabled = true;
horizontalOption.Enabled = true;
RIQCom.Enabled = false;
zoomSize.Enabled = false;
m_exportOptions.ZoomType = ZoomFitType.FitToPage;
pixelValue.Enabled = true;
}
private void Zoom_CheckedChanged(object sender, EventArgs e)
{
verticalOption.Checked = false;
horizontalOption.Checked = false;
verticalOption.Enabled = false;
horizontalOption.Enabled = false;
RIQCom.Enabled = true;
zoomSize.Enabled = true;
m_exportOptions.ZoomType = ZoomFitType.Zoom;
pixelValue.Enabled = false;
}
private void Cannel_Click(object sender, EventArgs e)
{
this.Close();
}
private void Select_Click(object sender, EventArgs e)
{
using (SelectViewsForm selectViewsForm = new SelectViewsForm(m_exportData.SelectViewsData))
{
m_exportData.SelectViewsData.SelectedViews.Clear();
selectViewsForm.ShowDialog();
}
}
private void CurrentWindow_CheckedChanged(object sender, EventArgs e)
{
m_exportOptions.ExportRange = ExportRange.CurrentView;
selectRange.Enabled = false;
}
private void VisiblePortion_CheckedChanged(object sender, EventArgs e)
{
m_exportOptions.ExportRange = ExportRange.VisibleRegionOfCurrentView;
selectRange.Enabled = false;
}
private void ViewsSheets_CheckedChanged(object sender, EventArgs e)
{
m_exportOptions.ExportRange = ExportRange.SetOfViews;
selectRange.Enabled = true;
}
private void Change_Click(object sender, EventArgs e)
{
String fileName = String.Empty;
int filterIndex = -1;
DialogResult result = ShowSaveDialog(m_exportData, ref fileName, ref filterIndex);
if (result != DialogResult.Cancel)
{
saveAs.Text = fileName.Substring(0, fileName.LastIndexOf("."));
}
}
private 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.ActiveViewName;
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;
}
}
private void OK_Click(object sender, EventArgs e)
{
m_exportOptions.FilePath = saveAs.Text;
if (m_exportOptions.ZoomType == ZoomFitType.FitToPage)
{
m_exportOptions.PixelSize = int.Parse(pixelValue.Text);
}
else if (m_exportOptions.ZoomType == ZoomFitType.Zoom)
{
m_exportOptions.Zoom = (int)zoomSize.Value;
m_exportOptions.ImageResolution = (ImageResolution)RIQCom.SelectedIndex;
}
m_exportOptions.ShadowViewsFileType = (ImageFileType)shadedCom.SelectedIndex;
m_exportOptions.HLRandWFViewsFileType = (ImageFileType)noShadedCom.SelectedIndex;
if (m_exportOptions.ExportRange == ExportRange.SetOfViews)
{
ViewSet views = m_exportData.SelectViewsData.SelectedViews;
List<ElementId> viewIds = new List<ElementId>();
foreach (Autodesk.Revit.DB.View view in views)
{
viewIds.Add(view.Id);
}
m_exportOptions.SetViewsAndSheets(viewIds);
}
try
{
m_exportData.ActiveDocument.ExportImage(m_exportOptions);
}
catch (Exception ex)
{
String errorMessage = "Failed to export img" + ex.ToString();
TaskDialog.Show("Error", errorMessage, TaskDialogCommonButtons.Ok);
}
this.Close();
}
private void Vertical_CheckedChanged(object sender, EventArgs e)
{
m_exportOptions.FitDirection = FitDirectionType.Vertical;
}
private void Horizontal_CheckedChanged(object sender, EventArgs e)
{
m_exportOptions.FitDirection = FitDirectionType.Horizontal;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,102 @@
//
// (C) Copyright 2003-2020 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.Linq;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Data class which stores the main information for exporting pdf format
/// </summary>
public class ExportPDFData : ExportDataWithViews
{
#region Class Member Variables
private bool m_combine;
#endregion
#region Class Properties
public bool Combine
{
get
{
return m_combine;
}
set
{
m_combine = value;
}
}
#endregion
/// <summary>
/// Constructor
/// </summary>
/// <param name="commandData">Revit command data</param>
/// <param name="exportFormat">Format to export</param>
public ExportPDFData(ExternalCommandData commandData, ExportFormat exportFormat)
: base(commandData, exportFormat)
{
m_filter = "PDF Files |*.pdf";
m_title = "Export PDF";
m_combine = true;
}
/// <summary>
/// Export PDF format
/// </summary>
/// <returns></returns>
public override bool Export()
{
base.Export();
bool exported = false;
// Parameter: The list of view/sheet id to export
IList<ElementId> views = new List<ElementId>();
if (m_currentViewOnly)
{
views.Add(m_activeDoc.ActiveView.Id);
}
else
{
ViewSet viewSet = m_selectViewsData.SelectedViews;
foreach (View v in viewSet)
{
views.Add(v.Id);
}
}
// Parameter: The exporting options, including paper size, orientation, file name or naming rule and etc.
PDFExportOptions options = new PDFExportOptions();
options.FileName = m_exportFileName;
options.Combine = m_combine; // If not combined, PDFs will be exported with default naming rule "Type-ViewName"
exported = m_activeDoc.Export(m_exportFolder, views, options);
return exported;
}
}
}
@@ -0,0 +1,99 @@
namespace Revit.SDK.Samples.ImportExport.CS
{
partial class ExportPDFOptionsForm
{
/// <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.checkBoxCombineViews = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(120, 113);
this.buttonOK.Margin = new System.Windows.Forms.Padding(4);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(121, 28);
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(253, 113);
this.buttonCancel.Margin = new System.Windows.Forms.Padding(4);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(135, 28);
this.buttonCancel.TabIndex = 3;
this.buttonCancel.Text = "&Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// checkBoxCombineViews
//
this.checkBoxCombineViews.AutoSize = true;
this.checkBoxCombineViews.Location = new System.Drawing.Point(13, 34);
this.checkBoxCombineViews.Margin = new System.Windows.Forms.Padding(4);
this.checkBoxCombineViews.Name = "checkBoxCombineViews";
this.checkBoxCombineViews.Size = new System.Drawing.Size(375, 21);
this.checkBoxCombineViews.TabIndex = 5;
this.checkBoxCombineViews.Text = "Combine selected views and sheets into single PDF file";
this.checkBoxCombineViews.UseVisualStyleBackColor = true;
//
// ExportPDFOptionsForm
//
this.AcceptButton = this.buttonOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.buttonCancel;
this.ClientSize = new System.Drawing.Size(411, 163);
this.Controls.Add(this.checkBoxCombineViews);
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 = "ExportPDFOptionsForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "ExportPDFOptionsForm";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.CheckBox checkBoxCombineViews;
}
}
@@ -0,0 +1,65 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Data class which stores information of lower priority for exporting PDF format.
/// </summary>
public partial class ExportPDFOptionsForm : Form
{
/// <summary>
/// ExportPDFData object
/// </summary>
private ExportPDFData m_data;
public ExportPDFOptionsForm(ExportPDFData data)
{
m_data = data;
InitializeComponent();
Initialize();
}
/// <summary>
/// Initialize controls
/// </summary>
private void Initialize()
{
checkBoxCombineViews.Checked = m_data.Combine;
}
private void buttonOK_Click(object sender, EventArgs e)
{
m_data.Combine = checkBoxCombineViews.Checked;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,170 @@
//
// (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
}
}
@@ -0,0 +1,213 @@
//
// (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;
}
}
@@ -0,0 +1,304 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Autodesk.Revit.UI;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// It contains a dialog which provides the options of common information for export
/// </summary>
public partial class ExportWithViewsForm : System.Windows.Forms.Form
{
// Data class object of ExportDataWithViews
private ExportDataWithViews m_exportData;
/// <summary>
/// Constructor
/// </summary>
/// <param name="data"></param>
public ExportWithViewsForm(ExportDataWithViews data)
{
m_exportData = data;
InitializeComponent();
InitializeControls();
}
/// <summary>
/// Initialize values and status of controls
/// </summary>
private void InitializeControls()
{
textBoxSaveAs.Text = m_exportData.ExportFolder + "\\" + m_exportData.ExportFileName;
radioButtonCurrentView.Checked = true;
// Initialize the title
this.Text = m_exportData.Title;
if (m_exportData.ExportFormat == ExportFormat.SAT)
{
buttonOptions.Visible = false;
}
else if (m_exportData.ExportFormat == ExportFormat.Image)
{
this.Hide();
ExportIMGData exportIMGData = m_exportData as ExportIMGData;
using (ExportIMGOptionsForm exportOptionsForm = new ExportIMGOptionsForm(m_exportData))
{
exportOptionsForm.ShowDialog();
}
}
}
/// <summary>
/// Provide the export option dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOptions_Click(object sender, EventArgs e)
{
// Export dwg
if (m_exportData.ExportFormat == ExportFormat.DWG)
{
bool contain3DView = false;
if (radioButtonCurrentView.Checked)
{
if (m_exportData.Is3DView)
{
contain3DView = true;
}
}
else
{
if (m_exportData.SelectViewsData.Contain3DView)
{
contain3DView = true;
}
}
ExportDWGData exportDWGData = m_exportData as ExportDWGData;
using (ExportBaseOptionsForm exportOptionsForm = new ExportBaseOptionsForm(exportDWGData.ExportOptionsData,
contain3DView, "DWG"))
{
exportOptionsForm.ShowDialog();
}
}
//Export dxf
else if (m_exportData.ExportFormat == ExportFormat.DXF)
{
bool contain3DView = false;
if (radioButtonCurrentView.Checked)
{
if (m_exportData.Is3DView)
{
contain3DView = true;
}
}
else
{
if (m_exportData.SelectViewsData.Contain3DView)
{
contain3DView = true;
}
}
ExportDXFData exportDXFData = m_exportData as ExportDXFData;
using (ExportBaseOptionsForm exportOptionsForm = new ExportBaseOptionsForm(exportDXFData.ExportOptionsData,
contain3DView, "DXF"))
{
exportOptionsForm.ShowDialog();
}
}
// Export dgn
else if (m_exportData.ExportFormat == ExportFormat.DGN)
{
ExportDGNData exportDGNData = m_exportData as ExportDGNData;
using (ExportDGNOptionsForm exportOptionsForm = new ExportDGNOptionsForm(exportDGNData))
{
exportOptionsForm.ShowDialog();
}
}
// Export PDF
else if (m_exportData.ExportFormat == ExportFormat.PDF)
{
ExportPDFData exportPDFData = m_exportData as ExportPDFData;
using (ExportPDFOptionsForm exportOptionsForm = new ExportPDFOptionsForm(exportPDFData))
{
exportOptionsForm.ShowDialog();
}
}
// Export DWF
else
{
ExportDWFData exportDWFData = m_exportData as ExportDWFData;
using (ExportDWFOptionForm exportOptionsForm = new ExportDWFOptionForm(exportDWFData))
{
exportOptionsForm.ShowDialog();
}
}
}
/// <summary>
/// Provide the views selecting dialog
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonSelectViews_Click(object sender, EventArgs e)
{
using (SelectViewsForm selectViewsForm = new SelectViewsForm(m_exportData.SelectViewsData))
{
m_exportData.SelectViewsData.SelectedViews.Clear();
selectViewsForm.ShowDialog();
if (m_exportData.SelectViewsData.SelectedViews.Size == 0)
{
radioButtonCurrentView.Checked = true;
}
else
{
radioButtonCurrentView.Checked = false;
}
}
}
/// <summary>
/// Specify a file to export into
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonBrowser_Click(object sender, EventArgs e)
{
String fileName = String.Empty;
int filterIndex = -1;
DialogResult result = MainData.ShowSaveDialog(m_exportData, ref fileName, ref filterIndex);
if (result != DialogResult.Cancel)
{
textBoxSaveAs.Text = fileName;
if (m_exportData.ExportFormat == ExportFormat.DWG)
{
ExportDWGData exportDWGData = m_exportData as ExportDWGData;
exportDWGData.ExportFileVersion = exportDWGData.EnumFileVersion[filterIndex - 1];
}
else if (m_exportData.ExportFormat == ExportFormat.DXF)
{
ExportDXFData exportDXFData = m_exportData as ExportDXFData;
exportDXFData.ExportFileVersion = exportDXFData.EnumFileVersion[filterIndex - 1];
}
}
}
/// <summary>
/// Change the status of buttonSelectViews according to the selection
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void radioButtonSelectView_CheckedChanged(object sender, EventArgs e)
{
buttonSelectViews.Enabled = radioButtonSelectView.Checked;
}
/// <summary>
/// Transfer information back to ExportData class and execute EXPORT operation
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonSave_Click(object sender, EventArgs e)
{
if (ValidateExportFolder())
{
m_exportData.CurrentViewOnly = !radioButtonSelectView.Checked;
try
{
bool exported = m_exportData.Export();
if (!exported)
{
TaskDialog.Show("Export", "This project cannot be exported to " + m_exportData.ExportFileName +
" in current settings.", TaskDialogCommonButtons.Ok);
}
}
catch (Exception ex)
{
TaskDialog.Show("Export Failed", ex.ToString(), TaskDialogCommonButtons.Ok);
}
this.DialogResult = DialogResult.OK;
this.Close();
}
}
/// <summary>
/// Check whether the folder specified is valid
/// </summary>
/// <returns></returns>
private Boolean ValidateExportFolder()
{
String fileNameFull = textBoxSaveAs.Text;
//If the textBoxSaveAs is empty
if (String.IsNullOrEmpty(fileNameFull))
{
TaskDialog.Show("Information", "Please specify the folder and file name!", TaskDialogCommonButtons.Ok);
textBoxSaveAs.Focus();
return false;
}
//If has file name
if (!fileNameFull.Contains("\\"))
{
TaskDialog.Show("Information", "Please specify file name!", TaskDialogCommonButtons.Ok);
textBoxSaveAs.Focus();
return false;
}
//Whether the folder exists
String folder = Path.GetDirectoryName(fileNameFull);
if (!Directory.Exists(folder))
{
TaskDialog.Show("Information", "The specified folder does not exist!", TaskDialogCommonButtons.Ok);
textBoxSaveAs.Focus();
return false;
}
m_exportData.ExportFileName = Path.GetFileNameWithoutExtension(fileNameFull);
m_exportData.ExportFolder = folder;
return true;
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,172 @@
//
// (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);
}
}
}
}
}
@@ -0,0 +1,192 @@
//
// (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;
}
}
@@ -0,0 +1,192 @@
//
// (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.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Revit.SDK.Samples.ImportExport.CS
{
/// <summary>
/// Provide a dialog which lets users choose views to export.
/// </summary>
public partial class SelectViewsForm : System.Windows.Forms.Form
{
/// <summary>
/// Data class
/// </summary>
private SelectViewsData m_selectViewsData;
/// <summary>
/// Constructor
/// </summary>
/// <param name="selectViewsData"></param>
public SelectViewsForm(SelectViewsData selectViewsData)
{
InitializeComponent();
m_selectViewsData = selectViewsData;
InitializeControls();
}
/// <summary>
/// Initialize values and status of controls
/// </summary>
void InitializeControls()
{
UpdateViews();
}
/// <summary>
/// Check all items
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCheckAll_Click(object sender, EventArgs e)
{
for(int i = 0; i < checkedListBoxViews.Items.Count; ++i)
{
checkedListBoxViews.SetItemChecked(i, true);
}
}
/// <summary>
/// Un-check all items
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonCheckNone_Click(object sender, EventArgs e)
{
for (int i = 0; i < checkedListBoxViews.Items.Count; ++i)
{
checkedListBoxViews.SetItemChecked(i, false);
}
}
/// <summary>
/// Whether to show the sheets
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void checkBoxSheets_CheckedChanged(object sender, EventArgs e)
{
UpdateViews();
}
/// <summary>
/// Whether to show the views (except sheets)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void checkBoxViews_CheckedChanged(object sender, EventArgs e)
{
UpdateViews();
}
/// <summary>
/// Update the views in the checked list box
/// </summary>
private void UpdateViews()
{
checkedListBoxViews.Items.Clear();
if (checkBoxViews.Checked)
{
foreach (Autodesk.Revit.DB.View view in m_selectViewsData.PrintableViews)
{
checkedListBoxViews.Items.Add(view.ViewType.ToString() + ": " + view.Name);
}
}
if (checkBoxSheets.Checked)
{
foreach (Autodesk.Revit.DB.ViewSheet viewSheet in m_selectViewsData.PrintableSheets)
{
checkedListBoxViews.Items.Add("Drawing Sheet: " + viewSheet.SheetNumber + " - " +
viewSheet.Name);
}
}
checkedListBoxViews.Sorted = true;
}
/// <summary>
/// OK button clicked
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void buttonOK_Click(object sender, EventArgs e)
{
GetSelectedViews();
this.Close();
}
/// <summary>
/// Transfer information back to SelectViewsData class
/// </summary>
/// <returns></returns>
private void GetSelectedViews()
{
m_selectViewsData.Contain3DView = false;
foreach(int index in checkedListBoxViews.CheckedIndices)
{
String text = checkedListBoxViews.Items[index].ToString();
String sheetPrefix = "Drawing Sheet: ";
if (text.StartsWith(sheetPrefix))
{
text = text.Substring(sheetPrefix.Length);
String sheetNumber;
String sheetViewName;
sheetNumber = text.Substring(0, text.IndexOf(" - "));
sheetViewName = text.Substring(text.IndexOf(" - ") + 3);
foreach(Autodesk.Revit.DB.ViewSheet viewSheet in m_selectViewsData.PrintableSheets)
{
if(viewSheet.SheetNumber == sheetNumber && viewSheet.Name == sheetViewName)
{
m_selectViewsData.SelectedViews.Insert(viewSheet);
break;
}
}
}
else
{
String viewType = text.Substring(0, text.IndexOf(": "));
String viewName = text.Substring(text.IndexOf(": ") + 2);
foreach (Autodesk.Revit.DB.View view in m_selectViewsData.PrintableViews)
{
Autodesk.Revit.DB.ViewType vt = view.ViewType;
if(viewType == vt.ToString() && viewName == view.Name)
{
m_selectViewsData.SelectedViews.Insert(view);
if (vt == Autodesk.Revit.DB.ViewType.ThreeD)
{
m_selectViewsData.Contain3DView = true;
}
break;
}
}
}
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>