Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do I get and set the View Design Option Override?

12 REPLIES 12
Reply
Message 1 of 13
trevor.taylor
7427 Views, 12 Replies

How do I get and set the View Design Option Override?

trevor.taylor
Enthusiast
Enthusiast

I would like to programatically acces the current design option property of a view. For example, In the UI I would go to Visibility / Graphic Overrides for <View Name>, then activate the 'Design Options' tab where each Design Option Set is listed with its currently displayed Design Option.

 

ViewOptionSettings.png

How do I get and set the View Design Option Override?

I would like to programatically acces the current design option property of a view. For example, In the UI I would go to Visibility / Graphic Overrides for <View Name>, then activate the 'Design Options' tab where each Design Option Set is listed with its currently displayed Design Option.

 

ViewOptionSettings.png

12 REPLIES 12
Message 2 of 13

augusto.goncalves
Alumni
Alumni

Have you looked into the DesignOptions property?

 

I made some testing and it's showing for elements, meaning in with DesignOption that specific element was created. But it seems that the View.DesignOption remains null regardless this changes...

 

So please give it a try, maybe your scenario is different.

 

void Getinfo_DesignOption(Document document)
{
    // Get the selected Elements in the Active Document
    UIDocument uidoc = new UIDocument(document);
    ElementSet selection = uidoc.Selection.Elements;

    foreach (Autodesk.Revit.DB.Element element in selection)
    {
        //Use the DesignOption property of Element
        if (element.DesignOption != null)
        {
            TaskDialog.Show("Revit",element.DesignOption.Name.ToString());
        }
    }
}

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network

Have you looked into the DesignOptions property?

 

I made some testing and it's showing for elements, meaning in with DesignOption that specific element was created. But it seems that the View.DesignOption remains null regardless this changes...

 

So please give it a try, maybe your scenario is different.

 

void Getinfo_DesignOption(Document document)
{
    // Get the selected Elements in the Active Document
    UIDocument uidoc = new UIDocument(document);
    ElementSet selection = uidoc.Selection.Elements;

    foreach (Autodesk.Revit.DB.Element element in selection)
    {
        //Use the DesignOption property of Element
        if (element.DesignOption != null)
        {
            TaskDialog.Show("Revit",element.DesignOption.Name.ToString());
        }
    }
}

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 13

trevor.taylor
Enthusiast
Enthusiast

I was able to get the option associate with a model element. Each element belongs to one an only one option. However, what I want is a diffent thing altogether. With a view's overrides, the game is a little different: we need a collection of IDs. A View has an associated Parameter called 'Visible in Option' whose built-in parameter def is named VIEWER_OPTION_VISIBILITY. That seems promising, but its value is always <null>.

 

There is also a parameter named 'Visibility/Graphics Overrides' whose built-in parameter def is named VIEW_VISIBLE_CATEGORIES. This parameter seems promising, and has a value, but I don't know what to do with it. I'll fiddle around a bit to see if in can extract some data.

I was able to get the option associate with a model element. Each element belongs to one an only one option. However, what I want is a diffent thing altogether. With a view's overrides, the game is a little different: we need a collection of IDs. A View has an associated Parameter called 'Visible in Option' whose built-in parameter def is named VIEWER_OPTION_VISIBILITY. That seems promising, but its value is always <null>.

 

There is also a parameter named 'Visibility/Graphics Overrides' whose built-in parameter def is named VIEW_VISIBLE_CATEGORIES. This parameter seems promising, and has a value, but I don't know what to do with it. I'll fiddle around a bit to see if in can extract some data.

Message 4 of 13

trevor.taylor
Enthusiast
Enthusiast

This seemed promising...

 

I create a view template and set the Design option overrides. When I inspect the parameters of the view template using Revit Lookup I see that there is one named "V/G Overrides Design Options" whose built-in parameter is named VIS_GRAPHICS_DESIGNOPTIONS.

 

Sweet!

 

But its value is always null. Stinky.

 

