0

I am trying to programmatically change the FamilyType that is mapped to a parameter inside a Family (specifically one that creates Weld Annotations). In this case, the FamilyType(s) in question are only inside the family, so a search for a matching FamilyInstance or FamilySymbol does not apply (nor work, since I tried -- these embedded families do not appear in the browser). These FamilyType(s) also do not appear using GetSubComponentIds -- the parent weld family reports no sub-components. A search for "ParameterType" of that parameter returns "FamilyType", but I don't know what value to apply to that parameter if I can't find an ElementId.

FilteredElementCollector DetailItems = new FilteredElementCollector(doc);
DetailItems.OfClass(typeof(Autodesk.Revit.DB.FamilyInstance));
List<string> Many_Annotations = new List<string>();
foreach (FamilyInstance One_Instance in DetailItems)
{
    ICollection<ElementId> Subbies = One_Instance.GetSubComponentIds();//insists that there are NONE with sub-elements?
    if (Subbies != null)
    {
        foreach (ElementId One_Id in Subbies)//apparently a nested component (parameter controlled) is NOT a sub-component?
        {
            FamilyInstance One_Sub = doc.GetElement(One_Id) as FamilyInstance;
            Many_Annotations = MyNamespace.Class.Unique_Strings(One_Sub.Name, Many_Annotations);
        }
   }
}

The code above always results in an empty List. I understand this may be one of the many items in Revit not yet "exposed".

UPDATE: I have been able to find the required ElementId of the embedded FamilyTypes assigned to instances of a family, but ONLY if that embedded type has been used in one of the Parameters in all FamilyInstances of the Family in question. I have been able to use these to enable radio buttons for those particular choices, but I would like to find "possible" parameter values.

  • https://forums.autodesk.com/t5/revit-api-forum/id-of-a-nested-element-in-parameter-reports-different-value/td-p/5738935 – Andy Apr 12 '18 at 07:50

1 Answers1

0

I find your naming a bit confusing, mixing annotations, detail items and family instances seemingly interchangeably. Have you explored your model using RevitLookup or the Revit Python shell? You might be able to see directly what is going on, and why no sub components are being returned.

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
  • I called my FilteredElementCollector "DetailItems" only because I had already used one called "Annotations" elsewhere in my code. I admit it is confusing since the families I am dealing with are annotations. However, since these annotations are FamilyInstances of a particular category, I don't believe I'm mixing those up. I mentioned FamilySymbols because one of the things I tried was to collect FamilySymbols and explore their Parameters (to no avail). As mentioned in my update, I have been able to get "used" ElementId's, but I would like "possible" ones. I have not used Python before. – KeachyPeenReturns Apr 11 '18 at 16:27