Mantis issue (IMP) 0020756: GetGroups() of a GEOM object.

This commit is contained in:
jfa 2010-07-23 13:18:32 +00:00
parent ea72d967c9
commit 3a293c4748
13 changed files with 741 additions and 528 deletions

View File

@ -19,10 +19,9 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : GEOM_Gen.idl // File : GEOM_Gen.idl
// Author : Sergey RUIN // Author : Sergey RUIN
//
#ifndef __GEOM_GEN__ #ifndef __GEOM_GEN__
#define __GEOM_GEN__ #define __GEOM_GEN__
@ -1399,6 +1398,17 @@ module GEOM
GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance, GEOM_Object MakeGlueFacesByList (in GEOM_Object theShape, in double theTolerance,
in ListOfGO theFaces, in boolean doKeepNonSolids); in ListOfGO theFaces, in boolean doKeepNonSolids);
/*!
* Get all sub-shapes and groups of \a theShape,
* that were created already by any other methods.
* \param theShape Any shape.
* \param theGroupsOnly If this parameter is TRUE, only groups will be
* returned, else all found sub-shapes and groups.
* \return List of existing sub-objects of \a theShape.
*/
ListOfGO GetExistingSubObjects (in GEOM_Object theShape,
in boolean theGroupsOnly);
/*! /*!
* Explode a shape on subshapes of a given type. * Explode a shape on subshapes of a given type.
* \param theShape Shape to be exploded. * \param theShape Shape to be exploded.
@ -2950,7 +2960,6 @@ module GEOM
*/ */
GEOM_Object GetCentreOfMass (in GEOM_Object theShape); GEOM_Object GetCentreOfMass (in GEOM_Object theShape);
/* /*
* Get the vertex by index for 1D objects depends the edge/wire orientation * Get the vertex by index for 1D objects depends the edge/wire orientation
* \param theShape Shape (wire or edge) to find the vertex on it * \param theShape Shape (wire or edge) to find the vertex on it

View File

@ -310,7 +310,7 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
Handle(TColStd_HArray1OfInteger) theIndices, Handle(TColStd_HArray1OfInteger) theIndices,
bool isStandaloneOperation) bool isStandaloneOperation)
{ {
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL; if (theMainShape.IsNull() || theIndices.IsNull()) return NULL;
Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID()); Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID());
Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main()); Handle(TDataStd_TreeNode) aRoot = TDataStd_TreeNode::Set(aDoc->Main());
@ -319,21 +319,6 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
// if this label has been freed (object deleted) // if this label has been freed (object deleted)
bool useExisting = false; bool useExisting = false;
TDF_Label aChild; TDF_Label aChild;
/*
if (!_lastCleared.IsNull()) {
if (_lastCleared.Root() == aDoc->Main().Root()) {
useExisting = true;
aChild = _lastCleared;
// 0020229: if next label exists and is empty, try to reuse it
Standard_Integer aNextTag = aChild.Tag() + 1;
TDF_Label aNextL = aDoc->Main().FindChild(aNextTag, Standard_False);
if (!aNextL.IsNull() && !aNextL.HasAttribute())
_lastCleared = aNextL;
else
_lastCleared.Nullify();
}
}
*/
int aDocID = theMainShape->GetDocID(); int aDocID = theMainShape->GetDocID();
if (_freeLabels.find(aDocID) != _freeLabels.end()) { if (_freeLabels.find(aDocID) != _freeLabels.end()) {
std::list<TDF_Label>& aFreeLabels = _freeLabels[aDocID]; std::list<TDF_Label>& aFreeLabels = _freeLabels[aDocID];
@ -349,10 +334,10 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
} }
Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction(); Handle(GEOM_Function) aMainShape = theMainShape->GetLastFunction();
Handle(GEOM_Object) anObject = new GEOM_Object(aChild, 28); //28 is SUBSHAPE type Handle(GEOM_Object) anObject = new GEOM_Object (aChild, 28); //28 is SUBSHAPE type
Handle(GEOM_Function) aFunction = anObject->AddFunction(GEOM_Object::GetSubShapeID(), 1); Handle(GEOM_Function) aFunction = anObject->AddFunction(GEOM_Object::GetSubShapeID(), 1);
GEOM_ISubShape aSSI(aFunction); GEOM_ISubShape aSSI (aFunction);
aSSI.SetMainShape(aMainShape); aSSI.SetMainShape(aMainShape);
aSSI.SetIndices(theIndices); aSSI.SetIndices(theIndices);
@ -372,11 +357,14 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
return NULL; return NULL;
} }
//Put an object in the map of created objects // Put an object in the map of created objects
TCollection_AsciiString anID = BuildIDFromObject(anObject); TCollection_AsciiString anID = BuildIDFromObject(anObject);
if(_objects.IsBound(anID)) _objects.UnBind(anID); if (_objects.IsBound(anID)) _objects.UnBind(anID);
_objects.Bind(anID, anObject); _objects.Bind(anID, anObject);
// Put this subshape in the list of subshapes of theMainShape
aMainShape->AddSubShapeReference(aFunction);
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
if (isStandaloneOperation) { if (isStandaloneOperation) {
@ -410,9 +398,17 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject)
TCollection_AsciiString anID = BuildIDFromObject(theObject); TCollection_AsciiString anID = BuildIDFromObject(theObject);
if (_objects.IsBound(anID)) _objects.UnBind(anID); if (_objects.IsBound(anID)) _objects.UnBind(anID);
// If subshape, remove it from the list of subshapes of its main shape
if (!theObject->IsMainShape()) {
Handle(GEOM_Function) aFunction = theObject->GetFunction(1);
GEOM_ISubShape aSSI (aFunction);
Handle(GEOM_Function) aMainShape = aSSI.GetMainShape();
aMainShape->RemoveSubShapeReference(aFunction);
}
int nb = theObject->GetNbFunctions(); int nb = theObject->GetNbFunctions();
Handle(TDataStd_TreeNode) aNode; Handle(TDataStd_TreeNode) aNode;
for (int i = 1; i<=nb; i++) { for (int i = 1; i <= nb; i++) {
Handle(GEOM_Function) aFunction = theObject->GetFunction(i); Handle(GEOM_Function) aFunction = theObject->GetFunction(i);
if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode)) if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode))
aNode->Remove(); aNode->Remove();

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
@ -43,6 +42,7 @@
#include <TDataStd_UAttribute.hxx> #include <TDataStd_UAttribute.hxx>
#include <TDataStd_ChildNodeIterator.hxx> #include <TDataStd_ChildNodeIterator.hxx>
#include <TDataStd_ExtStringArray.hxx> #include <TDataStd_ExtStringArray.hxx>
#include <TDataStd_ExtStringList.hxx>
#include <TDocStd_Owner.hxx> #include <TDocStd_Owner.hxx>
#include <TDocStd_Document.hxx> #include <TDocStd_Document.hxx>
#include <TFunction_Function.hxx> #include <TFunction_Function.hxx>
@ -64,6 +64,7 @@
#define RESULT_LABEL 2 #define RESULT_LABEL 2
#define DESCRIPTION_LABEL 3 #define DESCRIPTION_LABEL 3
#define HISTORY_LABEL 4 #define HISTORY_LABEL 4
#define SUBSHAPES_LABEL 5 // 0020756: GetGroups
#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL)) #define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
#define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition)) #define ARGUMENT(thePosition) _label.FindChild((ARGUMENT_LABEL)).FindChild((thePosition))
@ -471,8 +472,8 @@ TCollection_AsciiString GEOM_Function::GetString(int thePosition)
void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference) void GEOM_Function::SetReference(int thePosition, Handle(GEOM_Function) theReference)
{ {
_isDone = false; _isDone = false;
if(thePosition <= 0) return; if (thePosition <= 0) return;
if(theReference.IsNull()) return; if (theReference.IsNull()) return;
TDF_Label anArgLabel = ARGUMENT(thePosition); TDF_Label anArgLabel = ARGUMENT(thePosition);
TDF_Reference::Set(anArgLabel, theReference->GetEntry()); TDF_Reference::Set(anArgLabel, theReference->GetEntry());
TDataStd_UAttribute::Set(anArgLabel, GetDependencyID()); TDataStd_UAttribute::Set(anArgLabel, GetDependencyID());
@ -670,6 +671,85 @@ void GEOM_Function::GetDependency(TDF_LabelSequence& theSeq)
} }
} }
//=============================================================================
/*!
* AddSubShapeReference
*/
//=============================================================================
void GEOM_Function::AddSubShapeReference(Handle(GEOM_Function) theSubShape)
{
_isDone = false;
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
Handle(TDataStd_ExtStringList) aList;
if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
aList = new TDataStd_ExtStringList;
aSubShapesLabel.AddAttribute(aList);
}
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
aList->Append(anEntry);
_isDone = true;
}
//=============================================================================
/*!
* RemoveSubShapeReference
*/
//=============================================================================
void GEOM_Function::RemoveSubShapeReference(Handle(GEOM_Function) theSubShape)
{
_isDone = false;
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
Handle(TDataStd_ExtStringList) aList;
if (aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theSubShape->GetOwnerEntry(), anEntry);
aList->Remove(anEntry);
}
_isDone = true;
}
//=============================================================================
/*!
* HasSubShapeReferences
*/
//=============================================================================
bool GEOM_Function::HasSubShapeReferences()
{
_isDone = true;
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
return aSubShapesLabel.IsAttribute(TDataStd_ExtStringList::GetID());
}
//=============================================================================
/*!
* GetSubShapeReferences
*/
//=============================================================================
const TDataStd_ListOfExtendedString& GEOM_Function::GetSubShapeReferences()
{
_isDone = false;
TDF_Label aSubShapesLabel = _label.FindChild(SUBSHAPES_LABEL);
Handle(TDataStd_ExtStringList) aList;
if (!aSubShapesLabel.FindAttribute(TDataStd_ExtStringList::GetID(), aList)) {
aList = new TDataStd_ExtStringList;
aSubShapesLabel.AddAttribute(aList);
}
_isDone = true;
return aList->List();
}
//============================================================================= //=============================================================================
/*! /*!
* GetHistoryEntry * GetHistoryEntry
@ -721,10 +801,9 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
{ {
static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared); static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared); if (aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient); static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient); if (aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL}; static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function", static Handle_Standard_Type _aType = new Standard_Type("GEOM_Function",
@ -751,5 +830,5 @@ const Handle(GEOM_Function) Handle(GEOM_Function)::DownCast(const Handle(Standar
} }
} }
return _anOtherObject ; return _anOtherObject;
} }

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_Function_HeaderFile #ifndef _GEOM_Function_HeaderFile
#define _GEOM_Function_HeaderFile #define _GEOM_Function_HeaderFile
@ -65,7 +64,7 @@ class Handle(MMgt_TShared);
class GEOM_Function; class GEOM_Function;
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <TDataStd_ListOfExtendedString.hxx>
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function); Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function);
@ -141,8 +140,10 @@ public:
// Type management // Type management
// //
Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_(); Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOM_Function) ; } Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); } { return STANDARD_TYPE(GEOM_Function) ; }
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const
{ return (STANDARD_TYPE(GEOM_Function) == AType || MMgt_TShared::IsKind(AType)); }
private: private:
@ -254,6 +255,12 @@ public:
//Returns a sequence of the external dependencies of this function //Returns a sequence of the external dependencies of this function
Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq); Standard_EXPORT void GetDependency(TDF_LabelSequence& theSeq);
// Add/Remove/Check/Get subshape references
Standard_EXPORT void AddSubShapeReference (Handle(GEOM_Function) theSubShape);
Standard_EXPORT void RemoveSubShapeReference(Handle(GEOM_Function) theSubShape);
Standard_EXPORT bool HasSubShapeReferences();
Standard_EXPORT const TDataStd_ListOfExtendedString& GetSubShapeReferences();
//Returns top label of this function's history tree //Returns top label of this function's history tree
Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True); Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
@ -264,7 +271,6 @@ public:
private: private:
TDF_Label _label; TDF_Label _label;
bool _isDone; bool _isDone;
}; };

View File

@ -19,10 +19,9 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// NOTE: This is an intreface to a function for the Shapes // NOTE: This is an intreface to a function for the Shapes
// (Wire, Face, Shell, Solid and Compound) creation. // (Wire, Face, Shell, Solid and Compound) creation.
//
#include "GEOM_Function.hxx" #include "GEOM_Function.hxx"
#include "TColStd_HSequenceOfTransient.hxx" #include "TColStd_HSequenceOfTransient.hxx"
@ -30,7 +29,6 @@
#define SHAPE_ARG_MAIN_SHAPE 1 #define SHAPE_ARG_MAIN_SHAPE 1
#define SHAPE_ARG_INDICES 2 #define SHAPE_ARG_INDICES 2
#define SHAPE_ARG_SORTED 3
class GEOM_ISubShape class GEOM_ISubShape
{ {

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>

View File

@ -19,13 +19,12 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File : GEOMImpl_IShapesOperations.cxx // File : GEOMImpl_IShapesOperations.cxx
// Created : // Created :
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007 // Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
// Project : SALOME // Project : SALOME
// $Header$ // $Header$
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include "GEOMImpl_IShapesOperations.hxx" #include "GEOMImpl_IShapesOperations.hxx"
@ -66,6 +65,7 @@
#include <TFunction_Logbook.hxx> #include <TFunction_Logbook.hxx>
#include <TDataStd_Integer.hxx> #include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx> #include <TDataStd_IntegerArray.hxx>
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TDF_Tool.hxx> #include <TDF_Tool.hxx>
#include <BRepExtrema_ExtCF.hxx> #include <BRepExtrema_ExtCF.hxx>
@ -803,6 +803,70 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
return aGlued; return aGlued;
} }
//=============================================================================
/*!
* GetExistingSubObjects
*/
//=============================================================================
Handle(TColStd_HSequenceOfTransient) GEOMImpl_IShapesOperations::GetExistingSubObjects
(Handle(GEOM_Object) theShape,
const Standard_Boolean theGroupsOnly)
{
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
Handle(GEOM_Function) aMainShape = theShape->GetLastFunction();
if (aMainShape.IsNull()) return NULL;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
SetErrorCode(NOT_FOUND_ANY);
if (!aMainShape->HasSubShapeReferences()) return aSeq;
const TDataStd_ListOfExtendedString& aListEntries = aMainShape->GetSubShapeReferences();
if (aListEntries.IsEmpty()) return aSeq;
SetErrorCode(KO);
TCollection_AsciiString anAsciiList;
TDataStd_ListIteratorOfListOfExtendedString anIt (aListEntries);
for (; anIt.More(); anIt.Next()) {
TCollection_ExtendedString anEntry = anIt.Value();
Standard_Integer aStrLen = anEntry.LengthOfCString();
char* anEntryStr = new char[aStrLen];
anEntry.ToUTF8CString(anEntryStr);
Handle(GEOM_Object) anObj = GetEngine()->GetObject(GetDocID(), anEntryStr, false);
if (!anObj.IsNull()) {
if (!theGroupsOnly || anObj->GetType() == GEOM_GROUP) {
aSeq->Append(anObj);
// for python command
anAsciiList += anEntryStr;
anAsciiList += ",";
}
}
delete [] anEntryStr;
}
if (aSeq->Length() == 0) {
SetErrorCode(NOT_FOUND_ANY);
return aSeq;
}
//Make a Python command
anAsciiList.Trunc(anAsciiList.Length() - 1);
GEOM::TPythonDump pd (aMainShape, /*append=*/true);
pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.GetExistingSubObjects(";
pd << theShape << ", " << (int)theGroupsOnly << ")";
SetErrorCode(OK);
return aSeq;
}
//============================================================================= //=============================================================================
/*! /*!
* MakeExplode * MakeExplode

View File

@ -85,6 +85,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
std::list<Handle(GEOM_Object)> theFaces, std::list<Handle(GEOM_Object)> theFaces,
const Standard_Boolean doKeepNonSolids); const Standard_Boolean doKeepNonSolids);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetExistingSubObjects
(Handle(GEOM_Object) theShape,
const Standard_Boolean theGroupsOnly);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakeExplode (Handle(GEOM_Object) theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
const Standard_Boolean isSorted); const Standard_Boolean isSorted);

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
@ -411,6 +410,31 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
return GetObject(anObject); return GetObject(anObject);
} }
//=============================================================================
/*!
* GetExistingSubObjects
*/
//=============================================================================
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
CORBA::Boolean theGroupsOnly)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
if (aShape.IsNull()) return aSeq._retn();
Handle(TColStd_HSequenceOfTransient) aHSeq =
GetOperations()->GetExistingSubObjects(aShape, theGroupsOnly);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
Standard_Integer aLength = aHSeq->Length();
aSeq->length(aLength);
for (Standard_Integer i = 1; i <= aLength; i++)
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
return aSeq._retn();
}
//============================================================================= //=============================================================================
/*! /*!

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_IShapesOperations_i_HeaderFile #ifndef _GEOM_IShapesOperations_i_HeaderFile
#define _GEOM_IShapesOperations_i_HeaderFile #define _GEOM_IShapesOperations_i_HeaderFile
@ -75,6 +74,8 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
const GEOM::ListOfGO& theFaces, const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
CORBA::Boolean theGroupsOnly);
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape, GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType, CORBA::Long theShapeType,

View File

@ -437,6 +437,14 @@ def TestAll (geompy, math):
nameS = geompy.SubShapeName(SubFaceS, Box) nameS = geompy.SubShapeName(SubFaceS, Box)
id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS) id_SubFace = geompy.addToStudyInFather(Box, SubFaceS, nameS)
# GetExistingSubObjects
SubObjsAll = geompy.GetExistingSubObjects(Box, True)
print "For now, Box has the following created sub-objects:", SubObjsAll
# GetGroups
SubGrpsAll = geompy.GetGroups(Box)
print "For now, Box has the following created groups:", SubGrpsAll
# SubShapeAll # SubShapeAll
SubEdgeList = geompy.SubShapeAll(SubFace, geompy.ShapeType["EDGE"]) SubEdgeList = geompy.SubShapeAll(SubFace, geompy.ShapeType["EDGE"])
i=0 i=0

View File

@ -2052,6 +2052,32 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## @addtogroup l4_decompose ## @addtogroup l4_decompose
## @{ ## @{
## Get all sub-shapes and groups of \a theShape,
# that were created already by any other methods.
# @param theShape Any shape.
# @param theGroupsOnly If this parameter is TRUE, only groups will be
# returned, else all found sub-shapes and groups.
# @return List of existing sub-objects of \a theShape.
#
# @ref swig_all_decompose "Example"
def GetExistingSubObjects(self, theShape, theGroupsOnly = False):
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.GetExistingSubObjects(theShape, theGroupsOnly)
RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
return ListObj
## Get all groups of \a theShape,
# that were created already by any other methods.
# @param theShape Any shape.
# @return List of existing groups of \a theShape.
#
# @ref swig_all_decompose "Example"
def GetGroups(self, theShape):
# Example: see GEOM_TestAll.py
ListObj = self.ShapesOp.GetExistingSubObjects(theShape, True)
RaiseIfFailed("GetExistingSubObjects", self.ShapesOp)
return ListObj
## Explode a shape on subshapes of a given type. ## Explode a shape on subshapes of a given type.
# @param aShape Shape to be exploded. # @param aShape Shape to be exploded.
# @param aType Type of sub-shapes to be retrieved. # @param aType Type of sub-shapes to be retrieved.

View File

@ -19,12 +19,11 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
// File: IGESImport.cxx // File: IGESImport.cxx
// Created: Wed May 19 14:36:35 2004 // Created: Wed May 19 14:36:35 2004
// Author: Pavel TELKOV // Author: Pavel TELKOV
// <ptv@mutex.nnov.opencascade.com> // <ptv@mutex.nnov.opencascade.com>
//
#include "utilities.h" #include "utilities.h"
#include <Basics_Utils.hxx> #include <Basics_Utils.hxx>