When working with Revit or Revit API, we are mostly dealing with Revit Types and Custom Families. This guide takes you through the various Grasshopper components that help you query and create types and families. It is one of the most important aspects of the modeling process that is more about the Data being modeled, rather than geometry:

Querying Types

You can use the combination of a category picker components e.g. Model Categories Picker , the Category Filter component, and Query Types+ v1.0 component to collect types in a certain Revit category:

The Query Types+ v1.0 component can further filter the list of types:

Querying Type Info

Use the ElementType.Identity to access information about that type. Please note that the Family Name parameter, returns the System Family name for System Types and the Custom Family name for Custom Types:

Accessing Family of a Type

When querying the custom types that exist in a Revit model, we can find out the custom family definition that contains the logic for each of these types. We are using a custom Grasshopper Python component (Type Family) to grab the family of each type being passed into this component. You can download this component, as a Grasshopper user object, from the link below.

Type Family
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Notice that Duct Systems for example, is a system type and therefore have no associated custom family definition. Therefore the Type Family component is returning null.

Choosing A Specific Type

Rhino.Inside.Revit includes a few components that can help you pick a specific element type from a Revit category:

  • Model Categories Picker : Allows selecting a specific model category e.g. Walls
  • Analytical.CategoriesPicker: Allows selecting a specific analytical category e.g. Analytical Walls
  • Annotation.CategoriesPicker: Allows selecting a specific annotation category e.g. Dimensions
    • Tag.CategoriesPicker: Allows selecting a specific tag category e.g. Room Tags

You can pass the any of the categories above to the Element Type Picker component to select a specific type from that category:

Determining Default Types

When a build tool is launched (e.g. Place Door), Revit will automatically select the last-used type for that specific category (e.g. Doors for Place Door tool). This is called the Default Type for that category. This information is helpful when creating elements using the API. Use the component shared below to inspect the default types for the provided category:

In case of custom types, the component will return the default DB.FamilySymbol:

Get Default Type
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Modifying Types

Once you have filtered out the desired type, you can query its parameters and apply new values. See Document Model: Parameters to learn how to edit parameters of an element. The element parameter components work on element types as well.

Extracting Type Geometry

Once you have filtered out the desired type, you can extract the geometry for that element type using the component. The Level Of Detail value list component makes it easy to provide correct values for LOD input parameter.

The component automatically previews the geometry in Rhino window.

 

Level Of Detail
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Extracting Type Geometry by Category

The Element Geometry By SubCategory component shared here helps you extract geometry of a family instance alongside information about its subcategory definition inside the family. The example here extracts the geometry from a series of window instances

Element Geometry By SubCategory
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Creating New Types

To create new types, you would need to find an existing type, use the ElementType.Duplicate component to duplicate that type with a new name, and adjust the desired properties.

Revit Project Browser now displays the new type under Families

Removing Types

You can use the Element.Delete component to delete types. Remember that deleting types will delete all instances of that type as well. If you don’t want this, find the instances and change their types before deleting a type from model.

Loading Families

Use the Family.Load component to load a new family file into your model.

Revit Project Browser now lists the new family under Families

Saving Families

Use the Family.Save component to save a family into an external file.

Type Family
Place under Grasshopper User Objects folder. Find in Revit > Custom panel

Creating New Families

Under current Rhino.Inside.Revit implementation, you can use the Family.New component to generate new Revit families and insert a new geometry into the family. Make sure to assign the correct template file to the component for best results.

Revit Project Browser now lists the new family under Families

You can also pass the Generic Model template to the Family.New component and set the category manually using the Model Categories Picker component.

There are a series of components under the Revit > Family panel that will help you generate geometry for Revit families:

  • FamilyElement.ByBrep
  • FamilyElement.ByCurve
  • FamilyOpening.ByCurve
  • FamilyVoid.ByBrep

As shown in the example above, you can use the Visibility.Construct component to create visibility options for the generated geometry. This components provides all the options available in the native Revit Visibility/Graphics editor for family geometries.

Editing Families

You can use the Family.New component to edit existing families as well. Just pass the appropriate template and family name, the new geometry, and the Family.New component automatically finds the existing family, replaces the content and reloads the family into the Revit model. Make sure the OverrideFamily is set to True and OverrideParameters is set appropriately to override the family parameters if needed.