- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
How to change the current family type in the family manager? I need to do this so I can set a parameter?
I'm trying to write a short, simple macro that runs in the family manager, and copies one family parameter to another family parameter. The family will have various types, so the parameter contents will vary per family type.
I've got the code to read the parameter working correct, but it always writes to the same family type. I assume this is because the "get_Parameter" includes the family type, but the "Set" parameter doesn't seem to include this.
I've seen the example of how to make a new type (in about a dozen places):
FamilyType newFamilyType = familyManager.NewType("2X2");
but no examples at all of how to change the current type.
Here is part of my code:
famMan = doc.FamilyManager;
string types = "Family Types: ";
using (Transaction t = new Transaction(doc))
{
t.Start("Change parameters");
FamilyTypeSet familyTypes = famMan.Types;
FamilyTypeSetIterator familyTypesItor = familyTypes.ForwardIterator();
familyTypesItor.Reset();
while (familyTypesItor.MoveNext())
{
FamilyType familyType = familyTypesItor.Current as FamilyType;
types += "\n" + familyType.Name;
string value = familyType.AsString(famMan.get_Parameter("MANUFACTURER")); /////////THIS WORKS!!!!!!!
TaskDialog.Show ("Revit", value);
FamilyParameter familyParam = famMan.get_Parameter("MANUFACTURER 1");
//FamilyType newFamilyType = famMan.CurrentType(familyType.Name); ?? wont compile - cant be used like a method?
famMan.Set(familyParam, value); //always sets the same type parameter
}
t.Commit();
}
Solved! Go to Solution.