[RhinoCommon] Writing plug-in data to File3dm


(Menno Deij - van Rijswijk) #1

It would be nice if I could write plug-in data directly to a File3dm object. Now I can only remove and read plug-in data in the 3dm file.

Also, it would be nice if you could actually do something with the data read. Now the File3dmPlugInData only contains the plug-in GUID.

A quick scan of ON_BinaryArchive header seems to suggest that the C++ SDK is far more capable here.


(Dale Fugier) #2

Why do you need this? Where, in a 3DM file, where you expect this to be stored?

I guess I need to better understand why attaching user data to an object is not sufficient…


(Menno Deij - van Rijswijk) #3

When our plug-in is loaded, some information on e.g. ship dimensions is written to the 3dm file using the PlugIn.WriteDocument method. When the file is opened next in Rhino, this information is read and is available in a panel, and for a host of commands that depend on it.

Now, I am writing a large set of File3dm files, each containing a variation of the ship geometry. It would be very helpful if I could write the same information to each of the files, so that when such a file is openend in Rhino that the ship dimension data is available.

I expect the data to be stored in the exact same spot that it is stored when written using PlugIn.WriteDocument. In essence, I’m trying to emulate that behaviour.


(Dale Fugier) #4

PlugIn.WriteDocument is called by Rhino when it is ready to write the data, which is when it has finished writing everything else (document user data is written at the end of the 3DM file, along with the data from every other plug-in that writes document data. I don’t see us providing a way for you to write this data yourself. It might be possible for you to write your own version using openNURBS. Might be easier to just batch process all files so your data is written.


(Menno Deij - van Rijswijk) #5

Ok, thanks for your response. I’ll look into rolling my own method of doing this.