Add methods for creatin thrusections and pipe with different sections

This commit is contained in:
gka 2006-04-24 07:57:02 +00:00
parent aa800f73f1
commit b85ada0a2a
2 changed files with 109 additions and 0 deletions

View File

@ -484,3 +484,101 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_pt
return GetObject(anObject);
}
//=============================================================================
/*!
* MakeThruSections
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
CORBA::Boolean theModeSolid,
CORBA::Double thePreci,
CORBA::Boolean theRuled)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
int ind, aLen;
//Get the shapes
aLen = theSeqSections.length();
for (ind = 0; ind < aLen; ind++) {
if (theSeqSections[ind] == NULL) continue;
Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
(theSeqSections[ind]->GetStudyID(), theSeqSections[ind]->GetEntry());
if (!aSh.IsNull())
aSeqSections->Append(aSh);
}
if(!aSeqSections->Length())
return aGEOMObject._retn();
// Make shell or solid
Handle(GEOM_Object) anObject =
GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePipeWithDifferentSections
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
const GEOM::ListOfGO& theLocations,
GEOM::GEOM_Object_ptr thePath,
CORBA::Boolean theWithContact,
CORBA::Boolean theWithCorrections)
{
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();
Handle(GEOM_Object) aPath = GetOperations()->GetEngine()->GetObject
(thePath->GetStudyID(), thePath->GetEntry());
if(aPath.IsNull())
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()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
theWithContact,theWithCorrections);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}

View File

@ -94,6 +94,17 @@ class GEOM_I3DPrimOperations_i :
GEOM::GEOM_Object_ptr MakeFilling(GEOM::GEOM_Object_ptr theShape, CORBA::Long theMinDeg, CORBA::Long theMaxDeg, CORBA::Double theTol2D, CORBA::Double theTol3D, CORBA::Long theNbIter);
GEOM::GEOM_Object_ptr MakeThruSections(const GEOM::ListOfGO& theSeqSections,
CORBA::Boolean theModeSolid,
CORBA::Double thePreci,
CORBA::Boolean theRuled);
GEOM::GEOM_Object_ptr MakePipeWithDifferentSections(const GEOM::ListOfGO& theBases,
const GEOM::ListOfGO& theLocations,
GEOM::GEOM_Object_ptr thePath,
CORBA::Boolean theWithContact,
CORBA::Boolean theWithCorrections);
::GEOMImpl_I3DPrimOperations* GetOperations()
{ return (::GEOMImpl_I3DPrimOperations*)GetImpl(); }
};