Missing classes in Autodesk.Revit.DB.IFC Namespace

Missing classes in Autodesk.Revit.DB.IFC Namespace

Anonymous
Not applicable
2,208 Views
4 Replies
Message 1 of 5

Missing classes in Autodesk.Revit.DB.IFC Namespace

Anonymous
Not applicable

I'm working on a custom IFC exporter for Revit and I had problems with the IFCExportOptions.AddOption() method which seems to work only under some circonstances (that I don't know yet). Then I saw on the Revit API documentation a section about the Autodesk.Revit.DB.IFC namespace (here) with many usefull classes and options. Unfortunatly when I try to use it I have only these 3 choices :


ifc.png

 

The documentation seems to stop at Revit 2018.1 and I'm using Revit 2018.3. Is it the problem ? Or do I forget to import some dll or extensions to the Autodesk.Revit.DB namespace ?

Thanks !

Accepted solutions (2)
2,209 Views
4 Replies
Replies (4)
Message 2 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @Anonymous,

Create an instance of IFCExportOption Class so that you can access it's methods and properties

IFCExportOptions IFC_export_options = new IFCExportOptions();
                IFC_export_options.AddOption(string name, string value);

RIFC.pngefer the image attached


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

0 Likes
Message 3 of 5

Anonymous
Not applicable

As I said, I do have problems with the IFCExportOptions.AddOption() method. This is why I ask if a workaround exist using the Autodesk.Revit.DB.IFC.

The problem I have with IFCExportOptions.AddOption() is the following :

I can't find a configuration where rooms are exported as IFCSPACE.
My code : (Python)

options = IFCExportOptions()
    options.FileVersion = IFCVersion.IFC4RV
    options.WallAndColumnSplitting = False
    options.AddOption("ExportVisibleElementsInView", "true")
    options.AddOption("ExportRoomsInView", "true")
    options.AddOption("ExportInternalRevitPropertySets", "true")
    options.AddOption("ExportIFCCommonPropertySets", "true")
    options.ExportBaseQuantities = True
    options.AddOption("ExportAnnotations", "false")
    options.AddOption("UseFamilyAndTypeNameForReference", "false")
    options.AddOption("ExportPartsAsBuildingElements", "false")
    options.AddOption("UseActiveViewGeometry", "false")
    options.AddOption("ExportSpecificSchedules", "false")
    options.AddOption("ExportBoundingBox", "false")
    options.AddOption("ExportSolidModelRep", "false")
    options.AddOption("ExportSchedulesAsPsets", "false")
    options.AddOption("ExportUserDefinedPsets", "false")
    options.AddOption("ExportUserDefinedParameterMapping", "false")
    options.AddOption("ExportLinkedFiles", "false")
    options.AddOption("IncludeSiteElevation", "false")
    options.AddOption("Use2DRoomBoundaryForVolume", "true")

 As I understand the AddOption method the same configuration is working well using the UI but is not working the API.

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

Regarding your first question, adding the RevitAPIIFC.dll reference should help.

Regarding the second one, there is some information in this thread:

https://forums.autodesk.com/t5/revit-api-forum/ifc-export-using-document-export-not-working/td-p/811...

Message 5 of 5

Anonymous
Not applicable
Accepted solution

Thanks ! 

I found out that using the IFCExportUI.dll situated in "C:\Program Files\Autodesk\Revit 2018\AddIns\IFCExporterUI " I can create a new instance of IFCExportConfiguration.
This way I have a more stable way to export IFC :

IFCExportConfiguration config = IFCExportConfiguration.CreateDefaultConfiguration();
selectedConfig.Name = "<Sofya Setup>";
selectedConfig.IFCVersion = IFCVersion.IFC2x3CV2;
selectedConfig.SpaceBoundaries = 1;
selectedConfig.ActivePhaseId = ElementId.InvalidElementId;
selectedConfig.ExportBaseQuantities = true;
selectedConfig.SplitWallsAndColumns = false;
selectedConfig.VisibleElementsOfCurrentView = false;
selectedConfig.Use2DRoomBoundaryForVolume = false;
selectedConfig.UseFamilyAndTypeNameForReference = true;
selectedConfig.ExportInternalRevitPropertySets = true;
selectedConfig.ExportIFCCommonPropertySets = true;
selectedConfig.Export2DElements = false;
selectedConfig.ExportPartsAsBuildingElements = true;
selectedConfig.ExportBoundingBox = false;
selectedConfig.ExportSolidModelRep = false;
selectedConfig.ExportSchedulesAsPsets = false;
selectedConfig.ExportUserDefinedPsets = false;
selectedConfig.ExportUserDefinedPsetsFileName = "";
selectedConfig.ExportLinkedFiles = false;
selectedConfig.IncludeSiteElevation = true;
selectedConfig.UseActiveViewGeometry = false;
selectedConfig.ExportSpecificSchedules = false;
selectedConfig.TessellationLevelOfDetail = 0;
selectedConfig.StoreIFCGUID = true;
selectedConfig.ExportRoomsInView = true;

config.ActiveViewId = activeViewId.IntegerValue;
config.UpdateOptions(IFCOptions, activeViewId);

IFCExportOptions IFCOptions = new IFCExportOptions();
string folder = @"D:\"; string name = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + Path.GetFileNameWithoutExtension(doc.PathName) + ".ifc"; using(Transaction tr = new Transaction(doc, "Export IFC")) { tr.Start(); doc.Export(folder, name, IFCOptions); tr.Commit(); }

As @Anonymous said the classes mentionned in my first questions are situated in the RevitAPIIFC.dll (not used at the end).

I think this method is more stable than the IFCExportOptions .AddOptions() which is very typo sensitive.