To add my 2 cents, along with doing what Venu said, you can do a check if the AIS_InteractiveObject is really an AIS_Shape by calling the IsKind method. Like:
This is important because the objects like Trihedron also can be selected by the user and may get into your code where you try to downcast it to an AIS_Shape when it really isn't.
Wed, 04/06/2011 - 15:36
Hi Yeon,
AIS_Shape is derived from AIS_InteractiveObject, so just Downcast AIS_InteractiveObject:
Handle(AIS_Shape) anAISObj = Handle(AIS_Shape)::DownCast(anAIS_InteractiveObj);
Venu
Thu, 04/07/2011 - 13:12
Thanks Venu.
Yeon Cheol
Fri, 04/08/2011 - 03:06
To add my 2 cents, along with doing what Venu said, you can do a check if the AIS_InteractiveObject is really an AIS_Shape by calling the IsKind method. Like:
if(anInteractiveObj->IsKind(STANDARD_TYPE(AIS_Shape)))
{
Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anInteractiveObj);
}
This is important because the objects like Trihedron also can be selected by the user and may get into your code where you try to downcast it to an AIS_Shape when it really isn't.
Fri, 04/08/2011 - 03:20
Thanks Sharjith, learnt something today.
Venu
Fri, 04/08/2011 - 08:46
Thanks Sharjith
very useful information.
Yeon Cheol