Quantcast
Channel: RevitNetAddinWizard & NavisworksNetAddinWizard
Viewing all articles
Browse latest Browse all 872

Revit .NET Creations API: Visibility Control & Display All Graphics/Elements in the Active View

$
0
0

Revit generally does not display all graphics or elements in any views by default. Each Revit template regardless of Architectural, Structural or MEP has its own Graphics/Element display settings. It makes sense most of times by doing so to meet the requirements of different disciplines.
  VisibilityMassOff

However, sometimes, we may want to show up some types of elements such as Mass in some views that do not turn them on, or in the extreme case, show up all types of elements and in turn categories in a specific view or all of them. Here are a couple of help methods to use in this regard.

public class SettingAdjuster
{
    public static void TurnOnAllGraphics(Autodesk.Revit.DB.View view)
    {
        foreach (Category cat in view.Document.Settings.Categories)
            if( cat.get_AllowsVisibilityControl(view) )
                cat.set_Visible(view, true);
                //view.setVisibility(cat, true);
    }

    public static void TurnOnAllGraphicsInActiveView(RvtDocument doc)
    {
        TurnOnAllGraphics(doc.ActiveView);
    }
}
 
Here is some sample caller code.
...
SettingAdjuster.TurnOnAllGraphicsInActiveView(CachedDoc);
 …
After the code is executed, all will be visible in the Visibility/Graphic Overrides window.
  VisibilityMassOn

Revit Addin Wizard (RevitAddinWizard) provides various wizards, coders and widgets to help program Revit addins. It can be downloaded from the Download link at the bottom of the blog index page.


Viewing all articles
Browse latest Browse all 872

Trending Articles