Get DesignOptions in DesignOptionSet via API? (R22)

Get DesignOptions in DesignOptionSet via API? (R22)

eric.isaac2KKE9
Enthusiast Enthusiast
421 Views
2 Replies
Message 1 of 3

Get DesignOptions in DesignOptionSet via API? (R22)

eric.isaac2KKE9
Enthusiast
Enthusiast

Is there a way to determine which DesignOptions are in a given DesignOptionSet via the API in Revit 2022?

 

I'm able to get a list of the DesignOptions, and a list of the DesignOptionSets, but I don't know how to correlate them.

Accepted solutions (1)
422 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @eric.isaac2KKE9 ,

 

Try using this below sample code

 //Filter Design Option Sets Present in the Project
FilteredElementCollector designOptionSetcollector = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_DesignOptionSets).WhereElementIsNotElementType();
            
ElementFilter eFilter = new ElementCategoryFilter(BuiltInCategory.OST_DesignOptions);
            
foreach(Element e in designOptionSetcollector)
  {
   string designOptionSet_Name=e.Name;

   //Get all Design Options present in each DesignOptionSet
    IList<ElementId> designOptionList = e.GetDependentElements(eFilter);
    foreach(ElementId eid in designOptionList)
      {
          string designOptionName=doc.GetElement(eid).Name;
      }

}

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

eric.isaac2KKE9
Enthusiast
Enthusiast

This did what I needed, thank you @naveen.kumar.t!

0 Likes