Hello!
I work at a company that uses different versions of Rhino.
Rhino 5 is used for machine tools (CNC) and Rhino 5 or 7 for modeling.
I wrote a small script to save a version 5 when the document is saved in Rhino 7.
For those who are interested:
using System;
using System.Runtime.InteropServices;
using System.IO;
using Rhino;
using Rhino.PlugIns;
public class RhinoPlugIn : PlugIn
{
public override PlugInLoadTime LoadTime => PlugInLoadTime.AtStartup;
public RhinoPlugIn ()
{
RhinoDoc.EndSaveDocument += RhinoDoc_EndSaveDocument;
}
bool _islock;
private void RhinoDoc_EndSaveDocument (object sender, DocumentSaveEventArgs e)
{
// Recurrence due to _SaveVersion5
if (_islock) return;
_islock = true;
var extension = Path.GetExtension (e.FileName);
if (extension != ".3dm") return;
var filename = Path.ChangeExtension (e.FileName, " (V5).3dm");
var cmd = "-_SaveAs _Version=5 \"" + filename + "\"";
// Executes the second save command after saving the file
// Other methods do not work. Call `RhinoApp.RunScript` directly here or use `RhinoApp.InvokeOnUiThread`
RhinoApp.Idle += _SaveVersion5;
void _SaveVersion5 (object sender, EventArgs e) {
RhinoApp.Idle -= _SaveVersion5;
RhinoApp.RunScript (cmd, echo: true);
_islock = false;
}
}
}
Now I would like to know if there is a possibility for Windows to open version 5 of the file with Rhino 5 and version 7 with Rhino 7?
I tried changing the version 5 file extension to “.3dm5” and then setting the default app for that file type.
Unfortunately, there are 2 big problems.
- Rhino 5 does not want to open the file it indicates a dialog box
File not managed by Rhino
- File explorer can no longer display previews and notes, which is essential especially when searching for files from a project done last month or done by someone else.
I also imagined writing a standalone application to open all .3dm
files, use rhino3dm
to read File3dm.ApplicationName
and then launch the corresponding application. again I would lose the previews of the file, which will not be accepted.
Does anyone have a solution or a way forward?
merci,
jmv