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

how to convert from AIS_InteractiveObject to AIS_Shape?

yeon cheol Kang's picture
Forums: 

Hi.

In document, there is no solution and method. So i ask.

There is no way to convert?

Venugopal Gudimetla's picture

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

yeon cheol Kang's picture

Thanks Venu.

Yeon Cheol

Sharjith Naramparambath's picture

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.

Venugopal Gudimetla's picture

Thanks Sharjith, learnt something today.

Venu

yeon cheol Kang's picture

Thanks Sharjith

very useful information.

Yeon Cheol

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.