mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-14 08:31:34 +05:00
Mantis issue 0020952: EDF 1505 GEOM: The type of the geometrical primitives from .step files
This commit is contained in:
parent
5d094b2282
commit
b659aaf41b
@ -18,11 +18,10 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOMAlgo_KindOfShape_HeaderFile
|
||||
#define _GEOMAlgo_KindOfShape_HeaderFile
|
||||
|
||||
|
||||
enum GEOMAlgo_KindOfShape {
|
||||
GEOMAlgo_KS_UNKNOWN,
|
||||
GEOMAlgo_KS_SPHERE,
|
||||
@ -34,7 +33,10 @@ GEOMAlgo_KS_ELLIPSE,
|
||||
GEOMAlgo_KS_PLANE,
|
||||
GEOMAlgo_KS_CIRCLE,
|
||||
GEOMAlgo_KS_LINE,
|
||||
GEOMAlgo_KS_DEGENERATED
|
||||
GEOMAlgo_KS_DEGENERATED,
|
||||
//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f
|
||||
GEOMAlgo_KS_BSPLINE
|
||||
//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t
|
||||
};
|
||||
|
||||
#ifndef _Standard_PrimitiveTypes_HeaderFile
|
||||
|
@ -15,11 +15,9 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
|
||||
|
||||
static
|
||||
Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType);
|
||||
static
|
||||
@ -848,7 +846,8 @@ void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS)
|
||||
"KS_PLANE",
|
||||
"KS_CIRCLE",
|
||||
"KS_LINE",
|
||||
"KS_DEGENERATED"
|
||||
"KS_DEGENERATED",
|
||||
"KS_BSPLINE"
|
||||
};
|
||||
int i;
|
||||
//
|
||||
|
@ -15,7 +15,6 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_ShapeInfoFiller.hxx>
|
||||
|
||||
@ -24,47 +23,36 @@
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopExp.hxx>
|
||||
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
#include <gp_Circ.hxx>
|
||||
#include <gp_Ax2.hxx>
|
||||
#include <gp_Elips.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
#include <gp_Pln.hxx>
|
||||
|
||||
#include <Geom_Curve.hxx>
|
||||
#include <Geom_Surface.hxx>
|
||||
#include <Geom_BSplineCurve.hxx>
|
||||
|
||||
#include <GeomAdaptor_Curve.hxx>
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <BRepTools.hxx>
|
||||
|
||||
|
||||
|
||||
static
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT);
|
||||
static
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST);
|
||||
static
|
||||
Standard_Integer NbWires(const TopoDS_Face& aF);
|
||||
static
|
||||
Standard_Integer NbShells(const TopoDS_Solid& aS);
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function :
|
||||
@ -215,7 +203,7 @@ static
|
||||
TopoDS_Iterator aIt;
|
||||
//
|
||||
aIt.Initialize(aS);
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
const TopoDS_Shape& aSx=aIt.Value();
|
||||
FillShape(aSx);
|
||||
}
|
||||
@ -291,7 +279,7 @@ static
|
||||
//
|
||||
aSd=TopoDS::Solid(aS);
|
||||
//
|
||||
aNbShells=NbShells(aSd);
|
||||
aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
|
||||
if (aNbShells>1) {
|
||||
return;
|
||||
}
|
||||
@ -335,12 +323,12 @@ static
|
||||
//
|
||||
aF=TopoDS::Face(aS);
|
||||
//
|
||||
aNbWires=NbWires(aF);
|
||||
aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF);
|
||||
//
|
||||
aSurf=BRep_Tool::Surface(aF);
|
||||
GeomAdaptor_Surface aGAS(aSurf);
|
||||
aST=aGAS.GetType();
|
||||
bIsAllowedType=IsAllowedType(aST);
|
||||
bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aST);
|
||||
if (!bIsAllowedType) {
|
||||
return;
|
||||
}
|
||||
@ -358,7 +346,9 @@ static
|
||||
aInfo.SetLocation(aP0);
|
||||
aInfo.SetPosition(aAx3);
|
||||
//
|
||||
if (aNbWires>1) return;
|
||||
if (aNbWires>1) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
//aSurf->Bounds(aUMin, aUMax, aVMin, aVMax);
|
||||
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
@ -392,7 +382,9 @@ static
|
||||
aInfo.SetPosition(aAx3);
|
||||
aInfo.SetRadius1(aR1);
|
||||
//
|
||||
if (aNbWires>1) return;
|
||||
if (aNbWires>1) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
|
||||
aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
|
||||
@ -414,7 +406,9 @@ static
|
||||
aInfo.SetPosition(aAx3);
|
||||
aInfo.SetRadius1(aR1);
|
||||
//
|
||||
if (aNbWires>1) return;
|
||||
if (aNbWires>1) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
bInfU1=Precision::IsNegativeInfinite(aUMin);
|
||||
@ -446,7 +440,9 @@ static
|
||||
aInfo.SetPosition(aAx3);
|
||||
//aInfo.SetRadius1(aR1);
|
||||
//
|
||||
if (aNbWires>1) return;
|
||||
if (aNbWires>1) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
|
||||
bInfU1=Precision::IsNegativeInfinite(aUMin);
|
||||
@ -480,7 +476,9 @@ static
|
||||
aInfo.SetRadius1(aR1);
|
||||
aInfo.SetRadius2(aR2);
|
||||
//
|
||||
if (aNbWires>1) return;
|
||||
if (aNbWires>1) {
|
||||
return;
|
||||
}
|
||||
//
|
||||
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
|
||||
//
|
||||
@ -491,7 +489,7 @@ static
|
||||
//function :FillEdge
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
|
||||
void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
|
||||
{
|
||||
myErrorStatus=0;
|
||||
//
|
||||
@ -531,13 +529,54 @@ static
|
||||
aC3D=BRep_Tool::Curve(aE, aT1, aT2);
|
||||
GeomAdaptor_Curve aGAC(aC3D);
|
||||
aCT=aGAC.GetType();
|
||||
bIsAllowedType=IsAllowedType(aCT);
|
||||
bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aCT);
|
||||
if (!bIsAllowedType) {
|
||||
FillSubShapes(aS);
|
||||
return;
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f
|
||||
// BSplineCurve
|
||||
if (aCT==GeomAbs_BSplineCurve) {
|
||||
Standard_Integer aNbKnots, aNbPoles, aDegree;
|
||||
Standard_Real aLength;
|
||||
gp_XYZ aXYZ1, aXYZ2, aXYZc;
|
||||
Handle(Geom_BSplineCurve) aBSp;
|
||||
//
|
||||
aBSp=aGAC.BSpline();
|
||||
aNbKnots=aBSp->NbKnots();
|
||||
aNbPoles=aBSp->NbPoles();
|
||||
aDegree =aBSp->Degree();
|
||||
if (!(aDegree==1 && aNbKnots==2 && aNbPoles==2)) {
|
||||
return; // unallowed B-Spline curve
|
||||
}
|
||||
//
|
||||
aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE);
|
||||
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
|
||||
//
|
||||
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT);
|
||||
aGAC.D0(aT1, aP1);
|
||||
aGAC.D0(aT2, aP2);
|
||||
aInfo.SetPnt1(aP1);
|
||||
aInfo.SetPnt2(aP2);
|
||||
//
|
||||
aLength=aP1.Distance(aP2);
|
||||
aInfo.SetLength(aLength);
|
||||
//
|
||||
aXYZ1=aP1.XYZ();
|
||||
aXYZ2=aP2.XYZ();
|
||||
aXYZc=aXYZ1+aXYZ2;
|
||||
aXYZc.Multiply(0.5);
|
||||
aPc.SetXYZ(aXYZc);
|
||||
aInfo.SetLocation(aPc);
|
||||
//
|
||||
gp_Vec aVec(aPc, aP2);
|
||||
gp_Dir aDir(aVec);
|
||||
aInfo.SetDirection(aDir);
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
|
||||
// Line
|
||||
if (aCT==GeomAbs_Line) {
|
||||
else if (aCT==GeomAbs_Line) {
|
||||
Standard_Boolean bInf1, bInf2;
|
||||
Standard_Real aLength;
|
||||
gp_Lin aLin;
|
||||
@ -734,7 +773,7 @@ static
|
||||
//function :NbShells
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer NbShells(const TopoDS_Solid& aSd)
|
||||
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
|
||||
{
|
||||
Standard_Integer iCnt;
|
||||
TopoDS_Iterator aIt;
|
||||
@ -742,7 +781,7 @@ Standard_Integer NbShells(const TopoDS_Solid& aSd)
|
||||
iCnt=0;
|
||||
//
|
||||
aIt.Initialize(aSd);
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
//const TopoDS_Shape& aSh=aIt.Value();
|
||||
++iCnt;
|
||||
}
|
||||
@ -752,7 +791,7 @@ Standard_Integer NbShells(const TopoDS_Solid& aSd)
|
||||
//function : NbWires
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Integer NbWires(const TopoDS_Face& aF)
|
||||
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
|
||||
{
|
||||
Standard_Integer iCnt;
|
||||
TopoDS_Iterator aIt;
|
||||
@ -760,7 +799,7 @@ Standard_Integer NbWires(const TopoDS_Face& aF)
|
||||
iCnt=0;
|
||||
//
|
||||
aIt.Initialize(aF);
|
||||
for (; aIt.More(); aIt.Next()){
|
||||
for (; aIt.More(); aIt.Next()) {
|
||||
//const TopoDS_Shape& aW=aIt.Value();
|
||||
++iCnt;
|
||||
}
|
||||
@ -770,12 +809,15 @@ Standard_Integer NbWires(const TopoDS_Face& aF)
|
||||
//function : IsAllowedType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT)
|
||||
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer i, aNb;
|
||||
GeomAbs_CurveType aTypes[]={
|
||||
GeomAbs_Line, GeomAbs_Circle, GeomAbs_Ellipse
|
||||
GeomAbs_Line,
|
||||
GeomAbs_Circle,
|
||||
GeomAbs_Ellipse,
|
||||
GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft
|
||||
};
|
||||
//
|
||||
bRet=Standard_False;
|
||||
@ -783,14 +825,13 @@ Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT)
|
||||
for (i=0; i<aNb && !bRet; ++i) {
|
||||
bRet=(aCT==aTypes[i]);
|
||||
}
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsAllowedType
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST)
|
||||
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_SurfaceType aST)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Integer i, aNb;
|
||||
|
@ -15,24 +15,30 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#ifndef _GEOMAlgo_ShapeInfoFiller_HeaderFile
|
||||
#define _GEOMAlgo_ShapeInfoFiller_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Macro.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#include <Standard_Real.hxx>
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Sphere.hxx>
|
||||
#include <gp_Cylinder.hxx>
|
||||
#include <gp_Cone.hxx>
|
||||
#include <gp_Torus.hxx>
|
||||
|
||||
#include <GeomAbs_CurveType.hxx>
|
||||
#include <GeomAbs_SurfaceType.hxx>
|
||||
|
||||
#include <TopoDS_Solid.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Face.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#include <GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx>
|
||||
#include <GEOMAlgo_Algo.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//class : GEOMAlgo_ShapeInfoFiller
|
||||
@ -114,10 +120,27 @@ class GEOMAlgo_ShapeInfoFiller : public GEOMAlgo_Algo
|
||||
Standard_EXPORT
|
||||
void FillDetails(const TopoDS_Solid& aS) ;
|
||||
|
||||
//modified by NIZNHY-PKV Tue Jul 03 13:31:43 2012f
|
||||
Standard_EXPORT
|
||||
Standard_Boolean TreatStepSphere(const TopoDS_Solid& aS);
|
||||
|
||||
Standard_EXPORT static
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_CurveType aCT);
|
||||
|
||||
Standard_EXPORT static
|
||||
Standard_Boolean IsAllowedType(const GeomAbs_SurfaceType aST);
|
||||
|
||||
Standard_EXPORT static
|
||||
Standard_Integer NbWires(const TopoDS_Face& aF);
|
||||
|
||||
Standard_EXPORT static
|
||||
Standard_Integer NbShells(const TopoDS_Solid& aS);
|
||||
//modified by NIZNHY-PKV Tue Jul 03 13:31:49 2012t
|
||||
|
||||
TopoDS_Shape myShape;
|
||||
GEOMAlgo_ShapeInfo myEmptyInfo;
|
||||
GEOMAlgo_IndexedDataMapOfShapeShapeInfo myMapInfo;
|
||||
Standard_Real myTolerance;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -15,11 +15,12 @@
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
#include <GEOMAlgo_ShapeInfoFiller.hxx>
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
#include <gp_Lin.hxx>
|
||||
#include <gp_XYZ.hxx>
|
||||
@ -31,6 +32,8 @@
|
||||
|
||||
#include <ElCLib.hxx>
|
||||
|
||||
#include <GeomAdaptor_Surface.hxx>
|
||||
|
||||
#include <TopoDS.hxx>
|
||||
#include <TopoDS_Vertex.hxx>
|
||||
#include <TopoDS_Edge.hxx>
|
||||
@ -45,18 +48,25 @@
|
||||
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopTools_IndexedMapOfShape.hxx>
|
||||
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <BRepGProp.hxx>
|
||||
#include <GProp_GProps.hxx>
|
||||
|
||||
#include <GEOMAlgo_ShapeInfo.hxx>
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TColStd_IndexedMapOfInteger.hxx>
|
||||
|
||||
static
|
||||
Standard_Boolean IsEqual(const gp_Sphere& aSp1,
|
||||
const gp_Sphere& aSp2,
|
||||
const Standard_Real aTolDst);
|
||||
|
||||
//=======================================================================
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
|
||||
{
|
||||
Standard_Boolean bIsStepSphere;
|
||||
Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX;
|
||||
TopoDS_Shape aFCyl, aFCon;
|
||||
TopTools_IndexedMapOfShape aMF;
|
||||
@ -88,6 +98,15 @@
|
||||
return;
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f
|
||||
else if (aNbF==2) {
|
||||
// specific solid that should be treated as a sphere
|
||||
bIsStepSphere=TreatStepSphere(aSd);
|
||||
if (bIsStepSphere) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t
|
||||
//
|
||||
aNbCyl=0;
|
||||
aNbCon=0;
|
||||
@ -110,8 +129,8 @@
|
||||
++aNbCrc;
|
||||
}
|
||||
else if (aKNF==GEOMAlgo_KN_POLYGON ||
|
||||
aKNF==GEOMAlgo_KN_TRIANGLE ||
|
||||
aKNF==GEOMAlgo_KN_QUADRANGLE) {
|
||||
aKNF==GEOMAlgo_KN_TRIANGLE ||
|
||||
aKNF==GEOMAlgo_KN_QUADRANGLE) {
|
||||
++aNbPgn;
|
||||
}
|
||||
else if (aKNF==GEOMAlgo_KN_RECTANGLE) {
|
||||
@ -147,11 +166,9 @@
|
||||
return;
|
||||
}
|
||||
//
|
||||
//modified by NIZNHY-PKV Wed Jan 11 11:04:31 2012f
|
||||
if (aNbF!=aNbPgn) {
|
||||
return;// -> GEOMAlgo_KN_UNKNOWN
|
||||
}
|
||||
//modified by NIZNHY-PKV Wed Jan 11 11:04:37 2012t
|
||||
if (aNbPgn!=6) {
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_POLYHEDRON);
|
||||
return;
|
||||
@ -211,6 +228,11 @@
|
||||
const gp_Dir& aDNj=aIFj.Position().Direction();
|
||||
//
|
||||
aDot=aDNi*aDNj;
|
||||
//modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f
|
||||
if (aDot<0.) {
|
||||
aDot=-aDot;
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t
|
||||
if (fabs(1.-aDot)<0.0001) {
|
||||
aMp.Add(i);
|
||||
aMp.Add(j);
|
||||
@ -269,8 +291,8 @@
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Pln& aPln)
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Pln& aPln)
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, i, j;
|
||||
Standard_Real aDot, aD0, aD1, aLength, aWidth;
|
||||
@ -456,8 +478,8 @@
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Sphere& )
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Sphere& )
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbSE, aNbDE;
|
||||
TopoDS_Edge aE;
|
||||
@ -506,8 +528,8 @@
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Cone& )//aCone)
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Cone& )//aCone)
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
|
||||
Standard_Real aR[3], aHeight;
|
||||
@ -635,8 +657,8 @@
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Cylinder& aCyl)
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Cylinder& aCyl)
|
||||
{
|
||||
Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
|
||||
Standard_Real aT0, aT1, aHeight;
|
||||
@ -720,8 +742,8 @@
|
||||
//function : FillDetails
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Torus& )
|
||||
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
|
||||
const gp_Torus& )
|
||||
{
|
||||
Standard_Integer aNbV, aNbE, aNbSE;
|
||||
TopoDS_Edge aE;
|
||||
@ -748,7 +770,6 @@
|
||||
for (; aExp.More(); aExp.Next()) {
|
||||
aE=TopoDS::Edge(aExp.Current());
|
||||
if (aM.Add(aE)) {
|
||||
//const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
|
||||
if (BRep_Tool::IsClosed(aE, aF)) {
|
||||
++aNbSE;
|
||||
}
|
||||
@ -760,3 +781,121 @@
|
||||
}
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f
|
||||
//=======================================================================
|
||||
//function : TreatStepSphere
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean
|
||||
GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd)
|
||||
{
|
||||
Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
|
||||
Standard_Integer j;
|
||||
Standard_Real aTolAng, aTolLin;
|
||||
Standard_Real aVolume, aVolumeS, dV, aArea, aAreaS, dA;
|
||||
gp_Sphere aSphere[2];
|
||||
GeomAbs_SurfaceType aST;
|
||||
Handle(Geom_Surface) aS;
|
||||
GeomAdaptor_Surface aGAS;
|
||||
TopExp_Explorer aExp;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aTolLin=Precision::Confusion();
|
||||
aTolAng=Precision::Angular();
|
||||
//
|
||||
aExp.Init(aSd, TopAbs_FACE);
|
||||
for (j=0; aExp.More(); aExp.Next(), ++j) {
|
||||
const TopoDS_Face& aF=*((TopoDS_Face*)&aExp.Current());
|
||||
aS=BRep_Tool::Surface(aF);
|
||||
aGAS.Load(aS);
|
||||
aST=aGAS.GetType();
|
||||
bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aST);
|
||||
if (!bIsAllowedType) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
if (aST!=GeomAbs_Sphere) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
aSphere[j]=aGAS.Sphere();
|
||||
}
|
||||
//
|
||||
bIsEqual=IsEqual(aSphere[0], aSphere[1], aTolLin);
|
||||
if (!bIsEqual) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
//--------------------------------
|
||||
GProp_GProps aGProps;
|
||||
//
|
||||
bOnlyClosed=Standard_False;
|
||||
//
|
||||
aVolume=aSphere[0].Volume();
|
||||
//
|
||||
BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed);
|
||||
aVolumeS=aGProps.Mass();
|
||||
if (aVolumeS<0.) {
|
||||
aVolumeS=-aVolumeS;
|
||||
}
|
||||
//
|
||||
dV=fabs(aVolumeS-aVolume);
|
||||
if (dV>aTolLin) {
|
||||
return bRet;
|
||||
}
|
||||
//--------------------------------
|
||||
aArea=aSphere[0].Area();
|
||||
//
|
||||
BRepGProp::SurfaceProperties(aSd, aGProps);
|
||||
aAreaS=aGProps.Mass();
|
||||
//
|
||||
dA=fabs(aAreaS-aArea);
|
||||
if (dA>aTolLin) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
//--------------------------------
|
||||
gp_Pnt aP0;
|
||||
gp_Ax3 aAx3;
|
||||
Standard_Real aR1;
|
||||
//
|
||||
aP0=aSphere[0].Location();
|
||||
aAx3=aSphere[0].Position();
|
||||
aR1=aSphere[0].Radius();
|
||||
//
|
||||
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd);
|
||||
//
|
||||
aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
|
||||
aInfo.SetLocation(aP0);
|
||||
aInfo.SetPosition(aAx3);
|
||||
aInfo.SetRadius1(aR1);
|
||||
//
|
||||
return !bRet;// true
|
||||
}
|
||||
//=======================================================================
|
||||
//function : IsEqual
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean IsEqual(const gp_Sphere& aSp1,
|
||||
const gp_Sphere& aSp2,
|
||||
const Standard_Real aTolLin)
|
||||
{
|
||||
Standard_Boolean bRet;
|
||||
Standard_Real aR1, aR2, aD2;
|
||||
//
|
||||
bRet=Standard_False;
|
||||
aR1=aSp1.Radius();
|
||||
aR2=aSp2.Radius();
|
||||
if (fabs(aR1-aR2)>aTolLin) {
|
||||
return bRet;
|
||||
}
|
||||
//
|
||||
const gp_Pnt& aPC1=aSp1.Position().Location();
|
||||
const gp_Pnt& aPC2=aSp2.Position().Location();
|
||||
//
|
||||
aD2=aPC1.SquareDistance(aPC2);
|
||||
bRet=(aD2<aTolLin*aTolLin);
|
||||
//
|
||||
return bRet;
|
||||
}
|
||||
//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t
|
||||
|
Loading…
x
Reference in New Issue
Block a user