Help with Visualization

Could you please tell me how to visualize a simple solid in Opencascade?
I looked at the documentation but it was not very helpful..
Actually I want to know,
-what projects (TK*** projects) to add to my current project?
-what header files to include?
-and a sample to code (with all the methods) to just visualize a simple solid (TopoDS_Shape)?

Thanks

Franz Engel's picture

I think QTOCC is a good point to begin learning: http://qtocc.sourceforge.net/. I start with a similary project but I can't find it.

JuryS's picture

You are need previous version of OCC like 6.3.
Make install and see the samples.

Forum supervisor's picture

Dear Ata,
I think it would be useful for you to become familiar with OCCT "Visualization User's Guide".
Besides you may found good working examples in OCCT samples (for example: ImportExport sample and Viewer3d sample), which cover all questions mentioned by you.
Regards

AP's picture

Ata

Granted you already have modelled the solid and have it as a TopoDS_Shape, check the Make Bottle tutorial:

TopoDS_Shape mysolid = "put solid here";

// Create the OCC Viewers
TCollection_ExtendedString a3DName( "Visual3D" );
Handle(V3d_Viewer) myViewer = createViewer( "DISPLAY", a3DName.ToExtString(), "", 1000.0 );
myViewer->Init();
myViewer->SetZBufferManagment( Standard_False );
myViewer->SetDefaultViewProj( V3d_Zpos ); // Top view

Handle_AIS_InteractiveContext ic = new AIS_InteractiveContext( myViewer );
ic->SetDisplayMode( AIS_Shaded );
Handle_AIS_Shape anAIS=new AIS_Shape(aShape);
ic->SetMaterial(anAIS,Graphic3d_NOM_PEWTER);
ic->SetColor(anAIS, Quantity_NOC_BLACK);
ic->SetDisplayMode(anAIS,1,Standard_False);

//**************************************************************************************************************

in terms of header files, for any class or type you use in the code you will need to include it at the top some thing like

#include

if the class uses the Handle() macro, that is simply a short way of writing Handle_Classname

so for instance if you use Handle(V3d_Viewer) in the code then you need to add :
#include
sometimes you dont need to include the handle just the class: #include

at the top of the file.

//***************************************

in terms of the Libs, if youre using visual studio , you will need to go to the project properties and go to linker, in additional directories, add the opencascade6.3.0/ros/bin folder
and in the inputs list, just as a starter add all the files you find in the folder.
after you learn how to work with it then worry about optmizing your code.

the input list should look some thing like:

BinLPlugin.lib
BinPlugin.lib
BinXCAFPlugin.lib
FWOSPlugin.lib
gdi32.lib
glu32.lib
opengl32.lib
PTKernel.lib
QtCore4.lib
QtGui4.lib
QAxServer.lib
QAxContainer.lib
qtmaind.lib
StdLPlugin.lib
StdPlugin.lib
TKAdvTools.lib
TKBin.lib
TKBinL.lib
TKBinXCAF.lib
TKBO.lib
TKBool.lib
TKBRep.lib
TKCAF.lib
TKCDF.lib
TKernel.lib
TKFeat.lib
TKFillet.lib
TKG2d.lib
TKG3d.lib
TKGeomAlgo.lib
TKGeomBase.lib
TKHLR.lib
TKIGES.lib
TKLCAF.lib
TKMath.lib
TKMesh.lib
TKMeshVS.lib
TKNIS.lib
TKOffset.lib
TKOpenGl.lib
TKPCAF.lib
TKPLCAF.lib
TKPrim.lib
TKPShape.lib
TKService.lib
TKShapeSchema.lib
TKShHealing.lib
TKStdLSchema.lib
TKStdSchema.lib
TKSTEP.lib
TKSTEP209.lib
TKSTEPAttr.lib
TKSTEPBase.lib
TKSTL.lib
TKTopAlgo.lib
TKV2d.lib
TKV3d.lib
TKVRML.lib
TKXCAF.lib
TKXCAFSchema.lib
TKXDEIGES.lib
TKXDESTEP.lib
TKXml.lib
TKXmlL.lib
TKXmlXCAF.lib
TKXSBase.lib
TKXSDRAW.lib
user32.lib
XCAFPlugin.lib
XmlLPlugin.lib
XmlPlugin.lib
XmlXCAFPlugin.lib

Best,

AlexP

AP's picture

change the line :

Handle_AIS_Shape anAIS=new AIS_Shape(aShape);

with:

Handle_AIS_Shape anAIS=new AIS_Shape(mysolid);

ataeft's picture

Thanks, I did all these, but still I got this error -> error C3861: 'createViewer': identifier not found

I'm using visual studio 2008