If my plugin is already running and I am opening a new 3dm file - I can read plugin-related data with ReadDocument Sub.
But if required 3dm file is opened and I start my plugin afterward - how to check if file contains plugin data and if yes - read this data in a similar way as with ReadDocument?
As far as I know, this is not possible to load the data after the file has been opened. What you can do is this:
File3dm f; // you should open the 3dm file that is already opened
foreach (var pd in f.PlugInData)
{
Guid id = pd.PlugInId;
if (id == myPluginId)
{
// alert the user that they should re-open the file now that your plug-in is loaded
}
}
Only in the case where a) the plug-in is not previously known by Rhino and b) gets loaded manually after a file containing data has been loaded do you need to do ask the user to re-load the file. Otherwise, the plug-in is indeed loaded on demand by Rhino.
Thanks,
this, of course, will work but I was just thinking when using SuppressDialogBoxes - saving should take place without extra confirmation. I guess using of RC doesn’t foresee using of Script.