text display

I am working on this code from tutorials to visulize some 3d text:

// get the group
Handle (Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (aPrs);
// change the text aspect
Handle(Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d ();
aTextAspect->SetTextZoomable (Standard_True);
aTextAspect->SetTextAngle (45.0);
aGroup->SetPrimitivesAspect (aTextAspect);
// add a text primitive to the structure
Graphic3d_Vertex aPoint (1, 1, 1);
aGroup->Text (Standard_CString (“Text”), aPoint, 16.0);
/////////////////////////////////////

The code doesnt compile:
error C2275: 'Graphic3d_Group' : illegal use of this type as an expression

I have problem determening which includes are correct:

#include
#include

/*
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include

# include

# include
# include
# include
# include
# include
# include
# include
# include
# include
*/
i get some compile errors if I add all of them.
Thanks

Alexander Schneller's picture

Hi miha,

i think for this code you only need following includes:

#include
#include
#include
#include
#include
#include
#include

I'm not shure, but you shouldn't include files like # include only in this way #include , without "Handle_". If you look at the Standard_Macro.hxx file you will find this define,
# define Handle(ClassName) Handle_##ClassName
as you can see it's not necessary to include this files.

Have a look at the fcug.pdf in the /doc directory of opencascade:
"For every class derived (directly or indirectly) from Transient, CDL extractor creates associated class Handle() whose name is the same as the name of that class prefixed by “Handle_”. Open CASCADE provides pre-processor macro Handle() that produces a name of a Handle() class for a given transient class name." [fcug.pdf page 19]

Regards
Alex

pazduha's picture

Thanks for reply!

I find it very hard as a beginer to include the code above to the code that already displays some shapes. This is the function that draws shapes and I also want it to draw text:

/////////////////////
void
MakeMeshStructure(MeshStructureLayers layers,
Handle_AIS_InteractiveContext theContext,
Handle_TDocStd_Document aDoc,
MyMesh & mesh,
int detail_vertex,
double insulation_thickness,
OpenMesh::VPropHandleT _max_beam_offset,
double podatki[20])

{
///////////////////////
this is how it gets called from the mainwindow.cc:

///////////////////////

MeshStructure1::MakeMeshStructure(layers,
myCadFrame->getWidget()->getContext(),
myController->getDocument()->getOcafDoc(),
mesh,
detail_vertex,
toolBox->insulation_thickness_SpinBox->value(),
max_beam_offset_);

//////////////////////