Change the titleblock on a sheet

The titleblock is a FamilyInstance (just like a desk or door), so changing from one type to another is just a matter of finding the FamilyInstance (in this sample by looking in the active view for a FamilyInstance of the Titleblock category) and then changing its FamilySymbol.

public void changeTitleBlock()
    Document doc = this.ActiveUIDocument.Document;
    // find the titleblock in the active view
    FamilyInstance fi = new FilteredElementCollector(doc, doc.ActiveView.Id)
        .FirstOrDefault() as FamilyInstance;
    // find the titleblock family symbol with the desired name
    FamilySymbol fs = new FilteredElementCollector(doc)
        .FirstOrDefault(q => q.Name == "D 22 x 34 Horizontal") as FamilySymbol;           
    using (Transaction t = new Transaction(doc,"Change titleblock"))
        fi.Symbol = fs;

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s