Add "Deflection 2D" quality control

for GPUSPHGUI project
This commit is contained in:
eap 2017-10-12 19:52:03 +03:00
parent 85f0b9ca16
commit 05a257d4f4
33 changed files with 649 additions and 272 deletions

View File

@ -0,0 +1,45 @@
# Deflection 2D
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
# fuse a box and a sphere
Sphere_1 = geompy.MakeSphereR(100)
Box_1 = geompy.MakeBoxDXDYDZ(200, 200, 200)
Fuse = geompy.MakeFuse( Sphere_1, Box_1, theName="box + sphere" )
# create a mesh
mesh = smesh.Mesh( Fuse, "Deflection_2D")
algo = mesh.Segment()
algo.LocalLength(35)
algo = mesh.Triangle()
mesh.Compute()
# get min and max deflection
minMax = mesh.GetMinMax( SMESH.FT_Deflection2D )
print "min and max deflection: ", minMax
# get deflection of a certain face
faceID = mesh.NbEdges() + mesh.NbFaces()
defl = mesh.FunctorValue( SMESH.FT_Deflection2D, faceID )
print "deflection of face %s = %s" % ( faceID, defl )
margin = minMax[1] / 2
# get all faces with deflection LESS than the margin
aFilter = smesh.GetFilter(SMESH.FACE, SMESH.FT_Deflection2D, '<', margin, mesh=mesh)
anIds = aFilter.GetIDs()
print "%s faces have deflection less than %s" %( len(anIds), margin )
# create a group of faces with deflection MORE than the margin
aGroup = mesh.MakeGroup("Deflection > " + `margin`, SMESH.FACE, SMESH.FT_Deflection2D,'>',margin)
print "%s faces have deflection more than %s: %s ..." %( aGroup.Size(), margin, aGroup.GetIDs()[:10] )
salome.sg.updateObjBrowser(True)

View File

