
Sat, 03/30/2024 - 21:06
Forums:
Hi,
To find shapes under a rectangle area OCC provides "SelectRectangle" function from AISInteractiveContext which accepts pixel(view) coordinates.
Is there any function to use scene coordinates to get shapes instead of pixel coordinates ? also Is it possible to only find the objects instead of selecting the objects under the given area?
Graphic3d_Vec2i thePntMin(pixMinX, pixMinY);
Graphic3d_Vec2i thePntMax(pixMaxX, pixMaxY);
AIS_StatusOfPick pick = aisContext->SelectRectangle (thePntMin,thePntMax, currentView3d);
// Iterate through the selected owners
for (aisContext->InitSelected(); aisContext->MoreSelected();
aisContext->NextSelected())
{
}
Mon, 04/01/2024 - 08:25
To avoid selection of the objects - you may try using
SelectMgr_ViewerSelector::Pick()
directly, instead ofAIS_InteractiveContext::Select()
, which is returned byAIS_InteractiveContext::MainSelector()
.As for picking volume in 3d coordinates - these selection routines were designed for working with active camera, and that's why they deal with pixels, although internally they define volume in 3d space. It would be nice extending this API like
Pick()
method takinggp_Ax1
introduced in OCCT 7.6.0, but for the moment this cannot be done in a straightforward way.Of course, you should be also able to implement necessary logic at application side at expense of building an extra BVH tree (depending on your context).