Document doc = application.Application.OpenDocumentFile(System.IO.Path.Combine(path, name));
FamilyManager fmg = doc.FamilyManager;
using (Transaction remT = new Transaction(doc, "remove"))
{
remT.Start();
try
{
foreach (FamilyType _type in fmg.Types)
{
if (_type.Name == typeold)
{
fmg.RenameCurrentType(typenew);
break;
}
}
remT.Commit();
}
catch (Exception ex)
{
remT.RollBack();
}
}
doc.Save();
doc.Close();