What are these Mystery Parameters?

 

VIS-DESIGN-OPTIONS.png

This seemed promising...

 

I create a view template and set the Design option overrides. When I inspect the parameters of the view template using Revit Lookup I see that there is one named "V/G Overrides Design Options" whose built-in parameter is named VIS_GRAPHICS_DESIGNOPTIONS.

 

Sweet!

 

But its value is always null. Stinky.

 

What are these Mystery Parameters?

 

VIS-DESIGN-OPTIONS.png

Message 5 of 13

augusto.goncalves
Alumni
Alumni

I made some testing, and I might be wrong, but the views are not affected by the Design Option. Meaning the views are above it, and are applicable to all design options...

 

Am I missing anything here?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network

I made some testing, and I might be wrong, but the views are not affected by the Design Option. Meaning the views are above it, and are applicable to all design options...

 

Am I missing anything here?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 6 of 13

trevor.taylor
Enthusiast
Enthusiast

Let me recap my problem. I want to progamatically do what in the UI is done by accessing Visibility Graphics Overrides for a view and then the Design Options tab to change the options visibility for a view. This tab is visible in a project file with at least one Option Set.

 

When I use Revit Lookup -> Snoop DB to inspect the parameters of, say, a ViewPlan object, I don't see any properties or parameters that point to the Design Option V/G overrides. (A View has a 'Design Option' property, but this, I believe, is inherited from Element and is used to assign an element to the Main Model or a Design Option. If so, then it makes perfect sense that it would always have a value of <null> when applied to a view.)

 

However, a View whose 'IsTemplate' property = true has parameters that begin with 'V/G Overrides..." and includes a parameter named 'V/G Overrides Design Options' which, I'm hoping contains the View's Design Option visibility settings. So then, I suppose I have two questions: 1) How to I make use of this parameter and 2) why does it show up only for a View Template and not a View?

 

The reason I want to do this it to write an addin command that duplicates specified views for each design option in a design option set and then assigns one of the options to each of the views. This would be a big time-saver for presentations where I may have several options that I want to see using several views. For example, 3 options times 3 views for each option is 9 views i need to duplicate and the assign the appropriate option to. Boring. More fun to push a button than play see-saw with the scroll bar in the Project Browser.

 

 

Let me recap my problem. I want to progamatically do what in the UI is done by accessing Visibility Graphics Overrides for a view and then the Design Options tab to change the options visibility for a view. This tab is visible in a project file with at least one Option Set.

 

When I use Revit Lookup -> Snoop DB to inspect the parameters of, say, a ViewPlan object, I don't see any properties or parameters that point to the Design Option V/G overrides. (A View has a 'Design Option' property, but this, I believe, is inherited from Element and is used to assign an element to the Main Model or a Design Option. If so, then it makes perfect sense that it would always have a value of <null> when applied to a view.)

 

However, a View whose 'IsTemplate' property = true has parameters that begin with 'V/G Overrides..." and includes a parameter named 'V/G Overrides Design Options' which, I'm hoping contains the View's Design Option visibility settings. So then, I suppose I have two questions: 1) How to I make use of this parameter and 2) why does it show up only for a View Template and not a View?

 

The reason I want to do this it to write an addin command that duplicates specified views for each design option in a design option set and then assigns one of the options to each of the views. This would be a big time-saver for presentations where I may have several options that I want to see using several views. For example, 3 options times 3 views for each option is 9 views i need to duplicate and the assign the appropriate option to. Boring. More fun to push a button than play see-saw with the scroll bar in the Project Browser.

 

 

Message 7 of 13
Ning_Zhou
in reply to: trevor.taylor

Ning_Zhou
Advocate
Advocate
at first i thought VT cannot be changed and filed ADN support for my very 1st (?) dumb question, now it seems most if not all VG Overrides cannot be changed as mentioned by trevor?! still wait for their reply.

