EDF - GetShapesOnShape incomplete

Make it possible to set Tolerance as a parameter in GetShapesOnShape geompy function
This commit is contained in:
Ekaterina Sukhareva 2024-06-06 15:30:31 +01:00
parent fbbd6a9e07
commit f356cd45af
16 changed files with 112 additions and 52 deletions

View File

@ -2664,12 +2664,14 @@ module GEOM
* \param theShape - the shape to explore * \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape * \param theShapeType - type of sub-shape of theShape
* \param theState - required state * \param theState - required state
* \param theTolerance - tolerance
* \return List of IDs of all found sub-shapes. * \return List of IDs of all found sub-shapes.
*/ */
ListOfLong GetShapesOnShapeIDs (in GEOM_Object theCheckShape, ListOfLong GetShapesOnShapeIDs (in GEOM_Object theCheckShape,
in GEOM_Object theShape, in GEOM_Object theShape,
in short theShapeType, in short theShapeType,
in shape_state theState); in shape_state theState,
in double theTolerance);
/*! /*!
* \brief Find sub-shapes complying with given status * \brief Find sub-shapes complying with given status
@ -2677,12 +2679,14 @@ module GEOM
* \param theShape - the shape to explore * \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape * \param theShapeType - type of sub-shape of theShape
* \param theState - required state * \param theState - required state
* \param theTolerance - tolerance
* \return List of all found sub-shapes. * \return List of all found sub-shapes.
*/ */
ListOfGO GetShapesOnShape (in GEOM_Object theCheckShape, ListOfGO GetShapesOnShape (in GEOM_Object theCheckShape,
in GEOM_Object theShape, in GEOM_Object theShape,
in short theShapeType, in short theShapeType,
in shape_state theState); in shape_state theState,
in double theTolerance);
/*! /*!
* \brief Find sub-shapes complying with given status * \brief Find sub-shapes complying with given status
@ -2690,12 +2694,14 @@ module GEOM
* \param theShape - the shape to explore * \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape * \param theShapeType - type of sub-shape of theShape
* \param theState - required state * \param theState - required state
* \param theTolerance - tolerance
* \return compound includes all found sub-shapes. * \return compound includes all found sub-shapes.
*/ */
GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape, GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
in GEOM_Object theShape, in GEOM_Object theShape,
in short theShapeType, in short theShapeType,
in shape_state theState); in shape_state theState,
in double theTolerance);
/*! /*!
* \brief Get sub-shape(s) of \a theShapeWhere, which are * \brief Get sub-shape(s) of \a theShapeWhere, which are

View File

@ -413,11 +413,13 @@ module GEOM
GEOM_List GetShapesOnShape (in GEOM_Object theCheckShape, GEOM_List GetShapesOnShape (in GEOM_Object theCheckShape,
in GEOM_Object theShape, in GEOM_Object theShape,
in short theShapeType, in short theShapeType,
in shape_state theState); in shape_state theState,
in double theTolerance);
GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape, GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
in GEOM_Object theShape, in GEOM_Object theShape,
in short theShapeType, in short theShapeType,
in shape_state theState); in shape_state theState,
in double theTolerance);
//-----------------------------------------------------------// //-----------------------------------------------------------//
// BlocksOperations // // BlocksOperations //

View File

@ -396,7 +396,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1); Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1);
if (junctionFaces1.IsNull()) if (junctionFaces1.IsNull())
junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound
(aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN); (aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN, Precision::Confusion());
if (!junctionFaces1.IsNull()) { if (!junctionFaces1.IsNull()) {
junctionFaces1->GetLastFunction()->SetDescription(""); junctionFaces1->GetLastFunction()->SetDescription("");
junctionFaces1->SetName("JUNCTION_FACE_1"); junctionFaces1->SetName("JUNCTION_FACE_1");
@ -410,7 +410,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2); Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2);
if (junctionFaces2.IsNull()) if (junctionFaces2.IsNull())
junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound
(aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN); (aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN, Precision::Confusion());
if (!junctionFaces2.IsNull()) { if (!junctionFaces2.IsNull()) {
junctionFaces2->GetLastFunction()->SetDescription(""); junctionFaces2->GetLastFunction()->SetDescription("");
junctionFaces2->SetName("JUNCTION_FACE_2"); junctionFaces2->SetName("JUNCTION_FACE_2");
@ -424,7 +424,7 @@ bool AdvancedEngine_IOperations::MakeGroups(Handle(GEOM_Object) theShape, int sh
Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3); Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3);
if (junctionFaces3.IsNull()) if (junctionFaces3.IsNull())
junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound
(aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN); (aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN, Precision::Confusion());
if (!junctionFaces3.IsNull()) { if (!junctionFaces3.IsNull()) {
junctionFaces3->GetLastFunction()->SetDescription(""); junctionFaces3->GetLastFunction()->SetDescription("");
junctionFaces3->SetName("JUNCTION_FACE_3"); junctionFaces3->SetName("JUNCTION_FACE_3");

View File

@ -5279,6 +5279,10 @@ Please, select face, shell or solid and try again</translation>
<message> <message>
<source>GEOM_SHAPES_ON_SHAPE_STATE</source> <source>GEOM_SHAPES_ON_SHAPE_STATE</source>
<translation>State</translation> <translation>State</translation>
</message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
<translation>Tolerance</translation>
</message> </message>
<message> <message>
<source>GEOM_KIND_OF_SHAPE</source> <source>GEOM_KIND_OF_SHAPE</source>

View File

@ -5272,6 +5272,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_SHAPES_ON_SHAPE_STATE</source> <source>GEOM_SHAPES_ON_SHAPE_STATE</source>
<translation>Etat</translation> <translation>Etat</translation>
</message> </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
<translation>Tolérance </translation>
</message>
<message> <message>
<source>GEOM_KIND_OF_SHAPE</source> <source>GEOM_KIND_OF_SHAPE</source>
<translation>Type d&apos;objet :</translation> <translation>Type d&apos;objet :</translation>

View File

@ -5275,6 +5275,10 @@
<source>GEOM_SHAPES_ON_SHAPE_STATE</source> <source>GEOM_SHAPES_ON_SHAPE_STATE</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
<translation></translation>
</message>
<message> <message>
<source>GEOM_KIND_OF_SHAPE</source> <source>GEOM_KIND_OF_SHAPE</source>
<translation>:</translation> <translation>:</translation>

View File

@ -2901,7 +2901,8 @@ Handle(TColStd_HSequenceOfInteger)
(const Handle(GEOM_Object)& theCheckShape, (const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState) GEOMAlgo_State theState,
const Standard_Real theTolerance)
{ {
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
@ -2917,7 +2918,7 @@ Handle(TColStd_HSequenceOfInteger)
// Compute classification tolerance. // Compute classification tolerance.
TopTools_IndexedMapOfShape aMapVtx; TopTools_IndexedMapOfShape aMapVtx;
Standard_Real aTol = Precision::Confusion(); Standard_Real aTol = theTolerance;
TopExp::MapShapes(aShape, TopAbs_VERTEX, aMapVtx); TopExp::MapShapes(aShape, TopAbs_VERTEX, aMapVtx);
@ -3010,10 +3011,11 @@ Handle(TColStd_HSequenceOfInteger)
(const Handle(GEOM_Object)& theCheckShape, (const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState) GEOMAlgo_State theState,
const Standard_Real theTolerance)
{ {
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState); getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL; return NULL;
@ -3030,7 +3032,8 @@ Handle(TColStd_HSequenceOfInteger)
<< theCheckShape << ", " << theCheckShape << ", "
<< theShape << ", " << theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", " << TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")"; << theState << ", "
<< theTolerance << ")";
#endif // DUMP_SUBSHAPE_IDS #endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK); SetErrorCode(OK);
@ -3053,10 +3056,11 @@ Handle(TColStd_HSequenceOfTransient)
(const Handle(GEOM_Object)& theCheckShape, (const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState) GEOMAlgo_State theState,
const Standard_Real theTolerance)
{ {
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState); getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL; return NULL;
@ -3078,7 +3082,8 @@ Handle(TColStd_HSequenceOfTransient)
<< theCheckShape << ", " << theCheckShape << ", "
<< theShape << ", " << theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", " << TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")"; << theState << ", "
<< theTolerance << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aSeq; return aSeq;
@ -3091,10 +3096,11 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound
(const Handle(GEOM_Object)& theCheckShape, (const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState) GEOMAlgo_State theState,
const Standard_Real theTolerance)
{ {
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs = Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState); getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 ) if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL; return NULL;
@ -3137,8 +3143,8 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound
<< theCheckShape << ", " << theCheckShape << ", "
<< theShape << ", " << theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", " << TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")"; << theState << ", "
<< theTolerance << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aRes; return aRes;

View File

@ -397,13 +397,15 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
* \param theShape - the shape to explore * \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape * \param theShapeType - type of sub-shape of theShape
* \param theState - required state * \param theState - required state
* \param theTolerance - tolerance
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes * \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
*/ */
Standard_EXPORT Handle(TColStd_HSequenceOfInteger) Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape, GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState); GEOMAlgo_State theState,
const Standard_Real theTolerance);
/*! /*!
* \brief Find sub-shapes complying with given status about surface * \brief Find sub-shapes complying with given status about surface
@ -411,18 +413,21 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
* \param theShape - the shape to explore * \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape * \param theShapeType - type of sub-shape of theShape
* \param theState - required state * \param theState - required state
* \param theTolerance - tolerance
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects * \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
*/ */
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape, GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState); GEOMAlgo_State theState,
const Standard_Real theTolerance);
Standard_EXPORT Handle(GEOM_Object) Standard_EXPORT Handle(GEOM_Object)
GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape, GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState); GEOMAlgo_State theState,
const Standard_Real theTolerance);
/*! /*!
* \brief Resize the input edge with the new Min and Max parameters. * \brief Resize the input edge with the new Min and Max parameters.
@ -628,7 +633,8 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
(const Handle(GEOM_Object)& theCheckShape, (const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape, const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType, const Standard_Integer theShapeType,
GEOMAlgo_State theState); GEOMAlgo_State theState,
const Standard_Real theTolerance);
/*! /*!
* \brief Find shape objects and their entries by their ids * \brief Find shape objects and their entries by their ids

View File

@ -1188,7 +1188,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapes(GEOM::GEOM_Object_ptr theObject,
{ {
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject, aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
(short)GEOM::SOLID, GEOM::ST_ONIN); (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
} }
break; break;
case GEOM::FSM_GetInPlaceByHistory: case GEOM::FSM_GetInPlaceByHistory:
@ -1469,7 +1469,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreSubShapesOneLevel (SALOMEDS::SObject_ptr th
{ {
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
(short)GEOM::SOLID, GEOM::ST_ONIN); (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
} }
break; break;
case GEOM::FSM_GetInPlaceByHistory: case GEOM::FSM_GetInPlaceByHistory:
@ -1753,7 +1753,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapes(GEOM::GEOM_Object_ptr theObj
{ {
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject, aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
(short)GEOM::SOLID, GEOM::ST_ONIN); (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
} }
break; break;
case GEOM::FSM_GetInPlaceByHistory: case GEOM::FSM_GetInPlaceByHistory:
@ -2032,7 +2032,7 @@ GEOM::ListOfGO* GEOM_Gen_i::RestoreGivenSubShapesOneLevel (SALOMEDS::SObject_ptr
{ {
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids // Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO, aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
(short)GEOM::SOLID, GEOM::ST_ONIN); (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
} }
break; break;
case GEOM::FSM_GetInPlaceByHistory: case GEOM::FSM_GetInPlaceByHistory:

View File

@ -1850,7 +1850,8 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
(GEOM::GEOM_Object_ptr theCheckShape, (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState) GEOM::shape_state theState,
CORBA::Double theTolerance)
{ {
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
@ -1866,7 +1867,7 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetShapesOnShape
//Get Shapes On Shape //Get Shapes On Shape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
(aCheckShape,aShape, theShapeType,ShapeState(theState)); (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
if (!GetOperations()->IsDone() || aHSeq.IsNull()) if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn(); return aSeq._retn();
@ -1889,7 +1890,8 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape, (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState) GEOM::shape_state theState,
CORBA::Double theTolerance)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -1905,7 +1907,7 @@ GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::GetShapesOnShapeAsCompound
//Get Shapes On Shape //Get Shapes On Shape
Handle(::GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound Handle(::GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
(aCheckShape,aShape, theShapeType,ShapeState(theState)); (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
if (anObject.IsNull()) if (anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -1923,7 +1925,8 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
(GEOM::GEOM_Object_ptr theCheckShape, (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState) GEOM::shape_state theState,
CORBA::Double theTolerance)
{ {
GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong; GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
@ -1939,7 +1942,7 @@ GEOM::ListOfLong* GEOM_IShapesOperations_i::GetShapesOnShapeIDs
//Get Shapes On Shape //Get Shapes On Shape
Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
(aCheckShape,aShape, theShapeType,ShapeState(theState)); (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
if (!GetOperations()->IsDone() || aHSeq.IsNull()) if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn(); return aSeq._retn();

View File

@ -262,18 +262,21 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape, GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theSheckShape, (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState,
CORBA::Double theTolerance);
GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape, GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere, GEOM::GEOM_Object_ptr GetInPlace (GEOM::GEOM_Object_ptr theShapeWhere,
GEOM::GEOM_Object_ptr theShapeWhat); GEOM::GEOM_Object_ptr theShapeWhat);

View File

@ -2424,13 +2424,14 @@ GEOM::GEOM_List_ptr GEOM_Superv_i::GetShapesOnShape
(GEOM::GEOM_Object_ptr theCheckShape, (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState) GEOM::shape_state theState,
CORBA::Double theTolerance)
{ {
beginService( " GEOM_Superv_i::GetShapesOnShape" ); beginService( " GEOM_Superv_i::GetShapesOnShape" );
MESSAGE("GEOM_Superv_i::GetShapesOnShape"); MESSAGE("GEOM_Superv_i::GetShapesOnShape");
getShapesOp(); getShapesOp();
GEOM::ListOfGO* aList = GEOM::ListOfGO* aList =
myShapesOp->GetShapesOnShape(theCheckShape, theShape, theShapeType, theState); myShapesOp->GetShapesOnShape(theCheckShape, theShape, theShapeType, theState, theTolerance);
GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList)); GEOM_List_i<GEOM::ListOfGO>* aListPtr = new GEOM_List_i<GEOM::ListOfGO>(*(aList));
MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)"); MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
endService( " GEOM_Superv_i::GetShapesOnShape" ); endService( " GEOM_Superv_i::GetShapesOnShape" );
@ -2445,13 +2446,14 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape, (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState) GEOM::shape_state theState,
CORBA::Double theTolerance)
{ {
beginService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" ); beginService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
MESSAGE("GEOM_Superv_i::GetShapesOnShapeAsCompound"); MESSAGE("GEOM_Superv_i::GetShapesOnShapeAsCompound");
getShapesOp(); getShapesOp();
GEOM::GEOM_Object_ptr anObj = GEOM::GEOM_Object_ptr anObj =
myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState); myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState, theTolerance);
endService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" ); endService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
return anObj; return anObj;
} }

View File

@ -528,12 +528,14 @@ public:
GEOM::GEOM_List_ptr GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape, GEOM::GEOM_List_ptr GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape, (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState,
CORBA::Double theTolerance);
//-----------------------------------------------------------// //-----------------------------------------------------------//
// BlocksOperations // // BlocksOperations //

View File

@ -5915,7 +5915,6 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @param theShape Shape to find sub-shapes of. # @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
#
# @return List of all found sub-shapes indices. # @return List of all found sub-shapes indices.
# #
# @ref swig_GetShapesOnBoxIDs "Example" # @ref swig_GetShapesOnBoxIDs "Example"
@ -5946,6 +5945,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @param theShape Shape to find sub-shapes of. # @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
# @param theTol tolerance that can be set by the user
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -5954,7 +5954,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# #
# @ref swig_GetShapesOnShape "Example" # @ref swig_GetShapesOnShape "Example"
@ManageTransactions("ShapesOp") @ManageTransactions("ShapesOp")
def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theName=None): def GetShapesOnShape(self, theCheckShape, theShape, theShapeType, theState, theTol = 1e-07, theName=None):
""" """
Find in theShape all sub-shapes of type theShapeType, Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified theCheckShape by the situated relatively the specified theCheckShape by the
@ -5974,7 +5974,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape, aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
theShapeType, theState) theShapeType, theState, theTol)
RaiseIfFailed("GetShapesOnShape", self.ShapesOp) RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
self._autoPublish(aList, theName, "shapeOnShape") self._autoPublish(aList, theName, "shapeOnShape")
return aList return aList
@ -5986,6 +5986,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @param theShape Shape to find sub-shapes of. # @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
# @param theTol tolerance that can be set by the user
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -5994,7 +5995,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# #
# @ref swig_GetShapesOnShapeAsCompound "Example" # @ref swig_GetShapesOnShapeAsCompound "Example"
@ManageTransactions("ShapesOp") @ManageTransactions("ShapesOp")
def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theName=None): def GetShapesOnShapeAsCompound(self, theCheckShape, theShape, theShapeType, theState, theTol = 1e-07, theName=None):
""" """
Find in theShape all sub-shapes of type theShapeType, Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified theCheckShape by the situated relatively the specified theCheckShape by the
@ -6014,7 +6015,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape, anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
theShapeType, theState) theShapeType, theState, theTol)
RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp) RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
self._autoPublish(anObj, theName, "shapeOnShape") self._autoPublish(anObj, theName, "shapeOnShape")
return anObj return anObj
@ -6026,12 +6027,13 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
# @param theShape Shape to find sub-shapes of. # @param theShape Shape to find sub-shapes of.
# @param theShapeType Type of sub-shapes to be retrieved (see ShapeType()) # @param theShapeType Type of sub-shapes to be retrieved (see ShapeType())
# @param theState The state of the sub-shapes to find (see GEOM::shape_state) # @param theState The state of the sub-shapes to find (see GEOM::shape_state)
# @param theTol tolerance that can be set by the user
# #
# @return List of all found sub-shapes indices. # @return List of all found sub-shapes indices.
# #
# @ref swig_GetShapesOnShapeIDs "Example" # @ref swig_GetShapesOnShapeIDs "Example"
@ManageTransactions("ShapesOp") @ManageTransactions("ShapesOp")
def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState): def GetShapesOnShapeIDs(self, theCheckShape, theShape, theShapeType, theState, theTol = 1e-07):
""" """
Find in theShape all sub-shapes of type theShapeType, Find in theShape all sub-shapes of type theShapeType,
situated relatively the specified theCheckShape by the situated relatively the specified theCheckShape by the
@ -6048,7 +6050,7 @@ class geomBuilder(GEOM._objref_GEOM_Gen):
""" """
# Example: see GEOM_TestOthers.py # Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape, aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
theShapeType, theState) theShapeType, theState, theTol)
RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp) RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
return aList return aList

View File

@ -32,6 +32,11 @@
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
class SalomeApp_DoubleSpinBox;
#define MAX_TOL 0.0001
#define TOL 1e-07
//============================================================================== //==============================================================================
// class : OperationGUI_GetShapesOnShapeDlg() // class : OperationGUI_GetShapesOnShapeDlg()
// purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of // purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
@ -69,6 +74,11 @@ OperationGUI_GetShapesOnShapeDlg::OperationGUI_GetShapesOnShapeDlg (GeometryGUI*
GroupPoints->LineEdit1->setReadOnly(true); GroupPoints->LineEdit1->setReadOnly(true);
GroupPoints->LineEdit2->setReadOnly(true); GroupPoints->LineEdit2->setReadOnly(true);
QLabel *aTolLbl = new QLabel(tr("GEOM_SHAPES_ON_SHAPE_TOLERANCE"));
myTolSpinBox = new SalomeApp_DoubleSpinBox;
GroupPoints->gridLayout1->addWidget(aTolLbl, 4, 0);
GroupPoints->gridLayout1->addWidget(myTolSpinBox, 4, 1, 1, 2);
QVBoxLayout* layout = new QVBoxLayout(centralWidget()); QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6); layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints); layout->addWidget(GroupPoints);
@ -114,6 +124,9 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
GroupPoints->LineEdit2->clear(); GroupPoints->LineEdit2->clear();
myObject1 = myObject2 = GEOM::GEOM_Object::_nil(); myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
initSpinBox(myTolSpinBox, 0., MAX_TOL, TOL, "param_tol_precision");
myTolSpinBox->setValue(TOL);
showOnlyPreviewControl(); showOnlyPreviewControl();
// signals and slots connections // signals and slots connections
@ -132,6 +145,8 @@ void OperationGUI_GetShapesOnShapeDlg::Init()
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument())); this, SLOT(SelectionIntoArgument()));
connect(myTolSpinBox, SIGNAL(valueChanged(const QString&)), this, SLOT(processPreview()));
initName(mainFrame()->GroupConstructors->title()); initName(mainFrame()->GroupConstructors->title());
GroupPoints->TextLabel3->show(); GroupPoints->TextLabel3->show();
@ -335,7 +350,7 @@ bool OperationGUI_GetShapesOnShapeDlg::execute (ObjectList& objects)
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation()); GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1, GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1,
(CORBA::Short) aLimit, (CORBA::Short) aLimit,
aState); // todo: aState must be explicitly initialized to avoid warning (see above) aState, myTolSpinBox->value()); // todo: aState must be explicitly initialized to avoid warning (see above)
if (!anObj->_is_nil()) if (!anObj->_is_nil())
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());

View File

@ -59,6 +59,7 @@ private:
GEOMAlgo_State myState; GEOMAlgo_State myState;
DlgRef_2Sel2List* GroupPoints; DlgRef_2Sel2List* GroupPoints;
SalomeApp_DoubleSpinBox* myTolSpinBox;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();