Linked Models Not Exported to IFC When Setting "ExportLinkedFiles" to "true"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am trying to export a model including its linked models. When I export from the IFC exporter UI in Revit, it works fine creating separate files for the main model and the linked models. However, exporting from the code while setting the IFC export option "ExportLinkedFiles" to "true" does not produce the linked model IFC, only the model in the main document is exported.
This is the snippet of code that is relevant, it's inside a function and "activeDoc" is passed as argument representing the document that's to be exported:
IFCExportOptions ifcOptions = new IFCExportOptions();
BIM.IFC.Export.UI.IFCExportConfiguration myIFCExportConfiguration = BIM.IFC.Export.UI.IFCExportConfiguration.CreateDefaultConfiguration();
myIFCExportConfiguration.SitePlacement = 3;
myIFCExportConfiguration.ExportLinkedFiles = true;
ElementId ExportViewId = ElementId.InvalidElementId;
myIFCExportConfiguration.UpdateOptions(ifcOptions, ExportViewId);
string outputTitle = activeDoc.Title + "_temp_export";
string outputPath = "C:\\Projects\\myProject";
using (Transaction tr = new Transaction(activeDoc))
{
tr.Start("Export Ifc");
activeDoc.Export(outputPath, outputTitle, ifcOptions);
TransactionStatus s = tr.Commit();
if (TransactionStatus.Committed != s)
{
Log.Error("Transaction " + tr.GetName() + " did not commit. Status = " + s.ToString());
}
}
Before this code, we used to open each linked document separately in a loop, export the IFC then pass to the next until all are exported. However, we had some issues with the coordinates and none of the option for SitePlacement were giving the desired result, that's why I wanted to give this a shot since it seemed that it was supported natively by the IFC exporter.
Found that someone else has reported a similar issue here: https://github.com/Autodesk/revit-ifc/issues/222#issuecomment-1607934349
Thank you in advance for any help.