try
{
IList
foreach (var item in Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.SelectedItems)
{
var cat = item.DescendantsAndSelf.Where(i => i.PropertyCategories.FindCategoryByDisplayName("元素") != null);
var pro = cat.Where(m => m.PropertyCategories.FindCategoryByDisplayName("元素").Properties.FindPropertyByDisplayName("族") != null);
foreach (ModelItem m in pro)
{
if (GetPropertyValue(m.PropertyCategories.FindCategoryByDisplayName("元素").Properties.FindPropertyByDisplayName("族")) == "条形窗")
{
list.Add(m);
}
}
}
MessageBox.Show(list.Count.ToString());
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.Clear();
Autodesk.Navisworks.Api.Application.ActiveDocument.CurrentSelection.AddRange(list);
return 0;
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);//输出显示异常信息
return 0;
}