at first i thought VT cannot be changed and filed ADN support for my very 1st (?) dumb question, now it seems most if not all VG Overrides cannot be changed as mentioned by trevor?! still wait for their reply.
Message 8 of 13
trevor.taylor
in reply to: Ning_Zhou

trevor.taylor
Enthusiast
Enthusiast

Sometimes dumb questions attract smart answers. That's why I ask them. Often. And there are plenty of clever and persistent folks out there who are smarter than I am and can often come up a workaround to a seemingly impossible problem.

 

However, in this case, What we want to do apparently can't be done. The V/G Overrides Design Options settings, and their cousins in the V/G overrides diialog, have to be explicitly exposed. It just so happens that Filters have been made available, but not the other settings. I found this post on Jeremy's blog that tells the (sad) story: http://thebuildingcoder.typepad.com/blog/2013/08/view-filter-api.html

 

Here is the relevant citation:

 

"The SCHEDULE_FILTER_PARAM and VIS_GRAPHICS_FILTERS built-in parameters are possibly used to store these settings, but they cannot be read or modified through the API since they are used to store multiple values, and there is no API support for that kind of value type."

 

I wish Revit's approach to its API were like AutoCAD's in that the AutoCAD UI is completely separate from it's graphics and geometry engine. Therefore, with ACAD, if it can be accomplished in the UI, then it can be accomplished in the API. It was nice, back in the old AutoCAD days, being drunk with all that power, but Revit has sobered me up!

 

Sometimes dumb questions attract smart answers. That's why I ask them. Often. And there are plenty of clever and persistent folks out there who are smarter than I am and can often come up a workaround to a seemingly impossible problem.

 

However, in this case, What we want to do apparently can't be done. The V/G Overrides Design Options settings, and their cousins in the V/G overrides diialog, have to be explicitly exposed. It just so happens that Filters have been made available, but not the other settings. I found this post on Jeremy's blog that tells the (sad) story: http://thebuildingcoder.typepad.com/blog/2013/08/view-filter-api.html

 

Here is the relevant citation:

 

"The SCHEDULE_FILTER_PARAM and VIS_GRAPHICS_FILTERS built-in parameters are possibly used to store these settings, but they cannot be read or modified through the API since they are used to store multiple values, and there is no API support for that kind of value type."

 

I wish Revit's approach to its API were like AutoCAD's in that the AutoCAD UI is completely separate from it's graphics and geometry engine. Therefore, with ACAD, if it can be accomplished in the UI, then it can be accomplished in the API. It was nice, back in the old AutoCAD days, being drunk with all that power, but Revit has sobered me up!

 

Message 9 of 13

trevor.taylor
Enthusiast
Enthusiast

For those of your who may be following this post, I've found a suitable solution to my puzzle by using View parameter "Visible in Option". The real purpose of this property is to limit the display of view tags, sections or elevations for example, to only views displaying the specified option. This property is useful if, say, you have duplicated a section view several times to display several different options. By setting each duplicated section's Visible in Option property, you keep your floor plans neater by not having several section lines stacked one atop the other.

 

But I digress. By default this property is set to "All" options, or null. Setting it to a valid Design Option ID has the bonus behavior of causing the View's Visibility Graphics Design Option override setting to also be set to the selected option with the happy result that my addin now does exactly what I want. Hurray!

 

You need to get the ElementID of the Design Option you want to assign. Then you need a reference to the View. Be aware that not all views have this property, so plan accordingly. Here's the relevant example code:

 

// Set the View's Visible in Option Property:
Parameter myParameter =

  myView.get_Parameter(BuiltInParameter.VIEWER_OPTION_VISIBILITY) as Parameter;
// Some views don't have "visible in option" property (e.g.: Schedule)
if (null != myParameter)
  {
    myParameter.Set(opt.Id);
    // Use the following statement to set the View's Visible in Option property back to "All"

    //myParameter.Set(new ElementId(BuiltInParameter.INVALID));

 }

 

