Change the visibility of sub-catetory in the view.

Joe Ye

 

In a view’s Visibility/Graphic Overrides dialog, click the  tab "Model Categories", the sub-options of "Window", like "glass" / "Frame Mullion", can controlled the visibility of the related geometries of the Window. Then how to check this in API?  The Revit version is 2013.

We can simply call the View.SetVisibility(Category) to set the visibility of all main categories and also the sub-categories. You can simply get the target sub-category’s built-in category, and hide it.

Here is the code fragment to show the usage of the SetVisibility method. It hide the Glass and Frame/Mullion categories.

    Transaction trans = new Transaction(doc);

        trans.Start("ChangeVisibility");

 

    //Hide glass sub-category

 

    doc.ActiveView.setVisibility(doc.Settings.Categories.get_Item(

        BuiltInCategory.OST_WindowsGlassProjection),false);

 

    //Hide the frame/mullion sub-categories

 

    doc.ActiveView.setVisibility(doc.Settings.Categories.get_Item(

        BuiltInCategory.OST_WindowsFrameMullionProjection),false);

    trans.Commit();           

To get the visibility status of sub-categories, simply call View.GetVisibility(Category) method.


Comments

One response to “Change the visibility of sub-catetory in the view.”

  1. frank halliday Avatar
    frank halliday

    Can you hide the connector element though?

Leave a Reply to frank hallidayCancel reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading