Message 1 of 5
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to hide scope boxes from a linked file from my current view, but it doesn't seem to work. I know you can hide scope boxes from the Revit UI like this:
But when I try to do the same with the API nothing happens...
var docs = commandData.Application.Application.Documents;
var currentDocument = commandData.Application.ActiveUIDocument.Document;
var currentView = commandData.Application.ActiveUIDocument.ActiveView;
foreach (Document doc in docs)
{
var linkedScopeBoxes = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_VolumeOfInterest).ToElementIds();
if (linkedScopeBoxes.Count > 0)
{
var scopeBoxCategory = doc.Settings.Categories.get_Item(BuiltInCategory.OST_VolumeOfInterest);
using (var transaction = new Transaction(currentDocument, "Hide scope boxes"))
{
transaction.Start();
currentView.HideCategoryTemporary(scopeBoxCategory.Id);
transaction.Commit();
}
}
}
The scope boxes does not get hidden. I don't understand where I go wrong...
Can someone point me in the right direction?
Thanks!
Solved! Go to Solution.