mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-05-30 14:27:49 +05:00
Integration of new pipe algorithm (MakePipeWithoutPath).
This commit is contained in:
parent
ecb71846db
commit
aba38d6df2
@ -910,7 +910,16 @@ module GEOM
|
|||||||
in GEOM_Object thePath,
|
in GEOM_Object thePath,
|
||||||
in boolean theWithContact ,
|
in boolean theWithContact ,
|
||||||
in boolean theWithCorrection );
|
in boolean theWithCorrection );
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Create solids between given sections
|
||||||
|
* \param theSeqBases - list of sections (shell or face).
|
||||||
|
* \param theLocations - list of corresponding vertexes
|
||||||
|
* \return New GEOM_Object, containing the created solids.
|
||||||
|
*/
|
||||||
|
GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
|
||||||
|
in ListOfGO theLocations );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -184,6 +184,9 @@ module GEOM
|
|||||||
in boolean theWithContact ,
|
in boolean theWithContact ,
|
||||||
in boolean theWithCorrection );
|
in boolean theWithCorrection );
|
||||||
|
|
||||||
|
GEOM_Object MakePipeShellsWithoutPath (in ListOfGO theSeqBases,
|
||||||
|
in ListOfGO theLocations );
|
||||||
|
|
||||||
//-----------------------------------------------------------//
|
//-----------------------------------------------------------//
|
||||||
// BooleanOperations //
|
// BooleanOperations //
|
||||||
//-----------------------------------------------------------//
|
//-----------------------------------------------------------//
|
||||||
|
@ -1375,6 +1375,23 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
|
|||||||
|
|
||||||
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<< "], [";
|
||||||
|
|
||||||
for(i =1 ; i <= nbLocs; i++) {
|
for(i =1 ; i <= nbLocs; i++) {
|
||||||
|
|
||||||
Handle(Standard_Transient) anItem = theLocations->Value(i);
|
Handle(Standard_Transient) anItem = theLocations->Value(i);
|
||||||
@ -1396,3 +1413,135 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeWithShellSections(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakePipeShellsWithoutPath
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeShellsWithoutPath(
|
||||||
|
const Handle(TColStd_HSequenceOfTransient)& theBases,
|
||||||
|
const Handle(TColStd_HSequenceOfTransient)& theLocations)
|
||||||
|
{
|
||||||
|
Handle(GEOM_Object) anObj;
|
||||||
|
SetErrorCode(KO);
|
||||||
|
if(theBases.IsNull())
|
||||||
|
return anObj;
|
||||||
|
|
||||||
|
Standard_Integer nbBases = theBases->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 =
|
||||||
|
aPipeDS->AddFunction(GEOMImpl_PipeDriver::GetID(), PIPE_SHELLS_WITHOUT_PATH);
|
||||||
|
if (aFunction.IsNull()) return anObj;
|
||||||
|
|
||||||
|
//Check if the function is set correctly
|
||||||
|
if (aFunction->GetDriverGUID() != GEOMImpl_PipeDriver::GetID()) return anObj;
|
||||||
|
|
||||||
|
GEOMImpl_IPipeShellSect aCI (aFunction);
|
||||||
|
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aSeqLocs = new TColStd_HSequenceOfTransient;
|
||||||
|
|
||||||
|
Standard_Integer i =1;
|
||||||
|
for( ; i <= nbBases; i++) {
|
||||||
|
|
||||||
|
Handle(Standard_Transient) anItem = theBases->Value(i);
|
||||||
|
if(anItem.IsNull())
|
||||||
|
continue;
|
||||||
|
Handle(GEOM_Object) aBase = Handle(GEOM_Object)::DownCast(anItem);
|
||||||
|
if(aBase.IsNull())
|
||||||
|
continue;
|
||||||
|
Handle(GEOM_Function) aRefBase = aBase->GetLastFunction();
|
||||||
|
if(aRefBase.IsNull())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(nbLocs) {
|
||||||
|
Handle(Standard_Transient) anItemLoc = theLocations->Value(i);
|
||||||
|
if(anItemLoc.IsNull())
|
||||||
|
continue;
|
||||||
|
Handle(GEOM_Object) aLoc = Handle(GEOM_Object)::DownCast(anItemLoc);
|
||||||
|
if(aLoc.IsNull())
|
||||||
|
continue;
|
||||||
|
Handle(GEOM_Function) aRefLoc = aLoc->GetLastFunction();
|
||||||
|
if(aRefLoc.IsNull())
|
||||||
|
continue;
|
||||||
|
aSeqLocs->Append(aRefLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
aSeqBases->Append(aRefBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!aSeqBases->Length())
|
||||||
|
return anObj;
|
||||||
|
|
||||||
|
aCI.SetBases(aSeqBases);
|
||||||
|
aCI.SetLocations(aSeqLocs);
|
||||||
|
|
||||||
|
//Compute the Pipe value
|
||||||
|
try {
|
||||||
|
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
#endif
|
||||||
|
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||||
|
SetErrorCode("Pipe with shell sections without path driver failed");
|
||||||
|
return anObj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Standard_Failure) {
|
||||||
|
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||||
|
SetErrorCode(aFail->GetMessageString());
|
||||||
|
return anObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Make a Python command
|
||||||
|
GEOM::TPythonDump pyDump(aFunction);
|
||||||
|
pyDump << aPipeDS << " = geompy.MakePipeShellsWithoutPath([";
|
||||||
|
|
||||||
|
for(i =1 ; i <= nbBases; i++) {
|
||||||
|
|
||||||
|
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<< "], [";
|
||||||
|
|
||||||
|
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<< "])";
|
||||||
|
|
||||||
|
SetErrorCode(OK);
|
||||||
|
return aPipeDS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -94,6 +94,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
|||||||
bool theWithContact,
|
bool theWithContact,
|
||||||
bool theWithCorrections);
|
bool theWithCorrections);
|
||||||
|
|
||||||
|
Standard_EXPORT Handle(GEOM_Object) MakePipeShellsWithoutPath(
|
||||||
|
const Handle(TColStd_HSequenceOfTransient)& theBases,
|
||||||
|
const Handle(TColStd_HSequenceOfTransient)& theLocations);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -163,6 +163,7 @@
|
|||||||
#define PIPE_BASE_PATH 1
|
#define PIPE_BASE_PATH 1
|
||||||
#define PIPE_DIFFERENT_SECTIONS 2
|
#define PIPE_DIFFERENT_SECTIONS 2
|
||||||
#define PIPE_SHELL_SECTIONS 3
|
#define PIPE_SHELL_SECTIONS 3
|
||||||
|
#define PIPE_SHELLS_WITHOUT_PATH 4
|
||||||
|
|
||||||
#define THRUSECTIONS_RULED 1
|
#define THRUSECTIONS_RULED 1
|
||||||
#define THRUSECTIONS_SMOOTHED 2
|
#define THRUSECTIONS_SMOOTHED 2
|
||||||
|
@ -597,7 +597,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
|
|||||||
CORBA::Boolean theWithContact,
|
CORBA::Boolean theWithContact,
|
||||||
CORBA::Boolean theWithCorrections)
|
CORBA::Boolean theWithCorrections)
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var aGEOMObject;
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
@ -659,3 +659,57 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
|
|||||||
|
|
||||||
return GetObject(anObject);
|
return GetObject(anObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
/*!
|
||||||
|
* MakePipeWithShellSections
|
||||||
|
*/
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
|
||||||
|
(const GEOM::ListOfGO& theBases,
|
||||||
|
const GEOM::ListOfGO& theLocations)
|
||||||
|
{
|
||||||
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
|
//Set a not done flag
|
||||||
|
GetOperations()->SetNotDone();
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
|
||||||
|
Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
|
||||||
|
int ind=0, aNbBases=0, aNbLocs=0;
|
||||||
|
|
||||||
|
//Get the shapes
|
||||||
|
aNbBases = theBases.length();
|
||||||
|
aNbLocs = theLocations.length();
|
||||||
|
|
||||||
|
if( aNbLocs && aNbBases != aNbLocs)
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
for (ind = 0; ind < aNbBases; ind++) {
|
||||||
|
if (theBases[ind] == NULL) continue;
|
||||||
|
Handle(GEOM_Object) aBase = GetOperations()->GetEngine()->
|
||||||
|
GetObject(theBases[ind]->GetStudyID(), theBases[ind]->GetEntry());
|
||||||
|
if(aBase.IsNull())
|
||||||
|
continue;
|
||||||
|
if(aNbLocs) {
|
||||||
|
Handle(GEOM_Object) aLoc = GetOperations()->GetEngine()->GetObject
|
||||||
|
(theLocations[ind]->GetStudyID(), theLocations[ind]->GetEntry());
|
||||||
|
if(aLoc.IsNull())
|
||||||
|
continue;
|
||||||
|
aSeqLocations->Append(aLoc);
|
||||||
|
}
|
||||||
|
aSeqBases->Append(aBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!aSeqBases->Length())
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
// Make pipe
|
||||||
|
Handle(GEOM_Object) anObject =
|
||||||
|
GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
|
||||||
|
|
||||||
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||||
|
return aGEOMObject._retn();
|
||||||
|
|
||||||
|
return GetObject(anObject);
|
||||||
|
}
|
||||||
|
@ -112,6 +112,9 @@ class GEOM_I3DPrimOperations_i :
|
|||||||
CORBA::Boolean theWithContact,
|
CORBA::Boolean theWithContact,
|
||||||
CORBA::Boolean theWithCorrections);
|
CORBA::Boolean theWithCorrections);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
|
||||||
|
const GEOM::ListOfGO& theLocations);
|
||||||
|
|
||||||
::GEOMImpl_I3DPrimOperations* GetOperations()
|
::GEOMImpl_I3DPrimOperations* GetOperations()
|
||||||
{ return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
|
{ return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
|
||||||
};
|
};
|
||||||
|
@ -1017,6 +1017,23 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithShellSections
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=============================================================================
|
||||||
|
// MakePipe:
|
||||||
|
//=============================================================================
|
||||||
|
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeShellsWithoutPath
|
||||||
|
(const GEOM::ListOfGO& theBases,
|
||||||
|
const GEOM::ListOfGO& theLocations)
|
||||||
|
{
|
||||||
|
beginService( " GEOM_Superv_i::MakePipeShellsWithoutPath" );
|
||||||
|
MESSAGE("GEOM_Superv_i::MakePipeShellsWithoutPath");
|
||||||
|
get3DPrimOp();
|
||||||
|
GEOM::GEOM_Object_ptr anObj =
|
||||||
|
my3DPrimOp->MakePipeShellsWithoutPath(theBases,theLocations);
|
||||||
|
endService( " GEOM_Superv_i::MakePipeShellsWithoutPath" );
|
||||||
|
return anObj;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
// MakeFuse:
|
// MakeFuse:
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -243,6 +243,9 @@ public:
|
|||||||
GEOM::GEOM_Object_ptr thePath,
|
GEOM::GEOM_Object_ptr thePath,
|
||||||
CORBA::Boolean theWithContact,
|
CORBA::Boolean theWithContact,
|
||||||
CORBA::Boolean theWithCorrections);
|
CORBA::Boolean theWithCorrections);
|
||||||
|
|
||||||
|
GEOM::GEOM_Object_ptr MakePipeShellsWithoutPath(const GEOM::ListOfGO& theBases,
|
||||||
|
const GEOM::ListOfGO& theLocations);
|
||||||
|
|
||||||
//-----------------------------------------------------------//
|
//-----------------------------------------------------------//
|
||||||
// BooleanOperations //
|
// BooleanOperations //
|
||||||
|
@ -768,6 +768,51 @@ def MakePipeWithShellSections(theSeqBases, theSeqSubBases,
|
|||||||
print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
|
print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
def MakePipeWithShellSectionsBySteps(theSeqBases, theSeqSubBases,
|
||||||
|
theLocations, thePath,
|
||||||
|
theWithContact, theWithCorrection):
|
||||||
|
res = []
|
||||||
|
nbsect = len(theSeqBases)
|
||||||
|
nbsubsect = len(theSeqSubBases)
|
||||||
|
#print "nbsect = ",nbsect
|
||||||
|
for i in range(1,nbsect):
|
||||||
|
#print " i = ",i
|
||||||
|
tmpSeqBases = [ theSeqBases[i-1], theSeqBases[i] ]
|
||||||
|
tmpLocations = [ theLocations[i-1], theLocations[i] ]
|
||||||
|
tmpSeqSubBases = []
|
||||||
|
if nbsubsect>0: tmpSeqSubBases = [ theSeqSubBases[i-1], theSeqSubBases[i] ]
|
||||||
|
anObj = PrimOp.MakePipeWithShellSections(tmpSeqBases, tmpSeqSubBases,
|
||||||
|
tmpLocations, thePath,
|
||||||
|
theWithContact, theWithCorrection)
|
||||||
|
if PrimOp.IsDone() == 0:
|
||||||
|
print "Problems with pipe creation between ",i," and ",i+1," sections"
|
||||||
|
print "MakePipeWithShellSections : ", PrimOp.GetErrorCode()
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print "Pipe between ",i," and ",i+1," sections is OK"
|
||||||
|
res.append(anObj)
|
||||||
|
pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
resc = MakeCompound(res)
|
||||||
|
#resc = MakeSewing(res, 0.001)
|
||||||
|
#print "resc: ",resc
|
||||||
|
return resc
|
||||||
|
|
||||||
|
|
||||||
|
## Create solids between given sections
|
||||||
|
# @param theSeqBases - list of sections (shell or face).
|
||||||
|
# @param theLocations - list of corresponding vertexes
|
||||||
|
# @return New GEOM_Object, containing the created solids.
|
||||||
|
#
|
||||||
|
# Example: see GEOM_TestAll.py
|
||||||
|
def MakePipeShellsWithoutPath(theSeqBases, theLocations):
|
||||||
|
anObj = PrimOp.MakePipeShellsWithoutPath(theSeqBases, theLocations)
|
||||||
|
if PrimOp.IsDone() == 0:
|
||||||
|
print "MakePipeShellsWithoutPath : ", PrimOp.GetErrorCode()
|
||||||
|
return anObj
|
||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Create base shapes
|
# Create base shapes
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user