Select returning incorrect shapes AIS.InteractiveContext

Using  python-occ.

If I have multiple AIS_Shapes sharing the same TShape then selecting an object in visualisation returns all objects sharing the TShape which makes it impossible to correctly obtain the correct selected shape.

i.e. behaves like it is returning all IsPartner() objects instead of IsSame().

Even more perplexing if you have:

obj = someAIS_Shape()

context.Display(obj.GetHandle())

select shape  and  compare returned "shape" from the selection

 obj.isSame(shape)

Fails.

The issue is in the location not passing == test.

When you examine the complete Location data (complete iteration data, power, gp_Trsf etc)  both objects it appears identical!

Partial workaround for moment is to not share TShape handle which is inefficient.

 

Forum supervisor's picture

Dear Tarek,

For compatibility OCCT keeps a part of initial AIS API for asking interactive context to return detected TopoDS_Shape.

You should use API returning detected interactive object (AIS_Shape here should hold original TopoDS_Shape unmodified by locations or so on), selection owner (for handling local selection results) and use other means of object identification when necessary (e.g. custom owner object passed to interactive object using SetOwner()).

Specific issues can be related to either python-occ or existing implementation of AIS_InteractiveContext.

In the case of OCCT related issue I would suggested you to register the issue (with the complete test case and data) in OCCT Mantis Bugtracker which is available via the Collaborative portal - http://dev.opencascade.org/index.php?q=home/get_involved.

If the problem is urgent you may contact us via the Contact Form.

We will try to find a solution/workaround acceptable for you.

--

Best regards,

FSR