Brussels Hackathon, Pipe Wall Thickness and Voids

I received an email asking whether it is possible to determine the Revit MEP pipe element wall thickness, and also about the API access to voids in the family editor.

Before getting to that, let me mention that I am now in Brussels at the Open Data Hackathon.

Hackathon Open Data Brussels

I arrived in Gent last night and returned to Brussels this morning for the Hackathon Open Data Brussels taking place today and tomorrow, October 17-18 2014.

It is intended to promote the use of open data:

The list of available data sets is huge, comprising thousands – if not tens of thousands – of databases.

So far, this led me to take quick looks at a number of fascinating new topics and tools, e.g.:

Me and Cyrille co-initiated and joined the PoiPointer project, with a goal of implementing an app pointing out points of interest.

Backend probably based on ElasticSearch.

Cyrille also presented our standard spiel on the Autodesk Data and View API:

I'll stop here and report more on this later.

Back to the Revit API...

Determining Pipe Wall Thickness

Question: I would like to compute the wall thickness of a given Revit MEP pipe instance and populate this value so it can be tagged on the pipe.

The desired output could be something like 'OD x WT', i.e. outer diameter x wall thickness, e.g. '21.3 x 2.0' for a DN15 pipe.

Is it possible to get at the necessary data through the API?

Answer: Revit does not provide a wall thickness parameter, but it can easily be derived from other data available and accessible in the model:

Most Revit element properties are stored in parameters.

When possible, the parameter values should be access using the language independent and more efficient built-in parameter enumeration values instead of the language dependent display strings displayed to the used.

In this case, the built-in parameter enumeration values RBS_PIPE_INNER_DIAM_PARAM and RBS_PIPE_OUTER_DIAMETER can be used, e.g. like this:

  const BuiltInParameter bipDiameterInner
    = BuiltInParameter.RBS_PIPE_INNER_DIAM_PARAM;
 
  const BuiltInParameter bipDiameterOuter
    = BuiltInParameter.RBS_PIPE_OUTER_DIAMETER;
 
  static double GetWallThickness( Pipe pipe )
  {
    double dinner = pipe.get_Parameter(
      bipDiameterInner ).AsDouble();
 
    double douter = pipe.get_Parameter(
      bipDiameterOuter ).AsDouble();
 
    return 0.5 * ( douter - dinner );
  }

Voids in the Family Editor

Question: Are voids available in Revit 2015 through API?

I need programmatic access to the ability to create Void geometry in Family Editor.

It is required in order to create native geometry within a family, including some voids to get the right graphical representation.

Answer: Yes, sure.

An example of making use of programmatically created voids is given by the recent discussion of InstanceVoidCutUtils.

The actual programmatic generation of families is illustrated by various examples making use of the Family API.