A short and simple question from Nadim on the NewProjectDocument method:
Question: I am using
Document doc = app.NewProjectDocument( string templateFile );
Revit shows that it is loading the template as it does usually when it creates a new document; however, it does not really create the new document.
Any idea why?
Answer: I implemented a sample external command CmdNewProjectDoc to test it for you and it works fine for me:
const string _template_file_path = "C:/Documents and Settings/All Users" + "/Application Data/Autodesk/RAC 2010" + "/Metric Templates/DefaultMetric.rte"; public IExternalCommand.Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements ) { Application app = commandData.Application; Document doc = app.NewProjectDocument( _template_file_path ); doc.SaveAs( "C:/tmp/new_project.rvt" ); return CmdResult.Failed; }
After running the command, the new project file is created and saved in the expected location:
2009-11-23 12:26 2,056,192 new_project.rvt