Files
SzmediTools/Szmedi.RvKits/Samples/Selection.csx
2025-09-16 16:06:41 +08:00

28 lines
545 B
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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";