【发布时间】:2018-09-20 13:10:17
【问题描述】:
我正在尝试以编程方式更改映射到族内参数的 FamilyType(特别是创建焊接注释的参数)。在这种情况下,所讨论的 FamilyType(s) 仅在族内部,因此搜索匹配的 FamilyInstance 或 FamilySymbol 不适用(也不起作用,因为我尝试过——这些嵌入的族不会出现在浏览器中)。这些 FamilyType(s) 也不会使用 GetSubComponentIds 出现 - 父焊接族报告没有子组件。搜索该参数的“ParameterType”会返回“FamilyType”,但如果找不到 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);
}
}
}
上面的代码总是产生一个空列表。我知道这可能是 Revit 中尚未“公开”的众多项目之一。
更新:我已经能够找到分配给族实例的嵌入式 FamilyTypes 所需的 ElementId,但前提是该嵌入式类型已在相关族的所有 FamilyInstances 的参数之一中使用。我已经能够使用这些来启用这些特定选项的单选按钮,但我想找到“可能的”参数值。
【问题讨论】: