Saturday, February 21, 2009

What’s New in the Revit 2010 API: Element Enhancements

(Part of the What’s New in the Revit 2010 API series)

As with each release of the Revit API, there are a ton of enhancements to the “Elements” area of the Revit API. Whether it’s new capabilities on existing elements, or new Element classes to make Revit elements more identifiable and understandable – enhancements here are a big deal.

Elements and Materials

One of the features I’m most excited about is the new Element/Material part of the API. In the past, trying to do material take-offs with the API was tough – especially if the designers were using Split Faces (which almost everyone does). You pretty much had to export out to ODBC or schedules to Excel in order to extract what you needed. But no more.

image This room floor has been divided by a split face – with one of the sides being carpet and the other tile.

In Revit 2010, every Element has a Materials property to show all the materials associated with an element. Further, you can call Element.GetMaterialArea( Material ) or
Element.GetMaterialVolume (Material)

to get the area or volume of material for that element. With this, people trying to do material take-offs through the API should be in far better shape!

Element Hiding

For a number of releases, Revit has supported the hiding of individual elements on a view-specific basis. While great for designers, it did pose occasional challenges for developers. Now, the API offers up:

Element.CanBeHidden ( View v )
Element.IsHidden( View v )
as well as:
View.Hide( Element e)
View.UnHide( Element e)

This should give developers powers similar to what you can do in Revit interactively (that fairness which every CAD developer yearns for :) ).

Family Enhancements

There are few enhancements with Family and FamilyInstance elements:

  • Family.IsInPlace (this was possible heuristically in previous releases – but it’s always better to make it obvious)
  • Family.IsCurtainPanelFamily (because of the special additional properties – it’s good to know this directly)
  • FamilyInstance.IsSlantedColumn (another situation where there are special additional properties)
  • FamilyInstance.Space  (similar to familyInstances knowing which Room they reside in, now they know which space they reside in – very useful for MEP families!)

New Element Classes

The following classes are new in 2010:

  • Alignment
  • AreaScheme (see below)
  • BasePoint
  • Control
  • CurveByPoints
  • CurveElement
  • DividedSurface (with an amazing amount of depth!)
  • Form (representing all of the Family solid content, and also with a huge amount of depth)
  • ImportInstance (used for DWG imports, etc)
  • ModelText
  • PointOnEdge
  • PointOnEdgeEdgeIntersection (I think you might need to have a PhD or be Russian to understand this :) ).
  • PointOnEdgeFaceIntersection
  • PointOnFace
  • PointOnPlane
  • ReferencePoint
  • ReferencePointArray
  • SpacingRule (structure and grids)
  • SweptBlend
  • SymbolicCurve
  • TopographySurface (with an “AddPoints” method, no less)

Areas

There appear to be a few enhancements to Area elements that are of note:

  • New AreaScheme element (this typically is set for “Rentable”, “Gross” but also apparently has some new BOMA settings for facilities management people)
  • Areas have a link to their scheme
  • ViewPlans have a link to the AreaScheme (where appropriate)

Dimensioning

Dimensions also seem to have some upgrades in 2010. In particular:

  • Dimensions have DimensionSegments
  • The “Locked” property (read/write) has been added

Other Miscellaneous Enhancements

A few others that I couldn’t categorize:

  • Blends now have access to Profiles, Offsets and VertexConnections.
  • CurtainGridLines now have ExistingSegmentCurves
  • Grid.ExtendToAllLevels method
  • GridNodes
  • GBXMLParamElement now has an ExportComplexity object associated with it which contains all sorts of things to control how GBXML is exported (including, for example, how to handle Shading Surfaces).
  • ModelCurve now exposes:
    • IsReferenceLine
    • SubCategory
    • TrussCurveType
    • Visibility
  • Mullion.LocationCurve
  • Opening exposes IsTransparentIn3D and IsTransparentInElevation.
  • Path3D.AllCurveLoops

Two that I’ll be writing about a little later:

  • Room.IsPointInRoom (XYZ)
  • Space.IsPointInSpace( XYZ )

A few items seem targeted at making it easier to get geometry references and planes:

  • Level now exposes a PlaneReference (to make things easier)
  • ReferencePlane.Reference
  • SketchPlane exposes:
    • Reference
    • IsSuitableForModelElements
  • View.SketchPlane


Wow. Again – there’s enough in these enhancements, new classes and more to keep us busy for quite some time.

2 comments:

Alvaro Puertas said...

Hi Matt, I am a developer of some aplications of C# using the Api of Revit 2009. I am actually developing an application to obtain a list of materials of the objets that I have already drawn in the model. I have searched for some information about this item, and I have seen your article: http://cadappdev.blogspot.com/2009/02/whats-new-in-revit-2010-api-element_21.html, where you talk about some improvements for API 2010, like the facilities in obtaining the materials of the elements. I have seen you have much more experience using Revit, so, I would be very pleased if you could help me with this problem about how to obtait that list of materials. Thank you so much for your help. All the best, Alvaro Puertas

Matt Mason said...

Alvaro,

Are you trying to get the list of materials for scheduling/bill-of-material info or graphical presentation?

As of 2010, there are now different approaches for these.

For "scheduling", you look at each element and ask for its materials and material quantities.

If you need graphical presentation, you need to go in an look at each face on every solid to determine whether the material is derived from:

- Something specifically assigned to the face.
- An element with "layers" such as a wall or floor.
- The category of the element

The geometric approach is not as comprehensive as the "scheduling" approach - because it does not deal with Split Faces, and I'm not sure that it would be accurate for all cases.

Good Luck,
Matt