Assigning a Level to an Element Missing It

I recently implemented the IfcSpaceZoneBoundaries add-in to link in and analyse IFC file zones and spaces, then prepared it for use in Forge Design Automation.

The app bundle implementing the Design Automation for Revit or DA4R workitem functionality reads the .ifc.RVT file generated by the IFC linking command and exports its room and zone information to CSV.

My colleague Petr Broz worked on the DA4R side of things and requested the addition of level information and areas in square metres.

At first glance, this seems completely trivial.

However, the DirectShape elements created to represent the rooms and zones have no valid level assigned, so their Level property is invalid.

Happily, we can easily analyse the BIM and generate the equivalent information ourselves; afterwards, I'll quickly mention two technology and science related videos I happened across:

IFC sample levels

Retrieve Levels Sorted by Elevation

This provides a nice opportunity for a live demonstration of using the algorithm we already implemented to retrieve levels sorted by elevation.

It simply calls a filtered element collector to retrieve all levels and applies OrderBy to their elevations:

/// <summary>
/// Retrieve all levels sorted by elevation
/// </summary>
public static IOrderedEnumerable<Level> GetSortedLevels( 
  Document doc )
{
  return new FilteredElementCollector( doc )
    .OfClass( typeofLevel ) )
    .Cast<Level>()
    .OrderBy( lev => lev.Elevation );
}

Determine Level from Element Elevation

The resulting levels are stored and passed into the method used to determine each element's level name as follows:

Initially, we check the element's LevelId property.

If it returns a valid element id, we can retrieve the level name from that.

Otherwise, we make use of the element's Z elevation and the sorted list of all levels.

Since the levels are already sorted by elevation, can can simply loop through them from the bottom up and break as soon as the target Z elevation is reached.

/// <summary>
/// Return the name of the level of the given element.
/// </summary>
public static string GetLevelName(
  Element e,
  double z,
  IOrderedEnumerable<Level> levels )
{
  Level level = null;

  // Retrieve the element's Level property:

  ElementId lid = e.LevelId;

  ifnull == lid
    || ElementId.InvalidElementId == lid )
  {
    // If no level is defined, grab the first
    // one from the list sorted by elevation:

    foreachLevel l in levels )
    {
      double elev = l.Elevation;

      ifUtil.IsEqual( z, elev )
        || z <= l.Elevation )
      {
        level = l;
        break;
      }
    }
  }
  else
  {
    Document doc = e.Document;
    level = doc.GetElement( lid ) as Level;
  }
  return level.Name;
}

Carl Bass and Zoox Autonomous Vehicles

Moving away from the Revit API to Autodesk, and from Autodesk to technological trends and possibilities:

Have you ever wondered what the ex-Autodesk-CEO Carl Bass is up to now?

He is involved in an exciting new project documented in the 12-minute documentary video on Titan vs Robo-car – The Multi-Billion Dollar Company You’ve Never Heard Of:

Titan travels to Zoox to meet with Chairman Carl Bass and discuss their incredible self-driving car.

Not only do they have the artificial intelligence (AI) to autonomously drive the car through the streets of San Francisco, they are manufacturing their own vehicle to compete with the biggest names in ride-sharing.

CNC machining, Advanced 3D printing, and 7-Axis robots to name a few of their production capabilities.

Check out how their technology works, and why it is the future of driving.

Physical Reasons to be Happy to be Alive

One step further, from technology to physics and philosophy:

The 12-minute video on The Mystery at the Bottom of Physics dives deep enough into physics to wax philosophical on gratitude for life and the reason to be grateful and happy for every moment of my own personal existence: