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

Release Build Selection/Highlight Only Works over Origin (Debug Works) OCC 7.3.0

Matthew Johnson's picture
Forums: 

Hi all Matthew here, first post, and I'm looking for any input regarding the following issue:

First let me note that everything works in Debug as expected on multiple machines.  However, when building Release x64 on VS 2017, I am unable to highlight or select displayed objects in any way EXCEPT for in the following two conditions:

1)When the object is layered over (0,0,0)(origin point).   
 2)When mouse drag and select includes the origin point then anything else in the mouse selection box is selected as expected.

Additional Notes:
1) The code in question works in Debug on multiple machines, does not work in Release on multiple machines.
2) The Select event is fired, but when not layered over the origin the object/s will not  highlight or count as selected.
3) On Click and Drag the Select event is fired and again the objects will not highlight or count as selected unless including origin.

4) Mouse Input to the Select method is consistent across Debug/Release.
5) Changing SelectionMode will change the type: vertex, surface, etc.. highlighted but still requires inclusion of the origin point.
6) Tested in multiple different software functionality settings (Import, Designer, etc..)with the same result. 
7) Issue occurs with different display types: vertex, edge, solid.

Example of basic STEP Import code that fails to Select/Hilight:

void BTInteractiveContext::ReadFileDisplaySolids(const char * filePath)
{
    STEPControl_Reader aReader;
    aReader.ReadFile(filePath);
    aReader.TransferRoots();
   
   for (TopExp_Explorer explorer(aReader.OneShape(), TopAbs_SOLID); explorer.More(); explorer.Next())
   {
       Handle(AIS_Shape) aisShape = new AIS_Shape(explorer.Current());
       aisShape->SetColor(defaultColor);
       AISContext->Display(aisShape, Standard_False);
   }
   AISContext->UpdateCurrentViewer();
}

Images:

Matthew Johnson's picture

Here are some additional things I tested in AIS_InteractiveContext.  I'm going to look at V3d_view and v3d_viewer soon as well.

Some Effect
 1) AIS_InteractiveContext - SetAutoActivateSelection()
  - False(Disables as expected, including disables the origin point)
  - True (Enables but ONLY over origin point)
 2) Deactivate() - Disables as expected, including the origin opint
 2) DisplayActiveSensitive() Shows all relevant surfaces with a green mesh.

No Noticeable Effect
 1) Depth Fit and Z Fit - No effect.
 2) Displayed Count, does count the objects that are not selectable.
  - Counting using AIS_ListOfInteractive.
 3) DisplayAll(Standard_True) called last, no change.
 4) RebuildSelectionStructs() - No effect.
 5) SetZLayer: Graphic3d_ZLayerId_Topmost (No Effect)
 6) SetZLayer: Graphic3d_ZLayerId_Default (No Effect)
 7) SetDisplayPriority to -1 (No Effect)
 8) SetDisplayPriority to 100 (No Effect)
 9) Display Mode AIS_WIRED/AIS_SHADED (No Effect)
 10) Tried Selection Modes: 0, 1, 2, 3, 4, 5
 11) Activate(handle, 0, Standard_True) and Activate(0, Standard_True)

Matthew Johnson's picture

I'm not sure if this will prove useful to anyone with more knowledge of the codebase but I'm finding the deviation between Release and Debug to be:

In the function,  { void SelectMgr_ViewerSelector::TraverseSensitives() } line 570.

const opencascade::handle<BVH_Tree<Standard_Real, 3> >& aBVHTree = mySelectableObjects.BVH (aBVHSubset);

    Standard_Integer aNode = 0;
    if (!aMgr.Overlaps (aBVHTree->MinPoint (0), aBVHTree->MaxPoint (0)))
    {
      continue;
    }

    Standard_Integer aStack[BVH_Constants_MaxTreeDepth];
    Standard_Integer aHead = -1;
    for (;;)
    {
      if (!aBVHTree->IsOuter (aNode))
      {

The Bounding Volume Hierarchy is not outer check (!aBVHTree->IsOuter (aNode)) is always 'true' in Release EXCEPT over origin where as in Debug it is false anytime the cursor is over a selectable object.

Kirill Gavrilov's picture

First let me note that everything works in Debug as expected on multiple machines.
However, when building Release x64 on VS 2017

I believe that you should report this issue on Microsoft channels to fix the bug(s) in Visual Studio compilers.
And it would be helpful to others if you'll share exact version of VS2017 Update you are currently using, since this might come with some update or may be already fixed with some update.

Of course, the issue might be also somewhere in your code (memory corruption, etc.), but from current quotation it is not identifiable.

Matthew Johnson's picture

Hi Kirill,

I appreciate your input.

This morning we found that building the TKV3D project in Release x64 with /O2 or /Ox (Speed optimization flags) caused the inability to Highlight or Select any point outside of origin.  Building with the /O1 (Size optimization flag) worked as expected.

Internally we are using:
Visual Studio 2017 Versions: 15.8.7 and 15.8.8.

I will create a sample project to replicate the error and if the problem persists I will report it to Microsoft VC++ compiler team ASAP.  If you believe there is an error in our code that could cause this exact issue please let me know.

Thanks and best,
~Matt