Read Plugin Data from 3dm File



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?


(Menno Deij - van Rijswijk) #2

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


Hi Menno,

Sounds reasonable. Thanks!

@dale - can you please confirm this?

Kinds regards,


@dale or @stevebaer - can you comment, please?


(Steve Baer) #5

You shouldn’t have to worry about this. Your plug-in will automatically be loaded when Rhino encounters data written by it in the 3dm file.

(Menno Deij - van Rijswijk) #6

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 guys.

Question related to this:
I would like to save current doc.

Dim opts As New FileWriteOptions()
opts.SuppressDialogBoxes = True
RhinoDoc.ActiveDoc.WriteFile(mypath, opts)

But still i need to press Enter before it saves:

Save file name <C:\Users\DSO007\Desktop\curproj.3dm> ( Version=6 SaveSmall=No GeometryOnly=No SaveTextures=Yes SavePlugInData=Yes Browse ):

@menno @stevebaer , what should I add in order to save in absolutelz silent mode/no @Enter@ confirmation?


(Menno Deij - van Rijswijk) #8

Why not script it using RhinoApp.RunScript("_-SaveAs "D:\temp\test.3dm" _EnterEnd");


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.

Just would like to now if it is a Bug or not?

(Dale Fugier) #10

When saving a document, you should script the Save command using RhinoApp.RunScript…


Thanks @dale

And when WriteFile to be used then?


(Dale Fugier) #12

I’m not sure I can tell you - sorry…

(Menno Deij - van Rijswijk) #13

Because 3dm is an open file format, there is the possibility to read/write outside of rhino, when using Rhino3dmIO. That’s when to use WriteFile.


Ok. Clear.
Thanks guys!