22852: EDF 9937 GEOM: Kind of shape unrecognized when importing step files

This commit is contained in:
eap 2015-04-27 17:03:33 +03:00
parent 59b5446863
commit 7760eb2714
21 changed files with 789 additions and 733 deletions

View File

@ -59,7 +59,10 @@ SET(GEOMAlgo_HEADERS
GEOMAlgo_DataMapOfPassKeyInteger.hxx GEOMAlgo_DataMapOfPassKeyInteger.hxx
GEOMAlgo_DataMapOfShapeMapOfShape.hxx GEOMAlgo_DataMapOfShapeMapOfShape.hxx
GEOMAlgo_DataMapOfShapePnt.hxx GEOMAlgo_DataMapOfShapePnt.hxx
GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOn1.hxx
GEOMAlgo_FinderShapeOn2.hxx GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_GetInPlace.hxx GEOMAlgo_GetInPlace.hxx
GEOMAlgo_GetInPlaceAPI.hxx GEOMAlgo_GetInPlaceAPI.hxx
GEOMAlgo_GlueAnalyser.hxx GEOMAlgo_GlueAnalyser.hxx
@ -77,6 +80,7 @@ SET(GEOMAlgo_HEADERS
GEOMAlgo_IndexedDataMapOfShapeState.hxx GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_KindOfBounds.hxx GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_KindOfClosed.hxx GEOMAlgo_KindOfClosed.hxx
GEOMAlgo_KindOfDef.hxx
GEOMAlgo_KindOfName.hxx GEOMAlgo_KindOfName.hxx
GEOMAlgo_KindOfShape.hxx GEOMAlgo_KindOfShape.hxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx

View File

@ -11,25 +11,28 @@ GEOMAlgo_ShellSolid.cxx
GEOMAlgo_AlgoTools.hxx GEOMAlgo_AlgoTools.hxx
GEOMAlgo_AlgoTools.cxx GEOMAlgo_AlgoTools.cxx
GEOMAlgo_AlgoTools_1.cxx GEOMAlgo_AlgoTools_1.cxx
GEOMAlgo_AlgoTools_2.cxx
GEOMAlgo_SolidSolid.hxx GEOMAlgo_SolidSolid.hxx
GEOMAlgo_SolidSolid.cxx GEOMAlgo_SolidSolid.cxx
GEOMAlgo_ShapeAlgo.hxx GEOMAlgo_ShapeAlgo.hxx
GEOMAlgo_ShapeAlgo.cxx GEOMAlgo_ShapeAlgo.cxx
GEOMAlgo_FinderShapeOn.hxx
GEOMAlgo_FinderShapeOn.cxx
GEOMAlgo_FinderShapeOn1.hxx
GEOMAlgo_FinderShapeOn1.cxx
GEOMAlgo_HAlgo.hxx GEOMAlgo_HAlgo.hxx
GEOMAlgo_HAlgo.cxx GEOMAlgo_HAlgo.cxx
GEOMAlgo_Clsf.hxx GEOMAlgo_Clsf.hxx
GEOMAlgo_Clsf.cxx GEOMAlgo_Clsf.cxx
GEOMAlgo_ClsfBox.hxx GEOMAlgo_ClsfBox.hxx
GEOMAlgo_ClsfBox.cxx GEOMAlgo_ClsfBox.cxx
GEOMAlgo_ClsfQuad.hxx
GEOMAlgo_ClsfQuad.cxx
GEOMAlgo_ClsfSolid.hxx GEOMAlgo_ClsfSolid.hxx
GEOMAlgo_ClsfSolid.cxx GEOMAlgo_ClsfSolid.cxx
GEOMAlgo_ClsfSurf.hxx GEOMAlgo_ClsfSurf.hxx
GEOMAlgo_ClsfSurf.cxx GEOMAlgo_ClsfSurf.cxx
GEOMAlgo_FinderShapeOn2.hxx GEOMAlgo_FinderShapeOn2.hxx
GEOMAlgo_FinderShapeOn2.cxx GEOMAlgo_FinderShapeOn2.cxx
GEOMAlgo_FinderShapeOnQuad.hxx
GEOMAlgo_FinderShapeOnQuad.cxx
GEOMAlgo_Gluer.hxx GEOMAlgo_Gluer.hxx
GEOMAlgo_Gluer.cxx GEOMAlgo_Gluer.cxx
GEOMAlgo_GlueAnalyser.hxx GEOMAlgo_GlueAnalyser.hxx
@ -50,8 +53,6 @@ GEOMAlgo_GetInPlace.cxx
GEOMAlgo_GetInPlace_1.cxx GEOMAlgo_GetInPlace_1.cxx
GEOMAlgo_GetInPlace_2.cxx GEOMAlgo_GetInPlace_2.cxx
GEOMAlgo_GetInPlace_3.cxx GEOMAlgo_GetInPlace_3.cxx
GEOMAlgo_GetInPlaceAPI.hxx
GEOMAlgo_GetInPlaceAPI.cxx
GEOMAlgo_Splitter.hxx GEOMAlgo_Splitter.hxx
GEOMAlgo_Splitter.cxx GEOMAlgo_Splitter.cxx
GEOMAlgo_ShapeInfoFiller.hxx GEOMAlgo_ShapeInfoFiller.hxx
@ -106,3 +107,5 @@ GEOMAlgo_ShapeInfo.cxx
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Basics_OCCTVersion.hxx Basics_OCCTVersion.hxx
GEOMAlgo_KindOfDef.hxx

0
src/GEOMAlgo/GEOMAlgo.cdl Executable file → Normal file
View File

13
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx Executable file → Normal file
View File

@ -700,7 +700,7 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
return 0; // Nothing to do return 0; // Nothing to do
} }
// //
while(1) { for(;;) {
aNbEProcessed=aMProcessed.Extent(); aNbEProcessed=aMProcessed.Extent();
if (aNbEProcessed==aNbE) { if (aNbEProcessed==aNbE) {
break; break;
@ -991,8 +991,14 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
} }
// //
// 4. // 4.
aVx=aVMin;
aNbDomains=aHatcher.NbDomains(aIx); aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) { if (!aNbDomains) {
iErr=5;
return iErr;
}
//
i=1;
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
bHasFirstPoint=aDomain.HasFirstPoint(); bHasFirstPoint=aDomain.HasFirstPoint();
if (!bHasFirstPoint) { if (!bHasFirstPoint) {
@ -1012,9 +1018,6 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
// //
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
// //
break;
}
//
aS->D0(aUx, aVx, aPx); aS->D0(aUx, aVx, aPx);
// //
theP2D.SetCoord(aUx, aVx); theP2D.SetCoord(aUx, aVx);

View File

@ -62,7 +62,6 @@
#include <BRepLib_MakeFace.hxx> #include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx> #include <BRepLib_FaceError.hxx>
//#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx> #include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx> #include <GEOMAlgo_ShellSolid.hxx>
@ -300,7 +299,6 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
{ {
myErrorStatus=0; myErrorStatus=0;
// //
Standard_Boolean bIsDone;
Standard_Integer i, iErr; Standard_Integer i, iErr;
TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON}; TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
TopTools_ListIteratorOfListOfShape aIt; TopTools_ListIteratorOfListOfShape aIt;

View File

@ -309,6 +309,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges()
aType1=myGAS.GetType(); aType1=myGAS.GetType();
// //
TopExp::MapShapes(myShape, TopAbs_EDGE, aM); TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
//
bIsConformState=Standard_False;
//
aNb=aM.Extent(); aNb=aM.Extent();
for (i=1; i<=aNb; ++i) { for (i=1; i<=aNb; ++i) {
GEOMAlgo_ListOfPnt aLP; GEOMAlgo_ListOfPnt aLP;
@ -427,6 +430,8 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces()
} }
} }
// //
bIsConformState=Standard_False;
//
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current(); const TopoDS_Shape& aE=aExp.Current();
@ -500,6 +505,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids()
const TopoDS_Shape& aSd=aM(i); const TopoDS_Shape& aSd=aM(i);
aMF.Clear(); aMF.Clear();
TopExp::MapShapes(aSd, TopAbs_FACE, aMF); TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
//
bIsConformState=Standard_False;
//
aNbF=aMF.Extent(); aNbF=aMF.Extent();
for (j=1; j<=aNbF; ++j) { for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aF=aMF(j); const TopoDS_Shape& aF=aMF(j);
@ -660,7 +668,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
}// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
}// if (!aNb && myNbPntsMin) { }// if (!aNb && myNbPntsMin) {
} }
//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f
//======================================================================= //=======================================================================
//function : InnerPoints //function : InnerPoints
//purpose : //purpose :
@ -676,7 +683,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
aLP.Clear(); aLP.Clear();
InnerPoints(aE, aNbPntsMin, aLP); InnerPoints(aE, aNbPntsMin, aLP);
} }
//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t
//======================================================================= //=======================================================================
//function : InnerPoints //function : InnerPoints
//purpose : //purpose :
@ -702,16 +708,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
return; return;
} }
// //
//modified by NIZNHY-PKV Thu Jan 26 09:51:20 2012f
/*
aNbT=myNbPntsMin+1;
dT=(aT2-aT1)/aNbT;
for (j=1; j<=aNbPntsMin; ++j) {
aT=aT1+j*dT;
aC3D->D0(aT, aP);
aLP.Append(aP);
}
*/
aNbT=aNbPntsMin+1; aNbT=aNbPntsMin+1;
dT=(aT2-aT1)/aNbT; dT=(aT2-aT1)/aNbT;
for (j=1; j<aNbT; ++j) { for (j=1; j<aNbT; ++j) {
@ -719,7 +715,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
aC3D->D0(aT, aP); aC3D->D0(aT, aP);
aLP.Append(aP); aLP.Append(aP);
} }
//modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t
} }
//======================================================================= //=======================================================================

