// Created on: 1996-03-07 // Created by: Jean Yves LEBEY // Copyright (c) 1996-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef OCCT_DEBUG Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextEINTERNAL(); Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextEEXTERNAL(); Standard_EXPORT Standard_Boolean TopOpeBRepBuild_GetcontextNOSG(); Standard_EXPORT void debON(const Standard_Integer iF) {cout<<"++ debON "<GdumpSHASTA(iEG,TopAbs_ON,*PWES,str); debfillonfemess(iFOR,iEG); } Standard_EXPORT void debaddpwes(const Standard_Integer iFOR,const TopAbs_State TB1,const Standard_Integer iEG,const TopAbs_Orientation neworiE,const TopOpeBRepBuild_PBuilder& PB,const TopOpeBRepBuild_PWireEdgeSet& PWES,const TCollection_AsciiString& str1,const TCollection_AsciiString& str2) {PB->GdumpSHASTA(iFOR,TB1,*PWES,str1,str2);cout< + eONF"< + eONR"< + eONI"< + eONE"< CurvesSameOriented NYI for E !line //Standard_IMPORT Standard_Boolean TopOpeBRepBuild_FUN_aresamegeom(const TopoDS_Shape& S1,const TopoDS_Shape& S2); //======================================================================= //function : TopOpeBRepBuild_BuilderON //purpose : //======================================================================= TopOpeBRepBuild_BuilderON::TopOpeBRepBuild_BuilderON() { } //======================================================================= //function : TopOpeBRepBuild_BuilderON //purpose : //======================================================================= TopOpeBRepBuild_BuilderON::TopOpeBRepBuild_BuilderON(const TopOpeBRepBuild_PBuilder& PB, const TopoDS_Shape& FOR,const TopOpeBRepBuild_PGTopo& PG, const TopOpeBRepTool_Plos& PLSclass, const TopOpeBRepBuild_PWireEdgeSet& PWES) { Perform(PB,FOR,PG,PLSclass,PWES); } //======================================================================= //function : Perform //purpose : //======================================================================= void TopOpeBRepBuild_BuilderON::Perform(const TopOpeBRepBuild_PBuilder& PB,const TopoDS_Shape& FOR,const TopOpeBRepBuild_PGTopo& PG, const TopOpeBRepTool_Plos& PLSclass, const TopOpeBRepBuild_PWireEdgeSet& PWES) { myPB = PB; myFace = FOR; myPG = PG; myPLSclass = PLSclass; myPWES = PWES; #ifdef OCCT_DEBUG Standard_Integer iFOR;Standard_Boolean tFOR=myPB->GtraceSPS(FOR,iFOR); if (tFOR) debfillonf(iFOR); #endif const TopOpeBRepDS_DataStructure& BDS=myPB->DataStructure()->DS(); const TopOpeBRepDS_ListOfInterference& LI=BDS.ShapeInterferences(myFace); for (TopOpeBRepDS_ListIteratorOfListOfInterference ILI(LI);ILI.More();ILI.Next() ) { const Handle(TopOpeBRepDS_Interference)& I=ILI.Value(); GFillONPartsWES1(I); } } //======================================================================= //function : GFillONCheckI //purpose : //======================================================================= Standard_Boolean TopOpeBRepBuild_BuilderON::GFillONCheckI(const Handle(TopOpeBRepDS_Interference)& I) const { const TopOpeBRepDS_DataStructure& BDS=myPB->DataStructure()->DS(); Handle(TopOpeBRepDS_ShapeShapeInterference) SSI=Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I); if (SSI.IsNull()) return Standard_False; TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); if (GT != TopOpeBRepDS_EDGE || ST != TopOpeBRepDS_FACE) return Standard_False; #ifdef OCCT_DEBUG // Standard_Integer iFOR=BDS.Shape(myFace); #endif const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI, Standard_False)); #ifdef OCCT_DEBUG // Standard_Integer iEG=BDS.Shape(EG, Standard_False); #endif const TopoDS_Shape& FS=BDS.Shape(SI, Standard_False); #ifdef OCCT_DEBUG // Standard_Integer iFS=BDS.Shape(FS, Standard_False); #endif TopAbs_ShapeEnum ShapeInterf=TopAbs_FACE; const TopOpeBRepDS_Transition& TFE=SSI->Transition(); TopAbs_ShapeEnum shab=TFE.ShapeBefore(),shaa=TFE.ShapeAfter(); if (shaa != ShapeInterf || shab != ShapeInterf) return Standard_False; Standard_Boolean isrest=BDS.IsSectionEdge(EG); Standard_Boolean issplit=myPB->IsSplit(EG,TopAbs_ON); Standard_Boolean keep=(isrest && issplit); if ( !keep ) return Standard_False; const TopTools_ListOfShape& lEspON=myPB->Splits(EG,TopAbs_ON); if (lEspON.Extent() == 0) return Standard_False; #ifdef OCCT_DEBUG // const TopoDS_Shape& EspON=lEspON.First(); #endif Standard_Integer rankFS=myPB->GShapeRank(FS); Standard_Integer rankFOR=myPB->GShapeRank(myFace); if (rankFS == 0 || rankFOR == 0) return Standard_False; return Standard_True; } // GFillONCheckI //======================================================================= //function : GFillONPartsWES1 //purpose : //======================================================================= void TopOpeBRepBuild_BuilderON::GFillONPartsWES1(const Handle(TopOpeBRepDS_Interference)& I) { const TopOpeBRepDS_DataStructure& BDS=myPB->DataStructure()->DS(); #ifdef OCCT_DEBUG Standard_Integer iFOR= #endif BDS.Shape(myFace); TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(I,GT,GI,ST,SI); Standard_Boolean Iok=GFillONCheckI(I); if (!Iok) return; const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI)); // const TopoDS_Shape& FS=BDS.Shape(SI); #ifdef OCCT_DEBUG // Standard_Integer iEG=BDS.Shape(EG); // Standard_Integer iFS=BDS.Shape(FS); #endif #ifdef OCCT_DEBUG Standard_Boolean tEFOR=DEBTEFOR(*myPB,iFOR,GI); if (tEFOR) debfillonfemess(iFOR,GI,myPB,myPWES,"--- GFillONPartsWES1"); #endif const TopTools_ListOfShape& lEspON=myPB->Splits(EG,TopAbs_ON); #ifdef OCCT_DEBUG // Standard_Integer nEspON=lEspON.Extent(); #endif for(TopTools_ListIteratorOfListOfShape it(lEspON);it.More();it.Next()) { const TopoDS_Shape& EspON=it.Value(); GFillONPartsWES2(I,EspON); } } // GFillONPartsWES1 #ifdef OCCT_DEBUG Standard_EXPORT void FUN_coutmess(const TCollection_AsciiString& m) { cout<Opefus(); Standard_Boolean opec12 = PB->Opec12(); Standard_Boolean opec21 = PB->Opec21(); Standard_Boolean opeCom = PB->Opecom(); TopAbs_State sta = TopAbs_UNKNOWN; if (opeFus) sta = TopAbs_OUT; if (opeCom) sta = TopAbs_IN; if (opec12) sta = (rank == 1) ? TopAbs_OUT : TopAbs_IN; if (opec21) sta = (rank == 2) ? TopAbs_OUT : TopAbs_IN; return sta; } static Standard_Boolean FUN_Kpart0(const GeomAbs_SurfaceType& ST1, const GeomAbs_SurfaceType& ST2) { Standard_Boolean plane1 = (ST1 == GeomAbs_Plane); Standard_Boolean cyli1 = (ST1 == GeomAbs_Cylinder); Standard_Boolean cone1 = (ST1 == GeomAbs_Cone); Standard_Boolean cyli2 = (ST2 == GeomAbs_Cylinder); Standard_Boolean cone2 = (ST2 == GeomAbs_Cone); Standard_Boolean sphe2 = (ST2 == GeomAbs_Sphere); Standard_Boolean quad2 = cyli2 || cone2 || sphe2 || (ST2 == GeomAbs_Torus); if (plane1 && quad2) return Standard_True; if (cyli1 && sphe2) return Standard_True; if (cone1 && sphe2) return Standard_True; return Standard_False; } static Standard_Integer FUN_Kpart(const GeomAbs_SurfaceType& ST1, const GeomAbs_SurfaceType& ST2) { Standard_Boolean kpart0 = FUN_Kpart0(ST1,ST2); if (kpart0) return 1; kpart0 = FUN_Kpart0(ST2,ST1); if (kpart0) return 2; return 0; } static Standard_Integer FUN_findeSD (const TopOpeBRepDS_DataStructure& BDS, const TopoDS_Edge& EspON, const TopoDS_Edge& EG, const TopoDS_Face& FOR, TopAbs_Orientation& oeSD, const Standard_Integer D) { // chercher eSD = SameDomain3d/2d de EG, arete de FOR, qui contient EspON gp_Pnt ptON; Standard_Real parON; FUN_tool_findPinE(EspON,ptON,parON); TopTools_ListOfShape lesdSD; if (D == 3) FDS_HasSameDomain3d(BDS,EG,&lesdSD); if (D == 2) FDS_HasSameDomain2d(BDS,EG,&lesdSD); for(TopTools_ListIteratorOfListOfShape it(lesdSD);it.More();it.Next()) { TopoDS_Edge eSD = TopoDS::Edge(it.Value()); TopAbs_Orientation oesd; Standard_Boolean eSDofFOR = FUN_tool_orientEinFFORWARD(eSD,FOR,oesd); if (!eSDofFOR) continue; TopAbs_State staeSD = FUN_tool_staPinE(ptON,eSD); if (staeSD == TopAbs_IN) { Standard_Integer i = BDS.Shape(eSD); oeSD = oesd; return i; } } return 0; } static Standard_Boolean ComputeFaceCrvtInSec(const TopoDS_Face& aFace, const gp_Pnt2d& aP2d, const gp_Dir& aSecDir, Standard_Real& aCrvt) { BRepAdaptor_Surface aSurf(aFace); Standard_Integer cn = BRepLProp_SurfaceTool::Continuity(aSurf); if (cn < 2) return Standard_False; BRepLProp_SLProps aProp(aSurf, aP2d.X(), aP2d.Y(), 2, Precision::Confusion()); if (!aProp.IsCurvatureDefined()) return Standard_False; if (aProp.IsUmbilic()) { aCrvt = aProp.MaxCurvature(); return Standard_True; } Standard_Real maxCrv = aProp.MaxCurvature(); Standard_Real minCrv = aProp.MinCurvature(); gp_Dir maxDir, minDir; aProp.CurvatureDirections(maxDir, minDir); Standard_Real cosMax = aSecDir * maxDir; Standard_Real cosMin = aSecDir * minDir; aCrvt = maxCrv * cosMax + minCrv * cosMin; return Standard_True; } //======================================================================= //function : GFillONPartsWES2 //purpose : //======================================================================= void TopOpeBRepBuild_BuilderON::GFillONPartsWES2(const Handle(TopOpeBRepDS_Interference)& I,const TopoDS_Shape& EspON) { const Handle(TopOpeBRepDS_HDataStructure)& HDS=myPB->DataStructure(); const TopOpeBRepDS_DataStructure& BDS= HDS->DS(); Handle(TopOpeBRepDS_ShapeShapeInterference) SSI (Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I)); TopAbs_State TB1,TB2;myPG->StatesON(TB1,TB2); TopAbs_State TB=TB1; TopOpeBRepDS_Kind GT,ST;Standard_Integer GI,SI;FDS_data(SSI,GT,GI,ST,SI); const TopOpeBRepDS_Transition& TFE=SSI->Transition(); Standard_Boolean EGBoundFOR=SSI->GBound(); const TopoDS_Face& FOR=TopoDS::Face(myFace); Standard_Integer iFOR=BDS.Shape(FOR); const TopoDS_Edge& eON=TopoDS::Edge(EspON); const TopoDS_Edge& EG=TopoDS::Edge(BDS.Shape(GI)); #ifdef OCCT_DEBUG Standard_Integer iEG= #endif BDS.Shape(EG); const TopoDS_Face& FS=TopoDS::Face(BDS.Shape(SI)); Standard_Integer iFS=BDS.Shape(FS); Standard_Real tola = Precision::Angular()*1.e3;//nyitol TopAbs_Orientation oFOR = BDS.Shape(iFOR).Orientation(); TopAbs_Orientation oFS = BDS.Shape(iFS).Orientation(); Standard_Boolean isclosedFF=FUN_tool_IsClosingE(EG,FOR,FOR); //xpu240898 : cto900J5 faulty yapc2(FOR17,FS18,EG15) Standard_Boolean isclosedFS=FUN_tool_IsClosingE(EG,FS,FS); //xpu240898 Standard_Boolean isclosed=(isclosedFF || isclosedFS); Standard_Boolean isrest=BDS.IsSectionEdge(EG); #ifdef OCCT_DEBUG // Standard_Boolean issplit=myPB->IsSplit(EG,TopAbs_ON); #endif Standard_Integer rankFS=myPB->GShapeRank(FS); Standard_Integer rankEG=myPB->GShapeRank(EG); Standard_Integer rankFOR=myPB->GShapeRank(FOR); TopAbs_Orientation OTFE = TFE.Orientation(TopAbs_IN); TopAbs_State TFEbef = TFE.Before(); TopAbs_State TFEaft = TFE.After(); #ifdef OCCT_DEBUG // Standard_Boolean EGboundFOR = // Handle(TopOpeBRepDS_ShapeShapeInterference)::DownCast(I)->GBound(); #endif Standard_Boolean eghassd = HDS->HasSameDomain(EG); TopTools_ListOfShape le3;Standard_Boolean eghassd3d = FDS_HasSameDomain3d(BDS,EG,&le3); Standard_Integer ie3d = 0; TopAbs_Orientation oe3d = TopAbs_EXTERNAL; Standard_Integer ie2d = 0; TopAbs_Orientation oe2d = TopAbs_EXTERNAL; TopTools_ListOfShape lfcx; FDSCNX_FaceEdgeConnexFaces(FS,EG,HDS,lfcx); Standard_Integer nlfcx=lfcx.Extent(); Standard_Boolean hsdFOR = HDS->HasSameDomain(FOR); TopOpeBRepDS_Config cFOR = TopOpeBRepDS_UNSHGEOMETRY; Standard_Integer irefFOR = 0; TopAbs_Orientation orefFOR = TopAbs_EXTERNAL; Standard_Boolean FORisref = Standard_False; if (hsdFOR) { cFOR = BDS.SameDomainOri(iFOR); if (hsdFOR) irefFOR = BDS.SameDomainRef(FOR); if (irefFOR != 0) orefFOR = BDS.Shape(irefFOR).Orientation(); FORisref = (irefFOR == iFOR); } Standard_Boolean opeFus = myPB->Opefus(); Standard_Boolean opec12 = myPB->Opec12(); #ifdef OCCT_DEBUG // Standard_Boolean opec21 = myPB->Opec21(); #endif Standard_Boolean opeCut = myPB->Opec12() || myPB->Opec21(); Standard_Boolean opeCom = myPB->Opecom(); Standard_Boolean ComOfCut = opeCut && (TB1 == TB2) && (TB1 == TopAbs_IN); //xpu200598 only if FFSDSO TopAbs_State TBFOR = FUN_build_TB(myPB,rankFOR); #ifdef OCCT_DEBUG Standard_Boolean tFOR=myPB->GtraceSPS(iFOR);Standard_Boolean tE=myPB->GtraceSPS(GI); Standard_Boolean tEFOR=DEBTEFOR(*myPB,iFOR,GI); if (tFOR) debON(iFOR); #endif Standard_Real factor = 1.e2; Standard_Real tolEG = BRep_Tool::Tolerance(EG)*factor; //NYITOLXPU Standard_Real tolFOR = BRep_Tool::Tolerance(FOR)*factor; //NYITOLXPU Standard_Real tolFS = BRep_Tool::Tolerance(FS)*factor; //NYITOLXPU Standard_Real f,l; FUN_tool_bounds(eON,f,l); Standard_Real x=0.456189; Standard_Real parON = (1-x)*f + x*l; // xpu150698 : spON(EG)=spON1+spON2+.., spON1 ON EsdEG, spON2 shares no // geometry with any other edge. // FRA11018 (FOR=f5,EG=e18,EsdEG=e7) Standard_Boolean espONesd = Standard_False; Standard_Integer Iesd=0;// xpu150698 if (eghassd) espONesd = FUN_ds_ONesd(BDS,GI,EspON,Iesd);// xpu150698 Standard_Boolean eONsoEsd = Standard_False; if (eghassd && (Iesd != 0)) { const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); Standard_Boolean ok = FUN_tool_curvesSO(eON,Esd,eONsoEsd); if (!ok) return; } Standard_Boolean eONFS = Standard_True; // xpu240898 if (eghassd && (!espONesd)) { gp_Pnt pON; Standard_Boolean ok = FUN_tool_value(parON,eON,pON); if (!ok) return; gp_Pnt2d uvFS; Standard_Real d=1.; ok = FUN_tool_projPonboundedF(pON,FS,uvFS,d); if (!ok) return; Standard_Real tolF = FUN_tool_maxtol(FS); eONFS = (d < tolF); } // ------------------------------------ Standard_Boolean eghassdON = eghassd && espONesd; Standard_Boolean eghassd3dON = eghassd3d && espONesd; // ------------------------------------ Standard_Boolean yap00 = Standard_True; //xpu180998 : cto900Q2 yap00 = yap00 && (!isclosed); yap00 = yap00 && (EGBoundFOR); yap00 = yap00 && (espONesd); yap00 = yap00 && (!hsdFOR); //xpu280998 : PRO14892 (FOR16,FS30,GI20) if (yap00) { const TopOpeBRepDS_ListOfInterference& lI = BDS.ShapeInterferences(FOR); TopOpeBRepDS_ListOfInterference lIcopy; FDS_assign(lI,lIcopy); TopOpeBRepDS_ListOfInterference lIGesd; Standard_Integer nGesd = FUN_selectGIinterference(lIcopy,Iesd,lIGesd); if (nGesd != 0) yap00=Standard_False; // ES has interference on G=edge(Iesd) } Standard_Boolean yap0 = Standard_True; yap0 = yap0 && (!isclosed); yap0 = yap0 && (EGBoundFOR); yap0 = yap0 && (!eghassd); Standard_Boolean yap0bis = Standard_True; // xpu160698 yap0bis = yap0bis && (!isclosed); yap0bis = yap0bis && (EGBoundFOR); yap0bis = yap0bis && (eghassd); // xpu300798 : cto 902 B7 yap0bis = yap0bis && (!eghassdON); yap0bis = yap0bis && eONFS; //xpu240898 : cto900J3 (e7on_2 NOT ON FS, FOR18,FS17,EG7) yap0bis = yap0bis && !ComOfCut; // xpu270798 : boxes240798, f14in,GI=34 if ( yap0bis ) { yap0 = Standard_True; } Standard_Boolean hassd3dON = Standard_False; // if (isclosed && !EGBoundFOR && eghassd3d) { -xpu110898 -> yapc3 if (!EGBoundFOR && eghassd3d) { ie3d = ::FUN_findeSD(BDS,eON,EG,FOR,oe3d,3); hassd3dON = (ie3d != 0); } Standard_Boolean yapc1 = Standard_True; yapc1 = yapc1 && (isclosed); yapc1 = yapc1 && (!EGBoundFOR); yapc1 = yapc1 && (eghassd3d); yapc1 = yapc1 && hassd3dON; //xpu230798 Standard_Boolean yapc2a = Standard_True; yapc2a = yapc2a && (isclosed); yapc2a = yapc2a && (!eghassd3d); //xpu240798 cto902A3 (iFOR=5,GI=3,iFCX=6) : complement yapc1 Standard_Boolean yapc2b = Standard_True; yapc2b = yapc2b && (isclosed); yapc2b = yapc2b && (!EGBoundFOR); yapc2b = yapc2b && (eghassd3d); yapc2b = yapc2b && (!hassd3dON); Standard_Boolean yapc2c = Standard_True; yapc2c = yapc2c && (isclosed); yapc2c = yapc2c && (EGBoundFOR); yapc2c = yapc2c && (eghassd3d); Standard_Boolean yapc2 = yapc2a; yapc2 = yapc2 || yapc2b || yapc2c; //xpu240798 Standard_Boolean yapc3 = Standard_True; yapc3 = yapc3 && (!isclosed); yapc3 = yapc3 && (eghassd3d); yapc3 = yapc3 && (hassd3dON); Standard_Boolean e3closedFOR = Standard_False; if (hassd3dON) { const TopoDS_Edge& e3d = TopoDS::Edge(BDS.Shape(ie3d)); e3closedFOR = BRep_Tool::IsClosed(e3d,FOR); } yapc3 = yapc3 && e3closedFOR; // => !EGBoundFOR //========================================= if ( yap00 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap0 GFillON"); if (tE) {cout<<"yap00(FOR"<AddStartElement(newE); return; } //========================================= if ( yap0 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap0 GFillON"); if (tE) {cout<<"yap0(FOR"<AddStartElement(newE); return; } //yap0 //========================================= if ( yapc1 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yapc1 GFillON"); if (tE) {cout<<"yapc1(FOR"<AddStartElement(newE); } return; } // yapc1 //========================================= if ( yapc2 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yapc2 GFillON"); if (tE) {cout<<"yapc2(FOR"<AddStartElement(newE); newE.Orientation(TopAbs_REVERSED); myPWES->AddStartElement(newE); } else { myPWES->AddStartElement(newE); } return; } // yapc2 //========================================= if ( yapc3 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yapc3 GFillON"); if (tE) {cout<<"yapc3(FOR"< 0.); } Standard_Boolean unkeepclo = Standard_False; if (SO && M_EXTERNAL(OTFE) && opeCom) unkeepclo = Standard_True; if (SO && M_INTERNAL(OTFE) && opeFus) unkeepclo = Standard_True; addFORREV = !unkeepclo; } if (!addFORREV) { neworiEk = neworiE; Standard_Boolean samegeom; Standard_Boolean ok = FUN_tool_curvesSO(eON,EG,samegeom); if (!ok) return; // nyiRAISE Standard_Boolean reverse = (!samegeom); #ifdef OCCT_DEBUG if (TopOpeBRepBuild_GetcontextNOSG()) // MSV 21.03.2002: restore the genaral behaviour, since the function // FUN_UNKFstasta was corrected. reverse = Standard_False; //we exclude this line from #ifdef OCCT_DEBUG because //in optimised mode this line will never be included , and that follows to regressions //MZV-12-05-2000 #endif if (reverse) neworiEk = TopAbs::Complement(neworiEk); newE.Orientation(neworiEk); } #ifdef OCCT_DEBUG if (tEFOR) { if (!addFORREV) debaddpwes(iFOR,TB1,iEG,neworiEk,myPB,myPWES,"yapc3 GFillON","WES+ EspON "); else { debaddpwes(iFOR,TB1,iEG,TopAbs_FORWARD, myPB,myPWES,"yapc3 GFillON closed","WES+ EspON "); debaddpwes(iFOR,TB1,iEG,TopAbs_REVERSED,myPB,myPWES,"yapc3 GFillON closed","WES+ EspON "); } } #endif if (addFORREV) { newE.Orientation(TopAbs_FORWARD); myPWES->AddStartElement(newE); newE.Orientation(TopAbs_REVERSED); myPWES->AddStartElement(newE); } else { myPWES->AddStartElement(newE); } return; } // yapc3 if (nlfcx == 0) return; const TopoDS_Face& FCX=TopoDS::Face(lfcx.First()); Standard_Integer iFCX=BDS.Shape(FCX); // faces samedomain de FCX TopTools_ListOfShape LFSO,LFDO,LFSO1,LFDO1,LFSO2,LFDO2; myPB->GFindSamDomSODO(FCX,LFSO,LFDO); Standard_Integer rankFCX=myPB->GShapeRank(FCX),rankX=(rankFCX)?((rankFCX==1)?2:1):0; // DEB : rankFCX doit etre=rankFS // LFSO2,LFDO2=faces samedomain de FCX dans le shape oppose (rankX) // rankX=shape oppose=shape de FOR. myPB->GFindSameRank(LFSO,rankFCX,LFSO1); myPB->GFindSameRank(LFDO,rankFCX,LFDO1); myPB->GFindSameRank(LFSO,rankX,LFSO2); myPB->GFindSameRank(LFDO,rankX,LFDO2); // FFinSO=appartenance de FOR a l'ensemble des faces sameoriented de FCX=LFSO2 Standard_Boolean FFinSDSO=Standard_False; { for(TopTools_ListIteratorOfListOfShape i(LFSO2);i.More();i.Next()) { const TopoDS_Shape& F=i.Value(); if (F.IsSame(FOR)) {FFinSDSO=Standard_True;break;} } } // FFinDO=appartenance de FOR a l'ensemble des faces difforiented de FCX=LFDO2 Standard_Boolean FFinSDDO=Standard_False; { for(TopTools_ListIteratorOfListOfShape i(LFDO2);i.More();i.Next()) { const TopoDS_Shape& F=i.Value(); if (F.IsSame(FOR)) {FFinSDDO=Standard_True;break;} } } // FFinSD=appartenance de FOR a l'ensemble des faces samedomain de FCX Standard_Boolean FFinSD=(FFinSDSO || FFinSDDO); TopAbs_Orientation oFCX = BDS.Shape(iFCX).Orientation(); TopOpeBRepDS_Config cFCX = BDS.SameDomainOri(iFCX); Standard_Integer irefFCX = BDS.SameDomainRef(FCX); TopAbs_Orientation orefFCX = BDS.Shape(irefFCX).Orientation(); Standard_Boolean FCXisref = (irefFCX == iFCX); #ifdef OCCT_DEBUG // Standard_Real tolFCX = factor*BRep_Tool::Tolerance(FCX); //NYITOLXPU #endif TopAbs_Orientation oegFCXF;Standard_Boolean EGBoundFCX = FUN_tool_orientEinFFORWARD(EG,FCX,oegFCXF); TopAbs_Orientation oegFCX ; FUN_tool_orientEinF(EG,FCX,oegFCX); if (!EGBoundFOR && !espONesd) { //xpu220998 : ctocylcongA1 (FOR10,FS19,EG8) gp_Pnt ptON; Standard_Boolean ok = FUN_tool_value(parON,eON,ptON); if (!ok) return; //nyiRAISE Standard_Real d=1.; gp_Pnt2d uvFOR; ok = FUN_tool_projPonboundedF(ptON,FOR,uvFOR,d); if (!ok) return; //nyiRAISE Standard_Real tolON = Max(tolEG,tolFOR);//xpu291098 cto900L7(f7,e7on) //xpu051198 PRO12953(f6,e4on) tolON *= 1.e2;//*****CAREFULL***** : xpu040998, cto 904 A3 Standard_Boolean eONFOR = (d < tolON); if (!eONFOR) return; } Standard_Boolean yap1 = Standard_True; yap1 = yap1 && FFinSD; yap1 = yap1 && (!EGBoundFOR); yap1 = yap1 && EGBoundFCX; yap1 = yap1 && eghassd3dON; Standard_Boolean yap2 = Standard_True; yap2 = yap2 && FFinSD; yap2 = yap2 && (!EGBoundFOR); yap2 = yap2 && EGBoundFCX;// yap2 = yap2 && !eghassdON; yap2 = yap2 && !eghassd;// yap2 = yap2 && !eghassd3dON; Standard_Boolean yap1b = Standard_True; yap1b = yap1b && FFinSD; yap1b = yap1b && (!EGBoundFOR); yap1b = yap1b && EGBoundFCX; yap1b = yap1b && eghassd3d; yap1b = yap1b && !eghassd3dON; yap1b = yap1b && eONFS; //xpu240898 if (yap1b) { yap2 = Standard_True; // xpu220998 : ctocylcongA1 yap1b(FOR12,FS5,EG8) } Standard_Boolean yap6 = Standard_True; // cto001F3 : f18ou,EG=e23 yap6 = yap6 && FFinSD; yap6 = yap6 && (!EGBoundFOR); yap6 = yap6 && EGBoundFCX; yap6 = yap6 && eghassdON; yap6 = yap6 && !eghassd3d;// yap6 = yap6 && !eghassd3dON; Standard_Boolean yap6b = Standard_True; yap6b = yap6b && FFinSD; yap6b = yap6b && (!EGBoundFOR); yap6b = yap6b && EGBoundFCX; yap6b = yap6b && eghassd; yap6b = yap6b && !eghassdON; yap6b = yap6b && eONFS; //xpu240898 yap6b = yap6b && !eghassd3d;// yap6b = yap6b && !eghassd3dON; if (yap6b) { #ifdef OCCT_DEBUG // FUN_RaiseON(); #endif yap2 = Standard_True; } // CTS20205 spOUT(f30), e4 = eghassd3dON // mais f30 !sdm lfcx(e4) Standard_Boolean eghassd3fcx = eghassdON; eghassd3fcx = eghassd3fcx && !FUN_ds_sdm(BDS,FOR,FS); eghassd3fcx = eghassd3fcx && !FFinSD; //!FUN_ds_sdm(BDS,FOR,FCX) Standard_Boolean yap5 = Standard_True; yap5 = yap5 && !EGBoundFOR; yap5 = yap5 && eghassd3fcx; Standard_Boolean yap3 = Standard_True; yap3 = yap3 && !FFinSD; yap3 = yap3 && !EGBoundFOR; yap3 = yap3 && eghassd3dON; Standard_Boolean yap4 = Standard_True; yap4 = yap4 && !FFinSD; yap4 = yap4 && isrest; yap4 = yap4 && !yap5; yap4 = yap4 && !hsdFOR; //xpu290598 Standard_Boolean yap3b = Standard_True; yap3b = yap3b && !FFinSD; yap3b = yap3b && !EGBoundFOR; yap3b = yap3b && eghassd3d; yap3b = yap3b && !eghassd3dON; yap3b = yap3b && eONFS; //xpu240898 if (yap3b) { yap4 = Standard_True; //xpu191098 : cto016F3(yap3b(FOR7,EG4)) } //xpu290598 Standard_Boolean yap7 = Standard_True; yap7 = yap7 && !FFinSD; yap7 = yap7 && isrest; yap7 = yap7 && !yap5; yap7 = yap7 && hsdFOR; TopAbs_State staFOR = TB1; TopAbs_State staFS = (rankFS == rankFOR) ? TB1 : TB2; #ifdef OCCT_DEBUG // if(tEFOR) cout< projection) TopOpeBRepTool_ShapeClassifier& PSC = FSC_GetPSC(FOR); TopAbs_State state2d = FSC_StateEonFace(EspON,0.345,FOR,PSC); Standard_Boolean isin = (state2d == TopAbs_IN); if (!isin) return; TopAbs_State TBEG = TB1; TopAbs_Orientation neworiE = TFE.Orientation(TBEG); // if (FCXisref && FFinSDDO) { if (FCXisref && !EGBoundFOR) { FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); Standard_Boolean rev = myPB->Reverse(staFCX,staFOR); neworiE = myPB->Orient(neworiE,rev); } // xpu280798 : never occurs as yap1 -> !EGBoundFOR // else if (FORisref && EGBoundFOR) { // FUN_tool_orientEinFFORWARD(EG,FOR,neworiE); // Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); // neworiE = myPB->Orient(neworiE,rev); // } else if (FORisref && !EGBoundFOR) { const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); FUN_tool_orientEinFFORWARD(Esd,TopoDS::Face(FOR),neworiE); Standard_Boolean reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd); if (reverse) neworiE = TopAbs::Complement(neworiE); Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); neworiE = myPB->Orient(neworiE,rev); } else if (!EGBoundFOR) { // xpu210898 Standard_Integer rankrefFOR = BDS.AncestorRank(irefFOR); if (rankrefFOR == rankFCX) FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); else if (rankrefFOR == rankFOR) { const TopoDS_Edge& Esd = TopoDS::Edge(BDS.Shape(Iesd)); FUN_tool_orientEinFFORWARD(Esd,TopoDS::Face(FOR),neworiE); Standard_Boolean reverse = (M_FORWARD(neworiE) || M_REVERSED(neworiE)) && (!eONsoEsd); if (reverse) neworiE = TopAbs::Complement(neworiE); } Standard_Boolean rev = myPB->Reverse(staFOR,staFCX); neworiE = myPB->Orient(neworiE,rev); } TopoDS_Shape newE = EspON; newE.Orientation(neworiE); #ifdef OCCT_DEBUG if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap1 GFillON","WES+ EspON "); if (tE) FUN_cout(newE); #endif myPWES->AddStartElement(newE); return; } // yap1 //========================================= if ( yap2 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap2 GFillON"); if (tE) {cout<<"yap2(FOR"< 0); Standard_Boolean keep = Standard_True; if (FFinSDSO) { if (opeFus) keep = positive; //xpu090698 : PRO14033 (iFOR=15,GI=10,iFS=9) if (opeCom) keep = Standard_True; if (opeCut) { if (positive) keep = (TBFS == TopAbs_OUT); //xpu230698 cto100G1 else keep = (TBFS == TopAbs_IN); } } if (FFinSDDO) { if (opeFus) { keep = positive; //xpu050698 : (fuse = OU/IN + IN/OU) -CTS20578- if (keep) { Standard_Integer rkOU = (TB1 == TopAbs_OUT) ? 1 : 2; Standard_Integer rkfspOU = (rankFOR == rkOU) ? 1 : 2; Standard_Boolean spOUFOR = (rankFOR == rkfspOU); keep = spOUFOR; } } if (opeCom) keep = !positive; if (opeCut) { Standard_Boolean FORmoinsFS = (TBFS == TopAbs_IN); if (positive) { if (FORmoinsFS) keep = Standard_True; else keep = ComOfCut; // if (TBFS == TopAbs_OUT) keep = Standard_True; // else keep = (rankFS == 1); } else { // keep = !FORmoinsFS; // xpu230698 : cto100A1 // keep = Standard_False; if (!FORmoinsFS) keep = Standard_True; // xpu230698 : cto100A1 else keep = ComOfCut; //xpu120898 PRO12859 (FOR26,FS12,FCX18,EG14) } } } //#ifdef OCCT_DEBUG // if(tEFOR) {cout< projection) TopOpeBRepTool_ShapeClassifier& PSC = FSC_GetPSC(FOR); TopAbs_State state2d = FSC_StateEonFace(EspON,0.345,FOR,PSC); Standard_Boolean isin = (state2d == TopAbs_IN); if (!isin) return; TopAbs_State TBEG = TB1; TopAbs_Orientation neworiE = TFE.Orientation(TBEG); FUN_tool_orientEinFFORWARD(EG,FCX,neworiE); Standard_Boolean forw=M_FORWARD(neworiE), reve=M_REVERSED(neworiE); Standard_Boolean ok = forw || reve; if (FFinSDSO && ok) { if (opeCut) { neworiE = TopAbs::Complement(neworiE); } } // FFinSDSO && ok // bcl1;bcl2; tsp(f9) if (FFinSDDO && ok) { if (opeCut) { if (!ComOfCut) { // TopAbs_State TBEG = (rankEG == 1)? TB1 : TB2; // if (TBEG == TopAbs_IN) neworiE = TopAbs::Complement(neworiE); neworiE = TopAbs::Complement(neworiE); // xpu270898 : cto905E2 (FOR33,FCX16,EG19) } else if (ComOfCut) { // rien a faire } } if (opeFus) { // en principe , l'operation locale est tjrs = OUT,IN neworiE = TopAbs::Complement(neworiE); } if (opeCom) { // SDDO et oT anti// => oG // // xxFCX : gp_Dir xxFCX; ok = FUN_tool_getxx(FCX,EG,parEG,xxFCX); if (!ok) return;// nyiRAISE // ntFS : gp_Dir ntFS(ngFS); if (M_REVERSED(oFS)) ntFS.Reverse(); Standard_Real dot = xxFCX.Dot(ntFS); Standard_Boolean toreverse = (dot > 0); if (toreverse) neworiE = TopAbs::Complement(neworiE); } } // FFinSDDO && ok Standard_Boolean reverse = Standard_False; //xpu270598 : reverse=false=>FCX has same geom ori if (!FCXisref) { //xpu270598 if (cFCX == TopOpeBRepDS_DIFFORIENTED) reverse = Standard_True; if (oFCX != orefFCX) reverse = !reverse; } //xpu270598 if (reverse) neworiE = TopAbs::Complement(neworiE); // xpu270598 TopoDS_Shape newE = EspON; newE.Orientation(neworiE); #ifdef OCCT_DEBUG if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap2 GFillON","WES+ EspON "); if (tE) FUN_cout(newE); #endif myPWES->AddStartElement(newE); return; } // yap2 //========================================= if ( yap6 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap6 GFillON"); if (tE) {cout<<"yap6(FOR"<AddStartElement(newE); // xpu290798 : cto 902 C1, f9ou,f19in, spON(e7) = spON(e18) // splits IN and OUT generated on reference surface should be diff oriented // they share same edge eON which is FORWARD in one, REVERSED in the other Standard_Boolean addtwice = SO && !shareG && opeCut; addtwice = addtwice && (M_FORWARD(neworiE) || M_REVERSED(neworiE)); if (addtwice) { // we have splitIN TopoDS_Shape FtospIN = (TBFOR == TopAbs_IN) ? FOR : FCX; addtwice = Standard_False; TopExp_Explorer ex; for (ex.Init(FtospIN,TopAbs_EDGE); ex.More(); ex.Next()){ // for (TopExp_Explorer ex(FtospIN,TopAbs_EDGE); ex.More(); ex.Next()){ const TopoDS_Shape& ee = ex.Current(); if (!BDS.HasShape(ee)) continue; Standard_Boolean issp = myPB->IsSplit(ee,TopAbs_IN); if (issp) addtwice = !myPB->Splits(ee,TopAbs_IN).IsEmpty(); if (addtwice) break; } } if (addtwice) { neworiE = TopAbs::Complement(neworiE); newE.Orientation(neworiE); #ifdef OCCT_DEBUG if (tEFOR) debaddpwes(iFOR,TB1,iEG,neworiE,myPB,myPWES,"yap6 GFillON","WES+ EspON "); if (tE) FUN_cout(newE); #endif myPWES->AddStartElement(newE); } return; } // yap6 //========================================= if ( yap3 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap3 GFillON"); if (tE) {cout<<"yap3(FOR"<AddStartElement(newE); } return; } // yap3 //========================================= if ( yap5 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap5 GFillON"); if (tE) {cout<<"yap5(FOR"<AddStartElement(newE); } return; } // yap5 //========================================= if ( yap4 ) { #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap4 GFillON"); if (tE) {cout<<"yap4(FOR"<AddStartElement(newE); return; } // yap4 //========================================= if ( yap7 ) { // xpu290598 : CTS20212 #ifdef OCCT_DEBUG if (tEFOR) debfillonfemess(iFOR,iEG,myPB,myPWES,"yap7 GFillON"); if (tE) {cout<<"yap7(FOR"<AddStartElement(newE); return; } // yap7 } // GFillONPartsWES2