2027 Method
Changes 0
M

Document.SetDefaultFamilyTypeId

Description:
Sets the default family type id for the given family category.
public void SetDefaultFamilyTypeId(
	ElementId familyCategoryId,
	ElementId familyTypeId
)
  • familyCategoryId
    The family category id.
  • familyTypeId
    The default family type id.
private void SetDefaultTypeFromDoor(Document document, FamilyInstance door)
{
    ElementId doorCategoryId = new ElementId(BuiltInCategory.OST_Doors);

    // It is necessary to test the type suitability to be a default family type, for not every type can be set as default. 
    // Trying to set a non-qualifying default type will cause an exception
    if (door.Symbol.IsValidDefaultFamilyType(doorCategoryId))
    {
        document.SetDefaultFamilyTypeId(doorCategoryId, door.Symbol.Id);
    }
}
  • The family type id familyTypeId is invalid for the give family category familyCategoryId. -or- familyCategoryId is not a built in category or parameter Element ID.
  • A non-optional argument was null