Message 1 of 9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Code below doesn't open and activate new family from the standard template despite working fine with .rfa or .rvt files. OpenAndActivateDocument returns null.
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
public class CreateAndActivateNewFamily : IExternalCommand
{
public Result Execute(
ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
// Define the path to the family template
string familyTemplatePath = @"C:\ProgramData\Autodesk\RVT 2024\Family Templates\English\Metric Detail Item.rft";
// Open and activate the new family document
UIDocument uidoc = uiapp.OpenAndActivateDocument(familyTemplatePath);
return Result.Succeeded;
}
}
Solved! Go to Solution.