28 lines
545 B
Plaintext
28 lines
545 B
Plaintext
|
|
try
|
|||
|
|
{
|
|||
|
|
// 获取当前文档中选中的元素
|
|||
|
|
var selection = uidoc.Selection;
|
|||
|
|
ICollection<ElementId> selectedIds = uidoc.Selection.GetElementIds();
|
|||
|
|
|
|||
|
|
if (0 == selectedIds.Count)
|
|||
|
|
{
|
|||
|
|
TaskDialog.Show("Revit", "未选中任何元素");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
String info = "选中元素的Id: ";
|
|||
|
|
foreach (ElementId id in selectedIds)
|
|||
|
|
{
|
|||
|
|
info += "\n\t" + id.IntegerValue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
TaskDialog.Show("Revit", info);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
return e;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return "Done";
|