@TripleM-Dev.net
I did not experience this. I did something dumb recently... I purged a couple of my container files containing hundreds of families... Lost all my types. Families in the library still had all the types. I caught this way too late to be able to use backups without paranoia.
So, I figured a simple reload all families would fix it... but it did not. I used the following code:
// Edit the family document to get the file path
Document familyDoc = doc.EditFamily(family);
string familyPath = familyDoc.PathName;
report.AppendLine("\n\nFamily path: " + familyPath);
familyDoc.Close(false);
if (!string.IsNullOrEmpty(familyPath) && File.Exists(familyPath))
{
string originalFamilyName = family.Name;
report.AppendLine("\n\nAttempting to reload family from: " + familyPath);
// Reload family from the file path
using (Transaction trans = new Transaction(doc, "\n\nReload Family - " + originalFamilyName))
{
trans.Start();
if (doc.LoadFamily(familyPath, new FamilyOption(), out Family reloadedFamily))
{
report.AppendLine("\n\nSuccessfully reloaded family: " + originalFamilyName);
counterReloaded++;
}
else
{
report.AppendLine("\n\nFailed to reload family: " + originalFamilyName);
}
trans.Commit();
}
}
else
{
report.AppendLine("\n\nFailed to reload " + family.Name + ". Path not found or invalid: " + familyPath);
}
What I ended up doing, is modify Cost parameter in every family in the library, save it, and then set the Cost parameter to 0, and save it again (using Revit API lol... not sure if all the extra saving was necessary but I did not want to take chances or spend more time experimenting). Cost is a parameter we never use so it is a safe modification. After this, the above Revit API code to reload families worked and brought all the types to my container files. This is fresh off the press as I just finished doing this about an hour ago in Revit 2023...