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

File diff suppressed because it is too large Load Diff

View File

@ -310,7 +310,7 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
Handle(TColStd_HArray1OfInteger) theIndices,
bool isStandaloneOperation)
{
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL;
if (theMainShape.IsNull() || theIndices.IsNull()) return NULL;
Handle(TDocStd_Document) aDoc = GetDocument(theMainShape->GetDocID());
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)
bool useExisting = false;
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();
if (_freeLabels.find(aDocID) != _freeLabels.end()) {
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_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);
GEOM_ISubShape aSSI(aFunction);
GEOM_ISubShape aSSI (aFunction);
aSSI.SetMainShape(aMainShape);
aSSI.SetIndices(theIndices);
@ -372,11 +357,14 @@ Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
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);
if(_objects.IsBound(anID)) _objects.UnBind(anID);
if (_objects.IsBound(anID)) _objects.UnBind(anID);
_objects.Bind(anID, anObject);
// Put this subshape in the list of subshapes of theMainShape
aMainShape->AddSubShapeReference(aFunction);
GEOM::TPythonDump pd (aFunction);
if (isStandaloneOperation) {
@ -410,9 +398,17 @@ bool GEOM_Engine::RemoveObject(Handle(GEOM_Object) theObject)
TCollection_AsciiString anID = BuildIDFromObject(theObject);
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();
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);
if (aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode))
aNode->Remove();

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
@ -43,6 +42,7 @@
#include <TDataStd_UAttribute.hxx>
#include <TDataStd_ChildNodeIterator.hxx>
#include <TDataStd_ExtStringArray.hxx>
#include <TDataStd_ExtStringList.hxx>
#include <TDocStd_Owner.hxx>
#include <TDocStd_Document.hxx>
#include <TFunction_Function.hxx>
@ -64,6 +64,7 @@
#define RESULT_LABEL 2
#define DESCRIPTION_LABEL 3
#define HISTORY_LABEL 4
#define SUBSHAPES_LABEL 5 // 0020756: GetGroups
#define ARGUMENTS _label.FindChild((ARGUMENT_LABEL))
#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)
{
_isDone = false;
if(thePosition <= 0) return;
if(theReference.IsNull()) return;
if (thePosition <= 0) return;
if (theReference.IsNull()) return;
TDF_Label anArgLabel = ARGUMENT(thePosition);
TDF_Reference::Set(anArgLabel, theReference->GetEntry());
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
@ -721,10 +801,9 @@ Standard_EXPORT Handle_Standard_Type& GEOM_Function_Type_()
{
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);
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_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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_Function_HeaderFile
#define _GEOM_Function_HeaderFile
@ -34,10 +33,10 @@
#endif
#ifndef _Handle_MMgt_TShared_HeaderFile
#include <Handle_MMgt_TShared.hxx>
#endif
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#endif
#ifndef _Standard_GUID_HeaderFile
#include <Standard_GUID.hxx>
#endif
@ -65,31 +64,31 @@ class Handle(MMgt_TShared);
class GEOM_Function;
#include <TCollection_AsciiString.hxx>
#include <TDataStd_ListOfExtendedString.hxx>
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOM_Function);
class Handle(GEOM_Function) : public Handle(MMgt_TShared) {
public:
inline void* operator new(size_t,void* anAddress)
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
Handle(GEOM_Function)():Handle(MMgt_TShared)() {}
Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle)
Handle(GEOM_Function)():Handle(MMgt_TShared)() {}
Handle(GEOM_Function)(const Handle(GEOM_Function)& aHandle) : Handle(MMgt_TShared)(aHandle)
{
}
Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
Handle(GEOM_Function)(const GEOM_Function* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
{
}
@ -105,18 +104,18 @@ class Handle(GEOM_Function) : public Handle(MMgt_TShared) {
return *this;
}
GEOM_Function* operator->()
GEOM_Function* operator->()
{
return (GEOM_Function *)ControlAccess();
}
GEOM_Function* operator->() const
GEOM_Function* operator->() const
{
return (GEOM_Function *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOM_Function)() {};
Standard_EXPORT static const Handle(GEOM_Function) DownCast(const Handle(Standard_Transient)& AnObject);
};
@ -125,24 +124,26 @@ class GEOM_Function : public MMgt_TShared
public:
inline void* operator new(size_t,void* anAddress)
inline void* operator new(size_t,void* anAddress)
{
return anAddress;
}
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
inline void* operator new(size_t size)
{
return Standard::Allocate(size);
}
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
inline void operator delete(void *anAddress)
{
if (anAddress) Standard::Free((Standard_Address&)anAddress);
}
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOM_Function_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { 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)); }
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const
{ 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:
@ -150,22 +151,22 @@ private:
public:
//Returns a GUID for a function tree
//Returns a GUID for a function tree
Standard_EXPORT static const Standard_GUID& GetFunctionTreeID();
//Returns the ID which is associated with a reference to another function
//Returns the ID which is associated with a reference to another function
Standard_EXPORT static const Standard_GUID& GetDependencyID();
//Finds and returns a function located on a label theEntry
Standard_EXPORT static Handle(GEOM_Function) GetFunction(const TDF_Label& theEntry);
Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
Standard_EXPORT GEOM_Function(const TDF_Label& theEntry, const Standard_GUID& theGUID, int theType);
Standard_EXPORT ~GEOM_Function() {;}
Standard_EXPORT TDF_Label GetOwnerEntry();
//Access to properties
//Access to properties
//Returns a result of the function built by the function Driver
Standard_EXPORT TopoDS_Shape GetValue();
@ -177,7 +178,7 @@ public:
Standard_EXPORT TDF_Label& GetEntry() { return _label; }
//Returns the type of the function
Standard_EXPORT int GetType();
Standard_EXPORT int GetType();
//Returns a function Driver GUID
Standard_EXPORT Standard_GUID GetDriverGUID();
@ -185,8 +186,8 @@ public:
//Returns aPython description of the function
Standard_EXPORT TCollection_AsciiString GetDescription();
//Sets aPython description of the function
Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription);
//Sets aPython description of the function
Standard_EXPORT void SetDescription(const TCollection_AsciiString& theDescription);
//Access to arguments
@ -206,8 +207,8 @@ public:
Standard_EXPORT void SetInteger(int thePosition, int theValue);
//Returns an integer argument at position thePosition
Standard_EXPORT int GetInteger(int thePosition);
Standard_EXPORT int GetInteger(int thePosition);
//Sets an integer array argument at position thePosition
Standard_EXPORT void SetIntegerArray(int thePosition, const Handle(TColStd_HArray1OfInteger)& theArray);
@ -221,18 +222,18 @@ public:
Standard_EXPORT void SetString(int thePosition, const TCollection_AsciiString& theValue);
//Returns a string argument at position thePosition
Standard_EXPORT TCollection_AsciiString GetString(int thePosition);
Standard_EXPORT TCollection_AsciiString GetString(int thePosition);
//Returns a reference to other function argument at position thePosition
Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition);
Standard_EXPORT Handle(GEOM_Function) GetReference(int thePosition);
//Set an array of ExtendedString
Standard_EXPORT void SetStringArray(int thePosition, const Handle(TColStd_HArray1OfExtendedString)& theArray);
//Returns the array of ExtendedString
Standard_EXPORT Handle(TColStd_HArray1OfExtendedString) GetStringArray(int thePosition);
//Returns a GUID for a references tree
//Returns a GUID for a references tree
Standard_EXPORT static const Standard_GUID& GetReferencesTreeID();
//Sets a list of references to other function arguments at position thePosition
@ -240,31 +241,36 @@ public:
const Handle(TColStd_HSequenceOfTransient)& theRefList);
//Returns a list of references to other function arguments at position thePosition
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetReferenceList (int thePosition);
//Sets a TopoDS_Shape argument at position thePosition
//void SetShape(int thePosition, const TopoDS_Shape& theShape);
//Returns a TopoDS_Shape argument at position thePosition
//TopoDS_Shape GetShape(int thePosition);
//Returns true if the last method succided
//TopoDS_Shape GetShape(int thePosition);
//Returns true if the last method succided
Standard_EXPORT bool IsDone() { return _isDone; }
//Returns a sequence of the external dependencies of this function
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
Standard_EXPORT TDF_Label GetHistoryEntry (const Standard_Boolean create = Standard_True);
//Returns history label, corresponding to the label,
//on which a reference on argument is stored
Standard_EXPORT TDF_Label GetArgumentHistoryEntry (const TDF_Label& theArgumentRefEntry,
const Standard_Boolean create = Standard_True);
const Standard_Boolean create = Standard_True);
private:
TDF_Label _label;
bool _isDone;
};

