AIS_ConnectedInteractive problem and a possible solution (TKV3d.dll change)

1) Here is the summary of code used :
aCompoundShape = ImportIges("c\Iges\m01.igs")
myAIS_Shape = new AIS_Shape(aCompoundShape );// aCompoundShape is non null OK

myViewer->Display( myAIS_Shape, Standard_True); // OK
Handle(AIS_ConnectedInteractive) myAIS_TransformedShape= new AIS_ConnectedInteractive();

myAIS_TransformedShape->Connect(myAIS_Shape);// initialization. At this step I dont use Connect(myAIS_Shape, aTopLoc_Location) *(see below) the code

myViewer->Display( myAIS_TransformedShape, Standard_True); // Crash

2) The problem
I was faced to a problem in method below only when aShape = (10Mo) 3d Iges import. It works without any problem for simpler models (3 Mo).
Code was simply crashing because of a Null Handle returned by SE3D->GetConnected(myLocation);
The problem comes perhaps because I dont use method myAIS_TransformedShape->Connect(myAIS_Shape, aTopLoc_Location) in initialization.

3) Correction added in TKV3d. look commented lines

AIS_ConnectedInteractive::ComputeSelection(const Handle(SelectMgr_Selection)& aSel,
const Standard_Integer aMode)

...... around line 164
SNew = SE3D->GetConnected(myLocation); // * result SNew was Null in my case
if(!SNew.IsNull()){ // >>>>> the test I added

With the test added my app doesn't crash and visual result is OK.

Thanks for to add this test in OCC source code in future release if you think it's useful for the community.


Forum supervisor's picture

Hello Philippe,

Thank you for reporting this problem and suggesting the fix.
We have added the comments about the proposed fix to the already existing improvement OCC12121 that concerns optimization of selection classes.
Please refer to the Release Notes page for any news about this improvement.

Best regards,
Forum supervisor

P Dolbey's picture