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.

 /* Mapping for Coffs_Harbour classes */
{ "Class": [RevitDynamic", "M_Centrifugal_Fan__Rooftop__Upblast", "IfcElectricAppliance" ] },

 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.

/* Mapping for Coffs_Harbour classes */
{
    "Class": [ "RevitDynamic", "M_DoorOverheadRolling", "IfcDoor" ],
    "Properties": [
        [ "UserLabel", "NewPropSet", "UserLabel_new" ]
    ]
},

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 iTwin, your iModel and finally to the most recent change set.

After each selection of iTwin, iModel or Changset, there will be a delay while that is opened and there will be a spinning circle at the top right side of the iModel Console during that time:

Once the circle becomes a green checkmark, you will be able to continue.

Once you have selected your iTwin, iModel and Changeset, you can  open the Schema editor to view the relationships contained in your iModel. Click on the schema editor icon to the left of the green check box:

Once the schema editor is open, you will see relationships on the left side of the schema editor:

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.

 

Conditional Mapping

In some cases you may also need to add additional conditions to more precisely map an object to a more suitable IFC Class. This can be done using conditional mapping.

To use conditional mapping you need the following values in this order:

Property Name

Property Value

IFC Class Name

Property Group Name

Schema Name

Class Name

For example. if you want to map "Feature Name" whose value is "Proxy Name" to the IFC class "IfcSignal" from the property group "Feature" using schema "Proxy_Schema_Published" and Class Name "Feature_Proxy_Class".

Some examples of how single item mapping would look like:

[ "Feature Name", "Proxy Name", "IfcSignal", "Feature", "Proxy_Schema_Published", "Feature_Proxy_Class" ]

[ "Feature Name", "Subsoil Resoiling", "IfcSignal", "Feature", "CivilSchema_Published", "FeatureWithName_PresentationElementAspect" ]

[ "Feature Definition", "TC_Sub Soil Resoiling", "IfcWall", "Feature", "CivilSchema_Published", "FeatureWithName_PresentationElementAspect" ]

Multiple item mapping which adds "Condition" into the mapping:

{

        "Class": [ "Generic", "PhysicalObject", "IfcBuildingElementProxy" ],

        "Condition": [

        [ "UserLabel", "BRCM_EQP", "IfcElectricAppliance" ],

        [ "UserLabel", "BRCM_3DCABLE", "IfcCableCarrierSegment" ],

        [ "UserLabel", "brcm_eqp3d", "IfcElectricAppliance" ]

        /* Following condition need 4th value as property group name, 5th value as schema name and 6th value as associated class name in order to query to assign given ifcclass */

        /* [ "Feature Name", "Subsoil Resoiling", "IfcSignal", "Feature", "CivilSchema_Published", "FeatureWithName_PresentationElementAspect" ], */

        /* [ "Feature Definition", "TC_Sub Soil Resoiling", "IfcWall", "Feature", "CivilSchema_Published", "FeatureWithName_PresentationElementAspect" ] */

      ]

    }

Setting the angle tolerance for faceted surfaces

You can modify the ExportQualityTolerance value from the default of 0.5 to change the smoothness of faceted surfaces. A smaller value will result in a smoother surface, but can result in much larger IFC models as the geometry is more detailed.

    /* Lower the angle tolerance value, surface will be more smoother else faceted. Default value is 0.5*/
    "ExportQualityTolerance": "0.5"

 

 

Adding the source filename to each IFC element

To export the source model name that was originally synchronized into the iModel for an element, set the following flag to true.

    /* Process source model file name. Default value is false. */
    "ProcessModelSourceFilename": "false"

 

 

 

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.