Now, for the segment where I offer credit where credit is due: I found the key to my puzzle on Harry Mattison's Boost Your BIM blog. Check it out. He has lots of good stuff. Thanks, Harry!

 

Trevor Taylor

ZGF Architects

 

For those of your who may be following this post, I've found a suitable solution to my puzzle by using View parameter "Visible in Option". The real purpose of this property is to limit the display of view tags, sections or elevations for example, to only views displaying the specified option. This property is useful if, say, you have duplicated a section view several times to display several different options. By setting each duplicated section's Visible in Option property, you keep your floor plans neater by not having several section lines stacked one atop the other.

 

But I digress. By default this property is set to "All" options, or null. Setting it to a valid Design Option ID has the bonus behavior of causing the View's Visibility Graphics Design Option override setting to also be set to the selected option with the happy result that my addin now does exactly what I want. Hurray!

 

You need to get the ElementID of the Design Option you want to assign. Then you need a reference to the View. Be aware that not all views have this property, so plan accordingly. Here's the relevant example code:

 

// Set the View's Visible in Option Property:
Parameter myParameter =

  myView.get_Parameter(BuiltInParameter.VIEWER_OPTION_VISIBILITY) as Parameter;
// Some views don't have "visible in option" property (e.g.: Schedule)
if (null != myParameter)
  {
    myParameter.Set(opt.Id);
    // Use the following statement to set the View's Visible in Option property back to "All"

    //myParameter.Set(new ElementId(BuiltInParameter.INVALID));

 }

 

Now, for the segment where I offer credit where credit is due: I found the key to my puzzle on Harry Mattison's Boost Your BIM blog. Check it out. He has lots of good stuff. Thanks, Harry!

 

Trevor Taylor

ZGF Architects

 

Message 10 of 13
Sinha
in reply to: trevor.taylor

Sinha
Contributor
Contributor

Looks like this anomly persists. It seems to be caused by "Crop Region Visibility"

 

When I apply a "View Template" to a design option in a 3D View or Perspective, Design Options don't change.

But when I toggle the Crop Region, Design option takes effect.

 

Any fix yet for this out there?

Looks like this anomly persists. It seems to be caused by "Crop Region Visibility"

 

When I apply a "View Template" to a design option in a 3D View or Perspective, Design Options don't change.

But when I toggle the Crop Region, Design option takes effect.

 

Any fix yet for this out there?

Message 11 of 13
boostyourbim
in reply to: Sinha

boostyourbim
Advocate
Advocate

VIEWER_OPTION_VISIBILITY works nicely in plan views, but not in elevation views. Does anyone have a suggestion for this?

VIEWER_OPTION_VISIBILITY works nicely in plan views, but not in elevation views. Does anyone have a suggestion for this?

Message 12 of 13
Anonymous
in reply to: boostyourbim

Anonymous
Not applicable

I am a little late to this one (lol).  Instead of using an Exterior Elevation, use a Section for Elevation and the parameter will be available

 

0 Likes

I am a little late to this one (lol).  Instead of using an Exterior Elevation, use a Section for Elevation and the parameter will be available

 

Message 13 of 13
c_hanschen
in reply to: trevor.taylor

c_hanschen
Advocate
Advocate

Hello,

 

Is there a simple solution for this question already?

I just need to now, if the DesignOption is visible in the (3D) view.

 

Little more info:

FillteredElementCollector doesn't return Rooms for 3D view, but I want to use the Design Option Settings for filtering my Rooms.

So I want to filter the Rooms by accessing the Design Option view setting of a 3D view.

 

Thanks,

Chris Hanschen

The Netherlands

 

0 Likes

Hello,

 

Is there a simple solution for this question already?

I just need to now, if the DesignOption is visible in the (3D) view.

 

Little more info:

FillteredElementCollector doesn't return Rooms for 3D view, but I want to use the Design Option Settings for filtering my Rooms.

So I want to filter the Rooms by accessing the Design Option view setting of a 3D view.

 

Thanks,

Chris Hanschen

The Netherlands

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report