Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have been struggling for a while trying to add material to a Family. It seems strange that such a basic requirement is so difficult to implement.
I've tried most examples which I could find. The BuildingCoder samples were not helpful either.
Could anybody help me with this?
I generate a Family and am able to generate FamilyInstances of that Family. However, when I add the "Material" Parameter using AddParameter, I can no longer Access the Family using either Util.FindFamilySymbol or doc.LoadFamily(fileName, out Family). It seems as if adding a Parameter somehow invalidates that Family.
FamilyManager fm = doc.FamilyManager; FamilyParameter fparam = fm.get_Parameter("Material"); bool canAssign = fm.IsUserAssignableParameterGroup(BuiltInParameterGroup.PG_MATERIALS); if (fparam == null) oFamParam = fm.AddParameter("Material", BuiltInParameterGroup.PG_MATERIALS, ParameterType.Material, true); if (material != null) { if (doc.FamilyManager.Types.Size == 0) ft = doc.FamilyManager.NewType("Type 1"); fm.CurrentType = ft; fm.Set(oFamParam, material.Id); }
dirk
Solved! Go to Solution.