Changing the family category using the Revit API

By Saikat Bhattacharya

Is it possible to change the category of a family using the Revit API?

The category of a family is defined when it is created and cannot be changed later. If we use EditFamily() and access the OwnerFamily on the family document, we can see that the OwnerFamily’s Category is read-only. So the solution is to use the appropriate template for the category of family you wish to create at the time of family creation itself.


Comments

One response to “Changing the family category using the Revit API”

  1. Family family = famDoc.OwnerFamily;
    using(Transaction tx = new Transaction(famDoc, “change category”))
    {
    tx.Start();
    family.FamilyCategory = Category.GetCategory(doc, new ElementId((int)BuiltInCategory.OST_PipeAccessory));
    tx.Commit();
    }

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading