Thursday, February 28, 2008

Revit 2009 API: Rooms for Improvement

Whether you're working in pure architectural development, or particularly if you're involved in doing energy analysis work - Room objects are VERY, VERY important.

The 2009 API provides a variety of modest enhancements to rooms which improve what you can do with rooms and their related objects:


If you've ever wanted to get a better handle on the analytical geometry of a room than you could get with just the room boundaries (sloped ceilings, anyone?).

The 2009 API adds support for getting the ClosedShell geometry of a room. This geometry is much like getting the solid geometry of an element - it returns something that behaves like an Autodesk.Geometry.Solid - it has faces and edges that you can traverse.

PlanCircuits are Working...

2008 added support for a concept that it took me a long time to get my arms around (thanks to limited documentation, nudge, nudge). A document has a collection of "PlanTopologies" - one for every combination of Level and Phase (i.e. "Level 1, New Construction"). For each PlanTopology there are a number of openings defined by the walls where rooms might exist. Each opening is called a "PlanCircuit" - while you can't find out as much as you might like about a PlanCircuit (the area, the number of sides, etc).

Anyway - there was a property for 2008 called PlanCircuit.IsRoomLocated - which could tell you if a room existed... That said, from the time I tried it in mid 2008 until the 2009 alpha - it never worked. In fact, it threw an exception if you even tried to touch it.

Now it's working - and you can use it for a variety of things - mostly determining if there are rooms placed in all of the openings that there should be. There's even a NewRoom() method which takes a PlanCircuit as an input.

Tagging Is Improved

When room tagging was added in 2008 - it worked great - as long as you only had one view of a given Level/Phase. This was remedied in 2008 SP3 with a NewRoomTag() method where you can specify which view the tag should reside in - that said, bad things happened if you tried to build with SP3 and try that method in 2008 SP2 or lower - so it's nicer now that it's in a General Availability version of the Revit Software.

From Room / To Room

I've heard a variety of people complaining to me about the nature of the From Room / To Room in 2009. If you're not familiar with it - when a door (or window for that matter) is placed it immediately gets a From Room and To Room designation. This is usually based upon its initial orientation (which room it opens into) - however, it never appears to change (even if you flip the door direction).

One of the Revit Product Managers told me that it has historical roots in the lockset and which side that goes to - but I'm sure that was cold comfort to people who just wanted it to be based on the direction that it opens.

While the underlying behavior has not changed - it is now possible to programmatically change the From/To Room. We'll probably add this to our "Door Mark Update" utility in 2009.


It's now possible to "unplace" a room - which moves the room into an unplaced state (similar to adding new rooms via the schedule which have not been placed yet). The Rooms can be placed into another spot based on X,Y location or PlanCircuit.

Interactive Change

While this isn't an API change - it is something I very much appreciate. If you wanted to understand the room height, the best trick was usually to create a Section view - then turn on visibility of Rooms, as well as Room -> Interior Fills and References. The problem in 2008 was that while you could see them perfectly - you couldn't pick or otherwise change them.

In 2009, you can not only pick the rooms in Section View, you can take an drag the height of the room to a new level.

Base Level Offset

This is both an interactive aspect and an API aspect - in the past there was only a height offset from the "upper level". Now there is both an "upper level" offset and "lower level offset".

Calculation Settings

Another nice thing if you're doing Energy or MEP calculations - you can now programmatically set the Room Volume Calculation Settings (Areas or Volumes, as well as the wall boundary option). This is identical to the Settings -> Room and Area Calculations dialog box.


While there are few earth-shaking things in here - there's a lot of incremental progress... and for people in the right functional areas, it's huge.



andrewh said...

Hey Matt - great blog! Is Avatech planning on releasing an update to the '08 Revit utilities for '09 or is there a trick to getting them to work in '09?

Matt Mason said...


Yes - they will (finally) be replaced this coming week (the week of 5/27/2008) at