From b85ada0a2a2052ec7edf40139846963435601ea2 Mon Sep 17 00:00:00 2001 From: gka Date: Mon, 24 Apr 2006 07:57:02 +0000 Subject: [PATCH] Add methods for creatin thrusections and pipe with different sections --- src/GEOM_I/GEOM_I3DPrimOperations_i.cc | 98 ++++++++++++++++++++++++++ src/GEOM_I/GEOM_I3DPrimOperations_i.hh | 11 +++ 2 files changed, 109 insertions(+) diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index ac8d8fb6b..e8357a820 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -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); +} diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index acee1fdfc..bd44463d4 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -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(); } }; -- 2.39.2