#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;
    try
    {
        elementIdToIsolate = uidoc.Selection.PickObject(ObjectType.Element, "Select element or ESC to reset the view").ElementId;
    }
    catch
    {
        
    }
    
    OverrideGraphicSettings ogsFade = new OverrideGraphicSettings();
    ogsFade.SetSurfaceTransparency(50);
    ogsFade.SetSurfaceForegroundPatternVisible(false);
    ogsFade.SetSurfaceBackgroundPatternVisible(false);
    ogsFade.SetHalftone(true);
    
    OverrideGraphicSettings ogsIsolate = new OverrideGraphicSettings();
    ogsIsolate.SetSurfaceTransparency(0);
    ogsIsolate.SetSurfaceForegroundPatternVisible(true);
    ogsIsolate.SetSurfaceBackgroundPatternVisible(true);
    ogsIsolate.SetHalftone(false);
    
    using (Transaction t = new Transaction(doc, "Isolate with Fade"))
    {
        t.Start();
        foreach (Element e in new FilteredElementCollector(doc, doc.ActiveView.Id).WhereElementIsNotElementType())
        {
            if (e.Id == elementIdToIsolate || elementIdToIsolate == null)
                doc.ActiveView.SetElementOverrides(e.Id, ogsIsolate);
           else
                doc.ActiveView.SetElementOverrides(e.Id, ogsFade);
        }
        t.Commit();
    }
}
Advertisements

One thought on “#BILTNA Wish 5: Isolate with Fade

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