View File

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

View File

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

View File

@ -19,13 +19,12 @@
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : GEOMImpl_IShapesOperations.cxx
// Created :
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
// Project : SALOME
// $Header$
//
#include <Standard_Stream.hxx>
#include "GEOMImpl_IShapesOperations.hxx"
@ -66,6 +65,7 @@
#include <TFunction_Logbook.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_IntegerArray.hxx>
#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
#include <TDF_Tool.hxx>
#include <BRepExtrema_ExtCF.hxx>
@ -803,6 +803,70 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeGlueFacesByList
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

View File

@ -85,6 +85,10 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
std::list<Handle(GEOM_Object)> theFaces,
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,
const Standard_Integer theShapeType,
const Standard_Boolean isSorted);

View File

@ -18,7 +18,6 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include <Standard_Stream.hxx>
@ -411,6 +410,31 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeGlueFacesByList
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
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifndef _GEOM_IShapesOperations_i_HeaderFile
#define _GEOM_IShapesOperations_i_HeaderFile
@ -39,21 +38,21 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
{
public:
GEOM_IShapesOperations_i (PortableServer::POA_ptr thePOA,
GEOM::GEOM_Gen_ptr theEngine,
::GEOMImpl_IShapesOperations* theImpl);
GEOM::GEOM_Gen_ptr theEngine,
::GEOMImpl_IShapesOperations* theImpl);
~GEOM_IShapesOperations_i();
GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2);
GEOM::GEOM_Object_ptr thePnt2);
GEOM::GEOM_Object_ptr MakeWire (const GEOM::ListOfGO& theEdgesAndWires,
const CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
CORBA::Boolean isPlanarWanted);
CORBA::Boolean isPlanarWanted);
GEOM::GEOM_Object_ptr MakeFaceWires (const GEOM::ListOfGO& theWires,
CORBA::Boolean isPlanarWanted);
CORBA::Boolean isPlanarWanted);
GEOM::GEOM_Object_ptr MakeShell (const GEOM::ListOfGO& theFacesAndShells);
@ -64,34 +63,36 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* GetGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance);
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeGlueFacesByList (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids);
CORBA::Double theTolerance,
const GEOM::ListOfGO& theFaces,
CORBA::Boolean doKeepNonSolids);
GEOM::ListOfGO* GetExistingSubObjects (GEOM::GEOM_Object_ptr theShape,
CORBA::Boolean theGroupsOnly);
GEOM::ListOfGO* MakeExplode (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
GEOM::ListOfLong* SubShapeAllIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
CORBA::Long theShapeType,
CORBA::Boolean isSorted);
GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape,
CORBA::Long theID);
CORBA::Long theID);
CORBA::Long GetSubShapeIndex (GEOM::GEOM_Object_ptr theMainShape,
GEOM::GEOM_Object_ptr theSubShape);
GEOM::GEOM_Object_ptr theSubShape);
CORBA::Long GetTopologyIndex (GEOM::GEOM_Object_ptr theMainShape,
GEOM::GEOM_Object_ptr theSubShape);
GEOM::GEOM_Object_ptr theSubShape);
char* GetShapeTypeString (GEOM::GEOM_Object_ptr theShape);
@ -105,25 +106,25 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::ListOfLong* GetFreeFacesIDs (GEOM::GEOM_Object_ptr theShape);
GEOM::ListOfGO* GetSharedShapes (GEOM::GEOM_Object_ptr theShape1,
GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theShapeType);
GEOM::GEOM_Object_ptr theShape2,
CORBA::Long theShapeType);
GEOM::ListOfGO* GetShapesOnPlane (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnPlaneWithLocation(GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::GEOM_Object_ptr thePnt,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::GEOM_Object_ptr thePnt,
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnCylinder (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theRadius,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theRadius,
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnCylinderWithLocation (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
@ -133,10 +134,10 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnSphere (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theCenter,
CORBA::Double theRadius,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theCenter,
CORBA::Double theRadius,
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnQuadrangle (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
@ -147,21 +148,21 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnPlaneIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnPlaneWithLocationIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::GEOM_Object_ptr thePnt,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAx1,
GEOM::GEOM_Object_ptr thePnt,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnCylinderIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theRadius,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theAxis,
CORBA::Double theRadius,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnCylinderWithLocationIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
@ -171,10 +172,10 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnSphereIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theCenter,
CORBA::Double theRadius,
GEOM::shape_state theState);
CORBA::Long theShapeType,
GEOM::GEOM_Object_ptr theCenter,
CORBA::Double theRadius,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnQuadrangleIDs (GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
@ -185,39 +186,39 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnBox (GEOM::GEOM_Object_ptr theBox,
GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnBoxIDs (GEOM::GEOM_Object_ptr theBox,
GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr theShape,
CORBA::Long theShapeType,
GEOM::shape_state theState);
GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
GEOM::shape_state theState);
GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr GetInPlaceByHistory (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr GetSame (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat);
GEOM::GEOM_Object_ptr theShapeWhat);
::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }

View File

@ -437,6 +437,14 @@ def TestAll (geompy, math):
nameS = geompy.SubShapeName(SubFaceS, Box)
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
SubEdgeList = geompy.SubShapeAll(SubFace, geompy.ShapeType["EDGE"])
i=0

View File

@ -2052,6 +2052,32 @@ class geompyDC(GEOM._objref_GEOM_Gen):
## @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.
# @param aShape Shape to be exploded.
# @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
//
// File: IGESImport.cxx
// Created: Wed May 19 14:36:35 2004
// Author: Pavel TELKOV
// <ptv@mutex.nnov.opencascade.com>
// File: IGESImport.cxx
// Created: Wed May 19 14:36:35 2004
// Author: Pavel TELKOV
// <ptv@mutex.nnov.opencascade.com>
//
#include "utilities.h"
#include <Basics_Utils.hxx>