mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 16:30:35 +05:00
0023193: [CEA] Show sub-shapes with given tolerance
This commit is contained in:
parent
d075248eeb
commit
e6bcaa307f
Binary file not shown.
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 36 KiB |
BIN
doc/salome/gui/GEOM/images/inspect_object2.png
Normal file
BIN
doc/salome/gui/GEOM/images/inspect_object2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 30 KiB |
51
doc/salome/gui/GEOM/input/inspect_object_operation.doc
Executable file → Normal file
51
doc/salome/gui/GEOM/input/inspect_object_operation.doc
Executable file → Normal file
@ -6,12 +6,41 @@ This operation allows browsing the contents of the selected shape.
|
||||
|
||||
To <b>Inspect Object</b>, in the <b>Main Menu</b> select <b>Measures - > Inspect Object</b>.
|
||||
|
||||
\image html inspect_object.png
|
||||
The dialog can be used in two modes. The first one is a tree view mode:
|
||||
\image html inspect_object.png "Dialog in the tree view mode"
|
||||
|
||||
In this dialog:
|
||||
This is a default mode that allows to inspect an object in the form of tree
|
||||
starting from the shape itself. Its children are its direct sub-shapes that
|
||||
have they own children as sub-shapes etc. till most very base sub-shapes,
|
||||
i.e. vertices.
|
||||
|
||||
The second mode is a filtering one. It is activated when the user selects
|
||||
<b>Tolerance filter</b> check box:
|
||||
\image html inspect_object2.png "Dialog in the filtering mode"
|
||||
|
||||
In this mode the user can check the type of sub-shapes to work with using
|
||||
the radio-buttons. The type can be either \b Vertex, \b Edge or \b Face.
|
||||
Then the user choses a tolerance criterion to be applied to filter out
|
||||
sub-shapes. It is possible to chose one of the following values:
|
||||
- \b > - greater than (default value)
|
||||
- \b >= - greater than or equal to
|
||||
- \b < - lower than
|
||||
- \b <= - lower than or equal to
|
||||
|
||||
The last parameter to be chosen is the tolerance value. The result is the shapes
|
||||
of a certain type that satisfy the defined tolerance criterion. E.g. if the user
|
||||
chooses \b Face, criterion \b > and tolerance value equal to \b 1.e-6 the faces
|
||||
with the tolerance greater than \b 1.e-6 are displayed.
|
||||
|
||||
It is possible to set maximal and minimal value of the tolerance using the
|
||||
buttons <b>Max value</b> and <b>Min value</b>. These values are displayed in
|
||||
the labels <b>Max :</b> and <b>Min :</b>
|
||||
|
||||
In this dialog never mind of its mode it is possible to:
|
||||
- Click on the "selection" button and select an object to inspect in the Object Browser or in the viewer.
|
||||
- Show/hide sub-shape(s) in the 3D viewer, by pressing “eye” icon in the first column of the tree view.
|
||||
- Show/hide all sub-shapes in the 3D viewer, by pressing “eye” icon in the first column of the tree view header.
|
||||
- Show/hide sub-shape(s) in the 3D viewer, by pressing "eye" icon in the first column of the tree view.
|
||||
- Show/hide all sub-shapes in the tree, by pressing "eye" icon in the first column of the tree view header or
|
||||
by pressing <b>Show all</b>/<b>Hide all</b> buttons.
|
||||
- Rename the selected sub-shape by double-clicking on the item or pressing <F2> key.
|
||||
- Show the selected sub-shape(s) in the 3D viewer by pressing <b>Show Selected</b> button.
|
||||
- Show the selected sub-shape(s) in the 3D viewer and erase all currently shown objects by pressing <b>Show Only Selected</b> button.
|
||||
@ -19,4 +48,18 @@ In this dialog:
|
||||
- Publish the selected sub-shapes in the study, by pressing <b>Publish Selected</b> button.
|
||||
- Close dialog box, by pressing <b>Close</b> button.
|
||||
|
||||
\n <b>TUI Command:</b>
|
||||
|
||||
A command to filter sub-shapes is defined:
|
||||
|
||||
<em>geompy.GetSubShapesWithTolerance(theShape, theShapeType, theCondition, theTolerance),</em> \n
|
||||
where \n
|
||||
\em theShape is the shape to be exploded. \n
|
||||
\em theShapeType is the type of sub-shapes to be returned. Can have
|
||||
the values \b GEOM.FACE, \b GEOM.EDGE and \b GEOM.VERTEX only.\n
|
||||
\em theCondition is the condition type (the value of GEOM.comparison_condition emuneration).\n
|
||||
\em theTolerance is the tolerance filter.
|
||||
|
||||
See also a \ref swig_GetSubShapesWithTolerance "TUI example".
|
||||
|
||||
*/
|
||||
|
@ -102,6 +102,9 @@
|
||||
\until geompy.RestoreSubShapes(Partition1)
|
||||
|
||||
\anchor swig_GetSubShapeEdgeSorted
|
||||
\until geompy.GetSubShapeEdgeSorted(Sketcher3d_2, p3, "OrderedEdges")
|
||||
|
||||
\anchor swig_GetSubShapesWithTolerance
|
||||
\until print "DONE"
|
||||
|
||||
*/
|
||||
|
@ -209,6 +209,17 @@ module GEOM
|
||||
SI_ALL // all interferences
|
||||
};
|
||||
|
||||
/**
|
||||
* This enumeration represents comparison conditions.
|
||||
*/
|
||||
enum comparison_condition
|
||||
{
|
||||
CC_GT, ///< Greater then
|
||||
CC_GE, ///< Greater then or equal to
|
||||
CC_LT, ///< Less then
|
||||
CC_LE ///< Less then or equal to
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Object creation parameters
|
||||
*
|
||||
@ -2747,6 +2758,26 @@ module GEOM
|
||||
ListOfGO GetSubShapeEdgeSorted (in GEOM_Object theShape,
|
||||
in GEOM_Object theStartPoint);
|
||||
|
||||
/*!
|
||||
* \brief Return the list of subshapes that satisfies a certain tolerance
|
||||
* criterion. The user defines the type of shapes to be returned, the
|
||||
* condition and the tolerance value. The operation is defined for
|
||||
* faces, edges and vertices only. E.g. for theShapeType FACE, theCondition
|
||||
* CC_GT and theTolerance 1.e-7 this method returns all faces of theShape
|
||||
* that have tolerances greater then 1.e7.
|
||||
*
|
||||
* \param theShape the shape to be exploded
|
||||
* \param theShapeType the type of shapes to be returned. Can have the
|
||||
* values FACE, EDGE and VERTEX only.
|
||||
* \param theCondition the condition type.
|
||||
* \param theTolerance the tolerance filter.
|
||||
* \return the list of shapes that satisfy the conditions.
|
||||
*/
|
||||
ListOfGO GetSubShapesWithTolerance(in GEOM_Object theShape,
|
||||
in short theShapeType,
|
||||
in comparison_condition theCondition,
|
||||
in double theTolerance);
|
||||
|
||||
};
|
||||
|
||||
// # GEOM_IBlocksOperations:
|
||||
|
@ -5440,6 +5440,14 @@ shells and solids on the other hand.</translation>
|
||||
<source>GEOM_DIM_AXES</source>
|
||||
<translation>Dimensions along local axes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SHOW_ALL_BTN</source>
|
||||
<translation>Show all</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HIDE_ALL_BTN</source>
|
||||
<translation>Hide all</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GeometryGUI</name>
|
||||
@ -6507,14 +6515,6 @@ Number of sketch points too small</translation>
|
||||
<source>REMOVE_BTN</source>
|
||||
<translation>Remove</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SHOW_ALL_BTN</source>
|
||||
<translation>Show all</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HIDE_ALL_BTN</source>
|
||||
<translation>Hide all</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>DISTANCE_ITEM</source>
|
||||
<translation>Distance</translation>
|
||||
@ -7230,6 +7230,18 @@ Do you want to create new material?</translation>
|
||||
<source>GEOM_INSPECT_OBJECT_MAIN_SHAPE</source>
|
||||
<translation>Main shape</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_INSPECT_TOLERANCE_FILTER</source>
|
||||
<translation>Tolerance filter</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_INSPECT_RESET_MIN</source>
|
||||
<translation>Min value</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_INSPECT_RESET_MAX</source>
|
||||
<translation>Max value</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>GEOM_INSPECT_OBJECT_SHOW</source>
|
||||
<translation>Show Selected</translation>
|
||||
|
@ -3062,6 +3062,106 @@ Handle(TColStd_HSequenceOfTransient)
|
||||
return aSeq;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetSubShapesWithTolerance
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(TColStd_HSequenceOfTransient)
|
||||
GEOMImpl_IShapesOperations::GetSubShapesWithTolerance
|
||||
(const Handle(GEOM_Object) &theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const GEOMUtils::ComparisonCondition theCondition,
|
||||
const Standard_Real theTolerance)
|
||||
{
|
||||
if (theShape.IsNull()) {
|
||||
SetErrorCode("NULL GEOM object");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = theShape->GetValue();
|
||||
|
||||
if (aShape.IsNull()) {
|
||||
SetErrorCode("NULL Shape");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (theShapeType != TopAbs_FACE && theShapeType != TopAbs_EDGE &&
|
||||
theShapeType != TopAbs_VERTEX && aShape.ShapeType() >= theShapeType) {
|
||||
SetErrorCode("Invalid shape type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TopTools_IndexedMapOfShape anIndices;
|
||||
TopTools_MapOfShape aMapFence;
|
||||
TopExp_Explorer anExp(aShape,
|
||||
(TopAbs_ShapeEnum) theShapeType);
|
||||
Handle(TColStd_HSequenceOfInteger) anIDs = new TColStd_HSequenceOfInteger;
|
||||
|
||||
TopExp::MapShapes(aShape, anIndices);
|
||||
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Shape &aSubShape = anExp.Current();
|
||||
|
||||
if (aMapFence.Add(aSubShape)) {
|
||||
// Compute tolerance
|
||||
Standard_Real aTolerance = -1.;
|
||||
|
||||
switch (aSubShape.ShapeType()) {
|
||||
case TopAbs_FACE:
|
||||
aTolerance = BRep_Tool::Tolerance(TopoDS::Face(aSubShape));
|
||||
break;
|
||||
case TopAbs_EDGE:
|
||||
aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aSubShape));
|
||||
break;
|
||||
case TopAbs_VERTEX:
|
||||
aTolerance = BRep_Tool::Tolerance(TopoDS::Vertex(aSubShape));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (aTolerance < 0.) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Compare the tolerance with reference value.
|
||||
if (GEOMUtils::IsFitCondition (theCondition, aTolerance, theTolerance)) {
|
||||
anIDs->Append(anIndices.FindIndex(aSubShape));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (anIDs->IsEmpty()) {
|
||||
SetErrorCode("Empty sequence of sub-shapes");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Get objects by indices.
|
||||
TCollection_AsciiString anAsciiList;
|
||||
Handle(TColStd_HSequenceOfTransient) aSeq =
|
||||
getObjectsShapesOn(theShape, anIDs, anAsciiList);
|
||||
|
||||
if (aSeq.IsNull() || aSeq->IsEmpty()) {
|
||||
SetErrorCode("Empty sequence of edges");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Make a Python command
|
||||
Handle(GEOM_Object) anObj =
|
||||
Handle(GEOM_Object)::DownCast(aSeq->Value(1));
|
||||
Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
|
||||
|
||||
GEOM::TPythonDump(aFunction)
|
||||
<< "[" << anAsciiList.ToCString() << "] = geompy.GetSubShapesWithTolerance("
|
||||
<< theShape << ", " << theShapeType << ", " << theCondition << ", "
|
||||
<< theTolerance << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
|
||||
return aSeq;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : getShapesOnSurfaceIDs
|
||||
/*!
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "GEOM_IOperations.hxx"
|
||||
|
||||
#include "GEOMAlgo_State.hxx"
|
||||
#include "GEOMUtils.hxx"
|
||||
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
@ -448,6 +449,27 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
|
||||
GetSubShapeEdgeSorted (const Handle(GEOM_Object) &theShape,
|
||||
const Handle(GEOM_Object) &theStartPoint);
|
||||
|
||||
/*!
|
||||
* \brief Return the list of subshapes that satisfies a certain tolerance
|
||||
* criterion. The user defines the type of shapes to be returned, the
|
||||
* condition and the tolerance value. The operation is defined for
|
||||
* faces, edges and vertices only. E.g. for theShapeType FACE, theCondition
|
||||
* CC_GT and theTolerance 1.e-7 this method returns all faces of theShape
|
||||
* that have tolerances greater then 1.e7.
|
||||
*
|
||||
* \param theShape the shape to be exploded
|
||||
* \param theShapeType the type of shapes to be returned. Can have the
|
||||
* values FACE, EDGE and VERTEX only.
|
||||
* \param theCondition the condition type.
|
||||
* \param theTolerance the tolerance filter.
|
||||
* \return the list of shapes that satisfy the conditions.
|
||||
*/
|
||||
Handle(TColStd_HSequenceOfTransient) GetSubShapesWithTolerance
|
||||
(const Handle(GEOM_Object) &theShape,
|
||||
const Standard_Integer theShapeType,
|
||||
const GEOMUtils::ComparisonCondition theCondition,
|
||||
const Standard_Real theTolerance);
|
||||
|
||||
private:
|
||||
Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
|
||||
const Standard_Integer theObjectType,
|
||||
|
@ -104,6 +104,9 @@
|
||||
|
||||
#define STD_SORT_ALGO 1
|
||||
|
||||
#define DEFAULT_TOLERANCE_TOLERANCE 1.e-02
|
||||
#define DEFAULT_MAX_TOLERANCE_TOLERANCE 1.e-06
|
||||
|
||||
// When the following macro is defined, ShapeFix_ShapeTolerance function is used to set max tolerance of curve
|
||||
// in GEOMUtils::FixShapeCurves function; otherwise less restrictive BRep_Builder::UpdateEdge/UpdateVertex
|
||||
// approach is used
|
||||
@ -1287,3 +1290,55 @@ bool GEOMUtils::IsOpenPath(const TopoDS_Shape &theShape)
|
||||
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CompareToleranceValues
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
int GEOMUtils::CompareToleranceValues(const double theTolShape,
|
||||
const double theTolRef)
|
||||
{
|
||||
const double aTolTol = Min(DEFAULT_MAX_TOLERANCE_TOLERANCE,
|
||||
theTolRef*DEFAULT_TOLERANCE_TOLERANCE);
|
||||
|
||||
int aResult = 0;
|
||||
|
||||
if (theTolShape < theTolRef - aTolTol) {
|
||||
aResult = -1;
|
||||
} else if (theTolShape > theTolRef + aTolTol) {
|
||||
aResult = 1;
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IsFitCondition
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
bool GEOMUtils::IsFitCondition(const ComparisonCondition theCondition,
|
||||
const double theTolShape,
|
||||
const double theTolRef)
|
||||
{
|
||||
const int aCompValue = CompareToleranceValues(theTolShape, theTolRef);
|
||||
bool isFit = false;
|
||||
|
||||
switch (theCondition) {
|
||||
case CC_GT:
|
||||
isFit = aCompValue == 1;
|
||||
break;
|
||||
case GEOMUtils::CC_GE:
|
||||
isFit = aCompValue != -1;
|
||||
break;
|
||||
case GEOMUtils::CC_LT:
|
||||
isFit = aCompValue == -1;
|
||||
break;
|
||||
case GEOMUtils::CC_LE:
|
||||
isFit = aCompValue != 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return isFit;
|
||||
}
|
||||
|
@ -55,6 +55,16 @@ inline Standard_Boolean IsEqual (const TopoDS_Shape& S1, const TopoDS_Shape& S2)
|
||||
namespace GEOMUtils
|
||||
{
|
||||
|
||||
/**
|
||||
* This enumeration represents comparison conditions.
|
||||
*/
|
||||
enum ComparisonCondition {
|
||||
CC_GT, ///< Greater then
|
||||
CC_GE, ///< Greater then or equal to
|
||||
CC_LT, ///< Less then
|
||||
CC_LE ///< Less then or equal to
|
||||
};
|
||||
|
||||
typedef std::vector<std::string> NodeLinks;
|
||||
typedef std::map<std::string, NodeLinks> LevelInfo;
|
||||
typedef std::vector<LevelInfo> LevelsList;
|
||||
@ -341,6 +351,36 @@ namespace GEOMUtils
|
||||
*/
|
||||
Standard_EXPORT bool IsOpenPath(const TopoDS_Shape &theShape);
|
||||
|
||||
/**
|
||||
* This function compares two tolerances. The shape tolerance (the first
|
||||
* argument) is considered less than the reference tolerance (the second
|
||||
* argument) if theTolShape < theTolRef - Tolerance(theTolRef). theTolShape is
|
||||
* considered greater than theTolRef if theTolShape > theTolRef +
|
||||
* Tolerance(theTolRef). Otherwise these tolerances are equal.
|
||||
* Tolerance(theTolRef) = theTolRef*DEFAULT_TOLERANCE_TOLERANCE. But this value
|
||||
* should not be greated than DEFAULT_MAX_TOLERANCE_TOLERANCE.
|
||||
*
|
||||
* \param theTolShape the shape tolerance
|
||||
* \param theTolRef the reference tolerance
|
||||
* \return -1 if theTolShape is less than theTolRef; 1 if theTolShape is greater
|
||||
* than theTolRef; 0 if they are equal
|
||||
*/
|
||||
Standard_EXPORT int CompareToleranceValues(const double theTolShape,
|
||||
const double theTolRef);
|
||||
|
||||
/**
|
||||
* Check if the comarison of tolerances fit the condition. The comparison of
|
||||
* tolerances is performed using the function CompareToleranceValues.
|
||||
*
|
||||
* \param theCondition the condition
|
||||
* \param theTolShape the shape tolerance
|
||||
* \param theTolRef the reference tolerance
|
||||
* \return true if the shape tolerance fits the condition; false otherwise.
|
||||
*/
|
||||
Standard_EXPORT bool IsFitCondition(const ComparisonCondition theCondition,
|
||||
const double theTolShape,
|
||||
const double theTolRef);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -35,6 +35,35 @@
|
||||
#include <TColStd_HSequenceOfTransient.hxx>
|
||||
#include <TColStd_HArray1OfInteger.hxx>
|
||||
|
||||
/**
|
||||
* This function converts GEOM::comparison_condition type into
|
||||
* GEOMUtils::ComparisonCondition type.
|
||||
*
|
||||
* \param theCondition the condition of GEOM::comparison_condition type
|
||||
* \return the condition of GEOMUtils::ComparisonCondition type.
|
||||
*/
|
||||
static GEOMUtils::ComparisonCondition ComparisonCondition
|
||||
(const GEOM::comparison_condition theCondition)
|
||||
{
|
||||
GEOMUtils::ComparisonCondition aResult = GEOMUtils::CC_GT;
|
||||
|
||||
switch (theCondition) {
|
||||
case GEOM::CC_GE:
|
||||
aResult = GEOMUtils::CC_GE;
|
||||
break;
|
||||
case GEOM::CC_LT:
|
||||
aResult = GEOMUtils::CC_LT;
|
||||
break;
|
||||
case GEOM::CC_LE:
|
||||
aResult = GEOMUtils::CC_LE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* constructor:
|
||||
@ -2156,3 +2185,48 @@ GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapeEdgeSorted
|
||||
|
||||
return aSeq._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetSubShapesWithTolerance
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
|
||||
(GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Short theShapeType,
|
||||
GEOM::comparison_condition theCondition,
|
||||
CORBA::Double theTolerance)
|
||||
{
|
||||
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference objects
|
||||
Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
|
||||
|
||||
if (aShape.IsNull()) {
|
||||
return aSeq._retn();
|
||||
}
|
||||
|
||||
//Get Shapes On Shape
|
||||
const GEOMUtils::ComparisonCondition aCondition =
|
||||
ComparisonCondition(theCondition);
|
||||
Handle(TColStd_HSequenceOfTransient) aHSeq =
|
||||
GetOperations()->GetSubShapesWithTolerance
|
||||
(aShape, theShapeType, aCondition, theTolerance);
|
||||
|
||||
if (!GetOperations()->IsDone() || aHSeq.IsNull())
|
||||
return aSeq._retn();
|
||||
|
||||
const Standard_Integer aLength = aHSeq->Length();
|
||||
Standard_Integer i;
|
||||
|
||||
aSeq->length(aLength);
|
||||
|
||||
for (i = 1; i <= aLength; i++) {
|
||||
aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
|
||||
}
|
||||
|
||||
return aSeq._retn();
|
||||
}
|
||||
|
@ -300,6 +300,12 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
|
||||
GEOM::ListOfGO* GetSubShapeEdgeSorted (GEOM::GEOM_Object_ptr theShape,
|
||||
GEOM::GEOM_Object_ptr theStartPoint);
|
||||
|
||||
GEOM::ListOfGO* GetSubShapesWithTolerance
|
||||
(GEOM::GEOM_Object_ptr theShape,
|
||||
CORBA::Short theShapeType,
|
||||
GEOM::comparison_condition theCondition,
|
||||
CORBA::Double theTolerance);
|
||||
|
||||
::GEOMImpl_IShapesOperations* GetOperations()
|
||||
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }
|
||||
};
|
||||
|
@ -584,5 +584,11 @@ def TestAll (geompy, math):
|
||||
geompy.GetSubShapeEdgeSorted(Sketcher3d_1, p2, "OrderedEdges")
|
||||
geompy.GetSubShapeEdgeSorted(Sketcher3d_2, p3, "OrderedEdges")
|
||||
|
||||
# GetSubShapesWithTolerance
|
||||
geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_GT, 1.e-8, "gt")
|
||||
geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_GE, 1.e-7, "ge")
|
||||
geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_LT, 2.e-7, "lt")
|
||||
geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_LE, 1.e-7, "le")
|
||||
|
||||
|
||||
print "DONE"
|
||||
|
@ -6574,6 +6574,57 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
self._autoPublish(ListObj, theName, "SortedEdges")
|
||||
return ListObj
|
||||
|
||||
##
|
||||
# Return the list of subshapes that satisfies a certain tolerance
|
||||
# criterion. The user defines the type of shapes to be returned, the
|
||||
# condition and the tolerance value. The operation is defined for
|
||||
# faces, edges and vertices only. E.g. for theShapeType FACE,
|
||||
# theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
|
||||
# all faces of theShape that have tolerances greater then 1.e7.
|
||||
#
|
||||
# @param theShape the shape to be exploded
|
||||
# @param theShapeType the type of sub-shapes to be returned (see
|
||||
# ShapeType()). Can have the values FACE, EDGE and VERTEX only.
|
||||
# @param theCondition the condition type (see GEOM::comparison_condition).
|
||||
# @param theTolerance the tolerance filter.
|
||||
# @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.
|
||||
# @return the list of shapes that satisfy the conditions.
|
||||
#
|
||||
# @ref swig_GetSubShapesWithTolerance "Example"
|
||||
@ManageTransactions("ShapesOp")
|
||||
def GetSubShapesWithTolerance(self, theShape, theShapeType,
|
||||
theCondition, theTolerance, theName=None):
|
||||
"""
|
||||
Return the list of subshapes that satisfies a certain tolerance
|
||||
criterion. The user defines the type of shapes to be returned, the
|
||||
condition and the tolerance value. The operation is defined for
|
||||
faces, edges and vertices only. E.g. for theShapeType FACE,
|
||||
theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
|
||||
all faces of theShape that have tolerances greater then 1.e7.
|
||||
|
||||
Parameters:
|
||||
theShape the shape to be exploded
|
||||
theShapeType the type of sub-shapes to be returned (see
|
||||
ShapeType()). Can have the values FACE,
|
||||
EDGE and VERTEX only.
|
||||
theCondition the condition type (see GEOM::comparison_condition).
|
||||
theTolerance the tolerance filter.
|
||||
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.
|
||||
|
||||
Returns:
|
||||
The list of shapes that satisfy the conditions.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
|
||||
theCondition, theTolerance)
|
||||
RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
|
||||
self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
|
||||
return ListObj
|
||||
|
||||
## Check if the object is a sub-object of another GEOM object.
|
||||
# @param aSubObject Checked sub-object (or its parent object, in case if
|
||||
# \a theSubObjectIndex is non-zero).
|
||||
|
@ -41,6 +41,7 @@ INCLUDE_DIRECTORIES(
|
||||
${PROJECT_SOURCE_DIR}/src/DlgRef
|
||||
${PROJECT_BINARY_DIR}/src/DlgRef
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
|
||||
${PROJECT_SOURCE_DIR}/src/GEOMUtils
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
@ -55,6 +56,7 @@ ADD_DEFINITIONS(
|
||||
# libraries to link to
|
||||
SET(_link_LIBRARIES
|
||||
GEOMBase
|
||||
GEOMUtils
|
||||
)
|
||||
|
||||
# --- resources ---
|
||||
|
@ -98,7 +98,7 @@ bool RepairGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
|
||||
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpFuseEdges: aDlg = new RepairGUI_FuseEdgesDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpUnionFaces: aDlg = new RepairGUI_UnionFacesDlg (getGeometryGUI(), parent); break;
|
||||
case GEOMOp::OpInspectObj: aDlg = new RepairGUI_InspectObjectDlg (parent); break;
|
||||
case GEOMOp::OpInspectObj: aDlg = new RepairGUI_InspectObjectDlg (getGeometryGUI(), parent); break;
|
||||
default:
|
||||
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,10 +25,23 @@
|
||||
|
||||
// Qt includes
|
||||
#include <QDialog>
|
||||
#include <QTreeWidget>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QPointer>
|
||||
#include <QIcon>
|
||||
|
||||
class GeometryGUI;
|
||||
class SalomeApp_DoubleSpinBox;
|
||||
|
||||
class QButtonGroup;
|
||||
class QComboBox;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QStackedLayout;
|
||||
class QTreeWidget;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class TopTools_IndexedMapOfShape;
|
||||
|
||||
class RepairGUI_InspectObjectDlg : public QDialog, public GEOMBase_Helper
|
||||
{
|
||||
@ -38,7 +51,7 @@ class RepairGUI_InspectObjectDlg : public QDialog, public GEOMBase_Helper
|
||||
class Delegate;
|
||||
|
||||
public:
|
||||
RepairGUI_InspectObjectDlg( SUIT_Desktop* );
|
||||
RepairGUI_InspectObjectDlg(GeometryGUI*, SUIT_Desktop* );
|
||||
~RepairGUI_InspectObjectDlg();
|
||||
|
||||
private slots:
|
||||
@ -60,25 +73,54 @@ private slots:
|
||||
void clickOnHide();
|
||||
void clickOnPublish();
|
||||
void clickOnHelp();
|
||||
void clickOnResetToMin();
|
||||
void clickOnResetToMax();
|
||||
void clickOnShowAll();
|
||||
void clickOnHideAll();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
void onFilterToggled(bool);
|
||||
void onInitFilteredData();
|
||||
void onFilterData();
|
||||
|
||||
private:
|
||||
void createTreeWidget(QTreeWidget *&theTreeObjects);
|
||||
void init();
|
||||
void initSpinBox(SalomeApp_DoubleSpinBox* spinBox,
|
||||
double min, double max,
|
||||
double step, const char* quantity);
|
||||
void initTreeWidget(QTreeWidget *theTopLevelItem);
|
||||
void enterEvent( QEvent* );
|
||||
void checkVisibleIcon();
|
||||
void addSubObjects( TreeWidgetItem* );
|
||||
void addSubObjects( TreeWidgetItem*, const TopTools_IndexedMapOfShape &);
|
||||
|
||||
void displayItem( TreeWidgetItem* );
|
||||
void setItemDisplayStatus( TreeWidgetItem* theItem, bool theIsVisible );
|
||||
void setMainObjectTransparency( double );
|
||||
void restoreParam();
|
||||
void updateViewer(const bool theIsHideOtherTree);
|
||||
|
||||
SalomeApp_Application* myApp;
|
||||
QPointer<SUIT_ViewWindow> myViewWindow;
|
||||
GeometryGUI* myGeomGUI;
|
||||
|
||||
QIcon myVisible;
|
||||
QIcon myInvisible;
|
||||
|
||||
QTreeWidget* myTreeObjects;
|
||||
QLineEdit* myEditMainShape;
|
||||
|
||||
QTreeWidget *myTreeObjects;
|
||||
QTreeWidget *myFilteredTreeObjects;
|
||||
QTreeWidget *myCurrentTreeObjects;
|
||||
QLineEdit *myEditMainShape;
|
||||
QGroupBox *myTolFilterGrp;
|
||||
QButtonGroup *myShapeTypeBtnGrp;
|
||||
QComboBox *myComparisonCompo;
|
||||
SalomeApp_DoubleSpinBox *myTolEdit;
|
||||
QLabel *myMinTolValLabel;
|
||||
QLabel *myMaxTolValLabel;
|
||||
QStackedLayout *myTreesLayout;
|
||||
QPushButton *myMinTolResetBtn;
|
||||
QPushButton *myMaxTolResetBtn;
|
||||
double myMaxTol;
|
||||
double myMinTol;
|
||||
bool myIsSelectAll;
|
||||
double myTransparency;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user