Modifying Default Mapping for IFC Exports


How to modify the Default Mapping for IFC Exports

Class mapping

1. By default, the IFC Exporter uses a default mapping file. The default mapping file can be found here: Schema mapping.

2. This mapping file is a plain text file and can be edited by any text editor such as notepad.

3. Each mapping entry consists of the “Schema Name”, “EC Class Name” & “corresponding IFC Class Name” e.g.

{ "Class": [ "ArchPhys", "Door", "IfcDoor" ] },      OR

{ "Class": [ "ArchPhys", "Window", "IfcWindow" ] },    OR

{ "Class": [ "OpenPlant_3D", "BALL_CONTROL_VALVE", "IfcValve" ] },    

 The schema and EC Class names are from the iModel.

4. If the IFC Exporter can find an appropriate mapping for the iModel components, then elements will be exported to the correct IFC class as per the mapping. This is how it will look in the generated IFC file when you open it in BIMVision which is a free IFC viewer.

  

5. But if the IFC Exporter doesn’t find the corresponding mapping, then elements will be exported to a “Building Element Proxy” element in the generated IFC file as can be seen in the below image:

 

6. In the above image you can see that the Exhaust element is being exported as a “Building Element Proxy”. The source schema for this element in the iModel is “RevitDynamic” and the ECClass name is “M_Centrifugal_Fan___Rooftop___Upblast”. If the user wants to map this ECClass to a proper IFC class instead of just “Building Element Proxy”, it can be mapped (as an example) to “IfcElectricAppliance”. It will look like the following in the SchemaMapping.json file.

 

 7. When you use the modified mapping, you will see results like this:

Property Mapping

1. Similar to class mapping, we can also add Property mapping in the “SchemaMapping.json” file.

2. Please see the image below. There are different Property Sets and under each Property Set there are multiple properties. e.g. Under the “[RevitDynamic].[M_DoorOverheadingRolling]” property set we have a property called “User Label”.

3. Let’s say we need that property to be under a different Property Set, then we can add the following mapping to the “SchemaMapping.json” file.

4. The resulting IFC will show you results like this in BIMVision with the modified mapping file.

5. It is possible to export properties that have Null values by editing this part of the Global Variables section of the mapping file:

/* Process empty properties (without assigned values). Default value is false. */

        "ProcessEmptyProperties" : "true"

Relationship Mapping

1. Similar to class mapping, we can also add Property mapping in the “SchemaMapping.json” file.

2. Each relationship mapping entry consists of the “Schema Name”, “EC Relationship Class Name” & “IFC Relationship type”. The IFC Exporter supports 2 types of relationships “IfcRelNests” and “IfcRelAssignsToGroup” e.g.

{ "Relation": [ "ProcessPhysical", "EQUIPMENT_HAS_PORT", "IfcRelNests"] }, OR


{ "Relation": [ "OpenPlant_3D", "EQUIPMENT_HAS_PORT", "IfcRelNests"] }, OR


For “IfcRelAssignsToGroup” relationship type, the user needs to set the global variables “ProcessGroupingElements” : “true” in the Schema mapping file.

{ "Relation": [ "WorkPackaging", "WorkPackageGroupsElements", "IfcRelAssignsToGroup"]},

The schema and EC Relationship Class names are from the iModel.

3. If the IFC Exporter can find an appropriate mapping for the iModel components, then elements will be exported to the correct IFC class as per the mapping. This is how it will look in the generated IFC file when you open it in BIMVision which is a free IFC viewer.

Example showing IfcRelNests

The IfcRelAssignsToGroup relationships can be found in the “Objects” tab in the BIMVision

(TODO: need to insert this image)

4. Specific relationships that can be mapped to IFC may need to come from the specific content of your iModel. To  view the existing relationships that are in your iModel, use the schema editor. Accessing the schema editor is easiest the first time if you first open the iModel Console application and navigate to your project, your iModel and finally to the most recent Named Version. Once it is open, enter .schema into the iModel Console prompt and hit enter. This will open the schema editor with the schema from your iModel.

In the schema editor, you will see relationships 

and under relationships, you can find DEVICE_HAS_PORT and EQUIPMENT_HAS_PORT

Click on that brings up this information:

This tells you that the schema this is coming from is "ProcessPhysical" and the relationship name is "EQUIPMENT_HAS_PORT". You will also need to determine the relationship type as explained above.

Using a custom mapping file

In order to use your modified SchemaMapping.json, you will need to provide it to the IFC Exporter. If you are using itwin.bentley.com you first need to store the modified mapping file somewhere on share for this iTwin. When the Export to IFC interface appears, enable “Select user-defined mapping JSON file” and then browse to your mapping file on share.