
Mon, 05/29/2023 - 15:43
Hello,
We encountered a problem while developing the OCCT program that we're unable to select the step model surface at mouse point position.Sometimes we did not select the surface where the mouse point was located, but the back of the step model.
1. Here's the codes to import step model;
void OCCFeature::ImportStepFile(const char* fileName)
{
STEPControl_Reader aReader_Step;
aReader_Step.ReadFile(fileName);
aReader_Step.PrintCheckLoad(Standard_False, IFSelect_ItemsByEntity);
aReader_Step.TransferRoots();
TopoDS_Shape aShape = aReader_Step.OneShape();
Handle(AIS_Shape) aisShape = new AIS_Shape(aShape);
aisShape->SetColor(Quantity_NOC_GRAY);
this->Context->Display(aisShape, false);
this->Context->Activate(aisShape, AIS_Shape::SelectionMode(TopAbs_FACE));
this->View->FitAll();
}
2. Here's the codes to HighLight;
this->Context->MoveTo(x, y, this->View, true);
3. Here's the codes to Select;
this->Context->SelectDetected();
this->Context->UpdateCurrentViewer();
Mon, 05/29/2023 - 17:25
Could you share the model reproducing issue?
Tue, 05/30/2023 - 04:21
Sure. Please change the file suffix name from .info to .step, because we are unable to upload the .step file.
Tue, 05/30/2023 - 07:34
Indeed, you have stepped into the bug:
The issue occur on
Select3D_SensitiveCylinder
(entity for picking cylindrical surfaces, which is new in OCCT 7.7 #0032547). Maybe you may try reporting a bug on Bugtracker.Mon, 06/12/2023 - 05:14
In the function GetSensitiveForFace in the file StdSelect_BRepSelectionTool.cxx, if the following codes are commented out, for a body of revolution generated by rotating one polygon, the selection operation can be finished correctly.
else if (Handle(Geom_CylindricalSurface) aGeomCyl = Handle(Geom_CylindricalSurface)::DownCast (aSurf))
{
const gp_Cylinder aCyl = BRepAdaptor_Surface (theFace).Cylinder();
gp_Ax3 aPos = aCyl.Position();
gp_Dir aDirection = aPos.Direction();
if (isCylinderOrCone (theFace, aPos.Location(), aDirection))
{
const Standard_Real aRad = aCyl.Radius();
const Standard_Real aHeight = getCylinderHeight (aTriangulation, aLoc);
gp_Trsf aTrsf;
aPos.SetDirection (aDirection);
aTrsf.SetTransformation (aPos, gp::XOY());
Handle(Select3D_SensitiveCylinder) aSensSCyl = new Select3D_SensitiveCylinder (theOwner, aRad, aRad, aHeight, aTrsf, true);
theSensitiveList.Append (aSensSCyl);
return Standard_True;
}
}