#RTCNA wish granted – Design Option Set info

Rabi asked

I am curious if you have figured a way to get the Design Options Set from Revit API

Here’s what it seems we can do with the parameters OPTION_SET_ID and PRIMARY_OPTION_ID

Capture

public void getDesignOptionSet()
{
    Document doc = this.ActiveUIDocument.Document;
    List<ElementId> setIds = new List<ElementId>();
    foreach (DesignOption dopt in new FilteredElementCollector(doc).OfClass(typeof(DesignOption)).Cast<DesignOption>())
    {
        ElementId setId = dopt.get_Parameter(BuiltInParameter.OPTION_SET_ID).AsElementId();
        if (!setIds.Contains(setId))
            setIds.Add(setId);
    }
    
    string data = "";
    foreach (ElementId id in setIds)
    {
        Element e = doc.GetElement(id);
        data += e.Name + " - " + doc.GetElement(e.get_Parameter(BuiltInParameter.PRIMARY_OPTION_ID).AsElementId()).Name + Environment.NewLine;
    }
    
    TaskDialog.Show("data",data);
}

One thought on “#RTCNA wish granted – Design Option Set info

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s