/// <summary> /// Retrieve all available title blocks in the currently active document. /// </summary> /// <param name="doc">the currently active document</param> private void GetTitleBlocks(Document doc) { m_allTitleBlocks = doc.TitleBlocks; if (0 == m_allTitleBlocks.Size) { throw new InvalidOperationException("There is no title block to generate sheet."); } foreach (FamilySymbol f in m_allTitleBlocks) { AllTitleBlocksNames.Add(f.Name); if (null == m_titleBlock) { m_titleBlock = f; } } }
/// <summary> /// Retrieve all available title blocks in the currently active document. /// </summary> /// <param name="doc">the currently active document</param> private void GetTitleBlocks(Document doc) { FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc); filteredElementCollector.OfClass(typeof(FamilySymbol)); filteredElementCollector.OfCategory(BuiltInCategory.OST_TitleBlocks); m_allTitleBlocks = filteredElementCollector.ToElements(); if (0 == m_allTitleBlocks.Count) { throw new InvalidOperationException("There is no title block to generate sheet."); } foreach (Element element in m_allTitleBlocks) { FamilySymbol f = element as FamilySymbol; AllTitleBlocksNames.Add(f.Family.Name + ":" + f.Name); if (null == m_titleBlock) { m_titleBlock = f; } } }