
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I'm having trouble looping through all of the Design Option Sets in a document. I'm able to loop through all of the Design Options, but that object seems to have no information about what Design Option Set it belongs to. Code below.
Essentially, in the end I would like to display the Design Option Sets and Design Options in a TreeView, much like how it is shown in Revit.
Looping through design options of a document:
For Each projectDocument As Revit.DB.Document In commandData.Application.Application.Documents
If linkedModelData.Contains(D & projectDocument.PathName & L) Then
Dim linkedModelRootNode = tvDesignOptions.Nodes.Add(projectDocument.Title)
'Loop through design options and add to the tree view
Dim collector = New Revit.DB.FilteredElementCollector(projectDocument)
Dim FilteredDesignOptionElements = collector.OfClass(GetType(Revit.DB.DesignOption)).GetElementIterator
While FilteredDesignOptionElements.MoveNext
Dim currentDesignOption As DesignOption = FilteredDesignOptionElements.Current
Dim designOptionNode = linkedModelRootNode.Nodes.Add(currentDesignOption.Name)
designOptionNode.Tag = currentDesignOption.UniqueId & D & projectDocument.PathName
'If the design option was previously selected, set to checked
If CurrentlySelectedDesignOptions.Contains(D & currentDesignOption.UniqueId & D) Or currentDesignOption.IsPrimary Then
designOptionNode.Checked = True
End If
End While
linkedModelRootNode.ExpandAll()
End If
Next
Solved! Go to Solution.