For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

STEP to Image(*.jpg etc)

Wi Wi Wi's picture
Forums: 

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.

Wi Wi Wi's picture

STEPControl_Reader reader;
reader.ReadFile("C:\\Documents and Settings\\jing\\Desktop\\test_files\\14101110.stp");
cout Standard_Integer NbTrans = reader.TransferRoots();
cout cout

TopoDS_Shape result = reader.OneShape();//store the translated shape in CADE format in the object called result
i've just looked at the V3d_Dump.. it can save the snapshot. but i don't know where to pass the result(translated CADE format) to the V3d for it to get displayed.
thanks
winthan

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

Wi Wi Wi'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

Wi Wi Wi'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

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.