Hello
I know that other people posted here the same problem around 2016, but I don’t saw the solution for this problem.
I’m trying extract a bmp preview image from a 3dm file and save in a new bmp file. The program open 3dm, read properties , get ON_WindowsBitmap and save the bmp file, this is correct because I already tracked the code.
The problem is, I can’t open the bmp file saved with any other program because all programs tell me that the file is not a bmp file.
The code is the same that I saw here in this FORUM.
FILE* archive_fp = ON::OpenFile(filename, L"rb");
if (0 == archive_fp)
return false;
ON_BinaryFile archive(ON::archive_mode::read3dm, archive_fp);
int file_version = 0;
ON_String strComments;
if (!archive.Read3dmStartSection(&file_version, strComments))
{
ON::CloseFile(archive_fp);
return false;
}
ON_3dmProperties properties;
if (!archive.Read3dmProperties(properties))
{
ON::CloseFile(archive_fp);
return false;
}
ON::CloseFile(archive_fp);
if (!properties.m_PreviewImage.IsValid())
return false;
bitmap = properties.m_PreviewImage;
FILE *fp = ON::OpenFile("c:\\teste.bmp", "wb");
ON_BinaryFile file(ON::archive_mode::write, fp);
bitmap.Write(file);
ON::CloseFile(fp);
Does anyone know what’s going on ??
Thank you
Nairon