
Sat, 04/02/2022 - 05:55
Forums:
Hi,
I'm trying to make a rubber band selection feature. But I've found a weird situation.
When I drag all shapes in my view, some specific shapes were not selected. It was Cylinder and Cone
Here is my sample test code. I made 5 functions for creating shapes. Box, Sphere, Cylinder, Cone, Torus. Like below..
Handle(AISShape) CreateBox(double width, double height, double length)
{
TopoDS_Shape shape = BRepPrimAPI_MakeBox(width, height, length).Shape();
return new AIS_Shape(shape);
}
Handle(AISShape) CreateSphere(double radius)
{
TopoDS_Shape shape = BRepPrimAPI_MakeSphere(radius).Shape();
return new AIS_Shape(shape);
}
Handle(AISShape) CreateCylinder(double radius, double height)
{
TopoDS_Shape shape = BRepPrimAPI_MakeCylinder(radius, height).Shape();
return new AIS_Shape(shape);
}
Handle(AISShape) CreateCone(double bottomRadius, double topRadius, double height)
{
TopoDS_Shape shape = BRepPrimAPI_MakeCone(bottomRadius, topRadius, height).Shape();
return new AIS_Shape(shape);
}
Handle(AISShape) CreateTorus(double majorRadius, double minorRadius)
{
TopoDS_Shape shape = BRepPrimAPI_MakeTorus(majorRadius, minorRadius).Shape();
return new AIS_Shape(shape);
}
And for testing, I called the below lines. It should select all shapes in the scene.
Graphic3d_Vec2i minPos(-1000000, -1000000);
Graphic3d_Vec2i maxPos(1000000, 1000000);
context->SelectRectangle(minPos, maxPos, view);
But it selects all shapes except Cylinder and Cone !! Box, Sphere, and Torus were selected correctly. Am I doing wrong something? I'm using the OCCT 7.6.1
Sat, 04/02/2022 - 12:41
You code snippet is incomplete. I'm unable to reproduce the problem - cylinder is selected as expected, so maybe your complete scenario has some different elements.