Strange behavior when highlighting and selecting a surface in QtViewer

Forums: 

Hello all,

I have observerd a strange behavior in the QtViewer when I move my mouse over some surfaces. The surfaces are created using BRepPrimAPI_MakeRevol, revolving a single edge around the z-axis. I create one surface that is completely parallel to the z-axis, and another where the surface is at a very tiny angle to the z-axis (see the code below).

If I now hover over the two created surfaces, the one at a slight angle shows the expected behavor:When I hover over it with the mouse, it is highlighted and by clicking it I can select it. The other surface however shows a very strange behavior, where I can hover over most of the surface without it beeing highlighted, and only very specific parts of the surface work for highlighting. I have attached a gif showing the behavior.

Does anyone have an idea why this is happening? Looks to me to be a bug, I don't see why the two surfaces should behave so differently.

Thanks in advance!

from OCC.Core.AIS import AIS_Shape
from OCC.Core.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
from OCC.Core.BRepPrimAPI import BRepPrimAPI_MakeRevol
from OCC.Core.GC import GC_MakeSegment
from OCC.Core.gp import gp_Ax1, gp_Dir, gp_Pnt
from OCC.Core.TopoDS import TopoDS_Edge, TopoDS_Face
from OCC.Display.SimpleGui import init_display


def make_face_from_revolution(points: list[tuple[float, float]]) -> TopoDS_Face:

    def create_edge(h1: float, z1: float, h2: float, z2: float) -> TopoDS_Edge:
        p1 = gp_Pnt(0.0, h1, z1)
        p2 = gp_Pnt(0.0, h2, z2)
        segment = GC_MakeSegment(p1, p2)
        return BRepBuilderAPI_MakeEdge(segment.Value()).Edge()

    p1 = points[0]
    p2 = points[1]
    edge = create_edge(p1[0], p1[1], p2[0], p2[1])

    revolve_axis = gp_Ax1(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1))

    return BRepPrimAPI_MakeRevol(edge, revolve_axis).Shape()


display, start_display, add_menu, add_function_to_menu = init_display("pyqt5")

shapes = []

points = [(11.0, 1.0), (11.0, 3.0)]
shapes.append(make_face_from_revolution(points))

points = [(11.0, 6.0), (11.001, 8.0)]
shapes.append(make_face_from_revolution(points))

for shape in shapes:
    display.Context.Display(AIS_Shape(shape), False)
start_display()
Dmitrii Pasukhin's picture

Hello. Could you please check on latest master? https://github.com/Open-Cascade-SAS/OCCT/pull/182 looks like as a related bug. Best regards, Dmitrii.

Nico Krais's picture

Thanks Dmitrii for the quick response, I will test with the current master - looks rather similar!