#BILTNA Wish 5: Isolate with Fade

Isolate command should fade and lock all other objects instead of hiding them completely. What use can i find in seeing an object out of context? I can’t compare it visually to anything. If i want to modify it and can’t relate any modification to any context (because it’s hidden)

public void isolateFade()
    Document doc = this.ActiveUIDocument.Document;
    UIDocument uidoc = this.ActiveUIDocument;
    ElementId elementIdToIsolate = null;
        elementIdToIsolate = uidoc.Selection.PickObject(ObjectType.Element, "Select element or ESC to reset the view").ElementId;
    OverrideGraphicSettings ogsFade = new OverrideGraphicSettings();
    OverrideGraphicSettings ogsIsolate = new OverrideGraphicSettings();
    using (Transaction t = new Transaction(doc, "Isolate with Fade"))
        foreach (Element e in new FilteredElementCollector(doc, doc.ActiveView.Id).WhereElementIsNotElementType())
            if (e.Id == elementIdToIsolate || elementIdToIsolate == null)
                doc.ActiveView.SetElementOverrides(e.Id, ogsIsolate);
                doc.ActiveView.SetElementOverrides(e.Id, ogsFade);

6 thoughts on “#BILTNA Wish 5: Isolate with Fade

  1. Good tool, BUT what happen when there is some curtain walls in the projects?
    I get an error, I’m wandering what will happen when pinning curtain panels (which were unpinned and customized)

  2. Autodesk.Revit.Exceptions.InvalidOperationException: Element cannot be pinner or unpinned
    at autodesk.revit.db.element.set_Pinned(Boolean lock) at “namespace”.IsolateAndFadeAndLock.Isolate(Icollection ‘\ eIds, doc, uidoc)… <- method I call from the external command

    Sorry I cannot copy the message from the revit window, maybe I will adjust the code to have a proper TaskDialog

  3. Ops, i forgot that I’ve added the pin property to your code. It is very useful when used with the selection filter: you can work on the isolated element, without warry about selecting oher elements. Sorry about that, but, maybe I found the solution adding the .CanBeLocked method prior to lock them. Give it a try!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s