View File

@ -362,6 +362,8 @@ void GEOMAlgo_FinderShapeOn2::ProcessEdges()
// //
const TopoDS_Edge& aE=TopoDS::Edge(aM(i)); const TopoDS_Edge& aE=TopoDS::Edge(aM(i));
// //
bIsConformState=Standard_False;
//
aExp.Init(aE, TopAbs_VERTEX); aExp.Init(aE, TopAbs_VERTEX);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aV=aExp.Current(); const TopoDS_Shape& aV=aExp.Current();
@ -475,6 +477,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessFaces()
} }
} }
// //
//
bIsConformState=Standard_False;
//
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current(); const TopoDS_Shape& aE=aExp.Current();
@ -558,6 +563,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessSolids()
const TopoDS_Shape& aSd=aM(i); const TopoDS_Shape& aSd=aM(i);
aMF.Clear(); aMF.Clear();
TopExp::MapShapes(aSd, TopAbs_FACE, aMF); TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
//
bIsConformState=Standard_False;
//
aNbF=aMF.Extent(); aNbF=aMF.Extent();
for (j=1; j<=aNbF; ++j) { for (j=1; j<=aNbF; ++j) {
const TopoDS_Shape& aF=aMF(j); const TopoDS_Shape& aF=aMF(j);

View File

@ -239,7 +239,6 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
gp_Pnt aPx; gp_Pnt aPx;
gp_Pnt2d aP2Dx; gp_Pnt2d aP2Dx;
gp_Vec aDNx; gp_Vec aDNx;
TopoDS_Face aF; TopoDS_Face aF;
TopExp_Explorer aExp; TopExp_Explorer aExp;
// //
@ -247,9 +246,8 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
aCoef=10.; aCoef=10.;
// //
aExp.Init (aZ, TopAbs_FACE); aExp.Init (aZ, TopAbs_FACE);
for (; aExp.More() ; aExp.Next()) { if (aExp.More()) {
aF=*((TopoDS_Face*)&aExp.Current()); aF=*((TopoDS_Face*)&aExp.Current());
break;
} }
// //
iErr=PntInFace(aF, aPx, aP2Dx); iErr=PntInFace(aF, aPx, aP2Dx);
@ -368,7 +366,12 @@ Standard_Integer PntInFace(const TopoDS_Face& aF,
// //
// 4. // 4.
aNbDomains=aHatcher.NbDomains(aIx); aNbDomains=aHatcher.NbDomains(aIx);
for (i=1; i<=aNbDomains; ++i) { if (!aNbDomains) {
iErr=5;
return iErr;
}
//
i=1;
const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
bHasFirstPoint=aDomain.HasFirstPoint(); bHasFirstPoint=aDomain.HasFirstPoint();
if (!bHasFirstPoint) { if (!bHasFirstPoint) {
@ -388,9 +391,6 @@ Standard_Integer PntInFace(const TopoDS_Face& aF,
// //
aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
// //
break;
}
//
aS->D0(aUx, aVx, aPx); aS->D0(aUx, aVx, aPx);
// //
theP2D.SetCoord(aUx, aVx); theP2D.SetCoord(aUx, aVx);

View File

@ -90,7 +90,6 @@ GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
//======================================================================= //=======================================================================
GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
{} {}
//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//======================================================================= //=======================================================================
//function : StickedShapes //function : StickedShapes
//purpose : //purpose :
@ -100,7 +99,6 @@ const TopTools_IndexedDataMapOfShapeListOfShape&
{ {
return myStickedShapes; return myStickedShapes;
} }
//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//======================================================================= //=======================================================================
//function : Perform //function : Perform
//purpose : //purpose :
@ -124,12 +122,10 @@ void GEOMAlgo_GlueDetector::Perform()
return; return;
} }
// //
//modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f
CheckDetected(); CheckDetected();
if (myErrorStatus) { if (myErrorStatus) {
return; return;
} }
//modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t
// //
DetectEdges(); DetectEdges();
if (myErrorStatus) { if (myErrorStatus) {
@ -206,7 +202,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
TColStd_MapIteratorOfMapOfInteger aIt1; TColStd_MapIteratorOfMapOfInteger aIt1;
// //
aMIP.Add(i); aMIP.Add(i);
while(1) { for(;;) {
aNbIP=aMIP.Extent(); aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP); aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) { for(; aIt1.More(); aIt1.Next()) {
@ -460,7 +456,6 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
// //
aPK.SetShapes(aLV); aPK.SetShapes(aLV);
} }
//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f
//======================================================================= //=======================================================================
//function : CheckDetected //function : CheckDetected
//purpose : //purpose :
@ -607,4 +602,3 @@ Standard_Integer CheckAncesstors
// //
return iRet; return iRet;
} }
//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t

17
src/GEOMAlgo/GEOMAlgo_Gluer.cxx Executable file → Normal file
View File

@ -228,10 +228,7 @@ void GEOMAlgo_Gluer::MakeVertices()
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV; TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
//modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f
//GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB; GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
//modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t
// //
GEOMAlgo_BndSphereTreeSelector aSelector; GEOMAlgo_BndSphereTreeSelector aSelector;
GEOMAlgo_BndSphereTree aBBTree; GEOMAlgo_BndSphereTree aBBTree;
@ -278,7 +275,7 @@ void GEOMAlgo_Gluer::MakeVertices()
TColStd_MapIteratorOfMapOfInteger aIt1; TColStd_MapIteratorOfMapOfInteger aIt1;
// //
aMIP.Add(i); aMIP.Add(i);
while(1) { for(;;) {
aNbIP=aMIP.Extent(); aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP); aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) { for(; aIt1.More(); aIt1.Next()) {
@ -288,10 +285,7 @@ void GEOMAlgo_Gluer::MakeVertices()
} }
// //
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
//modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP); const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
//const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
//modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
// //
aSelector.Clear(); aSelector.Clear();
aSelector.SetBox(aBoxVP); aSelector.SetBox(aBoxVP);
@ -468,7 +462,8 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
aER.Orientation(TopAbs_FORWARD); aER.Orientation(TopAbs_FORWARD);
if (!BRep_Tool::Degenerated(aER)) { if (!BRep_Tool::Degenerated(aER)) {
// orient image // orient image
Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext); Standard_Boolean bIsToReverse=
GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
if (bIsToReverse) { if (bIsToReverse) {
aER.Reverse(); aER.Reverse();
} }
@ -490,8 +485,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape,
aBB.Add(theResult, aShapeR); aBB.Add(theResult, aShapeR);
} }
} }
else else {
{
if (myKeepNonSolids) { if (myKeepNonSolids) {
// just add image // just add image
const TopoDS_Shape& aShapeR = myOrigins.Find(theShape); const TopoDS_Shape& aShapeR = myOrigins.Find(theShape);
@ -1111,7 +1105,8 @@ void GetSubShapes(const TopoDS_Shape& aS,
//function : Modified //function : Modified
//purpose : //purpose :
//======================================================================= //=======================================================================
const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified
(const TopoDS_Shape& aS)
{ {
TopAbs_ShapeEnum aType; TopAbs_ShapeEnum aType;
// //

View File

@ -84,11 +84,8 @@ void GEOMAlgo_Gluer2::Clear()
myImagesToWork.Clear(); myImagesToWork.Clear();
myOriginsToWork.Clear(); myOriginsToWork.Clear();
myKeepNonSolids=Standard_False; myKeepNonSolids=Standard_False;
//modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f
myDetector.Clear(); myDetector.Clear();
//modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t
} }
//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//======================================================================= //=======================================================================
//function : StickedShapes //function : StickedShapes
//purpose : //purpose :
@ -98,12 +95,12 @@ const TopTools_IndexedDataMapOfShapeListOfShape&
{ {
return myDetector.StickedShapes(); return myDetector.StickedShapes();
} }
//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//======================================================================= //=======================================================================
//function : SetShapesToGlue //function : SetShapesToGlue
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) void GEOMAlgo_Gluer2::SetShapesToGlue
(const TopTools_DataMapOfShapeListOfShape& aM)
{ {
myShapesToGlue=aM; myShapesToGlue=aM;
} }
@ -241,6 +238,7 @@ void GEOMAlgo_Gluer2::CheckData()
myWarningStatus=0; myWarningStatus=0;
// //
aNbSG=myShapesToGlue.Extent(); aNbSG=myShapesToGlue.Extent();
aType=TopAbs_SHAPE;
if (aNbSG) { if (aNbSG) {
// Check myShapesToGlue // Check myShapesToGlue
aItDMSLS.Initialize(myShapesToGlue); aItDMSLS.Initialize(myShapesToGlue);
@ -587,6 +585,7 @@ void GEOMAlgo_Gluer2::BuildResult()
myErrorStatus=0; myErrorStatus=0;
myWarningStatus=0; myWarningStatus=0;
// //
bHasImage=Standard_False;
aItC.Initialize(myArgument); aItC.Initialize(myArgument);
for (; aItC.More(); aItC.Next()) { for (; aItC.More(); aItC.Next()) {
const TopoDS_Shape& aCx=aItC.Value(); const TopoDS_Shape& aCx=aItC.Value();

View File

@ -0,0 +1,37 @@
// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//GEOMAlgo_KindOfDef
#ifndef _GEOMAlgo_KindOfDef_HeaderFile
#define _GEOMAlgo_KindOfDef_HeaderFile
enum GEOMAlgo_KindOfDef {
GEOMAlgo_KD_UNKNOWN,
GEOMAlgo_KD_SPECIFIED,
GEOMAlgo_KD_ARBITRARY
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
#include <Standard_PrimitiveTypes.hxx>
#endif
#endif

View File

@ -44,7 +44,8 @@ GEOMAlgo_KN_DISKELLIPSE,
GEOMAlgo_KN_RECTANGLE, GEOMAlgo_KN_RECTANGLE,
GEOMAlgo_KN_TRIANGLE, GEOMAlgo_KN_TRIANGLE,
GEOMAlgo_KN_QUADRANGLE, GEOMAlgo_KN_QUADRANGLE,
GEOMAlgo_KN_ARCELLIPSE GEOMAlgo_KN_ARCELLIPSE,
GEOMAlgo_KN_SOLID
}; };
#ifndef _Standard_PrimitiveTypes_HeaderFile #ifndef _Standard_PrimitiveTypes_HeaderFile

View File

@ -35,9 +35,7 @@ GEOMAlgo_KS_PLANE,
GEOMAlgo_KS_CIRCLE, GEOMAlgo_KS_CIRCLE,
GEOMAlgo_KS_LINE, GEOMAlgo_KS_LINE,
GEOMAlgo_KS_DEGENERATED, GEOMAlgo_KS_DEGENERATED,
//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f
GEOMAlgo_KS_BSPLINE GEOMAlgo_KS_BSPLINE
//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t
}; };
#ifndef _Standard_PrimitiveTypes_HeaderFile #ifndef _Standard_PrimitiveTypes_HeaderFile

View File

@ -29,6 +29,8 @@ static
void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB); void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB);
static static
void DumpKindOfName(const GEOMAlgo_KindOfName aKS); void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
static
void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD);
static static
void DumpPosition(const gp_Ax3& aAx3); void DumpPosition(const gp_Ax3& aAx3);
static static
@ -69,6 +71,7 @@ static
myKindOfBounds=GEOMAlgo_KB_UNKNOWN; myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
myKindOfClosed=GEOMAlgo_KC_UNKNOWN; myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
myKindOfName=GEOMAlgo_KN_UNKNOWN; myKindOfName=GEOMAlgo_KN_UNKNOWN;
myKindOfDef=GEOMAlgo_KD_UNKNOWN;
// //
myLocation.SetCoord(99., 99., 99.); myLocation.SetCoord(99., 99., 99.);
myDirection.SetCoord(1.,0.,0.); myDirection.SetCoord(1.,0.,0.);
@ -113,7 +116,8 @@ static
//function : NbSubShapes //function : NbSubShapes
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes
(const TopAbs_ShapeEnum aType) const
{ {
Standard_Integer iN; Standard_Integer iN;
@ -188,6 +192,22 @@ static
return myKindOfClosed; return myKindOfClosed;
} }
//======================================================================= //=======================================================================
//function : SetKindOfDef
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfo::SetKindOfDef(const GEOMAlgo_KindOfDef aT)
{
myKindOfDef=aT;
}
//=======================================================================
//function : KindOfDef
//purpose :
//=======================================================================
GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const
{
return myKindOfDef;
}
//=======================================================================
//function : SetLocation //function : SetLocation
//purpose : //purpose :
//======================================================================= //=======================================================================
@ -479,7 +499,6 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
DumpKindOfBounds(aKB); DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC); DumpKindOfClosed(aKC);
} }
//======================================================================= //=======================================================================
//function : DumpSolid //function : DumpSolid
//purpose : //purpose :
@ -545,7 +564,6 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
printf(" Height : %.3lf\n", myHeight); printf(" Height : %.3lf\n", myHeight);
} }
} }
//======================================================================= //=======================================================================
//function : DumpFace //function : DumpFace
//purpose : //purpose :
@ -557,6 +575,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
GEOMAlgo_KindOfName aKN; GEOMAlgo_KindOfName aKN;
GEOMAlgo_KindOfBounds aKB; GEOMAlgo_KindOfBounds aKB;
GEOMAlgo_KindOfClosed aKC; GEOMAlgo_KindOfClosed aKC;
GEOMAlgo_KindOfDef aKD;
// //
aNbV=NbSubShapes(TopAbs_VERTEX); aNbV=NbSubShapes(TopAbs_VERTEX);
aNbE=NbSubShapes(TopAbs_EDGE); aNbE=NbSubShapes(TopAbs_EDGE);
@ -564,6 +583,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
aKN=KindOfName(); aKN=KindOfName();
aKB=KindOfBounds(); aKB=KindOfBounds();
aKC=KindOfClosed(); aKC=KindOfClosed();
aKD=KindOfDef();
// //
printf(" *FACE\n"); printf(" *FACE\n");
printf(" number of vertices: %d\n", aNbV); printf(" number of vertices: %d\n", aNbV);
@ -572,6 +592,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
DumpKindOfName (aKN); DumpKindOfName (aKN);
DumpKindOfBounds(aKB); DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC); DumpKindOfClosed(aKC);
DumpKindOfDef(aKD);
// //
// PLANE // PLANE
if (aKN==GEOMAlgo_KN_PLANE) { if (aKN==GEOMAlgo_KN_PLANE) {
@ -881,10 +902,27 @@ void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
"KN_RECTANGLE", "KN_RECTANGLE",
"KN_TRIANGLE", "KN_TRIANGLE",
"KN_QUADRANGLE", "KN_QUADRANGLE",
"KN_ARCELLIPSE" "KN_ARCELLIPSE",
"KN_SOLID"
}; };
int i; int i;
// //
i=(Standard_Integer)aKS; i=(Standard_Integer)aKS;
printf(" KindOfName : %s\n", pStr[i]); printf(" KindOfName : %s\n", pStr[i]);
} }
//=======================================================================
//function : DumpKindOfDef
//purpose :
//=======================================================================
void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD)
{
const char *pStr[]={
"KD_UNKNOWN",
"KD_SPECIFIED",
"KB_ARBITRARY"
};
int i;
//
i=(Standard_Integer)aKD;
printf(" KindOfDef: %s\n", pStr[i]);
}

