Get the path of stl file open in Rhino

Using a batch file, I am opening a .stl file, but I am looking to read the path to a text panel to enable saving with an edited file name? Does anyone know a method of doing this?

Any help would be greatly appreciated,

Regards,
Kevin

Hi @kevs3dhub,

In your plug-in, create an event watcher that executes in reponese to either a RhinoDoc.BeginOpenDocument or a RhinoDoc.EndOpenDocument event. The handler will be passed a DocumentOpenEventArgs parameter which has a FileName property.

For example, in your plug-in object:

protected override LoadReturnCode OnLoad(ref string errorMessage)
{
  RhinoDoc.EndOpenDocument += OnEndOpenDocument;
  return LoadReturnCode.Success;
}

public void OnEndOpenDocument(object sender, DocumentOpenEventArgs e)
{
  RhinoApp.WriteLine(e.FileName);
}

ā€“ Dale

1 Like

Hi Dale,

I appreciate the help Iā€™ll try that now.

Best regards,
Kevin