lisa-marie mueller

lisa-marie mueller

bullet pont

phases link

March 13, 2020

ipad with title, large neon star, movie real, marker, blue For my next series, I am tackling placing exterior elevations based on selected walls. For our plug-in we need to understand the phase of views, rooms, and walls. This week, I will try to assist in letting you know where to look for and manipulate this information. When working with phases you will need to make some assumptions. Users can rename phases as they like so I always try to get the phase from an active view. It is important to review phases because Revit automatically uses the last phase in a project when creating an element and sometimes even when using a FilteredElementCollector. As a reminder, our goals for the complete plug-in are listed below.

goals and considerations

  • create an elevation marker for exterior walls by having the user select the walls
  • place the marker and elevation offset from the wall so it is legible
  • correctly phase the elevation markers
  • accommodate curved and angled walls

if you missed it:

Part 1: elevation by wall

element phases

If you have worked in Revit, you know that everything you place has a phase. These things are in the Element class in the Revit API and therefore have a CreatedPhaseId and a DemolishedPhaseId property. This is how you read and set the phase of Elements including walls, components, and other families. These are the most straight-forward to understand and are well documented.

view phases

There are some things that inherit the above-mentioned properties from the Element class, but do not use these properties. ViewSections inherit the Element class and thus inherit the CreatedPhaseId property and the DemolishedPhaseId property. However, for views like ViewSections and ViewPlans, these parameters are not used. It makes sense if you think about it because the ViewSection itself does not have a phase, instead it is displaying a specific phase. Because of that, what you actually need is the enum BuiltInParameter called VIEW_PHASE. The ElementId for a specific phase is always the same regardless of which parameter it is used in. So the ElementId to set the BuiltInParameter VIEW_PHASE to the phase "New Construction", for example, is the same as the ElementId used to set the CreatedPhaseId property to the phase "New Construction".

room phases

For rooms, there are four different places to look for phases, as you can see below. The one you want is BuiltInParameter.ROOM_PHASE.

Additionally, when you use a FilteredElementCollector to gather all the rooms in the project, it will automatically collect the rooms in the last phase of your project. I wrote a RoomHelper class with utility methods that takes the active document and the phase as inputs and then it filters for the rooms that were created in that phase. This makes sure that the collector is returning the expected list of rooms, even if the project has multiple phases.

elevation marker phases

When placing elevation markers through C#, they will automatically be created in the last phase of the project. You do not need a ViewPlan to place the ElevationMarker, but you do need one to create the elevation ViewSection on the marker. Generally, the phase of the ViewPlan that the ElevationMarker will be visible in, should be the same as the PHASE_CREATED of the marker. You can see how you can set the marker’s phase to that of the view plan phase (indicated by variable “p”) in the sample below.

Additionally, once you create an elevation ViewSection, you can set the phase that the view is displaying. Generally, you will also want to set this to be the same phase as the ViewPlan. The Elevation uses the BuiltInParameter VIEW_PHASE so we can set it to the same phase as our ViewPlan which is indicated by variable “p” below.

As you can see, phases are an intricate process and sometimes require trial and error. If you are expecting something to show up in Revit and it does not, a good thing to check is the phase. I hope to have clarified a few items to make your process easier. As we are creating and filtering elements, it is always a good idea to keep track of what phase they are in.

resources

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

bullet pont

recommended next