View File

@ -37,6 +37,7 @@
#include <GEOMAlgo_KindOfName.hxx> #include <GEOMAlgo_KindOfName.hxx>
#include <GEOMAlgo_KindOfBounds.hxx> #include <GEOMAlgo_KindOfBounds.hxx>
#include <GEOMAlgo_KindOfClosed.hxx> #include <GEOMAlgo_KindOfClosed.hxx>
#include <GEOMAlgo_KindOfDef.hxx>
//======================================================================= //=======================================================================
@ -62,7 +63,8 @@ class GEOMAlgo_ShapeInfo
TopAbs_ShapeEnum Type() const; TopAbs_ShapeEnum Type() const;
Standard_EXPORT Standard_EXPORT
void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ; void SetNbSubShapes(const TopAbs_ShapeEnum aType,
const Standard_Integer aNb) ;
Standard_EXPORT Standard_EXPORT
Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const; Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const;
@ -91,6 +93,12 @@ class GEOMAlgo_ShapeInfo
Standard_EXPORT Standard_EXPORT
GEOMAlgo_KindOfClosed KindOfClosed() const; GEOMAlgo_KindOfClosed KindOfClosed() const;
Standard_EXPORT
void SetKindOfDef(const GEOMAlgo_KindOfDef aT) ;
Standard_EXPORT
GEOMAlgo_KindOfDef KindOfDef() const;
Standard_EXPORT Standard_EXPORT
void SetLocation(const gp_Pnt& aP) ; void SetLocation(const gp_Pnt& aP) ;
@ -189,6 +197,7 @@ class GEOMAlgo_ShapeInfo
GEOMAlgo_KindOfName myKindOfName; GEOMAlgo_KindOfName myKindOfName;
GEOMAlgo_KindOfBounds myKindOfBounds; GEOMAlgo_KindOfBounds myKindOfBounds;
GEOMAlgo_KindOfClosed myKindOfClosed; GEOMAlgo_KindOfClosed myKindOfClosed;
GEOMAlgo_KindOfDef myKindOfDef;
gp_Pnt myLocation; gp_Pnt myLocation;
gp_Dir myDirection; gp_Dir myDirection;
gp_Ax3 myPosition; gp_Ax3 myPosition;

