Reputation: 35
I have a family with nested families which are controlled by a family type type parameter. (Storage type ElementId)
How do I query a project file to retrieve possible values of parameters of the type elementId?
I've snooped the family instance to see what values are set for the parameter when I have different types selected. I can find those elementIds, can hard code them in, and it works. But I really need to be able to figure this out at runtime.
For example: one of the family types nested (not shared) in my family is named "Circular". I've searched all the elements and element types in the main document via filteredElementCollector(revitDoc) and cannot find one named "Circular", however, if I ask the document to get the element associated with my hard coded Id, it gives me an element with the name "Circular". So I know it's in the document!
The element Ids in the family document itself are not correct. My suspicion is that when the family is loaded into the Revit project document, the nested families are given element Ids but are excluded from being accessed via the filtered element collector.
NOTE: they could potentially be found if they were shared but they are not shared. (If they were shared, they could be found through the "sub-components" property of a placed familyinstance and from there, I assume we could get their types)
Upvotes: 0
Views: 3313
Reputation: 8294
I am afraid that the hard coded solution you mention is the only approach right now. I would add assertion and unit test suites around that to ensure that you really catch and support all possible states. You may want to check the Revit Idea station wish list items tagged API and see whether there is a suitable wish logged to include this into, or whether a new one could be logged for it. I would keep it as generic as possible, of course.
http://forums.autodesk.com/t5/revit-ideas/idb-p/302
http://forums.autodesk.com/t5/revit-ideas/idb-p/302/label-name/api
Upvotes: 2