i store plugin specific data in a document via the CRhinoPlugIn::WriteDocument event which works fine within the plugin.
Now i have a situation where i want to read the 3dm file without opening it and i use at the moment following code:
FILE* archive_fp = ON::OpenFile(file3dm, L"rb");
if (0 == archive_fp)
ON_BinaryFile archive(ON::archive_mode::read3dm, archive_fp);
ONX_Model model;
bool rc = model.Read(archive);
ON::CloseFile(archive_fp);
for (int i = 0; i < onxModel.m_object_table.Count(); i++)
{
const ONX_Model_Object& model_obj = onxModel.m_object_table[i];
...
}
onxModel.Destroy();
Is it possible to get the document data which was written with CRhinoPlugIn::WriteDocument also with ONX_Model?
Attached is a sample that demonstrates how to read a plug-in’s document user data from 3dm files without the use of Rhino. The sample comes in the form of a plug-in project that writes document data when you have a file. To read the document data, just run the command. The code in the command, however, only requires openNURBS.
The code works Rhino/openNURBS 6. My guess is there some minor refactoring to get this to work with Rhino/openNURBS 5.
thank you for this sample it helped me again to solve my problem .
Even though i had to change some details, not only because of Rhino V5/V6 differences, also because i do not use BeginWrite3dmChunk / BeginRead3dmChunk to write my user defined data.