Some interesting settings are stored in and can be modified by editing the Revit ini file Revit.ini
.
Peter @pgerz pointed out yet another possibility in his answer to the Revit API discussion forum thread on adding a project template to 'New Project' via API:
Question: I noticed that the UI method for adding a project template to the 'New Project' dialog on the Start Window is by going to Options > File Locations and clicking the little plus symbol.
Is there any way to achieve this same effect using the API?
I would like to add templates to the dropdown.
Answer: You can do it by editing the ini file with standard .NET functions; it is located at:
In the section [DirectoriesENU]
, modify the setting DefaultTemplate
.
Example:
string oriFile = @"" + Environment.GetEnvironmentVariable( "appdata" ) + @"\Autodesk\Revit\Autodesk Revit 2019\Revit.ini"; string tmpFile = @"c:\temp\11.ini"; if( System.IO.File.Exists( oriFile ) ) { using( StreamReader sr = new StreamReader( oriFile, Encoding.Unicode ) ) { StreamWriter sw = new StreamWriter( tmpFile, false, Encoding.Unicode ); string inputLine = ""; while( ( inputLine = sr.ReadLine() ) != null ) { if( inputLine.StartsWith( "DefaultTemplate=" ) ) { if( inputLine.Contains( "Example_SCHEMA.rte" ) ) { // do nothing } else { inputLine = inputLine + @", Example_SCHEMA=C:\temp\Example_SCHEMA.rte"; } } sw.WriteLine( inputLine ); } sw.Close(); } System.IO.File.Replace( tmpFile, oriFile, null ); }
Many thanks to Peter for this solution!