@ -156,6 +156,7 @@ SET(GOOD_TESTS
quality_controls_ex17.py quality_controls_ex17.py
quality_controls_ex18.py quality_controls_ex18.py
quality_controls_ex19.py quality_controls_ex19.py
quality_controls_defl.py
transforming_meshes_ex01.py transforming_meshes_ex01.py
transforming_meshes_ex02.py transforming_meshes_ex02.py
transforming_meshes_ex03.py transforming_meshes_ex03.py

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -7,21 +7,22 @@ specific condition or a set of conditions. Filters can be used to create
or edit mesh groups, remove elements from the mesh, control or edit mesh groups, remove elements from the mesh, control
mesh quality by different parameters, etc. mesh quality by different parameters, etc.
Several criteria can be combined together by using logical operators \a Several \ref filtering_criteria "filtering criteria" can be combined
AND and \a OR. In addition, a filter criterion can be reverted together by using logical operators \a AND and \a OR. In addition, a
using logical operator \a NOT. filter criterion can be reverted using logical operator \a NOT.
Some filtering criteria use the functionality of \ref quality_page "mesh quality controls" Some filtering criteria use the functionality of \ref quality_page
to filter mesh nodes / elements by specific characteristic (Area, Length, etc). "mesh quality controls" to filter mesh nodes / elements by specific
characteristic (Area, Length, etc).
The functinality of mesh filters is available in both GUI and TUI The functinality of mesh filters is available in both GUI and TUI
modes: modes:
- In GUI, filters are available in some dialog boxes via - In GUI, filters are available in some dialog boxes via "Set Filters"
"Set Filters" button, clicking on which opens the dialog box button, clicking on which opens the \ref filtering_elements "dialog box"
allowing to specify the list of filter criteria to be applied to the allowing to specify the list of filter criteria to be applied to the
current selection. See \subpage selection_filter_library_page page to learn more current selection. See \subpage selection_filter_library_page page to
about selection filters and their usage in GUI. learn more about selection filters and their usage in GUI.
- In Python scripts, filters can be used to choose only some mesh - In Python scripts, filters can be used to choose only some mesh
entities (nodes or elements) for the operations, which require the entities (nodes or elements) for the operations, which require the

View File

@ -37,6 +37,7 @@ Face quality controls:
<li>\subpage bare_border_faces_page "Bare border faces"</li> <li>\subpage bare_border_faces_page "Bare border faces"</li>
<li>\subpage over_constrained_faces_page "Over-constrained faces"</li> <li>\subpage over_constrained_faces_page "Over-constrained faces"</li>
<li>\subpage length_2d_page "Length 2D"</li> <li>\subpage length_2d_page "Length 2D"</li>
<li>\subpage deflection_2d_page "Deflection 2D"</li>
<li>\subpage borders_at_multi_connection_2d_page "Borders at multi-connection 2D"</li> <li>\subpage borders_at_multi_connection_2d_page "Borders at multi-connection 2D"</li>
<li>\subpage area_page "Area"</li> <li>\subpage area_page "Area"</li>
<li>\subpage taper_page "Taper"</li> <li>\subpage taper_page "Taper"</li>

View File

@ -0,0 +1,25 @@
/*!
\page deflection_2d_page Deflection 2D
\n This quality control criterion consists of calculation of distance
between a mesh face gravity corner and the surface the face discretizes.
<em>To apply the Deflection 2D quality criterion to your mesh:</em>
<ol>
<li>Display your mesh in the viewer. </li>
<li>Choose <b>Controls > Face Controls > Deflection 2D</b> or click
<em>"Deflection 2D"</em> button in the toolbar.
Your mesh will be displayed in the viewer with faces colored according
to the applied mesh quality control criterion:
\image html deflection_2d.png
</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\ref tui_deflection_2d "Deflection 2D quality control" operation.
*/

View File

@ -2,6 +2,10 @@
\page selection_filter_library_page Selection filter library \page selection_filter_library_page Selection filter library
\tableofcontents
\section selection_filter_library Filter library
\n Selection filter library allows creating and storing in files \n Selection filter library allows creating and storing in files
the filters that can be later reused for operations on meshes. You can the filters that can be later reused for operations on meshes. You can
access it from the Main Menu via <b>Tools / Selection filter library</b>. access it from the Main Menu via <b>Tools / Selection filter library</b>.
@ -18,8 +22,7 @@ the current study. You can \b Add or \b Delete filters.
\n In <b>Filter name</b> box you can specify the name for your \n In <b>Filter name</b> box you can specify the name for your
filter. By default it is prefixed with the corresponding entity type. filter. By default it is prefixed with the corresponding entity type.
\anchor filtering_elements \section filtering_elements Filter Dialog
<h2>Filter Dialog</h2>
When we use filters during group creation or another operation (by When we use filters during group creation or another operation (by
clicking <b>Set Filter</b> button in the corresponding dialog), the clicking <b>Set Filter</b> button in the corresponding dialog), the
@ -64,6 +67,8 @@ in the Library.
is no selected mesh in the Object Browser and the filter can not be is no selected mesh in the Object Browser and the filter can not be
created. You have to select the mesh and the button will be enabled. created. You have to select the mesh and the button will be enabled.
\section filtering_criteria Filtering Criteria
Some criteria are applicable to all <b>Entity types</b>: Some criteria are applicable to all <b>Entity types</b>:
<ul><li> <ul><li>
<b>Belong to Geom</b> selects entities whose all nodes lie on the <b>Belong to Geom</b> selects entities whose all nodes lie on the
@ -231,6 +236,10 @@ normal to the neighboring face and the normal to the selected face is less then
angular tolerance (defined in degrees). Selection continues among all neighbor faces of already angular tolerance (defined in degrees). Selection continues among all neighbor faces of already
selected ones.<br> selected ones.<br>
</li><li> </li><li>
<b>Deflection 2D</b> selects 2D mesh elements having distance between their gravity
centers and underlying surfaces, which is more, less or equal (within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a
\ref deflection_2d_page "Deflection 2D quality control".
</li><li>
<b>Element Diameter 2D</b> selects triangles and quadrangles composed of the edges and <b>Element Diameter 2D</b> selects triangles and quadrangles composed of the edges and
diagonals with a value of length, which is more, less or equal diagonals with a value of length, which is more, less or equal
(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a (within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>. See also a

View File

@ -37,6 +37,9 @@
\section tui_length_2d Length 2D \section tui_length_2d Length 2D
\tui_script{quality_controls_ex11.py} \tui_script{quality_controls_ex11.py}
\section tui_deflection_2d Deflection 2D
\tui_script{quality_controls_defl.py}
\section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D \section tui_borders_at_multiconnection_2d Borders at Multiconnection 2D
\tui_script{quality_controls_ex12.py} \tui_script{quality_controls_ex12.py}

View File

@ -61,6 +61,7 @@ module SMESH
FT_MultiConnection2D, FT_MultiConnection2D,
FT_Length, FT_Length,
FT_Length2D, FT_Length2D,
FT_Deflection2D,
FT_NodeConnectivityNumber, FT_NodeConnectivityNumber,
FT_BelongToMeshGroup, FT_BelongToMeshGroup,
FT_BelongToGeom, FT_BelongToGeom,
@ -150,6 +151,7 @@ module SMESH
typedef sequence<Value> Values; typedef sequence<Value> Values;
Values GetValues(); Values GetValues();
}; };
interface Deflection2D : NumericalFunctor{};
interface MultiConnection : NumericalFunctor{}; interface MultiConnection : NumericalFunctor{};
interface MultiConnection2D : NumericalFunctor interface MultiConnection2D : NumericalFunctor
{ {
@ -585,6 +587,7 @@ module SMESH
MaxElementLength3D CreateMaxElementLength3D(); MaxElementLength3D CreateMaxElementLength3D();
Length CreateLength(); Length CreateLength();
Length2D CreateLength2D(); Length2D CreateLength2D();
Deflection2D CreateDeflection2D();
MultiConnection CreateMultiConnection(); MultiConnection CreateMultiConnection();
MultiConnection2D CreateMultiConnection2D(); MultiConnection2D CreateMultiConnection2D();
BallDiameter CreateBallDiameter(); BallDiameter CreateBallDiameter();

View File

@ -228,6 +228,7 @@ SET(SMESH_RESOURCES_FILES
mesh_quality.png mesh_quality.png
mesh_show.png mesh_show.png
mesh_hide.png mesh_hide.png
mesh_deflection.png
) )
INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA}) INSTALL(FILES ${SMESH_RESOURCES_FILES} DESTINATION ${SALOME_SMESH_INSTALL_RES_DATA})

Binary file not shown.

After

Width:  |  Height:  |  Size: 827 B

View File

@ -23,6 +23,7 @@
#include "SMESH_ControlsDef.hxx" #include "SMESH_ControlsDef.hxx"
#include "SMDS_BallElement.hxx" #include "SMDS_BallElement.hxx"
#include "SMDS_FacePosition.hxx"
#include "SMDS_Iterator.hxx" #include "SMDS_Iterator.hxx"
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
@ -41,6 +42,7 @@
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Copy.hxx> #include <BRepBuilderAPI_Copy.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx> #include <BRepClass_FaceClassifier.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <Geom_CylindricalSurface.hxx> #include <Geom_CylindricalSurface.hxx>
@ -48,6 +50,7 @@
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <NCollection_Map.hxx> #include <NCollection_Map.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <ShapeAnalysis_Surface.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfAsciiString.hxx> #include <TColStd_SequenceOfAsciiString.hxx>
@ -261,13 +264,10 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
} }
if ( anIter ) { if ( anIter ) {
double xyz[3]; SMESH_NodeXYZ p;
while( anIter->more() ) { while( anIter->more() ) {
if ( const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>( anIter->next() )) if ( p.Set( anIter->next() ))
{ theRes.push_back( p );
aNode->GetXYZ( xyz );
theRes.push_back( gp_XYZ( xyz[0], xyz[1], xyz[2] ));
}
} }
} }
@ -1553,12 +1553,8 @@ SMDSAbs_ElementType Length::GetType() const
*/ */
//================================================================================ //================================================================================
double Length2D::GetValue( long theElementId ) double Length2D::GetValue( const TSequenceOfXYZ& P )
{ {
TSequenceOfXYZ P;
if ( GetPoints( theElementId, P ))
{
double aVal = 0; double aVal = 0;
int len = P.size(); int len = P.size();
SMDSAbs_EntityType aType = P.getElementEntity(); SMDSAbs_EntityType aType = P.getElementEntity();
@ -1791,9 +1787,6 @@ double Length2D::GetValue( long theElementId )
} }
return aVal; return aVal;
}
return 0.;
} }
double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
@ -1908,6 +1901,80 @@ void Length2D::GetValues(TValues& theValues)
} }
} }
//================================================================================
/*
Class : Deflection2D
Description : Functor for calculating number of faces conneted to the edge
*/
//================================================================================
double Deflection2D::GetValue( const TSequenceOfXYZ& P )
{
if ( myMesh && P.getElement() )
{
// get underlying surface
if ( myShapeIndex != P.getElement()->getshapeId() )
{
mySurface.Nullify();
myShapeIndex = P.getElement()->getshapeId();
const TopoDS_Shape& S =
static_cast< const SMESHDS_Mesh* >( myMesh )->IndexToShape( myShapeIndex );
if ( !S.IsNull() && S.ShapeType() == TopAbs_FACE )
{
mySurface = new ShapeAnalysis_Surface( BRep_Tool::Surface( TopoDS::Face( S )));
}
}
// project gravity center to the surface
if ( !mySurface.IsNull() )
{
gp_XYZ gc(0,0,0);
gp_XY uv(0,0);
int nbUV = 0;
for ( size_t i = 0; i < P.size(); ++i )
{
gc += P(i+1);
if ( const SMDS_FacePosition* fPos = dynamic_cast<const SMDS_FacePosition*>
( P.getElement()->GetNode( i )->GetPosition() ))
{
uv.ChangeCoord(1) += fPos->GetUParameter();
uv.ChangeCoord(2) += fPos->GetVParameter();
++nbUV;
}
}
gc /= P.size();
if ( nbUV ) uv /= nbUV;
double maxLen = MaxElementLength2D().GetValue( P );
double tol = 1e-3 * maxLen;
if ( uv.X() != 0 && uv.Y() != 0 ) // faster way
mySurface->NextValueOfUV( uv, gc, tol, 0.5 * maxLen );
else
mySurface->ValueOfUV( gc, tol );
return Round( mySurface->Gap() );
}
}
return 0;
}
void Deflection2D::SetMesh( const SMDS_Mesh* theMesh )
{
NumericalFunctor::SetMesh( dynamic_cast<const SMESHDS_Mesh* >( theMesh ));
myShapeIndex = -100;
}
SMDSAbs_ElementType Deflection2D::GetType() const
{
return SMDSAbs_Face;
}
double Deflection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
{
// meaningless as it is not quality control functor
return Value;
}
//================================================================================ //================================================================================
/* /*
Class : MultiConnection Class : MultiConnection

View File

@ -27,7 +27,6 @@
#include "SMESH_TypeDefs.hxx" #include "SMESH_TypeDefs.hxx"
#include <BRepClass3d_SolidClassifier.hxx>
#include <Bnd_B3d.hxx> #include <Bnd_B3d.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx> #include <GeomAPI_ProjectPointOnCurve.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx> #include <GeomAPI_ProjectPointOnSurf.hxx>
@ -55,6 +54,8 @@ class SMESHDS_SubMesh;
class SMESHDS_GroupBase; class SMESHDS_GroupBase;
class gp_Pnt; class gp_Pnt;
class BRepClass3d_SolidClassifier;
class ShapeAnalysis_Surface;
namespace SMESH{ namespace SMESH{
namespace Controls{ namespace Controls{
@ -293,7 +294,7 @@ namespace SMESH{
*/ */
class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{ class SMESHCONTROLS_EXPORT Length2D: public virtual NumericalFunctor{
public: public:
virtual double GetValue( long theElementId ); virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const; virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const; virtual SMDSAbs_ElementType GetType() const;
struct Value{ struct Value{
@ -307,6 +308,21 @@ namespace SMESH{
}; };
typedef boost::shared_ptr<Length2D> Length2DPtr; typedef boost::shared_ptr<Length2D> Length2DPtr;
/*
Class : Deflection2D
Description : Functor for calculating distance between a face and geometry
*/
class SMESHCONTROLS_EXPORT Deflection2D: public virtual NumericalFunctor{
public:
virtual void SetMesh( const SMDS_Mesh* theMesh );
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
private:
Handle(ShapeAnalysis_Surface) mySurface;
int myShapeIndex;
};
/* /*
Class : MultiConnection Class : MultiConnection
Description : Functor for calculating number of faces connected to the edge Description : Functor for calculating number of faces connected to the edge

View File

@ -844,11 +844,9 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
break; break;
} }
case eLength2D: case eLength2D:
{
myFunctor.reset(new SMESH::Controls::Length2D()); myFunctor.reset(new SMESH::Controls::Length2D());
myControlActor = my2DActor; myControlActor = my2DActor;
break; break;
}
case eFreeBorders: case eFreeBorders:
myFunctor.reset(new SMESH::Controls::FreeBorders()); myFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor; myControlActor = my1DActor;
@ -958,6 +956,14 @@ void SMESH_ActorDef::SetControlMode( eControl theMode, bool theCheckEntityMode )
myControlActor = my3DActor; myControlActor = my3DActor;
break; break;
} }
case eDeflection2D:
{
SMESH::Controls::Deflection2D* aControl = new SMESH::Controls::Deflection2D();
aControl->SetPrecision( myControlsPrecision );
myFunctor.reset( aControl );
myControlActor = my2DActor;
break;
}
case eBareBorderVolume: case eBareBorderVolume:
{ {
myFunctor.reset(new SMESH::Controls::BareBorderVolume()); myFunctor.reset(new SMESH::Controls::BareBorderVolume());

View File

@ -141,7 +141,7 @@ class SMESHOBJECT_EXPORT SMESH_Actor: public SALOME_Actor
virtual void SetFacesOrientation3DVectors(bool theState) = 0; virtual void SetFacesOrientation3DVectors(bool theState) = 0;
virtual bool GetFacesOrientation3DVectors() = 0; virtual bool GetFacesOrientation3DVectors() = 0;
enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eFreeNodes, enum eControl{eNone, eLength, eLength2D, eDeflection2D, eFreeBorders, eFreeEdges, eFreeNodes,
eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio, eFreeFaces, eMultiConnection, eArea, eTaper, eAspectRatio,
eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D, eMinimumAngle, eWarping, eSkew, eAspectRatio3D, eMultiConnection2D, eVolume3D,
eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume, eMaxElementLength2D, eMaxElementLength3D, eBareBorderFace, eBareBorderVolume,

View File

@ -701,7 +701,7 @@ public:
int idnode4, int idnode5, int idnode6) const; int idnode4, int idnode5, int idnode6) const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4, const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4,
int idnode5, int idnode6, int idnode7, int idnode8) const; int idnode5, int idnode6, int idnode7, int idnode8) const;
const SMDS_MeshElement *FindElement(int IDelem) const; virtual const SMDS_MeshElement * FindElement(int IDelem) const;
static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n); static const SMDS_Mesh0DElement* Find0DElement(const SMDS_MeshNode * n);
static const SMDS_BallElement* FindBall(const SMDS_MeshNode * n); static const SMDS_BallElement* FindBall(const SMDS_MeshNode * n);
static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1, static const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,

View File

@ -51,6 +51,11 @@ namespace SMDS {
static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) it->second; } static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) it->second; }
}; };
template<typename VALUE,typename VALUE_SET_ITERATOR>
struct PointerAccessor {
static VALUE value(VALUE_SET_ITERATOR it) { return (VALUE) &(*it); }
};
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Filters of value pointed by iterator /// Filters of value pointed by iterator
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -1138,6 +1138,8 @@ namespace
type = QObject::tr( "LENGTH_EDGES" ); type = QObject::tr( "LENGTH_EDGES" );
else if ( dynamic_cast< SMESH::Controls::Length2D* >( f.get() ) ) else if ( dynamic_cast< SMESH::Controls::Length2D* >( f.get() ) )
type = QObject::tr( "LENGTH2D_EDGES" ); type = QObject::tr( "LENGTH2D_EDGES" );
else if ( dynamic_cast< SMESH::Controls::Deflection2D* >( f.get() ) )
type = QObject::tr( "DEFLECTION2D_FACES" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection* >( f.get() ) ) else if ( dynamic_cast< SMESH::Controls::MultiConnection* >( f.get() ) )
type = QObject::tr( "MULTI_BORDERS" ); type = QObject::tr( "MULTI_BORDERS" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection2D* >( f.get() ) ) else if ( dynamic_cast< SMESH::Controls::MultiConnection2D* >( f.get() ) )
@ -1673,6 +1675,7 @@ namespace
ActionControl.Bind( SMESHOp::OpBareBorderFace, SMESH_Actor::eBareBorderFace ); ActionControl.Bind( SMESHOp::OpBareBorderFace, SMESH_Actor::eBareBorderFace );
ActionControl.Bind( SMESHOp::OpOverConstrainedFace, SMESH_Actor::eOverConstrainedFace ); ActionControl.Bind( SMESHOp::OpOverConstrainedFace, SMESH_Actor::eOverConstrainedFace );
ActionControl.Bind( SMESHOp::OpLength2D, SMESH_Actor::eLength2D ); ActionControl.Bind( SMESHOp::OpLength2D, SMESH_Actor::eLength2D );
ActionControl.Bind( SMESHOp::OpDeflection2D, SMESH_Actor::eDeflection2D );
ActionControl.Bind( SMESHOp::OpConnection2D, SMESH_Actor::eMultiConnection2D ); ActionControl.Bind( SMESHOp::OpConnection2D, SMESH_Actor::eMultiConnection2D );
ActionControl.Bind( SMESHOp::OpArea, SMESH_Actor::eArea ); ActionControl.Bind( SMESHOp::OpArea, SMESH_Actor::eArea );
ActionControl.Bind( SMESHOp::OpTaper, SMESH_Actor::eTaper ); ActionControl.Bind( SMESHOp::OpTaper, SMESH_Actor::eTaper );
@ -3617,6 +3620,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpBareBorderFace: case SMESHOp::OpBareBorderFace:
case SMESHOp::OpOverConstrainedFace: case SMESHOp::OpOverConstrainedFace:
case SMESHOp::OpLength2D: case SMESHOp::OpLength2D:
case SMESHOp::OpDeflection2D:
case SMESHOp::OpConnection2D: case SMESHOp::OpConnection2D:
case SMESHOp::OpArea: case SMESHOp::OpArea:
case SMESHOp::OpTaper: case SMESHOp::OpTaper:
@ -3918,6 +3922,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpBareBorderFace, "BARE_BORDER_FACE", "ICON_BARE_BORDER_FACE", 0, true ); createSMESHAction( SMESHOp::OpBareBorderFace, "BARE_BORDER_FACE", "ICON_BARE_BORDER_FACE", 0, true );
createSMESHAction( SMESHOp::OpOverConstrainedFace, "OVER_CONSTRAINED_FACE", "ICON_OVER_CONSTRAINED_FACE", 0, true ); createSMESHAction( SMESHOp::OpOverConstrainedFace, "OVER_CONSTRAINED_FACE", "ICON_OVER_CONSTRAINED_FACE", 0, true );
createSMESHAction( SMESHOp::OpLength2D, "LENGTH_2D", "ICON_LENGTH_2D", 0, true ); createSMESHAction( SMESHOp::OpLength2D, "LENGTH_2D", "ICON_LENGTH_2D", 0, true );
createSMESHAction( SMESHOp::OpDeflection2D, "DEFLECTION_2D", "ICON_DEFLECTION_2D", 0, true );
createSMESHAction( SMESHOp::OpConnection2D, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true ); createSMESHAction( SMESHOp::OpConnection2D, "CONNECTION_2D", "ICON_CONNECTION_2D", 0, true );
createSMESHAction( SMESHOp::OpArea, "AREA", "ICON_AREA", 0, true ); createSMESHAction( SMESHOp::OpArea, "AREA", "ICON_AREA", 0, true );
createSMESHAction( SMESHOp::OpTaper, "TAPER", "ICON_TAPER", 0, true ); createSMESHAction( SMESHOp::OpTaper, "TAPER", "ICON_TAPER", 0, true );
@ -4047,6 +4052,7 @@ void SMESHGUI::initialize( CAM_Application* app )
<< SMESHOp::OpNodeConnectivityNb // node controls << SMESHOp::OpNodeConnectivityNb // node controls
<< SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder << SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder
<< SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls << SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls
<< SMESHOp::OpDeflection2D
<< SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D << SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D
<< SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio << SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio
<< SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew << SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew
@ -4160,6 +4166,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( SMESHOp::OpSkew, faceId, -1 ); createMenu( SMESHOp::OpSkew, faceId, -1 );
createMenu( SMESHOp::OpMaxElementLength2D, faceId, -1 ); createMenu( SMESHOp::OpMaxElementLength2D, faceId, -1 );
createMenu( SMESHOp::OpEqualFace, faceId, -1 ); createMenu( SMESHOp::OpEqualFace, faceId, -1 );
createMenu( SMESHOp::OpDeflection2D, faceId, -1 );
createMenu( SMESHOp::OpAspectRatio3D, volumeId, -1 ); createMenu( SMESHOp::OpAspectRatio3D, volumeId, -1 );
createMenu( SMESHOp::OpVolume, volumeId, -1 ); createMenu( SMESHOp::OpVolume, volumeId, -1 );
createMenu( SMESHOp::OpMaxElementLength3D, volumeId, -1 ); createMenu( SMESHOp::OpMaxElementLength3D, volumeId, -1 );
@ -4309,6 +4316,7 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( SMESHOp::OpSkew, ctrl2dTb ); createTool( SMESHOp::OpSkew, ctrl2dTb );
createTool( SMESHOp::OpMaxElementLength2D, ctrl2dTb ); createTool( SMESHOp::OpMaxElementLength2D, ctrl2dTb );
createTool( SMESHOp::OpEqualFace, ctrl2dTb ); createTool( SMESHOp::OpEqualFace, ctrl2dTb );
createTool( SMESHOp::OpDeflection2D, ctrl2dTb );
createTool( SMESHOp::OpAspectRatio3D, ctrl3dTb ); createTool( SMESHOp::OpAspectRatio3D, ctrl3dTb );
createTool( SMESHOp::OpVolume, ctrl3dTb ); createTool( SMESHOp::OpVolume, ctrl3dTb );
@ -4720,10 +4728,15 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert ( action( SMESHOp::OpOverConstrainedFace ), aSubId, -1 ); popupMgr()->insert ( action( SMESHOp::OpOverConstrainedFace ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), "controlMode = 'eOverConstrainedFace'", QtxPopupMgr::ToggleRule ); popupMgr()->setRule( action( SMESHOp::OpOverConstrainedFace ), "controlMode = 'eOverConstrainedFace'", QtxPopupMgr::ToggleRule );
popupMgr()->insert ( action( SMESHOp::OpEqualFace ), aSubId, -1 ); popupMgr()->insert ( action( SMESHOp::OpEqualFace ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpEqualFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpEqualFace ), aMeshInVtkHasFaces, QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpEqualFace ), "controlMode = 'eCoincidentElems2D'", QtxPopupMgr::ToggleRule ); popupMgr()->setRule( action( SMESHOp::OpEqualFace ), "controlMode = 'eCoincidentElems2D'", QtxPopupMgr::ToggleRule );
popupMgr()->insert ( action( SMESHOp::OpDeflection2D ), aSubId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDeflection2D ), aMeshInVtkHasFaces + " && hasGeomReference", QtxPopupMgr::VisibleRule );
popupMgr()->setRule( action( SMESHOp::OpDeflection2D ), "controlMode = 'eDeflection2D'", QtxPopupMgr::ToggleRule );
aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS aSubId = popupMgr()->insert( tr( "MEN_VOLUME_CTRL" ), anId, -1 ); // VOLUME CONTROLS
popupMgr()->insert ( action( SMESHOp::OpAspectRatio3D ), aSubId, -1 ); popupMgr()->insert ( action( SMESHOp::OpAspectRatio3D ), aSubId, -1 );

View File

@ -1572,6 +1572,7 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
aCriterion == SMESH::FT_MaxElementLength3D || aCriterion == SMESH::FT_MaxElementLength3D ||
aCriterion == SMESH::FT_Length || aCriterion == SMESH::FT_Length ||
aCriterion == SMESH::FT_Length2D || aCriterion == SMESH::FT_Length2D ||
aCriterion == SMESH::FT_Deflection2D ||
aCriterion == SMESH::FT_BallDiameter ); aCriterion == SMESH::FT_BallDiameter );
bool toEnable = (( isDbl && ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo) || bool toEnable = (( isDbl && ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo) ||
@ -1618,6 +1619,7 @@ const char* SMESHGUI_FilterTable::getPrecision( const int aType )
retval = "len_tol_precision"; break; retval = "len_tol_precision"; break;
case SMESH::FT_Length: case SMESH::FT_Length:
case SMESH::FT_Length2D: case SMESH::FT_Length2D:
case SMESH::FT_Deflection2D:
case SMESH::FT_MaxElementLength2D: case SMESH::FT_MaxElementLength2D:
case SMESH::FT_MaxElementLength3D: case SMESH::FT_MaxElementLength3D:
case SMESH::FT_BallDiameter: case SMESH::FT_BallDiameter:
@ -1812,8 +1814,7 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
case SMESH::FT_Area: case SMESH::FT_Area:
case SMESH::FT_Volume3D: case SMESH::FT_Volume3D:
case SMESH::FT_MaxElementLength2D: case SMESH::FT_MaxElementLength2D:
case SMESH::FT_MaxElementLength3D: case SMESH::FT_MaxElementLength3D: anIsDoubleCriterion = true; break;
anIsDoubleCriterion = true; break;
case SMESH::FT_FreeBorders: case SMESH::FT_FreeBorders:
case SMESH::FT_FreeEdges: case SMESH::FT_FreeEdges:
@ -1829,7 +1830,8 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; nbCompareSigns = 3; break; case SMESH::FT_MultiConnection2D: anIsIntCriterion = true; nbCompareSigns = 3; break;
case SMESH::FT_Length: case SMESH::FT_Length:
case SMESH::FT_Length2D: anIsDoubleCriterion = true; break; case SMESH::FT_Length2D:
case SMESH::FT_Deflection2D: anIsDoubleCriterion = true; break;
case SMESH::FT_BelongToMeshGroup: break; case SMESH::FT_BelongToMeshGroup: break;
@ -2241,6 +2243,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria (const int theType)
aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE"); aCriteria[ SMESH::FT_BelongToGenSurface ] = tr("BELONG_TO_GENSURFACE");
aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM"); aCriteria[ SMESH::FT_LyingOnGeom ] = tr("LYING_ON_GEOM");
aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D"); aCriteria[ SMESH::FT_Length2D ] = tr("LENGTH2D");
aCriteria[ SMESH::FT_Deflection2D ] = tr("DEFLECTION2D");
aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS"); aCriteria[ SMESH::FT_MultiConnection2D ] = tr("MULTI2D_BORDERS");
aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES"); aCriteria[ SMESH::FT_FreeFaces ] = tr("FREE_FACES");
aCriteria[ SMESH::FT_BareBorderFace ] = tr("BARE_BORDER_FACE"); aCriteria[ SMESH::FT_BareBorderFace ] = tr("BARE_BORDER_FACE");

View File

@ -966,11 +966,13 @@ SMESHGUI_ElemInfo::~SMESHGUI_ElemInfo()
\brief Set mesh data source (actor) \brief Set mesh data source (actor)
\param actor mesh object actor \param actor mesh object actor
*/ */
void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor ) void SMESHGUI_ElemInfo::setSource( SMESH_Actor* actor, SMESH::SMESH_IDSource_var obj )
{ {
if ( myActor != actor ) { if ( myActor != actor ) {
myActor = actor; myActor = actor;
myIsElement = -1; myIsElement = -1;
SMESH::SMESH_Mesh_var mesh = obj->GetMesh();
myMeshHasShape = ( !mesh->_is_nil() && mesh->HasShapeToMesh() );
clear(); clear();
} }
} }
@ -1479,7 +1481,12 @@ void SMESHGUI_SimpleElemInfo::information( const QList<long>& ids )
//ElemDiam2D //ElemDiam2D
afunctor.reset( new SMESH::Controls::MaxElementLength2D() ); afunctor.reset( new SMESH::Controls::MaxElementLength2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() ); afunctor->SetMesh( actor()->GetObject()->GetMesh() );
afunctor->SetPrecision( cprecision );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_2D" )).arg( afunctor->GetValue( id )) ); myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MAX_ELEMENT_LENGTH_2D" )).arg( afunctor->GetValue( id )) );
//min edge length
afunctor.reset( new SMESH::Controls::Length2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
myInfo->append( QString( "- <b>%1:</b> %2" ).arg( tr( "MIN_ELEM_EDGE" )).arg( afunctor->GetValue( id )) );
} }
if( e->GetType() == SMDSAbs_Volume ) { if( e->GetType() == SMDSAbs_Volume ) {
//AspectRatio3D //AspectRatio3D
@ -2026,6 +2033,15 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
skewItem->setText( 0, tr( "SKEW_ELEMENTS" )); skewItem->setText( 0, tr( "SKEW_ELEMENTS" ));
skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) ); skewItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
} }
//Deflection
if ( hasShapeToMesh() )
{
afunctor.reset( new SMESH::Controls::Deflection2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* deflItem = createItem( cntrItem, Bold );
deflItem->setText( 0, tr( "DEFLECTION_2D" ));
deflItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
}
//ElemDiam2D //ElemDiam2D
if ( !e->IsPoly() ) if ( !e->IsPoly() )
{ {
@ -2060,6 +2076,13 @@ void SMESHGUI_TreeElemInfo::information( const QList<long>& ids )
diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) ); diam3Item->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
} }
//min edge length
afunctor.reset( new SMESH::Controls::Length2D() );
afunctor->SetMesh( actor()->GetObject()->GetMesh() );
QTreeWidgetItem* minEdgeItem = createItem( cntrItem, Bold );
minEdgeItem->setText( 0, tr( "MIN_ELEM_EDGE" ));
minEdgeItem->setText( 1, QString( "%1" ).arg( afunctor->GetValue( id )) );
// gravity center // gravity center
XYZ gc = gravityCenter( e ); XYZ gc = gravityCenter( e );
QTreeWidgetItem* gcItem = createItem( elemItem, Bold ); QTreeWidgetItem* gcItem = createItem( elemItem, Bold );
@ -2990,7 +3013,7 @@ void SMESHGUI_MeshInfoDlg::showInfo( const Handle(SALOME_InteractiveObject)& IO
SMESH::GetNameOfSelectedElements( selector, IO, ID ) : SMESH::GetNameOfSelectedElements( selector, IO, ID ) :
SMESH::GetNameOfSelectedNodes( selector, IO, ID ); SMESH::GetNameOfSelectedNodes( selector, IO, ID );
} }
myElemInfo->setSource( myActor ) ; myElemInfo->setSource( myActor, obj ) ;
if ( nb > 0 ) { if ( nb > 0 ) {
myID->setText( ID.trimmed() ); myID->setText( ID.trimmed() );
QSet<long> ids; QSet<long> ids;

View File

@ -153,7 +153,7 @@ public:
SMESHGUI_ElemInfo( QWidget* = 0 ); SMESHGUI_ElemInfo( QWidget* = 0 );
~SMESHGUI_ElemInfo(); ~SMESHGUI_ElemInfo();
void setSource( SMESH_Actor* ); void setSource( SMESH_Actor*, SMESH::SMESH_IDSource_var );
void showInfo( long, bool ); void showInfo( long, bool );
void showInfo( QSet<long>, bool ); void showInfo( QSet<long>, bool );
void clear(); void clear();
@ -179,6 +179,7 @@ protected:
QWidget* frame() const; QWidget* frame() const;
SMESH_Actor* actor() const; SMESH_Actor* actor() const;
bool isElements() const; bool isElements() const;
bool hasShapeToMesh() const { return myMeshHasShape; }
virtual void information( const QList<long>& ) = 0; virtual void information( const QList<long>& ) = 0;
virtual void clearInternal(); virtual void clearInternal();
@ -204,6 +205,7 @@ private:
QWidget* myFrame; QWidget* myFrame;
ExtraWidget* myExtra; ExtraWidget* myExtra;
int myIndex; int myIndex;
bool myMeshHasShape;
}; };
class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo class SMESHGUI_EXPORT SMESHGUI_SimpleElemInfo : public SMESHGUI_ElemInfo

