Hi there,
I'm trying to automate DGN export in Revit 2014/2015. I have tried this code :
public bool ExportDGN(Document document, View view)
{
bool exported = false;
// Get predefined setups and export the first one
IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
if (setupNames.Count > 0)
{
// Get predefined options for first predefined setup
DGNExportOptions dgnOptions = DGNExportOptions.GetPredefinedOptions(document, setupNames[0]);
// export the active view if it is printable
if (document.ActiveView.CanBePrinted == true)
{
ICollection<ElementId> views = new List<ElementId>();
views.Add(view.Id);
exported = document.Export(Path.GetDirectoryName(document.PathName),
Path.GetFileNameWithoutExtension(document.PathName), views, dgnOptions);
}
}
return exported;
However, this line doesn't return any setups.
IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
I have tried everything :
IList<string> setupNames = DGNExportOptions.GetPredefinedSetupNames(document);
IList<string> setupNames = ACADExportOptions.GetPredefinedSetupNames(document);
IList<string> setupNames = CADExportOptions.GetPredefinedSetupNames(document);
I receive the setups for DWG, but not for DGN.
Does anyone experience the same problem ?
Solved! Go to Solution.
Solved by Aaron.Lu. Go to Solution.
Dear R:
I don't see any problem in your code.
That might because there is no predefined DGN settings in your document.
Please check Revit>Export>CAD Formats>DGN>Select Export Setup, in the combobox did you see any predefined settings? if not, then Click the "Modify Export Setup" button, in the popup dialog, in the left bottom corner, click "New Export Setup"