Hello, i have problem with get model preview image. I used On_WindowsBitmap from openNURBS and his functions Read and Write. But the result is not a picture that i can write as image (Viewer said that its damaged). There is part of my code. Can u advice me please?
maybe someone can help me and show how i can get preview image from model? because i trying solve this problem for about a weak and have just not readable files.
Thanks for your reply!
Yes, i use this code for read file BitmapInfo. Then i try to write image in bmp file with function Write from On_WindowsBitmap. But result is file that cant be read.
I looked in file and did not see “BM” that should be in Bitmap Header. It must be so?
I tried to write it manually but my attempts were unsuccessful.
Hello again, i solved my problem today.
I think I should have said earlier that i working with OSX. May be features of this os did not allow me use default Write from openNURBS.
I wrote own function that writes file pixel by pixel and its working fine now.
I’m no Objective-C expert, but at a glace it looks correct. You might put some error checking in (validate the pointer returned by ON::OpenFile and check the return values of Read3dmThumbnailPreviewImage and ON_WindowsBitmap::Write. You should also add a break point on your code and step into each function to see if it succeeding or not.