View File

@ -116,7 +116,8 @@
//function : Info //function : Info
//purpose : //purpose :
//======================================================================= //=======================================================================
const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info
(const TopoDS_Shape& aS) const
{ {
if (!aS.IsNull()) { if (!aS.IsNull()) {
if (myMapInfo.Contains(aS)) { if (myMapInfo.Contains(aS)) {
@ -260,7 +261,6 @@
//======================================================================= //=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS)
{ {
Standard_Integer aNbShells;
TopoDS_Solid aSd; TopoDS_Solid aSd;
// //
myErrorStatus=0; myErrorStatus=0;
@ -280,11 +280,6 @@
// //
aSd=TopoDS::Solid(aS); aSd=TopoDS::Solid(aS);
// //
aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
if (aNbShells>1) {
return;
}
//
FillDetails(aSd); FillDetails(aSd);
} }
//======================================================================= //=======================================================================
@ -294,26 +289,23 @@
void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS)
{ {
myErrorStatus=0; myErrorStatus=0;
if (myMapInfo.Contains(aS)) {
return;
}
// //
Standard_Boolean bIsAllowedType; Standard_Boolean bIsAllowedType;
Standard_Integer aNbWires;//, iRet
Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2; Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2;
Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2; Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2, dV;
gp_Pnt aP0; gp_Pnt aP0;
gp_Dir aDN; gp_Dir aDN;
gp_Ax3 aAx3; gp_Ax3 aAx3;
GeomAbs_SurfaceType aST; GeomAbs_SurfaceType aST;
Handle(Geom_Surface) aSurf; Handle(Geom_Surface) aSurf;
TopoDS_Face aF; TopoDS_Face aF;
//GEOMAlgo_KindOfName aKindOfName;
//---------------------------------------------------- //----------------------------------------------------
if (myMapInfo.Contains(aS)) {
return;
}
else {
GEOMAlgo_ShapeInfo aInfoX; GEOMAlgo_ShapeInfo aInfoX;
myMapInfo.Add(aS, aInfoX); myMapInfo.Add(aS, aInfoX);
} //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
//---------------------------------------------------- //----------------------------------------------------
aInfo.SetType(TopAbs_FACE); aInfo.SetType(TopAbs_FACE);
@ -324,8 +316,6 @@
// //
aF=TopoDS::Face(aS); aF=TopoDS::Face(aS);
// //
aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF);
//
aSurf=BRep_Tool::Surface(aF); aSurf=BRep_Tool::Surface(aF);
GeomAdaptor_Surface aGAS(aSurf); GeomAdaptor_Surface aGAS(aSurf);
aST=aGAS.GetType(); aST=aGAS.GetType();
@ -334,6 +324,7 @@
return; return;
} }
// //
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 1. Plane // 1. Plane
if (aST==GeomAbs_Plane) { if (aST==GeomAbs_Plane) {
gp_Pln aPln; gp_Pln aPln;
@ -343,15 +334,11 @@
aAx3=aPln.Position(); aAx3=aPln.Position();
// //
aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE); aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE);
aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
aInfo.SetLocation(aP0); aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
// //
if (aNbWires>1) {
return;
}
//
//aSurf->Bounds(aUMin, aUMax, aVMin, aVMax);
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin); bInfU1=Precision::IsNegativeInfinite(aUMin);
bInfU2=Precision::IsPositiveInfinite(aUMax); bInfU2=Precision::IsPositiveInfinite(aUMax);
@ -361,14 +348,15 @@
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) { if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
return;
} }
else { //
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
}
// //
FillDetails(aF, aPln); FillDetails(aF, aPln);
}// if (aCT==GeomAbs_Line) { }// if (aCT==GeomAbs_Line) {
// //
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 2. Sphere // 2. Sphere
else if (aST==GeomAbs_Sphere) { else if (aST==GeomAbs_Sphere) {
gp_Sphere aSphere; gp_Sphere aSphere;
@ -379,20 +367,18 @@
aR1=aSphere.Radius(); aR1=aSphere.Radius();
// //
aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE); aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE);
aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
aInfo.SetLocation(aP0); aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1); aInfo.SetRadius1(aR1);
// //
if (aNbWires>1) {
return;
}
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
// //
FillDetails(aF, aSphere); FillDetails(aF, aSphere);
}// else if (aST==GeomAbs_Sphere) { }// else if (aST==GeomAbs_Sphere) {
// //
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 3. Cylinder // 3. Cylinder
else if (aST==GeomAbs_Cylinder) { else if (aST==GeomAbs_Cylinder) {
gp_Cylinder aCyl; gp_Cylinder aCyl;
@ -403,14 +389,11 @@
aR1=aCyl.Radius(); aR1=aCyl.Radius();
// //
aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER); aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER);
aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
aInfo.SetLocation(aP0); aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1); aInfo.SetRadius1(aR1);
// //
if (aNbWires>1) {
return;
}
//
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin); bInfU1=Precision::IsNegativeInfinite(aUMin);
bInfU2=Precision::IsPositiveInfinite(aUMax); bInfU2=Precision::IsPositiveInfinite(aUMax);
@ -420,30 +403,31 @@
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) { if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
return;
} }
else { //
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
} //
dV=aVMax-aVMin;
aInfo.SetHeight(dV);
//
FillDetails(aF, aCyl); FillDetails(aF, aCyl);
} }
// //
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 4. Cone // 4. Cone
else if (aST==GeomAbs_Cone) { else if (aST==GeomAbs_Cone) {
Standard_Real aSemiAngle;
gp_Cone aCone; gp_Cone aCone;
// //
aCone=aGAS.Cone(); aCone=aGAS.Cone();
aP0=aCone.Location(); aP0=aCone.Location();
aAx3=aCone.Position(); aAx3=aCone.Position();
//aR1=aCyl.Radius();
// //
aInfo.SetKindOfShape(GEOMAlgo_KS_CONE); aInfo.SetKindOfShape(GEOMAlgo_KS_CONE);
aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
aInfo.SetLocation(aP0); aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
//aInfo.SetRadius1(aR1);
//
if (aNbWires>1) {
return;
}
// //
BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
bInfU1=Precision::IsNegativeInfinite(aUMin); bInfU1=Precision::IsNegativeInfinite(aUMin);
@ -454,13 +438,20 @@
bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
if (bInf) { if (bInf) {
aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
return;
} }
else { //
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
} //
aSemiAngle=fabs(aCone.SemiAngle());
dV=(aVMax-aVMin)*cos(aSemiAngle);
aInfo.SetHeight(dV);
//
FillDetails(aF, aCone); FillDetails(aF, aCone);
} }
// //
//||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 5. Torus // 5. Torus
else if (aST==GeomAbs_Torus) { else if (aST==GeomAbs_Torus) {
gp_Torus aTorus; gp_Torus aTorus;
@ -472,15 +463,12 @@
aR2=aTorus.MinorRadius(); aR2=aTorus.MinorRadius();
// //
aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS); aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS);
aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
aInfo.SetLocation(aP0); aInfo.SetLocation(aP0);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
aInfo.SetRadius1(aR1); aInfo.SetRadius1(aR1);
aInfo.SetRadius2(aR2); aInfo.SetRadius2(aR2);
// //
if (aNbWires>1) {
return;
}
//
aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
// //
FillDetails(aF, aTorus); FillDetails(aF, aTorus);
@ -535,7 +523,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
FillSubShapes(aS); FillSubShapes(aS);
return; return;
} }
//modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f
// BSplineCurve // BSplineCurve
if (aCT==GeomAbs_BSplineCurve) { if (aCT==GeomAbs_BSplineCurve) {
Standard_Integer aNbKnots, aNbPoles, aDegree; Standard_Integer aNbKnots, aNbPoles, aDegree;
@ -577,7 +564,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
aInfo.SetDirection(aDir); aInfo.SetDirection(aDir);
} }
} }
//modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
// Line // Line
else if (aCT==GeomAbs_Line) { else if (aCT==GeomAbs_Line) {
Standard_Boolean bInf1, bInf2; Standard_Boolean bInf1, bInf2;
@ -776,7 +762,8 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
//function :NbShells //function :NbShells
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd) Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells
(const TopoDS_Solid& aSd)
{ {
Standard_Integer iCnt; Standard_Integer iCnt;
TopoDS_Iterator aIt; TopoDS_Iterator aIt;
@ -785,7 +772,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
// //
aIt.Initialize(aSd); aIt.Initialize(aSd);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
//const TopoDS_Shape& aSh=aIt.Value();
++iCnt; ++iCnt;
} }
return iCnt; return iCnt;
@ -794,7 +780,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
//function : NbWires //function : NbWires
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF) Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires
(const TopoDS_Face& aF)
{ {
Standard_Integer iCnt; Standard_Integer iCnt;
TopoDS_Iterator aIt; TopoDS_Iterator aIt;
@ -803,7 +790,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
// //
aIt.Initialize(aF); aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {
//const TopoDS_Shape& aW=aIt.Value();
++iCnt; ++iCnt;
} }
return iCnt; return iCnt;
@ -812,7 +798,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
//function : IsAllowedType //function : IsAllowedType
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT) Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
(const GeomAbs_CurveType aCT)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
Standard_Integer i, aNb; Standard_Integer i, aNb;
@ -820,7 +807,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType
GeomAbs_Line, GeomAbs_Line,
GeomAbs_Circle, GeomAbs_Circle,
GeomAbs_Ellipse, GeomAbs_Ellipse,
GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft GeomAbs_BSplineCurve
}; };
// //
bRet=Standard_False; bRet=Standard_False;
@ -834,7 +821,8 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType
//function : IsAllowedType //function : IsAllowedType
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_SurfaceType aST) Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
(const GeomAbs_SurfaceType aST)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
Standard_Integer i, aNb; Standard_Integer i, aNb;

