Create a label showing active design option

Create a label showing active design option

studio_ch
Explorer Explorer
123 Views
3 Replies
Message 1 of 4

Create a label showing active design option

studio_ch
Explorer
Explorer

Is this possible?

 

Thanks for any help.

0 Likes
124 Views
3 Replies
Replies (3)
Message 2 of 4

mhiserZFHXS
Advisor
Advisor

There can be multiple design options active at a time, so I don't know how it would be. 

0 Likes
Message 3 of 4

obulesub
Community Manager
Community Manager

Hi @studio_ch ,

It looks like your question is still open and hasn't received a definitive answer yet. If you're still looking into this, feel free to share a bit more about what you're trying to achieve, as that may help the community suggest possible approaches.

Obulesu | Community Manager
0 Likes
Message 4 of 4

Mike.FORM
Advisor
Advisor

This would be best done in dynamo with the following nodes passing into a python script. You could then use those values to and fill them into a generic annotation in the view or to shared parameter associated to the view.

 

Design Options Graaph.png

 


import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager

doc = DocumentManager.Instance.CurrentDBDocument

# Safe unwrapping of view input
view_input = IN
unwrapped = UnwrapElement(view_input)

# Force extraction of a single view item if a list or nested list was passed
if isinstance(unwrapped, list):
    while isinstance(unwrapped, list) and len(unwrapped) > 0:
        unwrapped = unwrapped[0]
    view = unwrapped
else:
    view = unwrapped

# 1. Collect all individual Design Options
option_collector = FilteredElementCollector(doc).OfClass(DesignOption).WhereElementIsNotElementType()
design_options = option_collector.ToElements()

# 2. Collect all parent Design Option Sets
set_collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_DesignOptionSets).WhereElementIsNotElementType()
option_sets = set_collector.ToElements()

# 3. Read the current View's active design option override parameter safely
override_param = view.get_Parameter(BuiltInParameter.VIEWER_OPTION_VISIBILITY) if view else None
override_id = override_param.AsElementId() if override_param and override_param.HasValue else ElementId.InvalidElementId

# Map parent Set IDs to their string names
set_map = {s.Id: s.Name for s in option_sets}

# 4. Filter and combine only the visible/set options
combined_output = []

for opt in design_options:
    set_id_param = opt.get_Parameter(BuiltInParameter.OPTION_SET_ID)
    
    if set_id_param and set_id_param.HasValue:
        parent_set_id = set_id_param.AsElementId()
        
        if parent_set_id in set_map:
            set_name = set_map[parent_set_id]
            is_primary = opt.IsPrimary
            
            # Determine if this specific option is the one actively displayed in the view
            is_visible = False
            if override_id == opt.Id:
                is_visible = True  # It is the explicit view override
            elif override_id == ElementId.InvalidElementId and is_primary:
                is_visible = True  # View is on Automatic, so the Primary option is visible
                
            # Only append to the final list if it is the option actively set/displayed
            if is_visible:
                combined_output.append("{0} - {1}".format(set_name, opt.Name))

# Returns a clean, flat list of strings
OUT = combined_output