View File

@ -116,6 +116,7 @@ namespace SMESHOp {
OpSkew = 3210, // MENU CONTROLS - SKEW OpSkew = 3210, // MENU CONTROLS - SKEW
OpMaxElementLength2D = 3211, // MENU CONTROLS - ELEMENT DIAMETER 2D OpMaxElementLength2D = 3211, // MENU CONTROLS - ELEMENT DIAMETER 2D
OpEqualFace = 3212, // MENU CONTROLS - DOUBLE FACES OpEqualFace = 3212, // MENU CONTROLS - DOUBLE FACES
OpDeflection2D = 3213, // MENU CONTROLS - DEFLECTION 2D
OpAspectRatio3D = 3300, // MENU CONTROLS - ASPECT RATIO 3D OpAspectRatio3D = 3300, // MENU CONTROLS - ASPECT RATIO 3D
OpVolume = 3301, // MENU CONTROLS - VOLUME OpVolume = 3301, // MENU CONTROLS - VOLUME
OpMaxElementLength3D = 3302, // MENU CONTROLS - ELEMENT DIAMETER 3D OpMaxElementLength3D = 3302, // MENU CONTROLS - ELEMENT DIAMETER 3D

View File

@ -364,6 +364,7 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
switch( actor->GetControlMode() ) { switch( actor->GetControlMode() ) {
case SMESH_Actor::eLength: mode = "eLength"; break; case SMESH_Actor::eLength: mode = "eLength"; break;
case SMESH_Actor::eLength2D: mode = "eLength2D"; break; case SMESH_Actor::eLength2D: mode = "eLength2D"; break;
case SMESH_Actor::eDeflection2D: mode = "eDeflection2D"; break;
case SMESH_Actor::eFreeEdges: mode = "eFreeEdges"; break; case SMESH_Actor::eFreeEdges: mode = "eFreeEdges"; break;
case SMESH_Actor::eFreeNodes: mode = "eFreeNodes"; break; case SMESH_Actor::eFreeNodes: mode = "eFreeNodes"; break;
case SMESH_Actor::eFreeBorders: mode = "eFreeBorders"; break; case SMESH_Actor::eFreeBorders: mode = "eFreeBorders"; break;
@ -411,6 +412,11 @@ QString SMESHGUI_Selection::controlMode() const
return "eNone"; return "eNone";
} }
//=======================================================================
//function : isNumFunctor
//purpose : return true if a given actor is shown using a numeric functor
//=======================================================================
bool SMESHGUI_Selection::isNumFunctor( int ind ) const bool SMESHGUI_Selection::isNumFunctor( int ind ) const
{ {
bool result = false; bool result = false;
@ -419,6 +425,7 @@ bool SMESHGUI_Selection::isNumFunctor( int ind ) const
switch( actor->GetControlMode() ) { switch( actor->GetControlMode() ) {
case SMESH_Actor::eLength: case SMESH_Actor::eLength:
case SMESH_Actor::eLength2D: case SMESH_Actor::eLength2D:
case SMESH_Actor::eDeflection2D:
case SMESH_Actor::eMultiConnection: case SMESH_Actor::eMultiConnection:
case SMESH_Actor::eMultiConnection2D: case SMESH_Actor::eMultiConnection2D:
case SMESH_Actor::eArea: case SMESH_Actor::eArea:

View File

@ -347,6 +347,10 @@
<source>ICON_LENGTH_2D</source> <source>ICON_LENGTH_2D</source>
<translation>mesh_length_2d.png</translation> <translation>mesh_length_2d.png</translation>
</message> </message>
<message>
<source>ICON_DEFLECTION_2D</source>
<translation>mesh_deflection.png</translation>
</message>
<message> <message>
<source>ICON_MAP</source> <source>ICON_MAP</source>
<translation>mesh_pattern.png</translation> <translation>mesh_pattern.png</translation>

View File

@ -103,6 +103,10 @@
<source>MIN_DIAG_ELEMENTS</source> <source>MIN_DIAG_ELEMENTS</source>
<translation>Minimum diagonal</translation> <translation>Minimum diagonal</translation>
</message> </message>
<message>
<source>MIN_ELEM_EDGE</source>
<translation>Minimum Edge Length</translation>
</message>
<message> <message>
<source>ASPECTRATIO_3D_ELEMENTS</source> <source>ASPECTRATIO_3D_ELEMENTS</source>
<translation>Aspect Ratio 3D</translation> <translation>Aspect Ratio 3D</translation>
@ -224,6 +228,10 @@
<source>LENGTH2D_EDGES</source> <source>LENGTH2D_EDGES</source>
<translation>Length 2D</translation> <translation>Length 2D</translation>
</message> </message>
<message>
<source>DEFLECTION2D_FACES</source>
<translation>Deflection 2D</translation>
</message>
<message> <message>
<source>LENGTH_EDGES</source> <source>LENGTH_EDGES</source>
<translation>Length</translation> <translation>Length</translation>
@ -240,6 +248,10 @@
<source>MAX_ELEMENT_LENGTH_3D</source> <source>MAX_ELEMENT_LENGTH_3D</source>
<translation>Element Diameter 3D</translation> <translation>Element Diameter 3D</translation>
</message> </message>
<message>
<source>DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message> <message>
<source>MEN_ADD</source> <source>MEN_ADD</source>
<translation>Add</translation> <translation>Add</translation>
@ -692,6 +704,10 @@
<source>MEN_LENGTH_2D</source> <source>MEN_LENGTH_2D</source>
<translation>Length 2D</translation> <translation>Length 2D</translation>
</message> </message>
<message>
<source>MEN_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message> <message>
<source>MEN_MAP</source> <source>MEN_MAP</source>
<translation>Pattern Mapping</translation> <translation>Pattern Mapping</translation>
@ -3278,6 +3294,10 @@ Use Display Entity menu command to show them.
<source>STB_LENGTH_2D</source> <source>STB_LENGTH_2D</source>
<translation>Length 2D</translation> <translation>Length 2D</translation>
</message> </message>
<message>
<source>STB_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message> <message>
<source>STB_MAP</source> <source>STB_MAP</source>
<translation>Pattern mapping</translation> <translation>Pattern mapping</translation>
@ -3958,6 +3978,10 @@ Use Display Entity menu command to show them.
<source>TOP_LENGTH_2D</source> <source>TOP_LENGTH_2D</source>
<translation>Length 2D</translation> <translation>Length 2D</translation>
</message> </message>
<message>
<source>TOP_DEFLECTION_2D</source>
<translation>Deflection 2D</translation>
</message>
<message> <message>
<source>TOP_MAP</source> <source>TOP_MAP</source>
<translation>Pattern mapping</translation> <translation>Pattern mapping</translation>
@ -5869,6 +5893,10 @@ Please enter correct value and try again</translation>
<source>LENGTH2D</source> <source>LENGTH2D</source>
<translation>Length 2D</translation> <translation>Length 2D</translation>
</message> </message>
<message>
<source>DEFLECTION2D</source>
<translation>Deflection 2D</translation>
</message>
<message> <message>
<source>LESS_THAN</source> <source>LESS_THAN</source>
<translation>Less than</translation> <translation>Less than</translation>

View File

@ -294,6 +294,8 @@ namespace {
// - FT_BelongToMeshGroup = 22 // - FT_BelongToMeshGroup = 22
// v 8.1.0: FT_Undefined == 48, new items: // v 8.1.0: FT_Undefined == 48, new items:
// - FT_NodeConnectivityNumber= 22 // - FT_NodeConnectivityNumber= 22
// v 8.5.0: FT_Undefined == 49, new items:
// - FT_Deflection2D = 22
// //
// It's necessary to continue recording this history and to fill // It's necessary to continue recording this history and to fill
// undef2newItems (see below) accordingly. // undef2newItems (see below) accordingly.
@ -316,6 +318,7 @@ namespace {
undef2newItems[ 46 ].push_back( 39 ); undef2newItems[ 46 ].push_back( 39 );
undef2newItems[ 47 ].push_back( 22 ); undef2newItems[ 47 ].push_back( 22 );
undef2newItems[ 48 ].push_back( 22 ); undef2newItems[ 48 ].push_back( 22 );
undef2newItems[ 49 ].push_back( 22 );
ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined ); ASSERT( undef2newItems.rbegin()->first == SMESH::FT_Undefined );
} }

View File

@ -431,6 +431,7 @@ namespace SMESH
case FT_MultiConnection2D: myStream<< "aMultiConnection2D"; break; case FT_MultiConnection2D: myStream<< "aMultiConnection2D"; break;
case FT_Length: myStream<< "aLength"; break; case FT_Length: myStream<< "aLength"; break;
case FT_Length2D: myStream<< "aLength2D"; break; case FT_Length2D: myStream<< "aLength2D"; break;
case FT_Deflection2D: myStream<< "aDeflection2D"; break;
case FT_NodeConnectivityNumber:myStream<< "aNodeConnectivityNumber";break; case FT_NodeConnectivityNumber:myStream<< "aNodeConnectivityNumber";break;
case FT_BelongToMeshGroup: myStream<< "aBelongToMeshGroup"; break; case FT_BelongToMeshGroup: myStream<< "aBelongToMeshGroup"; break;
case FT_BelongToGeom: myStream<< "aBelongToGeom"; break; case FT_BelongToGeom: myStream<< "aBelongToGeom"; break;

View File

@ -534,6 +534,21 @@ SMESH::Length2D::Values* Length2D_i::GetValues()
return aResult._retn(); return aResult._retn();
} }
/*
Class : Deflection2D_i
Description : Functor for calculating distance between a face and geometry
*/
Deflection2D_i::Deflection2D_i()
{
myNumericalFunctorPtr.reset( new Controls::Deflection2D() );
myFunctorPtr = myNumericalFunctorPtr;
}
FunctorType Deflection2D_i::GetFunctorType()
{
return SMESH::FT_Deflection2D;
}
/* /*
Class : MultiConnection_i Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge Description : Functor for calculating number of faces conneted to the edge
@ -2113,6 +2128,14 @@ Length2D_ptr FilterManager_i::CreateLength2D()
return anObj._retn(); return anObj._retn();
} }
Deflection2D_ptr FilterManager_i::CreateDeflection2D()
{
SMESH::Deflection2D_i* aServant = new SMESH::Deflection2D_i();
SMESH::Deflection2D_var anObj = aServant->_this();
TPythonDump()<<aServant<<" = "<<this<<".CreateLength2D()";
return anObj._retn();
}
MultiConnection_ptr FilterManager_i::CreateMultiConnection() MultiConnection_ptr FilterManager_i::CreateMultiConnection()
{ {
SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i(); SMESH::MultiConnection_i* aServant = new SMESH::MultiConnection_i();
@ -2956,6 +2979,9 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
case SMESH::FT_Length2D: case SMESH::FT_Length2D:
aFunctor = aFilterMgr->CreateLength2D(); aFunctor = aFilterMgr->CreateLength2D();
break; break;
case SMESH::FT_Deflection2D:
aFunctor = aFilterMgr->CreateDeflection2D();
break;
case SMESH::FT_AspectRatio: case SMESH::FT_AspectRatio:
aFunctor = aFilterMgr->CreateAspectRatio(); aFunctor = aFilterMgr->CreateAspectRatio();
break; break;
@ -3451,9 +3477,10 @@ static inline LDOMString toString( CORBA::Long theType )
case FT_EqualFaces : return "Equal faces"; case FT_EqualFaces : return "Equal faces";
case FT_EqualVolumes : return "Equal volumes"; case FT_EqualVolumes : return "Equal volumes";
case FT_MultiConnection : return "Borders at multi-connections"; case FT_MultiConnection : return "Borders at multi-connections";
case FT_MultiConnection2D :return "Borders at multi-connections 2D"; case FT_MultiConnection2D : return "Borders at multi-connections 2D";
case FT_Length : return "Length"; case FT_Length : return "Length";
case FT_Length2D : return "Length 2D"; case FT_Length2D : return "Length 2D";
case FT_Deflection2D : return "Deflection 2D";
case FT_LessThan : return "Less than"; case FT_LessThan : return "Less than";
case FT_MoreThan : return "More than"; case FT_MoreThan : return "More than";
case FT_EqualTo : return "Equal to"; case FT_EqualTo : return "Equal to";
@ -3502,6 +3529,7 @@ static inline SMESH::FunctorType toFunctorType( const LDOMString& theStr )
// else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D; // else if ( theStr.equals( "Borders at multi-connections 2D" ) ) return FT_MultiConnection2D;
else if ( theStr.equals( "Length" ) ) return FT_Length; else if ( theStr.equals( "Length" ) ) return FT_Length;
// else if ( theStr.equals( "Length2D" ) ) return FT_Length2D; // else if ( theStr.equals( "Length2D" ) ) return FT_Length2D;
else if ( theStr.equals( "Deflection" ) ) return FT_Deflection2D;
else if ( theStr.equals( "Range of IDs" ) ) return FT_RangeOfIds; else if ( theStr.equals( "Range of IDs" ) ) return FT_RangeOfIds;
else if ( theStr.equals( "Bad Oriented Volume" ) ) return FT_BadOrientedVolume; else if ( theStr.equals( "Bad Oriented Volume" ) ) return FT_BadOrientedVolume;
else if ( theStr.equals( "Volumes with bare border" ) ) return FT_BareBorderVolume; else if ( theStr.equals( "Volumes with bare border" ) ) return FT_BareBorderVolume;
@ -4078,6 +4106,7 @@ static const char** getFunctNames()
"FT_MultiConnection2D", "FT_MultiConnection2D",
"FT_Length", "FT_Length",
"FT_Length2D", "FT_Length2D",
"FT_Deflection2D",
"FT_NodeConnectivityNumber", "FT_NodeConnectivityNumber",
"FT_BelongToMeshGroup", "FT_BelongToMeshGroup",
"FT_BelongToGeom", "FT_BelongToGeom",

View File

@ -271,6 +271,18 @@ namespace SMESH
Controls::Length2DPtr myLength2DPtr; Controls::Length2DPtr myLength2DPtr;
}; };
/*
Class : Deflection2D_i
Description : Functor for calculating distance between a face and geometry
*/
class SMESH_I_EXPORT Deflection2D_i: public virtual POA_SMESH::Deflection2D,
public virtual NumericalFunctor_i
{
public:
Deflection2D_i();
FunctorType GetFunctorType();
};
/* /*
Class : MultiConnection_i Class : MultiConnection_i
Description : Functor for calculating number of faces conneted to the edge Description : Functor for calculating number of faces conneted to the edge
@ -1087,6 +1099,7 @@ namespace SMESH
MaxElementLength3D_ptr CreateMaxElementLength3D(); MaxElementLength3D_ptr CreateMaxElementLength3D();
Length_ptr CreateLength(); Length_ptr CreateLength();
Length2D_ptr CreateLength2D(); Length2D_ptr CreateLength2D();
Deflection2D_ptr CreateDeflection2D();
NodeConnectivityNumber_ptr CreateNodeConnectivityNumber(); NodeConnectivityNumber_ptr CreateNodeConnectivityNumber();
MultiConnection_ptr CreateMultiConnection(); MultiConnection_ptr CreateMultiConnection();
MultiConnection2D_ptr CreateMultiConnection2D(); MultiConnection2D_ptr CreateMultiConnection2D();

View File

@ -27,6 +27,7 @@
#define __SMESH_MeshPartDS_HXX__ #define __SMESH_MeshPartDS_HXX__
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESH_TypeDefs.hxx"
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
@ -55,6 +56,8 @@ public:
virtual SMDS_ElemIteratorPtr elementGeomIterator(SMDSAbs_GeometryType type) const; virtual SMDS_ElemIteratorPtr elementGeomIterator(SMDSAbs_GeometryType type) const;
virtual SMDS_ElemIteratorPtr elementEntityIterator(SMDSAbs_EntityType type) const; virtual SMDS_ElemIteratorPtr elementEntityIterator(SMDSAbs_EntityType type) const;
virtual const SMDS_MeshElement *FindElement(int IDelem) const;
private: private:
TIDSortedElemSet _elements[ SMDSAbs_NbElementTypes ]; TIDSortedElemSet _elements[ SMDSAbs_NbElementTypes ];
SMESHDS_Mesh* _meshDS; SMESHDS_Mesh* _meshDS;
@ -65,6 +68,17 @@ private:
{ {
void Add(const SMDS_MeshElement* e) { SMDS_MeshInfo::addWithPoly( e ); } void Add(const SMDS_MeshElement* e) { SMDS_MeshInfo::addWithPoly( e ); }
}; };
/*!
* \brief Element holing its ID only
*/
struct TElemID : public SMDS_MeshElement
{
TElemID(int ID) : SMDS_MeshElement( ID ) {}
virtual SMDSAbs_ElementType GetType() const { return SMDSAbs_All; }
virtual SMDSAbs_EntityType GetEntityType() const { return SMDSEntity_Last; }
virtual SMDSAbs_GeometryType GetGeomType() const { return SMDSGeom_NONE; }
virtual vtkIdType GetVtkType() const { return -1; }
};
}; };
#endif #endif

