IFC export user-defined mapping backslash in class name and other questions

I am trying to set up a custom mapping for IFC exports but have some troubles.

Backslashes in class names

First, I don't seem to be able to target any class that contain backslashes in their class name. Are these not supported by the user-defined mapping?

Most of the object classes in our iModels include backslashes. Examples include:
[CivilDesignerProductsDynamic].[Linear\Template Points\Grading\TL_End Cond Fill Tie]
[CivilDesignerProductsDynamic].[Linear\Utility\Util_Rainwater]
[CivilDesignerProductsDynamic].[Linear\Ditch\Ditch_Top_Front]
[CivilDesignerProductsDynamic].[Mesh\Grading\TC_Topsoil]
[CivilDesignerProductsDynamic].[Mesh\Modeling\Bottom Mesh]
[CivilDesignerProductsDynamic].[Corridor\Design]
[CivilDesignerProductsDynamic].[Alignment\MOE_Geom_Baseline_Color]

Other classes without the backslash in their names are OK. For example, the filter below:
{ "Class": [ "Generic", "Graphic3d", "IGNORETHISCLASS" ] },
{ "Class": [ "BisCore", "TextAnnotation3d", "IGNORETHISCLASS" ] },

correctly results in the objects in classes [Generic].[Graphic3d] and [BisCore].[TextAnnotation3d] being removed from the IFC export.

I have tested a bit and it seems that if there is a backslash in a string iTwin will not parse the json. for example the following:
{ "Class": [ "CivilDesignerProductsDynamic", "Linear\Utility\Util_Rainwater", "IGNORETHISCLASS" ] },

gives the following error in the log:
ERROR iModelToIFCConverter   - Cannot Parse Json File c:\stagingdir\UserDefinedMapping.json 

I tried "escaping" the backslash by adding another backslash like so:
{ "Class": [ "CivilDesignerProductsDynamic", "Linear\\Utility\\Util_Rainwater", "IGNORETHISCLASS" ] },

This got rid of the error. iTwin could parse the json, but it did not target the objects.

I also tried to remove the backslashes and replace them with hyphens, underscores and forward slashes but that did not work either.

Wildcard class filter

We have a lot of objects that get classified almost the same, but with a different ending. FOr example these:
[CivilDesignerProductsDynamic].[Linear\Template Points\Curb\TL_Curb Face Bot]
[CivilDesignerProductsDynamic].[Linear\Template Points\Curb\TL_Curb Face FL]
[CivilDesignerProductsDynamic].[Linear\Template Points\Curb\TL_Curb Face Top]
[CivilDesignerProductsDynamic].[Linear\Template Points\Curb\TL_Curb Back Top]
[CivilDesignerProductsDynamic].[Linear\Template Points\Curb\TL_Curb Back Bot]

I hope to be able to set up a filter for all of them. Is there some kind of regex/wildcard filter supported in the mapping json to let me match them all at once?

For example Linear\Template Points\Curb\TL_Curb*

Additional functionality:

Lastly, I saw the article here: Modifying Default Mapping for IFC Exports and have also studied the examples given in the default mapping file itself. There seem to be some functionality that are not really explained.

First, the Conditional Mapping. It is used in the default mapping to, I assume, map objects to Ifc classes based on the value of a property. It is not clear exactly how this work. I have not had any success in using it on any object myself.

Second, the "IGNORETHISCLASS" is used for some Civil objects. Is there a similar thing for properties that we don't want to include?

  • The class named used in this example may not be the class name but is instead the Display Label for the class.  Try the class name listed below to see if that affects the IFC output. 

    Example:

    [CivilDesignerProductsDynamic].[Linear\Template Points\Grading\TL_End Cond Fill Tie]

    Schema

    CivilDesignerProductsDynamic

    Class name

    Linear__x005C__Template__x0020__Points__x005C__Grading__x005C__TL_End__x0020__Cond__x0020__Fill__x0020__Tie 

    (Linear\Template Points\Grading\TL_End Cond Fill Tie)


    Here is an example of Condition for the OpenPlant class PIPE. In this example the “Condition” option is used with PIPE class to change the IfcEntity to IfcFlowSegment, IfcBuildingElementProxy, or IfcFlowFitting depending on the value of the property “SHORT_DESCRIPTION”. By default PIPE class will go to IfcFlowSegment but depending on the value of "SHORT_DESCRIPTION" the IfcClass will change between IfcBuildingElementProxy or IfcFlowFitting.

               {

                "Class": [ "OpenPlant_3D", "PIPE", "IfcFlowSegment" ],

                            "Condition":

                            [

                            [ "SHORT_DESCRIPTION", "Pipe123", "IfcBuildingElementProxy" ],

                            [ "SHORT_DESCRIPTION", "Pipe321", "IfcFlowFitting" ]

                            ]

                },

    Here the PIPEs with short description Pipe321 is going to IfcClass IfcFlowFitting and PIPEs with short description Pipe123 is going to IfcClass IfcBuildingElementProxy. IfcFlowSegment for PIPE has no attributes because all Short Descriptions fit the current Condition. This should work the same for generic OPM equipment as long as there consistent property to base the Condition on.


    IGNORETHISCLASS is used to prevent unwanted elements from being included in the IFC export.

    Joey Bertone
    Available
    Senior Technical Support Engineer
    iTwin Services 

    Answer Verified By: Sebastian Meier 

  • Thank you for your answer Joey!

    I think the unicodes work and I am able to target the correct classes. The export function in iTwin hasn't been that responsive this week so I have not tested much yet.

    One last thingDo you know if there is any wildcard or similar function implemented, or if all classes must be targeted individually?

  • Classes need to be targeted individually at this time. 

    Currently there is no wild card functionally but others have asked about that functionality.   

    Joey Bertone
    Available
    Senior Technical Support Engineer
    iTwin Services 
  • Thank you.

    That is certainly something I wish for as well then Slight smile