public static bool HideGroupById(Document doc, int groupidnum, bool n)
{
ElementId groupid = new ElementId(groupidnum);
try
{
Element elem = doc.GetElement(groupid);
Group g = elem as Group;
IList<ElementId> ids = g.GetMemberIds();
if (n == true)
{
doc.ActiveView.HideElements(ids);
return true;
}
else
{
doc.ActiveView.UnhideElements(ids);
return true;
}
}
catch (Exception ex)
{
return false;
}
}
public static void HideGroupsById(Document doc, List<int> groupidnums)
{
foreach (var idnum in groupidnums)
{
ElementId groupid = new ElementId(idnum);
Element elem = doc.GetElement(groupid);
Group g = elem as Group;
IList<ElementId> ids = g.GetMemberIds();
doc.ActiveView.HideElements(ids);
}
}
来源:CSDN
作者:专治BrIM
链接:https://blog.csdn.net/weixin_40626630/article/details/86664380