Make it possible to set Tolerance as a parameter in GetShapesOnShape geompy function
* \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape
* \param theState - required state
+ * \param theTolerance - tolerance
* \return List of IDs of all found sub-shapes.
*/
ListOfLong GetShapesOnShapeIDs (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
- in shape_state theState);
+ in shape_state theState,
+ in double theTolerance);
/*!
* \brief Find sub-shapes complying with given status
* \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape
* \param theState - required state
+ * \param theTolerance - tolerance
* \return List of all found sub-shapes.
*/
ListOfGO GetShapesOnShape (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
- in shape_state theState);
+ in shape_state theState,
+ in double theTolerance);
/*!
* \brief Find sub-shapes complying with given status
* \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape
* \param theState - required state
+ * \param theTolerance - tolerance
* \return compound includes all found sub-shapes.
*/
GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
- in shape_state theState);
+ in shape_state theState,
+ in double theTolerance);
/*!
* \brief Get sub-shape(s) of \a theShapeWhere, which are
GEOM_List GetShapesOnShape (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
- in shape_state theState);
+ in shape_state theState,
+ in double theTolerance);
GEOM_Object GetShapesOnShapeAsCompound (in GEOM_Object theCheckShape,
in GEOM_Object theShape,
in short theShapeType,
- in shape_state theState);
+ in shape_state theState,
+ in double theTolerance);
//-----------------------------------------------------------//
// BlocksOperations //
Handle(GEOM_Object) junctionFaces1 = myShapesOperations->GetInPlace(theShape, aPln1);
if (junctionFaces1.IsNull())
junctionFaces1 = myShapesOperations->GetShapesOnShapeAsCompound
- (aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
+ (aPln1, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN, Precision::Confusion());
if (!junctionFaces1.IsNull()) {
junctionFaces1->GetLastFunction()->SetDescription("");
junctionFaces1->SetName("JUNCTION_FACE_1");
Handle(GEOM_Object) junctionFaces2 = myShapesOperations->GetInPlace(theShape, aPln2);
if (junctionFaces2.IsNull())
junctionFaces2 = myShapesOperations->GetShapesOnShapeAsCompound
- (aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
+ (aPln2, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN, Precision::Confusion());
if (!junctionFaces2.IsNull()) {
junctionFaces2->GetLastFunction()->SetDescription("");
junctionFaces2->SetName("JUNCTION_FACE_2");
Handle(GEOM_Object) junctionFaces3 = myShapesOperations->GetInPlace(theShape, aPln3);
if (junctionFaces3.IsNull())
junctionFaces3 = myShapesOperations->GetShapesOnShapeAsCompound
- (aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN);
+ (aPln3, theShape, TopAbs_FACE, GEOMAlgo_ST_ONIN, Precision::Confusion());
if (!junctionFaces3.IsNull()) {
junctionFaces3->GetLastFunction()->SetDescription("");
junctionFaces3->SetName("JUNCTION_FACE_3");
<message>
<source>GEOM_SHAPES_ON_SHAPE_STATE</source>
<translation>State</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
+ <translation>Tolerance</translation>
</message>
<message>
<source>GEOM_KIND_OF_SHAPE</source>
<source>GEOM_SHAPES_ON_SHAPE_STATE</source>
<translation>Etat</translation>
</message>
+ <message>
+ <source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
+ <translation>Tolérance </translation>
+ </message>
<message>
<source>GEOM_KIND_OF_SHAPE</source>
<translation>Type d'objet :</translation>
<source>GEOM_SHAPES_ON_SHAPE_STATE</source>
<translation>状態</translation>
</message>
+ <message>
+ <source>GEOM_SHAPES_ON_SHAPE_TOLERANCE</source>
+ <translation>公差</translation>
+ </message>
<message>
<source>GEOM_KIND_OF_SHAPE</source>
<translation>形状の種類:</translation>
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState)
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
// Compute classification tolerance.
TopTools_IndexedMapOfShape aMapVtx;
- Standard_Real aTol = Precision::Confusion();
+ Standard_Real aTol = theTolerance;
TopExp::MapShapes(aShape, TopAbs_VERTEX, aMapVtx);
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState)
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
- getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
+ getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL;
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
- << theState << ")";
+ << theState << ", "
+ << theTolerance << ")";
#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState)
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
- getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
+ getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL;
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
- << theState << ")";
+ << theState << ", "
+ << theTolerance << ")";
SetErrorCode(OK);
return aSeq;
//=======================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetShapesOnShapeAsCompound
(const Handle(GEOM_Object)& theCheckShape,
- const Handle(GEOM_Object)& theShape,
+ const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState)
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs =
- getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState);
+ getShapesOnShapeIDs (theCheckShape, theShape, theShapeType, theState, theTolerance);
if ( aSeqOfIDs.IsNull() || aSeqOfIDs->Length() == 0 )
return NULL;
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
- << theState << ")";
-
+ << theState << ", "
+ << theTolerance << ")";
SetErrorCode(OK);
return aRes;
* \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape
* \param theState - required state
+ * \param theTolerance - tolerance
* \retval Handle(TColStd_HSequenceOfInteger) - IDs of found sub-shapes
*/
Standard_EXPORT Handle(TColStd_HSequenceOfInteger)
GetShapesOnShapeIDs(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState);
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance);
/*!
* \brief Find sub-shapes complying with given status about surface
* \param theShape - the shape to explore
* \param theShapeType - type of sub-shape of theShape
* \param theState - required state
+ * \param theTolerance - tolerance
* \retval Handle(TColStd_HSequenceOfTransient) - found shape objects
*/
Standard_EXPORT Handle(TColStd_HSequenceOfTransient)
GetShapesOnShape(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState);
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance);
Standard_EXPORT Handle(GEOM_Object)
GetShapesOnShapeAsCompound(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
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.
(const Handle(GEOM_Object)& theCheckShape,
const Handle(GEOM_Object)& theShape,
const Standard_Integer theShapeType,
- GEOMAlgo_State theState);
+ GEOMAlgo_State theState,
+ const Standard_Real theTolerance);
/*!
* \brief Find shape objects and their entries by their ids
{
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
- (short)GEOM::SOLID, GEOM::ST_ONIN);
+ (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
}
break;
case GEOM::FSM_GetInPlaceByHistory:
{
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
- (short)GEOM::SOLID, GEOM::ST_ONIN);
+ (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
}
break;
case GEOM::FSM_GetInPlaceByHistory:
{
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aSubO = aShapesOp->GetShapesOnShapeAsCompound(anArgO, theObject,
- (short)GEOM::SOLID, GEOM::ST_ONIN);
+ (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
}
break;
case GEOM::FSM_GetInPlaceByHistory:
{
// Use GetShapesOnShape. Can work only on solids, so it has sense to search only solids
aNewSubO = aShapesOp->GetShapesOnShapeAsCompound(anOldSubO, theNewO,
- (short)GEOM::SOLID, GEOM::ST_ONIN);
+ (short)GEOM::SOLID, GEOM::ST_ONIN, Precision::Confusion());
}
break;
case GEOM::FSM_GetInPlaceByHistory:
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState)
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
//Get Shapes On Shape
Handle(TColStd_HSequenceOfTransient) aHSeq = GetOperations()->GetShapesOnShape
- (aCheckShape,aShape, theShapeType,ShapeState(theState));
+ (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState)
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance)
{
GEOM::GEOM_Object_var aGEOMObject;
//Get Shapes On Shape
Handle(::GEOM_Object) anObject = GetOperations()->GetShapesOnShapeAsCompound
- (aCheckShape,aShape, theShapeType,ShapeState(theState));
+ (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
if (anObject.IsNull())
return aGEOMObject._retn();
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState)
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance)
{
GEOM::ListOfLong_var aSeq = new GEOM::ListOfLong;
//Get Shapes On Shape
Handle(TColStd_HSequenceOfInteger) aHSeq = GetOperations()->GetShapesOnShapeIDs
- (aCheckShape,aShape, theShapeType,ShapeState(theState));
+ (aCheckShape,aShape, theShapeType,ShapeState(theState), theTolerance);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
GEOM::ListOfGO* GetShapesOnShape (GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState);
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theSheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState);
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance);
GEOM::ListOfLong* GetShapesOnShapeIDs (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
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 theShapeWhat);
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState)
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance)
{
beginService( " GEOM_Superv_i::GetShapesOnShape" );
MESSAGE("GEOM_Superv_i::GetShapesOnShape");
getShapesOp();
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));
MESSAGE(" List of "<<aListPtr->GetList().length()<<" element(s)");
endService( " GEOM_Superv_i::GetShapesOnShape" );
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState)
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance)
{
beginService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
MESSAGE("GEOM_Superv_i::GetShapesOnShapeAsCompound");
getShapesOp();
GEOM::GEOM_Object_ptr anObj =
- myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState);
+ myShapesOp->GetShapesOnShapeAsCompound(theCheckShape, theShape, theShapeType, theState, theTolerance);
endService( " GEOM_Superv_i::GetShapesOnShapeAsCompound" );
return anObj;
}
GEOM::GEOM_List_ptr GetShapesOnShape (GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState);
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr GetShapesOnShapeAsCompound
(GEOM::GEOM_Object_ptr theCheckShape,
GEOM::GEOM_Object_ptr theShape,
CORBA::Short theShapeType,
- GEOM::shape_state theState);
+ GEOM::shape_state theState,
+ CORBA::Double theTolerance);
//-----------------------------------------------------------//
// BlocksOperations //
# @param theShape Shape to find sub-shapes of.
# @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)
- #
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnBoxIDs "Example"
# @param theShape Shape to find sub-shapes of.
# @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 theTol tolerance that can be set by the user
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @ref swig_GetShapesOnShape "Example"
@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,
situated relatively the specified theCheckShape by the
"""
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnShape(theCheckShape, theShape,
- theShapeType, theState)
+ theShapeType, theState, theTol)
RaiseIfFailed("GetShapesOnShape", self.ShapesOp)
self._autoPublish(aList, theName, "shapeOnShape")
return aList
# @param theShape Shape to find sub-shapes of.
# @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 theTol tolerance that can be set by the user
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @ref swig_GetShapesOnShapeAsCompound "Example"
@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,
situated relatively the specified theCheckShape by the
"""
# Example: see GEOM_TestOthers.py
anObj = self.ShapesOp.GetShapesOnShapeAsCompound(theCheckShape, theShape,
- theShapeType, theState)
+ theShapeType, theState, theTol)
RaiseIfFailed("GetShapesOnShapeAsCompound", self.ShapesOp)
self._autoPublish(anObj, theName, "shapeOnShape")
return anObj
# @param theShape Shape to find sub-shapes of.
# @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 theTol tolerance that can be set by the user
#
# @return List of all found sub-shapes indices.
#
# @ref swig_GetShapesOnShapeIDs "Example"
@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,
situated relatively the specified theCheckShape by the
"""
# Example: see GEOM_TestOthers.py
aList = self.ShapesOp.GetShapesOnShapeIDs(theCheckShape, theShape,
- theShapeType, theState)
+ theShapeType, theState, theTol)
RaiseIfFailed("GetShapesOnShapeIDs", self.ShapesOp)
return aList
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+class SalomeApp_DoubleSpinBox;
+
+#define MAX_TOL 0.0001
+#define TOL 1e-07
+
//==============================================================================
// class : OperationGUI_GetShapesOnShapeDlg()
// purpose : Constructs a OperationGUI_GetShapesOnShapeDlg which is a child of
GroupPoints->LineEdit1->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());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
GroupPoints->LineEdit2->clear();
myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
+ initSpinBox(myTolSpinBox, 0., MAX_TOL, TOL, "param_tol_precision");
+ myTolSpinBox->setValue(TOL);
+
showOnlyPreviewControl();
// signals and slots connections
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
+ connect(myTolSpinBox, SIGNAL(valueChanged(const QString&)), this, SLOT(processPreview()));
+
initName(mainFrame()->GroupConstructors->title());
GroupPoints->TextLabel3->show();
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
GEOM::GEOM_Object_var anObj = anOper->GetShapesOnShapeAsCompound(myObject2, myObject1,
(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())
objects.push_back(anObj._retn());
GEOMAlgo_State myState;
DlgRef_2Sel2List* GroupPoints;
+ SalomeApp_DoubleSpinBox* myTolSpinBox;
private slots:
void ClickOnOk();