X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOM_I_Superv%2FGEOM_Superv_i.cc;h=426aebb561fb12f229ff91b7b8650164175563a0;hb=693e5f65fe0f4868fe2e0f2923aef6a3afb20d67;hp=38e2011facfe4649fa24837396a6bcfaa0afcda0;hpb=5b3622aa2363853841fd5b4205c78a715bfee4a4;p=modules%2Fgeom.git diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 38e2011fa..426aebb56 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -6,7 +6,7 @@ // 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. +// 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 @@ -22,6 +22,7 @@ #include "GEOM_Superv_i.hh" #include "SALOME_LifeCycleCORBA.hxx" +#include "Utils_CorbaException.hxx" #include CORBA_SERVER_HEADER(SALOME_Session) #include "SALOMEDSClient_ClientFactory.hxx" @@ -394,14 +395,112 @@ void GEOM_Superv_i::getAdvancedOp() { if (CORBA::is_nil(myGeomEngine)) setGeomEngine(); - // get GEOM_IAdvancedOperations interface + // get GEOM::IAdvancedOperations interface if (CORBA::is_nil(myAdvancedOp) || isNewStudy(myLastStudyID,myStudyID)) { //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" // Try to get id of the study from the SALOME Session - if(myStudyID < 0 ) SetStudyID(-1); - myAdvancedOp = myGeomEngine->GetIAdvancedOperations(myStudyID); + if(myStudyID < 0 ) SetStudyID(-1); + myAdvancedOp = GEOM::IAdvancedOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "AdvancedEngine")); + } +} + +//============================================================================= +// getSTLPluginOp: +//============================================================================= +void GEOM_Superv_i::getSTLPluginOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM::ISTLOperations interface + if (CORBA::is_nil(mySTLOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + mySTLOp = GEOM::ISTLOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "STLPluginEngine")); + } +} + +//============================================================================= +// getBREPPluginOp: +//============================================================================= +void GEOM_Superv_i::getBREPPluginOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM:IBREPOperations interface + if (CORBA::is_nil(myBREPOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + myBREPOp = GEOM::IBREPOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "BREPPluginEngine")); + } +} + +//============================================================================= +// getSTEPPluginOp: +//============================================================================= +void GEOM_Superv_i::getSTEPPluginOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM::ISTEPOperations interface + if (CORBA::is_nil(mySTEPOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + mySTEPOp = GEOM::ISTEPOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "STEPPluginEngine")); + } +} + +//============================================================================= +// getIGESPluginOp: +//============================================================================= +void GEOM_Superv_i::getIGESPluginOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM::IIGESOperations interface + if (CORBA::is_nil(myIGESOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + myIGESOp = GEOM::IIGESOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "IGESPluginEngine")); + } +} + +//============================================================================= +// getXAOPluginOp: +//============================================================================= +void GEOM_Superv_i::getXAOPluginOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM::IXAOOperations interface + if (CORBA::is_nil(myXAOOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + myXAOOp = GEOM::IXAOOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "XAOPluginEngine")); + } +} + +#ifdef WITH_VTK +//============================================================================= +// getVTKPluginOp: +//============================================================================= +void GEOM_Superv_i::getVTKPluginOp() +{ + if (CORBA::is_nil(myGeomEngine)) + setGeomEngine(); + // get GEOM::IVTKOperations interface + if (CORBA::is_nil(myVTKOp) || isNewStudy(myLastStudyID,myStudyID)) { + //rnv: to fix bug "IPAL22461 6.3.0: Incorrect study storage if study contains shape modified with YACS" + // Try to get id of the study from the SALOME Session + if(myStudyID < 0 ) SetStudyID(-1); + myVTKOp = GEOM::IVTKOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "VTKPluginEngine")); } } +#endif //============================================================================= // GetServant: @@ -626,7 +725,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the beginService( " GEOM_Superv_i::MakePointOnCurve" ); MESSAGE("GEOM_Superv_i::MakePointOnCurve"); getBasicOp(); - GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter, false); endService( " GEOM_Superv_i::MakePointOnCurve" ); return anObj; } @@ -1072,6 +1171,38 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR, return anObj; } +//============================================================================= +// MakeCylinderPntVecRHA: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt, + GEOM::GEOM_Object_ptr theAxis, + CORBA::Double theRadius, + CORBA::Double theHeight, + CORBA::Double theAngle) +{ + beginService( " GEOM_Superv_i::MakeCylinderPntVecRHA" ); + MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRHA"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRHA(thePnt, theAxis, theRadius, theHeight, theAngle); + endService( " GEOM_Superv_i::MakeCylinderPntVecRHA" ); + return anObj; +} + +//============================================================================= +// MakeCylinderRHA: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRHA (CORBA::Double theR, + CORBA::Double theH, + CORBA::Double theA) +{ + beginService( " GEOM_Superv_i::MakeCylinderRHA" ); + MESSAGE("GEOM_Superv_i::MakeCylinderRHA"); + get3DPrimOp(); + GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRHA(theR, theH, theA); + endService( " GEOM_Superv_i::MakeCylinderRHA" ); + return anObj; +} + //============================================================================= // MakeSphere: //============================================================================= @@ -1275,9 +1406,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipe (GEOM::GEOM_Object_ptr theBase, beginService( " GEOM_Superv_i::MakePipe" ); MESSAGE("GEOM_Superv_i::MakePipe"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipe(theBase, thePath); + GEOM::ListOfGO_var aList = my3DPrimOp->MakePipe(theBase, thePath, false); endService( " GEOM_Superv_i::MakePipe" ); - return anObj; + return aList[0]; } //============================================================================= @@ -1325,8 +1456,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape beginService( " GEOM_Superv_i::MakeFilling" ); MESSAGE("GEOM_Superv_i::MakeFilling"); get3DPrimOp(); + GEOM::ListOfGO_var objList = new GEOM::ListOfGO; + objList->length( 1 ); + objList[0] = theShape; GEOM::GEOM_Object_ptr anObj = - my3DPrimOp->MakeFilling(theShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, + my3DPrimOp->MakeFilling(objList, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, theMethod, theApprox); endService( " GEOM_Superv_i::MakeFilling" ); return anObj; @@ -1336,16 +1470,18 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilling (GEOM::GEOM_Object_ptr theShape //============================================================================= // MakeBoolean: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2, - CORBA::Long theOperation) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeBoolean + (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2, + CORBA::Long theOperation) { beginService( " GEOM_Superv_i::MakeBoolean" ); // theOperation indicates the operation to be done: // 1 - Common, 2 - Cut, 3 - Fuse, 4 - Section MESSAGE("GEOM_Superv_i::MakeBoolean"); getBoolOp(); - GEOM::GEOM_Object_ptr anObj = myBoolOp->MakeBoolean(theShape1, theShape2, theOperation); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakeBoolean(theShape1, theShape2, theOperation, false); endService( " GEOM_Superv_i::MakeBoolean" ); return anObj; } @@ -1379,9 +1515,9 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections); + GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false, false); endService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); - return anObj; + return aList[0]; } @@ -1399,12 +1535,13 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithShellSections beginService( " GEOM_Superv_i::MakePipeWithShellSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithShellSections"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = + GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithShellSections(theBases, theSubBases, theLocations, thePath, - theWithContact, theWithCorrections); + theWithContact, theWithCorrections, + false); endService( " GEOM_Superv_i::MakePipeWithShellSections" ); - return anObj; + return aList[0]; } @@ -1418,10 +1555,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeShellsWithoutPath beginService( " GEOM_Superv_i::MakePipeShellsWithoutPath" ); MESSAGE("GEOM_Superv_i::MakePipeShellsWithoutPath"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = - my3DPrimOp->MakePipeShellsWithoutPath(theBases,theLocations); + GEOM::ListOfGO_var aList = + my3DPrimOp->MakePipeShellsWithoutPath(theBases,theLocations, false); endService( " GEOM_Superv_i::MakePipeShellsWithoutPath" ); - return anObj; + return aList[0]; } @@ -1436,27 +1573,65 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeBiNormalAlongVector beginService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" ); MESSAGE("GEOM_Superv_i::MakePipeBiNormalAlongVector"); get3DPrimOp(); - GEOM::GEOM_Object_ptr anObj = - my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec); + GEOM::ListOfGO_var aList = + my3DPrimOp->MakePipeBiNormalAlongVector(theBase, thePath, theVec, false); endService( " GEOM_Superv_i::MakePipeBiNormalAlongVector" ); - return anObj; + return aList[0]; } //============================================================================= // MakeFuse: //============================================================================= -GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse (GEOM::GEOM_Object_ptr theShape1, - GEOM::GEOM_Object_ptr theShape2) +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFuse + (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) { beginService( " GEOM_Superv_i::MakeFuse" ); MESSAGE("GEOM_Superv_i::MakeFuse"); getBoolOp(); - GEOM::GEOM_Object_ptr anObj = myBoolOp->MakeBoolean(theShape1, theShape2, 3); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakeBoolean(theShape1, theShape2, 3, false); endService( " GEOM_Superv_i::MakeFuse" ); return anObj; } +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCommon (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) +{ + beginService( " GEOM_Superv_i::MakeCommon" ); + MESSAGE("GEOM_Superv_i::MakeCommon"); + getBoolOp(); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakeBoolean(theShape1, theShape2, 1, false); + endService( " GEOM_Superv_i::MakeCommon" ); + return anObj; +} + +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCut (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) +{ + beginService( " GEOM_Superv_i::MakeCut" ); + MESSAGE("GEOM_Superv_i::MakeCut"); + getBoolOp(); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakeBoolean(theShape1, theShape2, 2, false); + endService( " GEOM_Superv_i::MakeCut" ); + return anObj; +} + +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSection (GEOM::GEOM_Object_ptr theShape1, + GEOM::GEOM_Object_ptr theShape2) +{ + beginService( " GEOM_Superv_i::MakeCut" ); + MESSAGE("GEOM_Superv_i::MakeCut"); + getBoolOp(); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakeBoolean(theShape1, theShape2, 4, false); + endService( " GEOM_Superv_i::MakeCut" ); + return anObj; +} + //============================================================================= // MakePartition: //============================================================================= @@ -1504,7 +1679,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeHalfPartition (GEOM::GEOM_Object_ptr th beginService( " GEOM_Superv_i::MakeHalfPartition" ); MESSAGE("GEOM_Superv_i::MakeHalfPartition"); getBoolOp(); - GEOM::GEOM_Object_ptr anObj = myBoolOp->MakeHalfPartition(theShape, thePlane); + GEOM::GEOM_Object_ptr anObj = + myBoolOp->MakeHalfPartition(theShape, thePlane); endService( " GEOM_Superv_i::MakeHalfPartition" ); return anObj; } @@ -1546,35 +1722,15 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportFile (const char* theFileName, beginService( " GEOM_Superv_i::ImportFile" ); MESSAGE("GEOM_Superv_i::ImportFile"); getInsOp(); - GEOM::GEOM_Object_ptr anObj = myInsOp->ImportFile(theFileName, theFormatName); - endService( " GEOM_Superv_i::ImportFile" ); - return anObj; -} - -//============================================================================= -// ImportTranslators: -//============================================================================= -void GEOM_Superv_i::ImportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns) -{ - beginService( " GEOM_Superv_i::ImportTranslators" ); - MESSAGE("GEOM_Superv_i::ImportTranslators"); - getInsOp(); - myInsOp->ImportTranslators(theFormats, thePatterns); - endService( " GEOM_Superv_i::ImportTranslators" ); -} + GEOM::ListOfGBO_var aSeq = myInsOp->ImportFile(theFileName, theFormatName); + GEOM::GEOM_Object_var anObj; + + if (aSeq->length() > 0) { + anObj = GEOM::GEOM_Object::_narrow(aSeq[0]); + } -//============================================================================= -// ExportTranslators: -//============================================================================= -void GEOM_Superv_i::ExportTranslators (GEOM::string_array_out theFormats, - GEOM::string_array_out thePatterns) -{ - beginService( " GEOM_Superv_i::ExportTranslators" ); - MESSAGE("GEOM_Superv_i::ExportTranslators"); - getInsOp(); - myInsOp->ExportTranslators(theFormats, thePatterns); - endService( " GEOM_Superv_i::ExportTranslators" ); + endService( " GEOM_Superv_i::ImportFile" ); + return anObj._retn(); } //============================= TransformOperations =========================== @@ -1908,7 +2064,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShape (GEOM::GEOM_Object_ptr theObjec beginService( " GEOM_Superv_i::OffsetShape" ); MESSAGE("GEOM_Superv_i::OffsetShape"); getTransfOp(); - GEOM::GEOM_Object_ptr anObj = myTransfOp->OffsetShape(theObject, theOffset); + GEOM::GEOM_Object_ptr anObj = myTransfOp->OffsetShape(theObject, theOffset, true); endService( " GEOM_Superv_i::OffsetShape" ); return anObj; } @@ -1922,7 +2078,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theO beginService( " GEOM_Superv_i::OffsetShapeCopy" ); MESSAGE("GEOM_Superv_i::OffsetShapeCopy"); getTransfOp(); - GEOM::GEOM_Object_ptr anObj = myTransfOp->OffsetShapeCopy(theObject, theOffset); + GEOM::GEOM_Object_ptr anObj = myTransfOp->OffsetShapeCopy(theObject, theOffset, true); endService( " GEOM_Superv_i::OffsetShapeCopy" ); return anObj; } @@ -2122,6 +2278,24 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceWires (GEOM::GEOM_List_ptr theWires return NULL; } +//============================================================================= +// MakeFaceWithConstraints: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFaceWithConstraints (GEOM::GEOM_List_ptr theConstraints) +{ + beginService( " GEOM_Superv_i::MakeFaceWithConstraints" ); + MESSAGE("GEOM_Superv_i::MakeFaceWithConstraints"); + if (GEOM_List_i* aConstraints = + dynamic_cast*>(GetServant(theConstraints, myPOA).in())) { + getShapesOp(); + GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeFaceWithConstraints(aConstraints->GetList()); + endService( " GEOM_Superv_i::MakeFaceWithConstraints" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeFaceWithConstraints" ); + return NULL; +} + //============================================================================= // MakeShell: //============================================================================= @@ -2189,6 +2363,25 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes return NULL; } +//============================================================================= +// MakeSolidFromConnectedFaces: +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSolidFromConnectedFaces (GEOM::GEOM_List_ptr theFacesOrShells, + CORBA::Boolean isIntersect) +{ + beginService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" ); + MESSAGE("GEOM_Superv_i::MakeSolidFromConnectedFaces"); + if (GEOM_List_i* aListImpl = + dynamic_cast*>(GetServant(theFacesOrShells, myPOA).in())) { + getShapesOp(); + GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeSolidFromConnectedFaces(aListImpl->GetList(), isIntersect); + endService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" ); + return NULL; +} + //============================================================================= // MakeGlueFaces: //============================================================================= @@ -2199,8 +2392,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFaces (GEOM::GEOM_Object_ptr theSha beginService( " GEOM_Superv_i::MakeGlueFaces" ); MESSAGE("GEOM_Superv_i::MakeGlueFaces"); getShapesOp(); + GEOM::ListOfGO_var objList = new GEOM::ListOfGO; + objList->length( 1 ); + objList[0] = theShape; GEOM::GEOM_Object_ptr anObj = - myShapesOp->MakeGlueFaces(theShape, theTolerance, doKeepNonSolids); + myShapesOp->MakeGlueFaces(objList, theTolerance, doKeepNonSolids); endService( " GEOM_Superv_i::MakeGlueFaces" ); return anObj; } @@ -2214,7 +2410,10 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetGlueFaces (GEOM::GEOM_Object_ptr theShape, beginService( " GEOM_Superv_i::GetGlueFaces" ); MESSAGE("GEOM_Superv_i::GetGlueFaces"); getShapesOp(); - GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(theShape, theTolerance); + GEOM::ListOfGO_var objList = new GEOM::ListOfGO; + objList->length( 1 ); + objList[0] = theShape; + GEOM::ListOfGO* aList = myShapesOp->GetGlueFaces(objList, theTolerance); GEOM_List_i* aListPtr = new GEOM_List_i(*(aList)); MESSAGE(" List of "<GetList().length()<<" element(s)"); endService( " GEOM_Superv_i::GetGlueFaces" ); @@ -2233,8 +2432,11 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeGlueFacesByList (GEOM::GEOM_Object_ptr beginService( " GEOM_Superv_i::MakeGlueFacesByList" ); MESSAGE("GEOM_Superv_i::MakeGlueFacesByList"); getShapesOp(); + GEOM::ListOfGO_var objList = new GEOM::ListOfGO; + objList->length( 1 ); + objList[0] = theShape; GEOM::GEOM_Object_ptr anObj = - myShapesOp->MakeGlueFacesByList(theShape, theTolerance, theFaces, + myShapesOp->MakeGlueFacesByList(objList, theTolerance, theFaces, doKeepNonSolids, doGlueAllEdges); endService( " GEOM_Superv_i::MakeGlueFacesByList" ); return anObj; @@ -2564,7 +2766,7 @@ CORBA::Boolean GEOM_Superv_i::CheckCompoundOfBlocks beginService( " GEOM_Superv_i::CheckCompoundOfBlocks" ); MESSAGE("GEOM_Superv_i::CheckCompoundOfBlocks"); getBlocksOp(); - CORBA::Boolean aRes = myBlocksOp->CheckCompoundOfBlocks(theCompound, theErrors); + CORBA::Boolean aRes = myBlocksOp->CheckCompoundOfBlocks(theCompound, -1., theErrors); endService( " GEOM_Superv_i::CheckCompoundOfBlocks" ); return aRes; } @@ -3287,6 +3489,194 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetObjects (GEOM::GEOM_Object_ptr theGroup) return aListPtr->_this(); } +//=============================== Import/Export Operations ============================= +//============================================================================= +// Export STL +//============================================================================= +void GEOM_Superv_i::ExportSTL( GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + const bool theIsASCII, + CORBA::Double theDeflection, + const bool theIsRelative ) +{ + beginService( " GEOM_Superv_i::ExportSTL" ); + MESSAGE("GEOM_Superv_i::ExportSTL"); + getSTLPluginOp(); + mySTLOp->ExportSTL( theObject, theFileName, theIsASCII, theDeflection, theIsRelative ); + endService( " GEOM_Superv_i::ExportSTL" ); +} + +//============================================================================= +// Import STL +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportSTL( const char* theFileName ) +{ + beginService( " GEOM_Superv_i::ImportSTL" ); + MESSAGE("GEOM_Superv_i::ImportSTL"); + getSTLPluginOp(); + GEOM::ListOfGO* aSeq = mySTLOp->ImportSTL(theFileName ); + GEOM::GEOM_Object_ptr anObj; + + if (aSeq->length() > 0) { + anObj = aSeq->operator[](0); + } + + endService( " GEOM_Superv_i::ImportSTL" ); + return anObj; +} + +//============================================================================= +// Export BREP +//============================================================================= +void GEOM_Superv_i::ExportBREP( GEOM::GEOM_Object_ptr theObject, + const char* theFileName ) +{ + beginService( " GEOM_Superv_i::ExportBREP" ); + MESSAGE("GEOM_Superv_i::ExportBREP"); + getBREPPluginOp(); + myBREPOp->ExportBREP( theObject, theFileName ); + endService( " GEOM_Superv_i::ExportBREP" ); +} + +//============================================================================= +// Import BREP +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportBREP( const char* theFileName ) +{ + beginService( " GEOM_Superv_i::ImportBREP" ); + MESSAGE("GEOM_Superv_i::ImportBREP"); + getBREPPluginOp(); + GEOM::ListOfGO* aSeq = myBREPOp->ImportBREP(theFileName ); + GEOM::GEOM_Object_ptr anObj; + + if (aSeq->length() > 0) { + anObj = aSeq->operator[](0); + } + + endService( " GEOM_Superv_i::ImportBREP" ); + return anObj; +} + +//============================================================================= +// Export STEP +//============================================================================= +void GEOM_Superv_i::ExportSTEP( GEOM::GEOM_Object_ptr theObject, + const char* theFileName ) +{ + beginService( " GEOM_Superv_i::ExportSTEP" ); + MESSAGE("GEOM_Superv_i::ExportSTEP"); + getSTEPPluginOp(); + + const GEOM::length_unit aUnit = GEOM::LU_METER; + + mySTEPOp->ExportSTEP( theObject, theFileName, aUnit ); + endService( " GEOM_Superv_i::ExportSTEP" ); +} + +//============================================================================= +// Import STEP +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportSTEP( const char* theFileName, + const bool theIsIgnoreUnits ) +{ + beginService( " GEOM_Superv_i::ImportSTEP" ); + MESSAGE("GEOM_Superv_i::ImportSTEP"); + getSTEPPluginOp(); + GEOM::ListOfGO* aSeq = mySTEPOp->ImportSTEP(theFileName, theIsIgnoreUnits, false ); + GEOM::GEOM_Object_ptr anObj; + + if (aSeq->length() > 0) { + anObj = aSeq->operator[](0); + } + + endService( " GEOM_Superv_i::ImportSTEP" ); + return anObj; +} + +//============================================================================= +// Export IGES +//============================================================================= +void GEOM_Superv_i::ExportIGES( GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + const char* theVersion ) +{ + beginService( " GEOM_Superv_i::ExportIGES" ); + MESSAGE("GEOM_Superv_i::ExportIGES"); + getIGESPluginOp(); + myIGESOp->ExportIGES( theObject, theFileName, theVersion ); + endService( " GEOM_Superv_i::ExportIGES" ); +} + +//============================================================================= +// Import IGES +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::ImportIGES( const char* theFileName, + const bool theIsIgnoreUnits ) +{ + beginService( " GEOM_Superv_i::ImportIGES" ); + MESSAGE("GEOM_Superv_i::ImportIGES"); + getIGESPluginOp(); + GEOM::ListOfGO* aSeq = myIGESOp->ImportIGES(theFileName, theIsIgnoreUnits ); + GEOM::GEOM_Object_ptr anObj; + + if (aSeq->length() > 0) { + anObj = aSeq->operator[](0); + } + + endService( " GEOM_Superv_i::ImportIGES" ); + return anObj; +} + +//============================================================================= +// Export XAO +//============================================================================= +CORBA::Boolean GEOM_Superv_i::ExportXAO( GEOM::GEOM_Object_ptr shape, + const GEOM::ListOfGO& groups, + const GEOM::ListOfFields& fields, + const char* author, + const char* fileName, + const char* shapeFileName ) +{ + beginService( " GEOM_Superv_i::ExportXAO" ); + MESSAGE("GEOM_Superv_i::ExportXAO"); + getXAOPluginOp(); + CORBA::Boolean isGood = myXAOOp->ExportXAO( shape, groups, fields, author, fileName, shapeFileName ); + endService( " GEOM_Superv_i::ExportXAO" ); + return isGood; +} + +//============================================================================= +// Import XAO +//============================================================================= +CORBA::Boolean GEOM_Superv_i::ImportXAO( const char* fileName, + GEOM::GEOM_Object_out shape, + GEOM::ListOfGO_out subShapes, + GEOM::ListOfGO_out groups, + GEOM::ListOfFields_out fields ) +{ + return false; +} + + +//============================================================================= +// Export VTK +//============================================================================= +void GEOM_Superv_i::ExportVTK( GEOM::GEOM_Object_ptr theObject, + const char* theFileName, + CORBA::Double theDeflection ) +{ + #ifdef WITH_VTK + beginService( " GEOM_Superv_i::ExportVTK" ); + MESSAGE("GEOM_Superv_i::ExportVTK"); + getVTKPluginOp(); + myVTKOp->ExportVTK( theObject, theFileName, theDeflection ); + endService( " GEOM_Superv_i::ExportVTK" ); +#else + std::string message("GEOM_Superv_i::ExportVTK functionality is unavailable"); + THROW_SALOME_CORBA_EXCEPTION(message.c_str(), SALOME::INTERNAL_ERROR); +#endif +} + //=============================== Advanced Operations ============================= //============================================================================= // MakePipeTShape @@ -3433,6 +3823,25 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDividedCylinder (CORBA::Double theR, return anObj; } +//============================================================================= +// MakeSmoothingSurface +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSmoothingSurface (GEOM::GEOM_List_ptr thelPoints) +{ + beginService( " GEOM_Superv_i::MakeSmoothingSurface" ); + MESSAGE("GEOM_Superv_i::MakeSmoothingSurface"); + getAdvancedOp(); + if (GEOM_List_i* aListImplP = + dynamic_cast*>(GetServant(thelPoints, myPOA).in())) { + getCurvesOp(); + GEOM::GEOM_Object_ptr anObj = myAdvancedOp->MakeSmoothingSurface(aListImplP->GetList(), 2, 8, 0.); + endService( " GEOM_Superv_i::MakeSmoothingSurface" ); + return anObj; + } + endService( " GEOM_Superv_i::MakeSmoothingSurface" ); + return NULL; +} + /*@@ insert new functions before this line @@ do not remove this line @@*/ //=====================================================================================