FileSettings.TemplateFile Property help

Hi,
Is it possible to use this property to set the default template from a plugin on_load?

Could I get an example of this?

Hi @CassieConti,

Yes it is.

Perhaps something like this?

protected override LoadReturnCode OnLoad(ref string message)
{
  var pluginLocation = Assembly.GetExecutingAssembly().Location;
  var pluginFolder = Path.GetDirectoryName(pluginLocation);
  var pluginTemplate = Path.Combine(pluginFolder, "MyTemplateFile.3dm");
  if (File.Exists(pluginTemplate))
  {
    var rhinoTemplate = Rhino.ApplicationSettings.FileSettings.TemplateFile;
    if (!rhinoTemplate.Equals(pluginTemplate))
      Rhino.ApplicationSettings.FileSettings.TemplateFile = pluginTemplate;
  }
  return LoadReturnCode.Success;
}

– Dale

1 Like

Hi @dale,
Works great on its own, but how can I can’t figure out how to combine it with your .RUI
replacement script?

…got it

is it also possible to add display modes and aliases from the plugin?

Use DisplayModeDescription.ImportFromFile.

Use CommandAliasList.

– Dale

1 Like