Read 3dm file object count problem



Hi to all,

I have one simple 3dm model (in addition). When I use List command I detect 6 surface = 1 brep. When I read the same model using ON_BinaryFile archive(ON::read3dm, fileName) I detect that archive gives me 2 objects in m_object_table (count is 2) which means that I can get 2 equal breps. Can you please tell me what can be problem here? Is it problem with 3dm model or problem with ON_BinaryFile? Can you please share some advice how can I protect from this kind of errors?

In addition here is my code for checking:

const wchar_t* file = L"BadPart.3dm";
FILE* archive_fp = ON::OpenFile(file,L"rb");
ON_BinaryFile archive(ON::read3dm, archive_fp);
ONX_Model model;
bool result = model.Read(archive, &error_log);
int objectCount = model.m_object_table.Count(); // object count = 2

Thanks a lot,
Best regards,

BadPart.3dm (53.2 KB)

(Dale Fugier) #2

Hi Iv,

In addition to the Brep, that you can see, the model also contains a block definition (MP-DTH-2091111) that you can see using the BlockManager command. You can get rid of unused block definitions using the Purge command.

– Dale


Yes I saw block definition with BlockManager command as you mention and when I delete block definition there was only one brep…

Thanks a lot Dale