Message 1 of 5
IFC4 export error

Not applicable
05-23-2021
09:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to export revit model to IFC by creating my add-in. I've created a very simple project and the export class. The problem is that export to the IFCVersion.Default and all IFC2.** versions works fine, but i can't export to any IFC4.* version as i simply get a mistake like this "An unrecoverable error occurred during the export process. The export will be aborted". Does anybody have any sugestions what can be wrong? I',m using revit 2019 and here is an example of my code
[Transaction(TransactionMode.Manual)]
public class Command : IExternalCommand
{
private IServiceProvider _serviceProvider;
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elementSet)
{
try
{
var doc = commandData.Application.ActiveUIDocument.Document;
if (!(doc.ActiveView is View3D view))
{
MessageBox.Show("This is not a 3D view");
return Result.Cancelled;
}
using (Transaction tr = new Transaction(doc))
{
tr.Start("Export doc");
try
{
var ifcExportOptions = new IFCExportOptions {FileVersion = IFCVersion.IFC4};
bool res = doc.Export("D:\\temp\\", "ExportDoc.ifc", ifcExportOptions);
tr.Commit();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
tr.RollBack();
throw;
}
}
return Result.Succeeded;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
return Result.Failed;
}
}