As software and standards mature and even become archaic, they inevitably attract baggage along the way. Years of technical debt amassed by well-intentioned developers and product managers will be paid for by us and our children.
This is particularly evident when we start talking about the Id of Revit elements, and the IFC GUID syntax. As most of you are aware, Revit carries a number of different identifying attributes for each and every element. Here is a basic list:
Element Id – the numerical form of a Revit Id, you can interact directly with this using the Select By Id command in Revit
UniqueId – “A stable unique identifier for an element within the document.” This is not a correctly formed UUID, but rather a concatenation of a standard UUID for the Revit EpisodeId (session based), along with the Revit element Id. From Jeremy’s post: similar to the standard GUID format, but has 8 additional characters at the end. These 8 additional hexadecimal characters are large enough to store 4 bytes or a 32 bit number, which is exactly the size of a Revit element id.
DwfGuid (Export Guid) – this is a correctly formed UUID in .NET / standard format
IfcGuid – identical to DwfGuid, but encoded differently according to IFC rules created in the mid-90s. At the time, it was deemed worthwhile to ‘compress’ the IFC Guid to the shorter form we still have to deal with today.
It would be nice if Revit and IFC shared a single common unique identifying syntax, but unfortunately this is not the case.
The above Ids do actually bear some predictable relationship to each other. The UniqueId is formed by Revit joining the EpisodeId and the encoded Element Id, the Dwf or Export Guid is created by an algorithm that has a number of conditional rules, and the Dwf Guid can be converted to the backwards-compatible IfcGuid format through a different algorithm, originally created in C. Those algorithms can be sourced in various places (see links in Further Reading below).
Also, some of these get exposed in different ways – if you create Element-bound BCF files, they will typically show the IFC Guid syntax. Further, if you export an IFC file from Revit and tick the option on the Exporter, it will write the IfcGuid to a parameter on the element.
You can query the Element Id directly in Revit (Modify ribbon, Inquiry panel, IDs of Selection):
However, for the purpose of this post, let’s assume you are using Dynamo with IronPython, and you want to query all 4 Ids from an element.
We at least need to import the Revit API and the Revit IFC API:
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.IFC import *
Following this, we can use the various Dynamo and Python commands to access the Ids:
elementIds, uniqueIds, DwfGuids, IfcGuids, successlist = , , , , 
for i in e:
OUT = elementIds, uniqueIds, DwfGuids, IfcGuids, successlist
Notice the commands and properties used:
Element Id – query the Element.Id member
Unique Id – query the Element.UniqueId member
Dwf or Export Guid – use the ExportUtils.GetExportId method
IfcGuid – use the ExporterIFCUtils.CreateSubElementGUID method (index 0 refers to the main element itself)
From here, I create a Dynamo node that eats Revit elements and gives us back these Id values:
This node will be published in the Bakery package on the package manager, and to Github.
Further, our VirtualBuiltApp platform has been developed to store and query multiple Ids for a single element.
Example output from the Dynamo / Python (initial test showed the Dwf Guid is still a .NET object, that probably should get converted to a string for consistency).
[<System.Guid object at 0x0000000000000071 [c98618bf-7112-4e90-8a71-8ab768f2b8b8]>]
I added str() to the Python:
Final test showing the 4 different Id values for a single object:
Ever wondered how to install and use BIMserver to create your own IFC web viewer?
Sometimes I finish a blog post and think, what a mess…
That’s because I often sketch out things as I do them, on the fly. And so you end up with essentially a collection of notes. In any case, here are my notes on how I got BIMserverupand running on my workstation, so that I can view, mergeand work with IFCfileslocally. I hope you can understand the fragments of thought below 🙂
The bimserver Java module will be limited by the Java version on your system. So, if you want to be able use big memory, you should be running a 64 bit Java engine.
Install JDK for 64 bit windows, such as from here:
Update notes forIFCforRevit2015 (v15.6): General:
– Added some minor export performance tweaks.
– Added IFC4 Design Transfer View as an option. With this option, Revit will attempt to create IfcAdvancedBReps in some cases.
– The import log file now contains the importer version at the end.
New Export Functionality:
– Display the element id for each element as it is exported.
– Create IfcGroups for multiple IfcReinforcingBars created by one rebar element in Revit.
– (IFC4) Add support for ConicalFace and fix RevolvedFace forIfcAdvancedBRep.
– (IFC4) Reuse IfcCartesianPoints when exporting an IfcAdvancedBRep.
Export Bug Fixes:
– Associate some entities with IfcBuilding if they have no other spatial containment, or there are no levels.
– Correctly export DirectShapes of Ramp, Stairs, or certain MEP categories.
– Correctly relate IfcAssembly to IfcBuildingStorey in certain cases.
– Export some elements with geometry that couldn’t be correctly split into multiple solids.
– Fix crash in certain cases where we can’t create a valid tessellation for a face.
– Fix crash when exporting certain vertical roofs.
– Fix crash when exporting elements with no bounding box when splitting elements by level.
– Fix crash when exporting filled regions with invalid color definitions.
– Fix the name of IfcArbitraryClosedProfileDef entities.
– Never export curtain wall panels independent of their curtain walls.
– Remove invisible geometry when exporting families when exporting elements in the current view.
– (IFC4) Correct export of IfcMechanicalFastener.
New Import Functionality:
– Add support for extra currency types.
– Allow import of unbounded grid lines, with a warning and an arbitrary length.
Import Bug Fixes:
– The IfcSweptSurface “Position” attribute is now optional.
Sometimes you have a set of DWFs that you would like to work with in Revit. For example, you might have DWFs of site equipment, fences and trucks that would be useful for site modelling in Revit. Here is one way to get those dwfs into a more Revit-friendly format…
Note: You need to have iConstruct with their Smart IFC Exporter for this workflow
Create a container NWD for DWF files, so that you can fix rotation and coordinates:
Steps toconvertDWFto IFC with colours and object selectability:
Open two Navisworks 2016 instances
Open the rotator.nwd from above in one instance
Append any DWFs you would like toconvert
Adjust their Units and Transform until they look right
Save the rotator.nwd
Open the container.nwf
Refresh to reload the rotator if necessary
Now, hide everything but ‘shell’ elements using a search like this:
Save the search set for Item Type = Shell
Set up an iConstruct IFC config…
Type a Name
Press Building button
Expand to IfcBuildingElementProxy, userdefined
Choose search set for Item Type = Shell from above
Should look like this…
Close config dialog
Go to Smart IFC Export and choose the export config you just saved
Fill out next dialog and press ok
Choose target IFC location
Wait for Navisworksto export the IFC
Phase 3 – intoRevit
After IFC is created, open Revit. Ensure you have latest IFC updates installed, then open the the IFC. Wait for Revitto complete importing… For the most part, you should get a pretty good looking result. One exception is where the DWF had one ‘shell’ with multiple materials, like this:
In any case, now you have a bunch of ‘Revit elements’ (yes, I use the term loosely) that can be made into Model Groups. They aren’t in families, but you can make them into little rvts to load as links. I realise there are some limitations in this workflow, but in some cases there is no other way…
If you are interested in more to do with DWF conversions, check out these links:
Updates from the previous version are listed below. Please upgrade to the newest version!
NOTES: 1. IFC Exporter for Revit 2013 and IFC Exporter for Revit 2014 will no longer be getting regular updates. 2. IFC for Revit 2015 and 2016 includes export, import and the alternate export UI. There is no need for separate installs of each. 3. This update will work for both Revit and Revit LT.
What’s new for IFC for Revit 2015 v15.5.0 and IFC for Revit 2016 v16.2.0: General:
– Both Link and Export will use the IFC4 Addendum 1 schema instead of the IFC4 schema if the IFC4_ADD1.EXP is loaded in the EDM sub-folder of your Revit executable folder.
New Export Functionality:
– Allow setting of IfcBuildingStorey element composition type via IfcElementCompositionType shared parameter for levels. – IFC4: handle elliptical edges for IFC4 Design Transfer View export. – Support export of volumes as liters (a.k.a cubic decimeters) – Support export of volumetric flow rates as liters per second (a.k.a. cubic decimeters per second).
New Export UI Functionality:
– Better progress messages in the status bar. – Remove list of “Current Options” from the starting UI dialog; only display the IFC Schema and MVD as “IFC Version” – Remove path from “Projects to Export” list; the path is now a tooltip.
Export Bug Fixes:
– Correctly toggle between SLIDING_TO_LEFT / SLIDING_TO_RIGHT for flipped doors. – Use the element type “Function” parameter when setting the “IsExternal” common property for all element types, not just wall types.
New Import Functionality:
– Add “IfcElement HasPorts Name” and “IfcElement HasPorts IfcGUID” parameters to show port information for elements. There will be multiple shared parameters created if the element has multiple ports. – Add support for more thermal transmittance units. – Entities that are decomposed by IfcBuildingElementPart will now be visible if either the top level category or the Parts category is enabled by default. – If attempting to create an IfcShellBasedSurfaceModel as a Solid results in any dropped faces, import it as a Mesh instead. – (2016 only) If processing an IfcBooleanResult entity results in a failed Revit Boolean operation, try again by slightly shifting (by 1mm) the second of the two geometries in the operation. – Improve import of IfcSweptDiskSolid when the geometric description of the entity would create a self-intersecting surface. In this case, create the minimum number of solids possible to import as much as the geometry as possible. – Read in IfcSystems that aren’t associated to the building via a IfcRelServicesBuildings relation. – Read in IfcPropertyBoundedValues (including support for IFC4 version). – Support import of volumes as liters. – Support import of volumetric flow rates as liters per second.
Import Bug Fixes:
– Add a message to the log file if we skip importing an IfcProduct that neither has geometry nor is decomposed by other entities. – Fix a potential crash if a file contains a large number of elements in system joined by ports. – Improve log message when an entity can’t be imported because it has no geometry. – Improve log message when an entity can’t create all of the facets of its tessellated geometric representation. – Move some MEP entities from Generic Models category to the appropriate categories by default.
I recently had the pleasure of presenting at the 1st Build SA event of the year. Overall, it was a very informative event that packed heaps of useful content into a half-day of presentations, labs and discussions of real world case studies.
You can get tickets for BuildSA Event 02 – Documentation and Deliverables Part 1 here at this link.
(The one missing piece that you don’t get access to is the larger resource download package. If you want to get hold of some of these extra goodies, may I suggest that you attend Build SA Session 2 as per link above? )