default export all

This commit is contained in:
Zhuangkh 2023-05-12 18:26:38 +08:00
parent ece4afe350
commit c9395d83f8

View File

@ -9,6 +9,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Windows;
namespace PDF3D.Addin
{
@ -23,7 +24,25 @@ namespace PDF3D.Addin
try
{
var elems = uIDocument.Selection.PickObjects(Autodesk.Revit.UI.Selection.ObjectType.Element).Select(x => doc.GetElement(x)).ToList();
List<Element> elems = new List<Element>();
FilteredElementCollector collector = new FilteredElementCollector(doc).WhereElementIsNotElementType();
foreach (Element e in collector)
{
if (e.Category != null)
{
if (e.Category.HasMaterialQuantities)
{
elems.Add(e);
}
else
{
if (e.Category.IsCuttable)
{
elems.Add(e);
}
}
}
}
SaveFileDialog fileDialog = new SaveFileDialog()
{
@ -60,11 +79,12 @@ namespace PDF3D.Addin
iDTFBuilder.Export(idtf);
iDTFBuilder.ExportView(view);
GeneratePDF(idtf, view, fileDialog.FileName);
MessageBox.Show("导出完成");
}
}
catch
catch(Exception ex)
{
MessageBox.Show(ex.Message,"导出失败");
}
return Result.Succeeded;