Recently spotted something weird from a post on web:
How to programmatically load a new symbol from an existing Family in a Revit project
“You will find that neither of the following overloaded methods will work for you:
public bool Document::LoadFamilySymbol(string filename, string name)
public bool Document::LoadFamilySymbol(string filename, string name, out FamilySymbol symbol)
You will have to use the third version of this overloaded method:”
Not sure what happened or how the guy got the above assertion, but it did not sound right at all to us. It totally contradicted to our coding experiences about the method since it came out. To make things clear, let’s do a tiny experiment.
using (Transaction tran1 = new Transaction(CachedDoc, "LoadFamilySymbolTest1"))
{
tran1.Start();
string libPath = CachedDoc.Application.GetLibraryPaths()["Imperial Library"];
string rfaFullName = Path.Combine(libPath, @"Columns\Wood Timber Column.rfa");
CachedDoc.LoadFamilySymbol(rfaFullName, "6 x 8");
CachedDoc.LoadFamilySymbol(rfaFullName, "8 x 10");
tran1.Commit();
}
Before the code is run, our test Revit model only has a couple of default architectural Rectangular Columns as shown by the following screenshot:
After the code is run, we will find the two column symbols of the Wood Timber Column family are successfully loaded into the current document and are available to use right way as shown clearly again below.
What might be really wrong then?!