.step model to .bmp

Hello guys,
I'm trying to make a simple conversion from a model (the dimension z is always very short, so it's like it's 2-dimensional) loaded with opencascade to a simple bitmap. The pixels are either white (nothing, blank) or black (filled, the modell is here). The bitmap is 1024x768 pixels big. What I was suggested is to make an intersection between a small box and the model for each pixel. If the intersection contains something, I write a black pixel, else white pixel. But I believe this will take very long to execute. You guys are brilliant, so do you have any other idea?

Many thanks!
Bernardo

EricThompson's picture

If you have the model showing in a view, you could try

mView->ToPixMap( width, height, planesDepth );

Try setting planesDepth to 1 for a black and white image. ( I've never tried that myself. )

bcarneiro's picture

Hello,

Thanks for the quick reply! This should work, but sadly, I'm using NaroCAD which did not write the wrappers for this class yet. I have noticed that the view has a dump function, that should work, but always when I call dump on a view I don't get any shapes, it's all blank like there's no shape being draw. Any idea why? Thanks A LOT in advance.

Neil Martin's picture

Have you thought about just capturing the view that the model is contained in, I've used the following code in the past to do this:

CSampleViewer3dView* pView;
POSITION pos=GetFirstViewPosition();
pView=(CSampleViewer3dView*)GetNextView(pos);
pView->DrawBitmap ();

where CSampleViewer3dView is the view class that the model is contained in. There's obviously a bit more too it than that but it's not too complicated.

bcarneiro's picture

Hi Neil, thanks for the fast reply!

I only have one view, namely V3d_View. There is no such function as DrawBitmap, am I missing something? I also did not understand why you need the position and GetNextView. Could you please enlighten me? Thanks in advance!

Cheers,
Bernardo

Neil Martin's picture

It has to do with the structure of my program (I have two views) though you should still be able to use it.

Getting the position and then the next view lets the program know where the view you are capturing is on the screen so that it can create the .bmp.

Have a look at the following link, different way from mine but may be of use to you.

http://wiki.forum.nokia.com/index.php/Screen_capture