不废话,直接上源代码。
如果有设置了二维视图的生成设置,请添加setupName进行过滤。如果没有,请直接按第一个设置选项导出。
private bool ExportDWGF(Document document,View view,string setupName)
{
bool exported = false;
IList<string> setupNames = BaseExportOptions.GetPredefinedSetupNames(document);
foreach(string name in setupNames)
{
// if(name.CompareTo(setupName)==0)
// {
DWGExportOptions dwgOptions = DWGExportOptions.GetPredefinedOptions(document, name);
ICollection<ElementId> views = new List<ElementId>();
views.Add(view.Id);
exported = document.Export(Path.GetDirectoryName(document.PathName), Path.GetFileNameWithoutExtension(document.PathName),
views, dwgOptions);
break;
// }
}
return exported;
}