Not applicable
08-19-2015
03:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Manually this is possible in revit. I have main doc and a linked doc. Now I select one element from main doc and one element from linked doc; I do a right click and Hide In View - Elements. Both the selected element gets hidden.
Trying to do the same via code:
FilteredElementCollector links = new FilteredElementCollector(Command.doc).OfCategory(BuiltInCategory.OST_RvtLinks); foreach (Document d in Command.app.Documents) { coll = new FilteredElementCollector(d); coll.WherePasses(new LogicalOrFilter(new ElementIsElementTypeFilter(false), new ElementIsElementTypeFilter(true))); elemSet = new ElementSet(); foreach (Element el in coll) { try { if (el.Id == new ElementId(elementid1) || el.Id == new ElementId(elementid2) { IList<ElementId> ilds = new List<ElementId>(); ilds.Add(el.Id); ICollection<ElementId> elemIdsColl = (ICollection<ElementId>)ilds.Cast<ElementId>().ToList(); Command.doc.ActiveView.HideElements(ilds); } } catch (Exception sd) { string fg = sd.ToString(); } }
The code hides only the element of the main doc but does not hide the element of the linked doc.
Thanks & Regards
Sanjay Pandey
Solved! Go to Solution.
Link copied