Ejemplo n.º 1
0
        // PB: Commented out until we have a good way of setting the sheet size given the views.  Not sure how to do that yet.

        ///// <summary>
        ///// Create a Revit Sheet by the sheet name, number, and a collection of views.  This method will automatically
        ///// pack the views onto the sheet.
        ///// </summary>
        ///// <param name="sheetName"></param>
        ///// <param name="sheetNumber"></param>
        ///// <param name="views"></param>
        ///// <returns></returns>
        //public static Sheet ByNameNumberAndViews(string sheetName, string sheetNumber, AbstractView[] views)
        //{
        //    if (sheetName == null)
        //    {
        //        throw new ArgumentNullException("sheetName");
        //    }

        //    if (sheetNumber == null)
        //    {
        //        throw new ArgumentNullException("sheetNumber");
        //    }

        //    if (views == null)
        //    {
        //        throw new ArgumentNullException("views");
        //    }

        //    if (views.Length == 0)
        //    {
        //        throw new ArgumentException("Must supply more than one view");
        //    }

        //    return new Sheet(sheetName, sheetNumber, views.Select(x => x.InternalView));
        //}

        ///// <summary>
        ///// Create a Revit Sheet by the sheet name, number, and a view.  This method will automatically
        ///// pack the views onto the sheet.
        ///// </summary>
        ///// <param name="sheetName"></param>
        ///// <param name="sheetNumber"></param>
        ///// <param name="view"></param>
        ///// <returns></returns>
        //public static Sheet ByNameNumberAndView(string sheetName, string sheetNumber, AbstractView view)
        //{
        //    if (view == null)
        //    {
        //        throw new ArgumentNullException("view");
        //    }

        //    return Sheet.ByNameNumberAndViews(sheetName, sheetNumber, new[] { view });
        //}

        /// <summary>
        /// Create a Revit Sheet by the sheet name, number, a title block FamilySymbol, and a collection of views.  This method will automatically
        /// pack the views onto the sheet. 
        /// </summary>
        /// <param name="sheetName"></param>
        /// <param name="sheetNumber"></param>
        /// <param name="titleBlockFamilySymbol"></param>
        /// <param name="views"></param>
        /// <returns></returns>
        public static Sheet ByNameNumberTitleBlockAndViews(string sheetName, string sheetNumber, FamilySymbol titleBlockFamilySymbol, View[] views)
        {
            if (sheetName == null)
            {
                throw new ArgumentNullException("sheetName");
            }

            if (sheetNumber == null)
            {
                throw new ArgumentNullException("sheetNumber");
            }

            if (titleBlockFamilySymbol == null)
            {
                throw new ArgumentNullException("titleBlockFamilySymbol");
            }

            if (views == null)
            {
                throw new ArgumentNullException("views");
            }

            if (views.Length == 0)
            {
                throw new ArgumentException("Must supply more than 0 views");
            }

            return new Sheet(sheetName, sheetNumber, titleBlockFamilySymbol.InternalFamilySymbol, views.Select(x => x.InternalView));
        }