// // (C) Copyright 2003-2007 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.Elements; namespace Revit.SDK.Samples.ImportAndExportForDWG.CS { /// /// Data class which stores views information for export /// public class SelectViewsData { #region Class Memeber Variables // Revit command data private ExternalCommandData m_commandData; // All printable views(except sheets) private ViewSet m_printableViews; // All printable sheets private ViewSet m_printableSheets; // All selected views in UI private ViewSet m_selectedViews; // Whether contain 3D view in selected views private bool m_contain3DView; #endregion #region Class Properties /// /// All printable views(except sheets) /// public ViewSet PrintableViews { get { return m_printableViews; } set { m_printableViews = value; } } /// /// All printable sheets /// public ViewSet PrintableSheets { get { return m_printableSheets; } set { m_printableSheets = value; } } /// /// All selected views in UI /// public ViewSet SelectedViews { get { return m_selectedViews; } set { m_selectedViews = value; } } /// /// Whether contain 3D view in selected views /// public bool Contain3DView { get { return m_contain3DView; } set { m_contain3DView = value; } } #endregion /// /// Constructor /// /// public SelectViewsData(ExternalCommandData commandData) { m_commandData = commandData; m_printableViews = new ViewSet(); m_printableSheets = new ViewSet(); m_selectedViews = new ViewSet(); m_contain3DView = false; GetAllPrintableViews(); } /// /// Get all printable views and sheets /// private void GetAllPrintableViews() { ElementIterator itor = m_commandData.Application.ActiveDocument.Elements; itor.Reset(); m_printableViews.Clear(); m_printableSheets.Clear(); while (itor.MoveNext()) { View view = itor.Current as View; if (null != view && view.CanBePrinted) { if(view.ViewType == Autodesk.Revit.Enums.ViewType.DrawingSheet) { m_printableSheets.Insert(view); } else { m_printableViews.Insert(view); } } } } } }