View File

@ -68,10 +68,12 @@ static
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
{ {
Standard_Boolean bIsStepSphere; Standard_Boolean bIsStepSphere;
Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX; Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct;
Standard_Integer aNbShells, aNbCrc, aNbX;
TopoDS_Shape aFCyl, aFCon; TopoDS_Shape aFCyl, aFCon;
TopTools_IndexedMapOfShape aMF; TopTools_IndexedMapOfShape aMF;
GEOMAlgo_KindOfName aKNF; GEOMAlgo_KindOfName aKNF;
GEOMAlgo_KindOfDef aKD;
// //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd); GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
@ -83,7 +85,26 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return; return;
} }
// //
aKD=GEOMAlgo_KD_SPECIFIED;
for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) {
const TopoDS_Shape& aF=aMF(i);
GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
aKD=aInfoF.KindOfDef();
}
if (aKD!=GEOMAlgo_KD_SPECIFIED) {
aInfo.SetKindOfName(GEOMAlgo_KN_SOLID);
return;
}
//
aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
if (aNbShells>1) {
aInfo.SetKindOfName(GEOMAlgo_KN_SOLID);
return;
}
//
//
if (aNbF==1) { if (aNbF==1) {
// mb: sphere, torus
const TopoDS_Shape& aF=aMF(1); const TopoDS_Shape& aF=aMF(1);
GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
aKNF=aInfoF.KindOfName(); // mb: sphere, torus aKNF=aInfoF.KindOfName(); // mb: sphere, torus
@ -99,7 +120,6 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return; return;
} }
} }
//modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f
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);
@ -107,7 +127,6 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return; return;
} }
} }
//modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t
// //
aNbCyl=0; aNbCyl=0;
aNbCon=0; aNbCon=0;
@ -229,11 +248,9 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
const gp_Dir& aDNj=aIFj.Position().Direction(); const gp_Dir& aDNj=aIFj.Position().Direction();
// //
aDot=aDNi*aDNj; aDot=aDNi*aDNj;
//modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f
if (aDot<0.) { if (aDot<0.) {
aDot=-aDot; aDot=-aDot;
} }
//modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t
if (fabs(1.-aDot)<0.0001) { if (fabs(1.-aDot)<0.0001) {
aMp.Add(i); aMp.Add(i);
aMp.Add(j); aMp.Add(j);
@ -248,6 +265,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
return; return;
} }
// //
iMin=-1;
iMax=-1;
aDistMin=1.e15; aDistMin=1.e15;
aDistMax=-aDistMin; aDistMax=-aDistMin;
for (i=0; i<aNbFi; ++i) { for (i=0; i<aNbFi; ++i) {
@ -308,21 +327,10 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
TopTools_IndexedMapOfShape aMV; TopTools_IndexedMapOfShape aMV;
BRepTools_WireExplorer aWExp; BRepTools_WireExplorer aWExp;
GEOMAlgo_KindOfName aKN, aKNE; GEOMAlgo_KindOfName aKN, aKNE;
GEOMAlgo_KindOfShape aKS;
// //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aKN=GEOMAlgo_KN_UNKNOWN;
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
// //
aKS=aInfo.KindOfShape(); aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
if (aKS!=GEOMAlgo_KS_PLANE) {
return;
}
//
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
return;
}
// //
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE); aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
@ -330,9 +338,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
// 1. may be it is circle/ellipse // 1. may be it is circle/ellipse
if (aNbV==1 && aNbE==1) { if (aNbV==1 && aNbE==1) {
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) { if (aExp.More()) {
aE=aExp.Current(); aE=aExp.Current();
break;
} }
// //
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
@ -343,6 +350,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aInfo.SetRadius1(aInfoE.Radius1()); aInfo.SetRadius1(aInfoE.Radius1());
aInfo.SetLocation(aInfoE.Location()); aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position()); aInfo.SetPosition(aInfoE.Position());
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
} }
if (aKNE==GEOMAlgo_KN_ELLIPSE) { if (aKNE==GEOMAlgo_KN_ELLIPSE) {
aKN=GEOMAlgo_KN_DISKELLIPSE; aKN=GEOMAlgo_KN_DISKELLIPSE;
@ -351,21 +359,28 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aInfo.SetRadius2(aInfoE.Radius2()); aInfo.SetRadius2(aInfoE.Radius2());
aInfo.SetLocation(aInfoE.Location()); aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position()); aInfo.SetPosition(aInfoE.Position());
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
} }
} return;
}// if (aNbV==1 && aNbE==1) {
// //
// 2. may be it is rectangle //
else { Standard_Boolean bSegment;
//
bSegment=Standard_True;
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) { for (; aExp.More() && bSegment; aExp.Next()) {
aE=aExp.Current(); aE=aExp.Current();
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aKNE=aInfoE.KindOfName(); aKNE=aInfoE.KindOfName();
if (aKNE!=GEOMAlgo_KN_SEGMENT) { if (aKNE!=GEOMAlgo_KN_SEGMENT) {
return; bSegment=!bSegment;
} }
} }
// //
if (bSegment) {
// 2. may be it is TRIANGLE, POLYGON, QUADRANGLE, RECTANGLE
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON); aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
// //
if (aNbV==3 && aNbE==3) { if (aNbV==3 && aNbE==3) {
@ -393,19 +408,12 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
// //
aInfo.SetLocation(aPc); aInfo.SetLocation(aPc);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
} // if (aNbV==3 && aNbE==3) {
// //
return; if (aNbV==4 && aNbE==4) {
}
//
if (!(aNbV==4 && aNbE==4)) {
return;
}
//
// aNbV==4 && aNbE==4 and all edges are segments
aIt.Initialize(aF); aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()){ if (aIt.More()) {
aW=TopoDS::Wire(aIt.Value()); aW=*((TopoDS_Wire*)&aIt.Value());
break;
} }
// //
aWExp.Init(aW, aF); aWExp.Init(aW, aF);
@ -471,37 +479,33 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
gp_Ax2 aAx2(aPc, aDZ, aDX); gp_Ax2 aAx2(aPc, aDZ, aDX);
gp_Ax3 aAx3(aAx2); gp_Ax3 aAx3(aAx2);
aInfo.SetPosition(aAx3); aInfo.SetPosition(aAx3);
} //
}// if (aNbV==4 && aNbE==4) {
return; return;
}// if (bSegment) {
//
//aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
} }
//======================================================================= //=======================================================================
//function : FillDetails //function : FillDetails
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Sphere& ) const gp_Sphere& )//aSph)
{ {
Standard_Integer aNbV, aNbE, aNbSE, aNbDE; Standard_Integer aNbV, aNbE, aNbSE, aNbDE;
TopoDS_Edge aE; TopoDS_Edge aE;
TopExp_Explorer aExp; TopExp_Explorer aExp;
TopTools_MapOfShape aM; TopTools_MapOfShape aM;
GEOMAlgo_KindOfShape aKS, aKSE; GEOMAlgo_KindOfShape aKSE;//, aKSE;
// //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_SPHERE) {
return;
}
// //
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE); aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==2 && aNbE==3)) { if (aNbV==2 && aNbE==3) {
return;
}
//
aNbSE=0; aNbSE=0;
aNbDE=0; aNbDE=0;
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
@ -520,49 +524,110 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
} }
} }
// //
if (!(aNbSE==1 && aNbDE==2)) { if (aNbSE==1 && aNbDE==2) {
return; aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
} }
aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
} }
//======================================================================= //=======================================================================
//function : FillDetails //function : FillDetails
//purpose : //purpose :
//======================================================================= //=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Cone& )//aCone) const gp_Cylinder& aCyl)
{
Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
Standard_Real aT0, aT1, aHeight;
gp_Pnt aPC[3], aPc;
TopoDS_Edge aE;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
GEOMAlgo_KindOfName aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
//
aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (aNbV==2 && aNbE==3) {
const gp_Ax1& aAx1=aCyl.Axis();
const gp_Dir& aDir=aAx1.Direction();
const gp_Pnt& aPLoc=aAx1.Location();
//
i=0;
aNbCE=0;
aNbSE=0;
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
aE=TopoDS::Edge(aExp.Current());
if(aM.Add(aE)) {
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aKNE=aInfoE.KindOfName();
aKCE=aInfoE.KindOfClosed();
if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
aPC[aNbCE]=aInfoE.Location();
++aNbCE;
}
else if (aKNE==GEOMAlgo_KN_SEGMENT) {
if (BRep_Tool::IsClosed(aE, aF)) {
++aNbSE;
}
}
}
}
//
if (aNbCE==2 && aNbSE==1) {
gp_Lin aLin(aPLoc, aDir);
//
aT0=ElCLib::Parameter(aLin, aPC[0]);
aT1=ElCLib::Parameter(aLin, aPC[1]);
//
aPc=aPC[0];
if (aT0>aT1) {
aPc=aPC[1];
}
aHeight=aPC[0].Distance(aPC[1]);
//
gp_Ax3 aAx3=aCyl.Position();
aAx3.SetLocation(aPc);
//
aInfo.SetPosition(aAx3);
aInfo.SetLocation(aPc);
aInfo.SetHeight(aHeight);
//
aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
return; // conventional cylinder
}//if (aNbCE==2 && aNbSE==1) {
}//if (aNbV==2 && aNbE==3) {
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Cone& aCone)
{ {
Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i; Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
Standard_Real aR[3], aHeight; Standard_Real aR[3], aHeight, aRmin, aRmax;
gp_Pnt aPC[3], aPD, aPc, aPX[3]; gp_Pnt aPC[3], aPD, aPc, aPX[3];
TopoDS_Vertex aVD; TopoDS_Vertex aVD;
TopoDS_Edge aE; TopoDS_Edge aE;
TopoDS_Iterator aIt; TopoDS_Iterator aIt;
TopExp_Explorer aExp; TopExp_Explorer aExp;
TopTools_MapOfShape aM; TopTools_MapOfShape aM;
GEOMAlgo_KindOfShape aKS, aKSE; GEOMAlgo_KindOfShape aKSE;
GEOMAlgo_KindOfName aKN, aKNE; GEOMAlgo_KindOfName aKNE;
GEOMAlgo_KindOfClosed aKCE; GEOMAlgo_KindOfClosed aKCE;
// //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aKN=GEOMAlgo_KN_UNKNOWN;
aInfo.SetKindOfName(aKN);
// //
aKS=aInfo.KindOfShape(); aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
if (aKS!=GEOMAlgo_KS_CONE) {
return;
}
//
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
return;
}
// //
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE); aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==2 && aNbE==3)) { if (aNbV==2 && aNbE==3) {
return;
}
//
i=0; i=0;
aNbCE=0; aNbCE=0;
aNbSE=0; aNbSE=0;
@ -580,9 +645,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aR[i]=aInfoE.Radius1(); aR[i]=aInfoE.Radius1();
// //
aIt.Initialize(aE); aIt.Initialize(aE);
for (; aIt.More(); aIt.Next()) { if (aIt.More()) {
aVD=TopoDS::Vertex(aIt.Value()); aVD=*((TopoDS_Vertex*)&aIt.Value());
break;
} }
aPX[i]=BRep_Tool::Pnt(aVD); aPX[i]=BRep_Tool::Pnt(aVD);
// //
@ -596,9 +660,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
} }
else if (aKSE==GEOMAlgo_KS_DEGENERATED) { else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
aIt.Initialize(aE); aIt.Initialize(aE);
for (; aIt.More(); aIt.Next()) { if (aIt.More()) {
aVD=TopoDS::Vertex(aIt.Value()); aVD=*((TopoDS_Vertex*)&aIt.Value());
break;
} }
// //
aPD=BRep_Tool::Pnt(aVD); aPD=BRep_Tool::Pnt(aVD);
@ -608,10 +671,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
} }
} }
// //
if (!((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1)) { if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) {
return;
}
//
if (aNbDE==1) { if (aNbDE==1) {
aPC[1]=aPD; aPC[1]=aPD;
aR[1]=0.; aR[1]=0.;
@ -619,7 +679,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
// //
aHeight=aPC[0].Distance(aPC[1]); aHeight=aPC[0].Distance(aPC[1]);
// //
Standard_Real aRmin, aRmax;
gp_Ax2 aAx2new; gp_Ax2 aAx2new;
// //
if (aR[0]>aR[1]) { if (aR[0]>aR[1]) {
@ -652,93 +712,16 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
aInfo.SetRadius2(aRmin); aInfo.SetRadius2(aRmin);
aInfo.SetHeight(aHeight); aInfo.SetHeight(aHeight);
// //
aInfo.SetKindOfName(GEOMAlgo_KN_CONE); aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
//=======================================================================
//function : FillDetails
//purpose :
//=======================================================================
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Cylinder& aCyl)
{
Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
Standard_Real aT0, aT1, aHeight;
gp_Pnt aPC[3], aPc;
TopoDS_Edge aE;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
GEOMAlgo_KindOfShape aKS;
GEOMAlgo_KindOfName aKN, aKNE;
GEOMAlgo_KindOfClosed aKCE;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aKN=GEOMAlgo_KN_UNKNOWN;
aInfo.SetKindOfName(aKN);
//
aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_CYLINDER) {
return; return;
} }//if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) {
}//if (aNbV==2 && aNbE==3) {
// //
if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) { aInfo.SetRadius1 (aCone.RefRadius());
return;
}
// //
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aRmin=0.; // ZZ
aNbE=aInfo.NbSubShapes(TopAbs_EDGE); aInfo.SetRadius2(aRmin);
if (!(aNbV==2 && aNbE==3)) {
return;
} }
//
i=0;
aNbCE=0;
aNbSE=0;
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
aE=TopoDS::Edge(aExp.Current());
if(aM.Add(aE)) {
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aKNE=aInfoE.KindOfName();
aKCE=aInfoE.KindOfClosed();
if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
aPC[aNbCE]=aInfoE.Location();
++aNbCE;
}
else if (aKNE==GEOMAlgo_KN_SEGMENT) {
if (BRep_Tool::IsClosed(aE, aF)) {
++aNbSE;
}
}
}
}
//
if (!(aNbCE==2 && aNbSE==1)) {
return;
}
//
const gp_Ax1& aAx1=aCyl.Axis();
const gp_Dir& aDir=aAx1.Direction();
const gp_Pnt& aPLoc=aAx1.Location();
gp_Lin aLin(aPLoc, aDir);
//
aT0=ElCLib::Parameter(aLin, aPC[0]);
aT1=ElCLib::Parameter(aLin, aPC[1]);
//
aPc=aPC[0];;
if (aT0>aT1) {
aPc=aPC[1];
}
aHeight=aPC[0].Distance(aPC[1]);
//
gp_Ax3 aAx3=aCyl.Position();
aAx3.SetLocation(aPc);
//
aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
aInfo.SetPosition(aAx3);
aInfo.SetLocation(aPc);
aInfo.SetHeight(aHeight);
}
//======================================================================= //=======================================================================
//function : FillDetails //function : FillDetails
//purpose : //purpose :
@ -746,6 +729,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Torus& ) const gp_Torus& )
{ {
Standard_Integer aNbV, aNbE, aNbSE; Standard_Integer aNbV, aNbE, aNbSE;
TopoDS_Edge aE; TopoDS_Edge aE;
TopExp_Explorer aExp; TopExp_Explorer aExp;
@ -753,19 +737,17 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
GEOMAlgo_KindOfShape aKS; GEOMAlgo_KindOfShape aKS;
// //
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
// //
aKS=aInfo.KindOfShape(); aKS=aInfo.KindOfShape();
if (aKS!=GEOMAlgo_KS_TORUS) { if (aKS!=GEOMAlgo_KS_TORUS) {
return; return;
} }
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE); aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
if (!(aNbV==1 && aNbE==2)) {
return; if (aNbV==1 && aNbE==2) {
}
//
aNbSE=0; aNbSE=0;
aExp.Init(aF, TopAbs_EDGE); aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) { for (; aExp.More(); aExp.Next()) {
@ -777,18 +759,17 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
} }
} }
// //
if (aNbSE!=2) { if (aNbSE==2) {
return; aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
} }
aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
} }
//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f
//======================================================================= //=======================================================================
//function : TreatStepSphere //function : TreatStepSphere
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere
GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd) (const TopoDS_Solid& aSd)
{ {
Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual; Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
Standard_Integer j; Standard_Integer j;
@ -899,4 +880,3 @@ Standard_Boolean IsEqual(const gp_Sphere& aSp1,
// //
return bRet; return bRet;
} }
//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t

View File

@ -245,7 +245,7 @@ void GEOMAlgo_ShellSolid::Perform()
const BOPDS_IndexRange& aRange=pDS->Range(iRank); const BOPDS_IndexRange& aRange=pDS->Range(iRank);
aRange.Indices(iBeg, iEnd); aRange.Indices(iBeg, iEnd);
const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj); const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
// //
//------------------------------ShellSolidBuilder //------------------------------ShellSolidBuilder
GEOMAlgo_ShellSolidBuilder aSSB; GEOMAlgo_ShellSolidBuilder aSSB;

