Skip to main content

Getting BIM data into Unity (Part 4 - Exporting a Schedule from Revit)

This is part 4 of a series of posts about getting BIM data into Unity.

We discussed ArchiCAD in a previous article, but this time, we look at Revit. Getting our information into a schedule is not difficult, but getting the identifier of the elements is actually not trivial at all. We need to do some mean tweaking and we need a Revit Add-on too…

Preparing Revit Schedules for use with Unity

Basic concept: We will collect information from our BIM model into a table (schedule) for export. If we add the ID of the element in the first column, we can use that information to map the data from the table to the entity.

Creating an instance-parameter for the Entity ID

In Revit, every entity has a unique number, the EntityID. While it looks very simple, there is a catch. It can be used directly from the Application’s Programming Interface (API) and you can also query objects for it in the Revit GUI, but there is no way to collect them in a schedule (in contrast to ArchiCAD, I must say)!

There is a workaround, which can be also be automated:

  • Use a Shared or Project Parameter to store the unique Revit Entity ID (and possibly the IFC Guid)
  • Step through all objects to collect both IDs and write them into the Parameter
  • Set up a Schedule including these IDs and our required parameters

The first step is easy to accomplish and is widely documented. There are reasons for Shared and Project parameters, but both are possible and both can be scheduled, so it doesn’t really matter too much.

Here I’ve used a Project Parameter and defined it as an Integer. It is very important to ensure it sits at Instance Level and not Type Level! You may check All Elements or only those you want to have the ID.

PastedGraphic-2016-03-17-12-45.png

Getting the Entity ID into an instance-parameter

The field is now prepared, but is still empty.

PastedGraphic2-2016-03-17-12-45.png

However, writing the ID into this field manually is not what you want to do, ever… So we need some automation.

The most extensive solution is to develop a small Add-on for Revit, which runs through all elements and collects the EntityID. Its value can then be copied in the shared parameter. This can also be done with the IFCguid.

Luckily for us, there is a free Add-on that you can use to automate adding the EntityID to the object parameters, so they can be scheduled after all.

The Show ID add-in precisely does that.

https://apps.exchange.autodesk.com/RVT/en/Detail/Index?id=appstore.exchange.autodesk.com%3Ashowid_windows32and64%3Aen

1__%252524%252521%252540%252521__PastedGraphic-2016-03-17-12-45.png

The installation of the plug-in is straight-forward. It then becomes available in the Add-ins tab and the plug-in opens in a very simple dialog. You can apply it to ALL elements or only to the selected ones.

p937-2016-03-17-12-45.png

 

However, there are some caveats. This assumes that all these elements are editable. In collaborative projects, they may sit inside a locked WorkSet. And in the background, this approach does create a Shared Parameter without asking for it, so beware if you are sensitive about your setup.

The second approach is more fun, though, if you want to dive into Visual Programming with Dynamo. There the process is surprisingly simple. The only gotcha is that you’d best prepare the parameter to store the ID.

In Dynamo, you need only a few Nodes. In the example below, I was just interested in adding the Element ID into the Rooms. So I used a Categories Node to define the Rooms and an “All Elements of Category” to make the actual selection/query. They both live under the Selection header.

We can then request the ID from the Element (Element header) and link the elements to this node.

Finally, the Element.SetParameterByName does the hard work of filling the parameter with the values (IDs). You can add a small String node to define the Parameter Name.

PastedGraphic1-2016-03-17-12-45.png

For larger projects, it is best to have this Dynamo definition not run automatically.

No matter which approach you use, you should end up with the EntityID and (possibly) the IFC Guid as instance-parameters to all Revit objects.

PastedGraphic6-2016-03-17-12-45.png

Create the Schedule in Revit

Create either a multi-schedule for many different element types or create separate schedules for walls, slabs, doors and windows to add more specific parameters to the list. All the effort above was meant to be able to add the “Element ID” field alongside element parameters into the schedule.

It may be best to have a few schedules, for the different object categories you want to tackle, e.g. Walls, Slabs etc.

PastedGraphic7-2016-03-17-12-45.png

Check that the Element ID is included in the schedule:

PastedGraphic8-2016-03-17-12-45.png

Now you can export the schedule to a CSV file. We use “;” as a list separator and double quotes as string delimiters and also avoid to add the title and (sub-)totals, but be sure to add the Headers.

PastedGraphic9-2016-03-17-12-45.png

Make a few more, e.g. for Slabs, Roofs, Columns etc… This is now straightforward.

Beware that this is still a simple Integer Field but as long as you remember to re-run the Script when new elements are introduced, you should be fine.

With these schedules in place, we are now ready to tackle the next task: getting this data in our interactive model.

See you next time!

Comments

Popular posts from this blog

Improve usage of BIM during early design phases

When I was collecting ideas for a book chapter on BIM (that seemed to never have emerged after that), I collected 10 ideas, which I believe still reflect good recommendations to improve the usage of BIM during the early design phases. These ideas are related to BIM software, but you can apply them in any flavor, as long as you can model with Building Elements, Spaces and have control over representation. Introduction This article gives an overview of several recommendations and tips, to better apply BIM applications and BIM methodologies, in the context of the early design phases. Many of these tips are applicable in any BIM application and they are based on experience gathered from teaching, researching and using BIM software. Sometimes they could help software developers to improve the workflow of their particular BIM implementation. Tip 1 : Gradually increase the amount of information In the early design phases, the architect makes assumptions and lays out the main design in...

Getting BIM data into Unity (Part 9 - using IfcConvert)

This is part 9 of a series of posts about getting BIM data into Unity. In this post, we’ll discuss the IfcConvert utility from the IfcOpenShell Open Source IFC Library to preprocess an IFC model for integration with Unity. This is (finally?) again a coding post, with some scripts which are shared to build upon. Conversion of IFC into Unity-friendly formats The strategy with this approach is that you preprocess the IFC-file into more manageable formats for Unity integration. Most Web-platforms do some sort of pre-processing anyway, so what you see in your browsers is almost never an IFC-file, but an optimised Mesh-based geometric representation. However, it wouldn’t be BIM-related if we’d limit ourselves to the geometry, so we will parse the model information as well, albeit using another, pre-processed file. IFC to Wavefront OBJ I used a test IFC-model and used the IfcConvert-utility converted it into OBJ en XML formats. The default way to use it is very simple: ...

Getting BIM data into Unity (Part 8 - Strategies to tackle IFC)

This is part 8 of a series of posts about getting BIM data into Unity. In this post, we’ll discuss IFC as a transfer format towards Unity. As with the previous post, this is not a coding post, although hints and examples are provided. Open BIM and IFC Everybody who ever met me or heard me present on a conference or BIM-lecture will not be surprised to hear that I’m a strong believer in the Industry Foundation Classes (IFC), an open standard, with already two versions published as an ISO standard, being IFC2x2 and IFC4 (but surprisingly not IFC2x3 which is widely used). In the ideal world, this would be the format to use to transfer BIM data into another environment, such as Unity. So what are our options? Looking in the Unity Asset Store Assimp is a library which supports multiple formats, including IFC. https://assetstore.unity.com/packages/tools/modeling/trilib-unity-model-loader-package-91777   I did a few attempts, but alas without any success. It is po...