View File

@ -6119,6 +6119,7 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(SMESH::SMESH_IDSource_ptr meshPart):
SMESH::SMESH_Mesh_var mesh = meshPart->GetMesh(); SMESH::SMESH_Mesh_var mesh = meshPart->GetMesh();
SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh ); SMESH_Mesh_i* mesh_i = SMESH::DownCast<SMESH_Mesh_i*>( mesh );
mesh_i->Load();
_meshDS = mesh_i->GetImpl().GetMeshDS(); _meshDS = mesh_i->GetImpl().GetMeshDS();
SetPersistentId( _meshDS->GetPersistentId() ); SetPersistentId( _meshDS->GetPersistentId() );
@ -6188,6 +6189,21 @@ SMESH_MeshPartDS::SMESH_MeshPartDS(const std::list< const SMDS_MeshElement* > &
myInfo = tmpInfo; myInfo = tmpInfo;
} }
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
const SMDS_MeshElement * SMESH_MeshPartDS::FindElement(int IDelem) const
{
if ( _meshDS ) return _meshDS->FindElement( IDelem );
TElemID elem( IDelem );
for ( int iType = SMDSAbs_Edge; iType < SMDSAbs_NbElementTypes; ++iType )
if ( !_elements[ iType ].empty() )
{
TIDSortedElemSet::const_iterator it = _elements[ iType ].find( &elem );
if ( it != _elements[ iType ].end() )
return *it;
}
return 0;
}
// -------------------------------------------------------------------------------------
SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const SMDS_ElemIteratorPtr SMESH_MeshPartDS::elementGeomIterator(SMDSAbs_GeometryType geomType) const
{ {
if ( _meshDS ) return _meshDS->elementGeomIterator( geomType ); if ( _meshDS ) return _meshDS->elementGeomIterator( geomType );

View File

@ -966,6 +966,8 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
functor = aFilterMgr.CreateLength() functor = aFilterMgr.CreateLength()
elif theCriterion == FT_Length2D: elif theCriterion == FT_Length2D:
functor = aFilterMgr.CreateLength2D() functor = aFilterMgr.CreateLength2D()
elif theCriterion == FT_Deflection2D:
functor = aFilterMgr.CreateDeflection2D()
elif theCriterion == FT_NodeConnectivityNumber: elif theCriterion == FT_NodeConnectivityNumber:
functor = aFilterMgr.CreateNodeConnectivityNumber() functor = aFilterMgr.CreateNodeConnectivityNumber()
elif theCriterion == FT_BallDiameter: elif theCriterion == FT_BallDiameter:
@ -3117,6 +3119,16 @@ class Mesh:
def GetPointState(self, x, y, z): def GetPointState(self, x, y, z):
return self.editor.GetPointState(x, y, z) return self.editor.GetPointState(x, y, z)
## Check if a 2D mesh is manifold
# @ingroup l1_controls
def IsManifold(self):
return self.editor.IsManifold()
## Check if orientation of 2D elements is coherent
# @ingroup l1_controls
def IsCoherentOrientation2D(self):
return self.editor.IsCoherentOrientation2D()
## Find the node closest to a point and moves it to a point location ## Find the node closest to a point and moves it to a point location
# @param x the X coordinate of a point # @param x the X coordinate of a point
# @param y the Y coordinate of a point # @param y the Y coordinate of a point
@ -4619,6 +4631,24 @@ class Mesh:
def MergeEqualElements(self): def MergeEqualElements(self):
self.editor.MergeEqualElements() self.editor.MergeEqualElements()
## Returns all or only closed free borders
# @return list of SMESH.FreeBorder's
# @ingroup l2_modif_trsf
def FindFreeBorders(self, ClosedOnly=True):
return self.editor.FindFreeBorders( ClosedOnly )
## Fill with 2D elements a hole defined by a SMESH.FreeBorder.
# @param FreeBorder either a SMESH.FreeBorder or a list on node IDs. These nodes
# must describe all sequential nodes of the hole border. The first and the last
# nodes must be the same. Use FindFreeBorders() to get nodes of holes.
# @ingroup l2_modif_trsf
def FillHole(self, holeNodes):
if holeNodes and isinstance( holeNodes, list ) and isinstance( holeNodes[0], int ):
holeNodes = SMESH.FreeBorder(nodeIDs=holeNodes)
if not isinstance( holeNodes, SMESH.FreeBorder ):
raise TypeError, "holeNodes must be either SMESH.FreeBorder or list of integer and not %s" % holeNodes
self.editor.FillHole( holeNodes )
## Return groups of FreeBorder's coincident within the given tolerance. ## Return groups of FreeBorder's coincident within the given tolerance.
# @param tolerance the tolerance. If the tolerance <= 0.0 then one tenth of an average # @param tolerance the tolerance. If the tolerance <= 0.0 then one tenth of an average
# size of elements adjacent to free borders being compared is used. # size of elements adjacent to free borders being compared is used.
@ -4934,7 +4964,14 @@ class Mesh:
def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords): def CreateHoleSkin(self, radius, theShape, groupName, theNodesCoords):
return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords ) return self.editor.CreateHoleSkin( radius, theShape, groupName, theNodesCoords )
def _getFunctor(self, funcType ): ## Return a cached numerical functor by its type.
# @param theCriterion functor type - an item of SMESH.FunctorType enumeration.
# Type SMESH.FunctorType._items in the Python Console to see all items.
# Note that not all items correspond to numerical functors.
# @return SMESH_NumericalFunctor. The functor is already initialized
# with a mesh
# @ingroup l1_measurements
def GetFunctor(self, funcType ):
fn = self.functors[ funcType._v ] fn = self.functors[ funcType._v ]
if not fn: if not fn:
fn = self.smeshpyD.GetFunctor(funcType) fn = self.smeshpyD.GetFunctor(funcType)
@ -4950,7 +4987,7 @@ class Mesh:
# @return the functor value or zero in case of invalid arguments # @return the functor value or zero in case of invalid arguments
# @ingroup l1_measurements # @ingroup l1_measurements
def FunctorValue(self, funcType, elemId, isElem=True): def FunctorValue(self, funcType, elemId, isElem=True):
fn = self._getFunctor( funcType ) fn = self.GetFunctor( funcType )
if fn.GetElementType() == self.GetElementType(elemId, isElem): if fn.GetElementType() == self.GetElementType(elemId, isElem):
val = fn.GetValue(elemId) val = fn.GetValue(elemId)
else: else:
@ -5056,7 +5093,7 @@ class Mesh:
unRegister.set( meshPart ) unRegister.set( meshPart )
if isinstance( meshPart, Mesh ): if isinstance( meshPart, Mesh ):
meshPart = meshPart.mesh meshPart = meshPart.mesh
fun = self._getFunctor( funType ) fun = self.GetFunctor( funType )
if fun: if fun:
if meshPart: if meshPart:
if hasattr( meshPart, "SetMesh" ): if hasattr( meshPart, "SetMesh" ):

View File

@ -136,7 +136,7 @@ this one for this mesh/sub-mesh.</translation>
</message> </message>
<message> <message>
<source>SMESH_DISTR_EXPR</source> <source>SMESH_DISTR_EXPR</source>
<translation>Distribution with analitic density</translation> <translation>Distribution with analytic density</translation>
</message> </message>
<message> <message>
<source>SMESH_DISTR_REGULAR</source> <source>SMESH_DISTR_REGULAR</source>