X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FGEOMImpl%2FGEOMImpl_I3DPrimOperations.cxx;h=d5473f280a915c1928a00b3774d0e156d70c2acf;hb=c86487eae575fa5d5253fea29197e5741e180aff;hp=8b68577976c3875db93f26ad209fd92547a6e034;hpb=8e1ef24a91d1db7af5b9e7b3bae0f39048846c49;p=modules%2Fgeom.git diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 8b6857797..d5473f280 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2010 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 @@ -67,6 +67,8 @@ #include #include +#include + #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC @@ -255,7 +257,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceHW (double theH, double */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFaceObjHW (Handle(GEOM_Object) theObj, - double theH, double theW) + double theH, double theW) { SetErrorCode(KO); @@ -370,8 +372,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskPntVecR */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskThreePnt (Handle(GEOM_Object) thePnt1, - Handle(GEOM_Object) thePnt2, - Handle(GEOM_Object) thePnt3) + Handle(GEOM_Object) thePnt2, + Handle(GEOM_Object) thePnt3) { SetErrorCode(KO); @@ -920,7 +922,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeTorusPntVecRR //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theVec, - double theH) + double theH, double theScaleFactor) { SetErrorCode(KO); @@ -947,6 +949,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec aCI.SetBase(aRefBase); aCI.SetVector(aRefVec); aCI.SetH(theH); + aCI.SetScale(theScaleFactor); //Compute the Prism value try { @@ -966,8 +969,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec } //Make a Python command - GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismVecH(" - << theBase << ", " << theVec << ", " << theH << ")"; + GEOM::TPythonDump pd (aFunction); + pd << aPrism << " = geompy.MakePrismVecH(" << theBase << ", " << theVec << ", " << theH; + if (theScaleFactor > Precision::Confusion()) + pd << ", " << theScaleFactor << ")"; + else + pd << ")"; SetErrorCode(OK); return aPrism; @@ -979,8 +986,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH (Handle(GEOM_Objec */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) theVec, - double theH) + Handle(GEOM_Object) theVec, + double theH) { SetErrorCode(KO); @@ -1040,7 +1047,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismVecH2Ways (Handle(GEOM_ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2) + Handle(GEOM_Object) thePoint1, Handle(GEOM_Object) thePoint2, + double theScaleFactor) { SetErrorCode(KO); @@ -1068,6 +1076,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt aCI.SetBase(aRefBase); aCI.SetFirstPoint(aRefPnt1); aCI.SetLastPoint(aRefPnt2); + aCI.SetScale(theScaleFactor); //Compute the Prism value try { @@ -1087,8 +1096,12 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt } //Make a Python command - GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrism(" - << theBase << ", " << thePoint1 << ", " << thePoint2 << ")"; + GEOM::TPythonDump pd (aFunction); + pd << aPrism << " = geompy.MakePrism(" << theBase << ", " << thePoint1 << ", " << thePoint2; + if (theScaleFactor > Precision::Confusion()) + pd << ", " << theScaleFactor << ")"; + else + pd << ")"; SetErrorCode(OK); return aPrism; @@ -1161,7 +1174,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismTwoPnt2Ways */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ - (Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ) + (Handle(GEOM_Object) theBase, double theDX, double theDY, double theDZ, + double theScaleFactor) { SetErrorCode(KO); @@ -1188,6 +1202,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ aCI.SetDX(theDX); aCI.SetDY(theDY); aCI.SetDZ(theDZ); + aCI.SetScale(theScaleFactor); //Compute the Prism value try { @@ -1206,8 +1221,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ } //Make a Python command - GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakePrismDXDYDZ(" - << theBase << ", " << theDX << ", " << theDY << ", " << theDZ << ")"; + GEOM::TPythonDump pd (aFunction); + pd << aPrism << " = geompy.MakePrismDXDYDZ(" + << theBase << ", " << theDX << ", " << theDY << ", " << theDZ; + if (theScaleFactor > Precision::Confusion()) + pd << ", " << theScaleFactor << ")"; + else + pd << ")"; SetErrorCode(OK); return aPrism; @@ -1453,7 +1473,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle2Ways //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling (Handle(GEOM_Object) theShape, int theMinDeg, int theMaxDeg, - double theTol2D, double theTol3D, int theNbIter, bool isApprox) + double theTol2D, double theTol3D, int theNbIter, + int theMethod, bool isApprox) { SetErrorCode(KO); @@ -1482,6 +1503,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling aFI.SetTol3D(theTol3D); aFI.SetNbIter(theNbIter); aFI.SetApprox(isApprox); + aFI.SetMethod(theMethod); //Compute the Solid value try { @@ -1505,10 +1527,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling //Make a Python command GEOM::TPythonDump pd (aFunction); pd << aFilling << " = geompy.MakeFilling(" - << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " - << theTol2D << ", " << theTol3D << ", " << theNbIter; + << theShape << ", " << theMinDeg << ", " << theMaxDeg << ", " + << theTol2D << ", " << theTol3D << ", " << theNbIter << ", "; + if( theMethod==1 ) pd << "GEOM.FOM_UseOri"; + else if( theMethod==2 ) pd << "GEOM.FOM_AutoCorrect"; + else pd << "GEOM.FOM_Default"; if(isApprox) - pd << ", " << isApprox; + pd << ", " << isApprox ; pd << ")"; SetErrorCode(OK); @@ -1521,10 +1546,10 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeFilling */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( - const Handle(TColStd_HSequenceOfTransient)& theSeqSections, - bool theModeSolid, - double thePreci, - bool theRuled) + const Handle(TColStd_HSequenceOfTransient)& theSeqSections, + bool theModeSolid, + double thePreci, + bool theRuled) { Handle(GEOM_Object) anObj; SetErrorCode(KO); @@ -1532,13 +1557,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( return anObj; Standard_Integer nbObj = theSeqSections->Length(); - if (!nbObj) + if (!nbObj) return anObj; //Add a new ThruSections object Handle(GEOM_Object) aThruSect = GetEngine()->AddObject(GetDocID(), GEOM_THRUSECTIONS); - + //Add a new ThruSections function int aTypeFunc = (theRuled ? THRUSECTIONS_RULED : THRUSECTIONS_SMOOTHED); @@ -1559,7 +1584,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( Handle(Standard_Transient) anItem = theSeqSections->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem); if(!aSectObj.IsNull()) { @@ -1601,21 +1626,19 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThruSections( Handle(Standard_Transient) anItem = theSeqSections->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) aSectObj = Handle(GEOM_Object)::DownCast(anItem); if(!aSectObj.IsNull()) { pyDump<< aSectObj; if(i < nbObj) - pyDump<<", "; + pyDump<<", "; } } - + pyDump<< "],"<Length(); - + if (!nbBases) return anObj; - + Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); //Add a new Pipe object Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); - + //Add a new Pipe function Handle(GEOM_Function) aFunction = @@ -1669,7 +1692,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem); if(aBase.IsNull()) continue; @@ -1680,14 +1703,14 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( { Handle(Standard_Transient) anItemLoc = theLocations->Value(i); if(anItemLoc.IsNull()) - continue; - + continue; + Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); if(aLoc.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); if(aRefLoc.IsNull()) - continue; + continue; aSeqLocs->Append(aRefLoc); } aSeqBases->Append(aRefBase); @@ -1701,7 +1724,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( aCI.SetPath(aRefPath); aCI.SetWithContactMode(theWithContact); aCI.SetWithCorrectionMode(theWithCorrections); - + //Compute the Pipe value try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 @@ -1727,38 +1750,35 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithDifferentSections( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbLocs; i++) { Handle(Standard_Transient) anItem = theLocations->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbLocs) - pyDump<<", "; + pyDump<<", "; } - } + } pyDump<< "], "<Length(); - + if (!nbBases) return anObj; - + Standard_Integer nbSubBases = (theSubBases.IsNull() ? 0 :theSubBases->Length()); Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); //Add a new Pipe object Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); - + //Add a new Pipe function Handle(GEOM_Function) aFunction = @@ -1828,26 +1848,26 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( if( nbSubBases >= nbBases ) { Handle(Standard_Transient) aSubItem = theSubBases->Value(i); if(aSubItem.IsNull()) - continue; + continue; Handle(GEOM_Object) aSubBase = Handle(GEOM_Object)::DownCast(aSubItem); if(aSubBase.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefSubBase = aSubBase->GetLastFunction(); if(aRefSubBase.IsNull()) - continue; + continue; aSeqSubBases->Append(aRefSubBase); } if(nbLocs) { Handle(Standard_Transient) anItemLoc = theLocations->Value(i); if(anItemLoc.IsNull()) - continue; + continue; Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); if(aLoc.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); if(aRefLoc.IsNull()) - continue; + continue; aSeqLocs->Append(aRefLoc); } @@ -1863,7 +1883,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( aCI.SetPath(aRefPath); aCI.SetWithContactMode(theWithContact); aCI.SetWithCorrectionMode(theWithCorrections); - + //Compute the Pipe value try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 @@ -1889,48 +1909,46 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbSubBases; i++) { Handle(Standard_Transient) anItem = theSubBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbLocs; i++) { Handle(Standard_Transient) anItem = theLocations->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbLocs) - pyDump<<", "; + pyDump<<", "; } - } + } pyDump<< "], "<Length(); - + if (!nbBases) return anObj; - + Standard_Integer nbLocs = (theLocations.IsNull() ? 0 :theLocations->Length()); //Add a new Pipe object Handle(GEOM_Object) aPipeDS = GetEngine()->AddObject(GetDocID(), GEOM_PIPE); - + //Add a new Pipe function Handle(GEOM_Function) aFunction = @@ -1994,13 +2012,13 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( if(nbLocs) { Handle(Standard_Transient) anItemLoc = theLocations->Value(i); if(anItemLoc.IsNull()) - continue; + continue; Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc); if(aLoc.IsNull()) - continue; + continue; Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction(); if(aRefLoc.IsNull()) - continue; + continue; aSeqLocs->Append(aRefLoc); } @@ -2012,7 +2030,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( aCI.SetBases(aSeqBases); aCI.SetLocations(aSeqLocs); - + //Compute the Pipe value try { #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 @@ -2038,31 +2056,30 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( Handle(Standard_Transient) anItem = theBases->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbBases) - pyDump<<", "; + pyDump<<", "; } - } - + pyDump<< "], ["; - + for(i =1 ; i <= nbLocs; i++) { Handle(Standard_Transient) anItem = theLocations->Value(i); if(anItem.IsNull()) continue; - + Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(anItem); if(!anObj.IsNull()) { pyDump<< anObj; if(i < nbLocs) - pyDump<<", "; + pyDump<<", "; } - } + } pyDump<< "])"; @@ -2078,8 +2095,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath( */ //============================================================================= Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase, - Handle(GEOM_Object) thePath, - Handle(GEOM_Object) theVec) + Handle(GEOM_Object) thePath, + Handle(GEOM_Object) theVec) { SetErrorCode(KO); @@ -2131,4 +2148,3 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Han SetErrorCode(OK); return aPipe; } -