2
src/GEOMAlgo/GEOMAlgo_Splitter.cxx Executable file → Normal file
View File

@ -301,7 +301,7 @@ void TreatCompound(const TopoDS_Shape& aC1,
TopoDS_Iterator aItC; TopoDS_Iterator aItC;
// //
aLC.Append (aC1); aLC.Append (aC1);
while(1) { for(;;) {
aLC1.Clear(); aLC1.Clear();
aIt.Initialize(aLC); aIt.Initialize(aLC);
for (; aIt.More(); aIt.Next()) { for (; aIt.More(); aIt.Next()) {

View File

@ -48,7 +48,8 @@
//function : GetState //function : GetState
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, Standard_Integer GEOMAlgo_SurfaceTools::GetState
(const gp_Pnt& aP,
const GeomAdaptor_Surface& aGAS, const GeomAdaptor_Surface& aGAS,
const Standard_Real aTol, const Standard_Real aTol,
TopAbs_State& aState) TopAbs_State& aState)
@ -95,7 +96,8 @@
//function : GetState //function : GetState
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, Standard_Integer GEOMAlgo_SurfaceTools::GetState
(const gp_Pnt& aP,
const Handle(Geom_Surface)& aSurf, const Handle(Geom_Surface)& aSurf,
const Standard_Real aTol, const Standard_Real aTol,
TopAbs_State& aState) TopAbs_State& aState)
@ -114,7 +116,8 @@
//function : ReverseState //function : ReverseState
//purpose : //purpose :
//======================================================================= //=======================================================================
TopAbs_State GEOMAlgo_SurfaceTools::ReverseState(const TopAbs_State aState) TopAbs_State GEOMAlgo_SurfaceTools::ReverseState
(const TopAbs_State aState)
{ {
TopAbs_State aRSt=aState; TopAbs_State aRSt=aState;
// //
@ -135,7 +138,8 @@
//function : IsCoaxial //function : IsCoaxial
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial
(const gp_Pnt& aP1,
const gp_Pnt& aP2, const gp_Pnt& aP2,
const gp_Cylinder& aCyl, const gp_Cylinder& aCyl,
const Standard_Real aTol) const Standard_Real aTol)
@ -147,7 +151,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
gp_XYZ aDP2 = aP2.XYZ().Subtracted(aLoc); gp_XYZ aDP2 = aP2.XYZ().Subtracted(aLoc);
Standard_Real aDot1 = aDP1.Dot(aDAxis); Standard_Real aDot1 = aDP1.Dot(aDAxis);
Standard_Real aDot2 = aDP1.Dot(aDAxis); Standard_Real aDot2 = aDP1.Dot(aDAxis);
Standard_Real aTol2 = aTol*aTol; //Standard_Real aTol2 = aTol*aTol;
// Project P1 and P2 onto a plane with location aLoc and Norm aDAxis. // Project P1 and P2 onto a plane with location aLoc and Norm aDAxis.
aDP1.Subtract(aDAxis.Multiplied(aDot1)); aDP1.Subtract(aDAxis.Multiplied(aDot1));
@ -160,7 +164,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
if (fabs(aRadius1 - aRadius2) <= aTol) { if (fabs(aRadius1 - aRadius2) <= aTol) {
// Check the deflection of the middle point. // Check the deflection of the middle point.
gp_XYZ aMidP = 0.5*(aDP1 + aDP2); gp_XYZ aMidP = 0.5*(aDP1 + aDP2);
Standard_Real aMidRadius1 = aMidP.Modulus(); //Standard_Real aMidRadius1 = aMidP.Modulus();
if (fabs(aRadius1 - aRadius2) <= aTol) { if (fabs(aRadius1 - aRadius2) <= aTol) {
isOn = Standard_True; isOn = Standard_True;
@ -173,7 +177,8 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
//function : IsAnalytic //function : IsAnalytic
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf) Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic
(const Handle(Geom_Surface)& aSurf)
{ {
Standard_Boolean bRet; Standard_Boolean bRet;
GeomAbs_SurfaceType aType; GeomAbs_SurfaceType aType;
@ -190,7 +195,8 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& a
//function : IsConformState //function : IsConformState
//purpose : //purpose :
//======================================================================= //=======================================================================
Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1, Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState
(const TopAbs_State aST1,
const GEOMAlgo_State aST2) const GEOMAlgo_State aST2)
{ {
Standard_Boolean bRet=Standard_False; Standard_Boolean bRet=Standard_False;