Selectable Text in 3D viewer

Hi,

I have some text in a 3D viewer which I want to make pickable.

I overwrote the ComputeSelection method of my text class which is derived from AIS_InteractiveObject. It looks like this (and results in a crash):

void MY_Text::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection, const Standard_Integer unMode) {

Handle(MY_ObjectOwner) anObjectOwner = new MY_ObjectOwner(this,0);

Handle(StdSelect_SensitiveText2d) aSensitiveText2d = new StdSelect_SensitiveText2d(anObjectOwner,MyText,MyX,MyY,MyAngle,MyFontIndex);

aSelection->Add(aSensitiveText2d);

}

Has anybody an idea what I did wrong?

What I wonder about is the following sentence of the file StdSelect_SensitiveText2d.cdl:

class SensitiveText2d from StdSelect inherits SensitiveEntity from Select2D ---Purpose: SensitiveEntity " Text" dedicated to Views from V2d;

Doesn't that mean that selectable texts can only be implemented in 2D viewers?

Thanks in advance

Thomas

Francois Lauzon's picture

> Doesn't that mean that selectable texts can
> only be implemented in 2D viewers?

Hi Thomas, you're right, StdSelect_SensitiveText2d work with 2d text, you have to developp you own Select3D_SensitiveText class the same way the other Select3D Sensitive class are developp (have a look at the source code) and do what you were doing but with you're Select3D_SensitiveText class instead of the StdSelect_SensitiveText2d. Or maybe there is already a sensitive class for 3d text that I don't know of?

Francois.

Thomas Haller's picture

Hi Francois,

Thank you. May be I can use one of the Select3D_Sensitive classes as a basis. What I wonder about is that there are various dimension classes which link a shape with lines and text, but no class that just links a shape with a text alone.

Best regards

Thomas