lisa-marie mueller

lisa-marie mueller

bullet pont

ViewFamilyTypeId link

October 18, 2019

Laptop with code on screen, toy bird, toy rocket This week we continue on the path to automating interior elevations. As a reminder, I have been building a plug-in that automates various parts of creating interior elevations, and I will continue to develop it. Since this project will evolve as I continue, I have determined to set my primary goal for each stage. With this goal in mind, I will develop a functioning piece of software to meet the goal. Then I will discuss topics that cover key aspects for each step for building the plug-in. At the end of each stage, I will move the plug-in to a public repository on GitHub so you can use it too.

if you missed it:

Part 1: filtered element collector [c#]

Part 2: finding centroids and considering exceptions

primary goal #1

Create interior elevations for all placed rooms, place the tag at the center of the rooms, place the tag on the correct level when multiple levels exist, ensure the tag is visible on the interior elevation key plans (already in the project), and ensure the interior elevation tags have the proper phase settings


To place an ElevationMarker we need four parameters:

  • Document parameter - the document in which the ElevationMarker will be placed
  • ElementId parameter - ViewFamilyTypeId sets the type of view that is being created
  • XYZ parameter - coordinate to place the elevation
  • Integer parameter - the scale of the view

The document is just a variable that we will declare, we already found our XYZ parameter in Part 2, and for the initial build, I will hard-code the scale. That leaves us to find the ElementId parameter which needs to be the ViewFamilyTypeId used for the elevations that are hosted on the ElevationMarker.

You will need an interior elevation View Type within the Revit project you are working with. I recommend you set this up already in your template. Check the Autodesk Knowledge Network for instructions on how to create a new View Type. To gather our ViewFamilyTypeId, we can use our favorite, a FilteredElementCollector. We need to filter for ViewFamilyTypes and of those, we want the elevations where the name contains “interior”. If it returns null, we need to throw an exception so the program doesn’t crash and our user knows the error that occurred.

Now we can start putting together our method that will place our ElevationMarkers. We are not returning anything so we want a public void method. We will call it PlaceElevations and it will need a few parameters Document doc, XYZ center [which we found in Part 2], and a ViewPlan [which we will discuss next week]. We use the CreateElevationMarker method in the ElevationMarker class using the paramters we have now defined. This method returns a new object of type ElevationMarker.


If you want to learn to code and don’t know where to start check out my posts about Steps to Learn to Code [for architects and designers] Part 1 and Part 2.

Revit API Docs