Hi;
I want to get the Instance Definition from the other rhino file, use the following code, I already have a brep,how cant I change the brep to Instance Definition or is it any way to get Instance Definition the direct?
ON_wString filename = "E:\\Test.3dm";
filename.TrimLeftAndRight();
FILE* archive_fp = ON::OpenFile(filename, L"rb");
if (0 == archive_fp)
{
return 0;
}
ON_BinaryFile archive(ON::read3dm, archive_fp);
ONX_Model model;
bool rc = model.Read(archive) ? TRUE : FALSE;
ON::CloseFile( archive_fp );
if (!rc)
{
return 0;
}
int num_imported = 0;
const ON_Brep* brep;
for (int i = 0; i < model.m_object_table.Count(); i++)
{
const ONX_Model_Object& model_object = model.m_object_table[i];
brep = ON_Brep::Cast(model_object.m_object);
if (0 != brep)
{
num_imported++;
}
}
if (0 == num_imported)
{
return 0;
}
else
{
return 1;
}