0

I noticed that Model Derivatives are able to translate Revit to IFC using a specified Export Setting Name. Is it possible to do the same in Design Automation? The Autodesk exporter (Autodesk.IFC.Export.UI) is able to utilize saved export settings, but it can not be used in Design Automation because it depends on RevitAPIUI. Currently, I've tried snipping parts of the source code and putting it into my add-in, but I wonder if there is an easier way to do this.

rchen
  • 9
  • 2
  • I try to understand the question first. There is an API: `OpenIFCDocument Method (String, IFCImportOptions)` (see https://www.revitapidocs.com/2022/84e92ca4-6c6a-af82-454e-1c0b7b145398.htm). Do you have trouble to call this function in the addin for Design Automation? – Emma Zhu Jul 07 '21 at 19:02
  • I'm trying to convert from Revit to IFC. Stored in my Revit files are "export settings" managed by the Revit IFC exporter (https://github.com/Autodesk/revit-ifc). The exporter uses UI libraries, so it does not work on Design Automation. Is there an API that can access these export settings without using a UI library? – rchen Jul 07 '21 at 21:44

1 Answers1

1

Update:

Migrated Revit add-in for Revit DA: https://github.com/yiskang/forge-revit-ifc-exporter-appbundle

==========

Unfortunately, it's not builtin in Revit DA I'm afraid, since they come from Autodesk/revit-ifc.

But you may port IFCExportConfigurationsMap.cs, IFCExportConfiguration.cs and Enums to your own Revit addin.

Usage example:

var configurationsMap = new IFCExportConfigurationsMap();
//configurationsMap.Add(IFCExportConfiguration.GetInSession());
configurationsMap.AddBuiltInConfigurations();
configurationsMap.AddSavedConfigurations();

var selectedConfig = configurationsMap["IFC2x3 Coordination View 2.0"];
var exportOptions = new IFCExportOptions();

ElementId activeViewId = document.ActiveView.Id;
selectedConfig.ActiveViewId = selectedConfig.UseActiveViewGeometry ? activeViewId.IntegerValue : -1;
selectedConfig.UpdateOptions(exportOptions, activeViewId);

bool result = document.Export(path, fileName, exportOptions);

refs:

Eason Kang
  • 6,155
  • 1
  • 7
  • 24