Hello,
I have the following code invoked from C++ after a user action to load a model into Rhino:
` CRhinoGetFileDialog gf;
gf.SetScriptMode(context.IsInteractive() ? FALSE : TRUE);
bool rc = gf.DisplayFileDialog(CRhinoGetFileDialog::open_dialog, nullptr, RhinoApp().MainWnd());
if (!rc)
{
return CRhinoCommand::cancel;
}
ON_wString filename = gf.FileName();
filename.TrimLeftAndRight();
if (filename.IsEmpty())
{
return CRhinoCommand::nothing;
}
if( !CRhinoFileUtilities::FileExists(filename) )
{
RhinoApp().Print( L"File not found.\n" );
return CRhinoCommand::failure;
}
ON_wString script;
script.Format(L"_-Open “%ls” _Enter", filename);
RhinoApp().RunScript(context.m_doc.RuntimeSerialNumber(), script);`
The model is failing to load, and the output is Rhino is just Command: _Open
, as if the rest of the script (the path to the file to load) is being trimmed and lost somewhere.
What am I missing here?
Thanks