Maxime Touchard - 2020-05-19

Hello I'm trying to have a stable IFC export (so not view-dependant) from the Revit API. I need all the visible elements but also all the rooms to be exported as IFCSpaces.
Here is the configuration i'm using :

{
  "Name": "Sof",
  "IFCVersion": 21,
  "IFCFileType": 0,
  "SpaceBoundaries": 0,
  "SitePlacement": 0,
  "ActivePhaseId": {
    "IntegerValue": 0
  },
  "ExportBaseQuantities": true,
  "SplitWallsAndColumns": false,
  "ExportInternalRevitPropertySets": true,
  "ExportIFCCommonPropertySets": true,
  "Export2DElements": true,
  "VisibleElementsOfCurrentView": false,
  "Use2DRoomBoundaryForVolume": true,
  "UseFamilyAndTypeNameForReference": false,
  "ExportPartsAsBuildingElements": false,
  "ExportSolidModelRep": false,
  "ExportSchedulesAsPsets": false,
  "ExportUserDefinedPsets": false,
  "ExportUserDefinedPsetsFileName": "",
  "ExportUserDefinedParameterMapping": false,
  "ExportUserDefinedParameterMappingFileName": "",
  "ExportBoundingBox": false,
  "IncludeSiteElevation": false,
  "UseActiveViewGeometry": false,
  "ExportSpecificSchedules": false,
  "TessellationLevelOfDetail": 0.5,
  "UseOnlyTriangulation": false,
  "StoreIFCGUID": false,
  "ExportRoomsInView": false,
  "ExportLinkedFiles": false,
  "ActiveViewId": -1,
  "ExcludeFilter": "",
  "COBieCompanyInfo": "",
  "COBieProjectInfo": "",
  "IncludeSteelElements": true,
  "UseTypeNameOnlyForIfcType": false,
  "UseVisibleRevitNameAsEntityName": false,
  "IsBuiltIn": false,
  "IsInSession": false,
  "FileVersionDescription": "IFC 2x3 Coordination View 2.0"
}

Using the UI, the export id working well and i have IFCSPACES in the output IFC but using the API I have no rooms...
I've tried both the native revit API method :

IFCExportOptions exportOptions = new IFCExportOptions();
exportOptions.AddOption(/*add all options here one by one*/);

And the method provided inside your BIM.IFC.Export.UI :

using (StreamReader sr = new StreamReader(@"C:\Users\MaximeTOUCHARD\Documents\Sof.json"))
                    {
                        IFCExportConfiguration configuration = JsonConvert.DeserializeObject<IFCExportConfiguration>(sr.ReadToEnd());
                        if (configuration != null)
                        {
                            IFCExportOptions exportOptions = new IFCExportOptions();
                            configuration.UpdateOptions(exportOptions, ElementId.InvalidElementId);
                            using (Transaction transaction = new Transaction(document, "Export IFC"))
                            {
                                transaction.Start();
                                bool result = document.Export(@"C:\Users\MaximeTOUCHARD\Documents", Guid.NewGuid().ToString(), exportOptions); // pass in the options here

                                if (!result)
                                {
                                    MessageBox.Show("Erreur lors de l'export de l'IFC");
                                }
                                transaction.Commit();
                            }

                        }
                    }

I feel like I've tested a million combination of options and read all the exporter code... I hope I only forget a little magic key thing,
Thanks anyway for taking some time to read,
Regards,
Maxime