STEP to Image(*.jpg etc)

Hi all,
I'm just wondering whether there is a way to take the snapshot of the STEP file and save it as Jpeg or any graphical format via Open Cascade?
Also, it will be helpful if there is a code(or program) to convert STEP to jpeg?
Thanks in advance
winthan

Sharjith Naramparambath's picture

Check out the inport export sample. It demonstrates how to take snapshot using V3d_View::Dump method.

Win Than Aung's picture

STEPControl_Reader reader;
reader.ReadFile("C:\\Documents and Settings\\jing\\Desktop\\test_files\\14101110.stp");
cout<<"Number of roots in STEP file: "<< NbRoots<

Stephane Routelous's picture

another way , if you need only the outlines (wireframe, not shaded) is to use the HLR algorithms which returns you a 2d result.
after that, you can create an image (vectorial or bitmap) and "draw" the lines with MoveTo / LineTo like code

Stephane

Win Than Aung's picture

can u give me more details like which classes and functions to use?
thanks

Stephane Routelous's picture

check the code for the 12_HLR sample (SelectionDialog.cpp .h in 12_HLR folder and ISession2d_Shape.cpp .h in the common folder)
basically, you create a projector (HLRAlgo_Projector) and you are using it with HLRBRep_Algo.

I don't have my example code with me right now, but I can send you an example how to use it next week (If i don't forget ;-) ).

Stephane

Win Than Aung's picture

TopoDS_Shape result = reader.OneShape();
thanks
btw, do you have the sample code for using V3d_Viewer?
I think that way is much easier
cuz i already have the shape object and i just need to find out a way to get it displayed on v3d viewer but i am not seeing any method in v3dview accepts my shape(result) parameter.
thanks
winthan