RevitLookup.Test.SDKSamples.CreateSheet.Views.GetTitleBlocks C# (CSharp) Method

GetTitleBlocks() private method

Retrieve all available title blocks in the currently active document.
private GetTitleBlocks ( System.Windows.Forms.Document doc ) : void
doc System.Windows.Forms.Document the currently active document
return void
        private void GetTitleBlocks(Document doc)
        {
            var tmp = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_TitleBlocks).Cast<FamilySymbol>();
               m_allTitleBlocks = new HashSet<FamilySymbol>(tmp);
            if (0 == m_allTitleBlocks.Count())
            {
                throw new Exception("There is no title block to generate sheet.");
            }

            foreach (FamilySymbol f in m_allTitleBlocks) {
                m_titleBlockNames.Add(f.Name);

                if (null == m_titleBlock) {
                    m_titleBlock = f;
                }
            }
        }