mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-26 01:10:36 +05:00
Fix regression in KindOfShape functionality - sphere imported from SolidWorks's STEP file is not recognized as sphere
This commit is contained in:
parent
c38fbe7a1c
commit
faf08d0c52
35
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx
Normal file → Executable file
35
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx
Normal file → Executable file
@ -85,6 +85,17 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
//modified by NIZNHY-PKV Tue Jun 09 08:35:23 2015f
|
||||||
|
if (aNbF==2) {
|
||||||
|
// case requested by the customer
|
||||||
|
// specific solid that should be treated as a sphere
|
||||||
|
bIsStepSphere=TreatStepSphere(aSd);
|
||||||
|
if (bIsStepSphere) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//modified by NIZNHY-PKV Tue Jun 09 08:35:28 2015t
|
||||||
|
//
|
||||||
aKD=GEOMAlgo_KD_SPECIFIED;
|
aKD=GEOMAlgo_KD_SPECIFIED;
|
||||||
for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) {
|
for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) {
|
||||||
const TopoDS_Shape& aF=aMF(i);
|
const TopoDS_Shape& aF=aMF(i);
|
||||||
@ -120,6 +131,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//modified by NIZNHY-PKV Tue Jun 09 08:36:08 2015f
|
||||||
|
/*
|
||||||
else if (aNbF==2) {
|
else if (aNbF==2) {
|
||||||
// specific solid that should be treated as a sphere
|
// specific solid that should be treated as a sphere
|
||||||
bIsStepSphere=TreatStepSphere(aSd);
|
bIsStepSphere=TreatStepSphere(aSd);
|
||||||
@ -127,6 +140,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
//modified by NIZNHY-PKV Tue Jun 09 08:36:12 2015t
|
||||||
//
|
//
|
||||||
aNbCyl=0;
|
aNbCyl=0;
|
||||||
aNbCon=0;
|
aNbCon=0;
|
||||||
@ -780,7 +795,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
|
|||||||
{
|
{
|
||||||
Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
|
Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
|
||||||
Standard_Integer j;
|
Standard_Integer j;
|
||||||
Standard_Real aTolAng, aTolLin;
|
Standard_Real aTolAng, aTol;
|
||||||
Standard_Real aVolume, aVolumeS, dV, aArea, aAreaS, dA;
|
Standard_Real aVolume, aVolumeS, dV, aArea, aAreaS, dA;
|
||||||
gp_Sphere aSphere[2];
|
gp_Sphere aSphere[2];
|
||||||
GeomAbs_SurfaceType aST;
|
GeomAbs_SurfaceType aST;
|
||||||
@ -789,7 +804,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
|
|||||||
TopExp_Explorer aExp;
|
TopExp_Explorer aExp;
|
||||||
//
|
//
|
||||||
bRet=Standard_False;
|
bRet=Standard_False;
|
||||||
aTolLin=Precision::Confusion();
|
aTol=Precision::Confusion();
|
||||||
aTolAng=Precision::Angular();
|
aTolAng=Precision::Angular();
|
||||||
//
|
//
|
||||||
aExp.Init(aSd, TopAbs_FACE);
|
aExp.Init(aSd, TopAbs_FACE);
|
||||||
@ -810,7 +825,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
|
|||||||
aSphere[j]=aGAS.Sphere();
|
aSphere[j]=aGAS.Sphere();
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
bIsEqual=IsEqual(aSphere[0], aSphere[1], aTolLin);
|
bIsEqual=IsEqual(aSphere[0], aSphere[1], aTol);
|
||||||
if (!bIsEqual) {
|
if (!bIsEqual) {
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
@ -822,24 +837,30 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
|
|||||||
//
|
//
|
||||||
aVolume=aSphere[0].Volume();
|
aVolume=aSphere[0].Volume();
|
||||||
//
|
//
|
||||||
BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed);
|
//modified by NIZNHY-PKV Tue Jun 09 08:39:47 2015f
|
||||||
|
BRepGProp::VolumeProperties(aSd, aGProps, aTol, bOnlyClosed);
|
||||||
|
//BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed);
|
||||||
|
//modified by NIZNHY-PKV Tue Jun 09 08:39:50 2015t
|
||||||
aVolumeS=aGProps.Mass();
|
aVolumeS=aGProps.Mass();
|
||||||
if (aVolumeS<0.) {
|
if (aVolumeS<0.) {
|
||||||
aVolumeS=-aVolumeS;
|
aVolumeS=-aVolumeS;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
dV=fabs(aVolumeS-aVolume);
|
dV=fabs(aVolumeS-aVolume);
|
||||||
if (dV>aTolLin) {
|
if (dV>aTol) {
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
//--------------------------------
|
//--------------------------------
|
||||||
aArea=aSphere[0].Area();
|
aArea=aSphere[0].Area();
|
||||||
//
|
//
|
||||||
BRepGProp::SurfaceProperties(aSd, aGProps);
|
//modified by NIZNHY-PKV Tue Jun 09 08:23:54 2015f
|
||||||
|
BRepGProp::SurfaceProperties(aSd, aGProps, aTol);
|
||||||
|
//BRepGProp::SurfaceProperties(aSd, aGProps);
|
||||||
|
//modified by NIZNHY-PKV Tue Jun 09 08:23:56 2015t
|
||||||
aAreaS=aGProps.Mass();
|
aAreaS=aGProps.Mass();
|
||||||
//
|
//
|
||||||
dA=fabs(aAreaS-aArea);
|
dA=fabs(aAreaS-aArea);
|
||||||
if (dA>aTolLin) {
|
if (dA>aTol) {
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
Loading…
Reference in New Issue
Block a user