Merge branch 'master' into gni/evolution

This commit is contained in:
Gérald NICOLAS 2021-09-16 08:56:58 +02:00
commit 6ca43e11b2
22 changed files with 400 additions and 342 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -30,6 +30,7 @@
#include <Utils_SALOME_Exception.hxx> #include <Utils_SALOME_Exception.hxx>
#include <Basics_Utils.hxx> #include <Basics_Utils.hxx>
#include "SMESH_TypeDefs.hxx"
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> // getpid() #include <unistd.h> // getpid()

View File

@ -659,6 +659,7 @@ namespace
bool toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false ); bool toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
bool toOverwrite = true; bool toOverwrite = true;
bool toFindOutDim = true; bool toFindOutDim = true;
bool saveNumbers = resMgr->booleanValue( "SMESH", "med_save_numbers", true );
bool toRenumber = true; bool toRenumber = true;
double zTol = resMgr->doubleValue( "SMESH", "med_ztolerance", 0. ); double zTol = resMgr->doubleValue( "SMESH", "med_ztolerance", 0. );
@ -770,7 +771,9 @@ namespace
aDefaultFilter = it.key(); aDefaultFilter = it.key();
} }
QStringList checkBoxes; QStringList checkBoxes;
checkBoxes << QObject::tr("SMESH_AUTO_GROUPS") << QObject::tr("SMESH_AUTO_DIM"); checkBoxes << QObject::tr("SMESH_AUTO_GROUPS")
<< QObject::tr("SMESH_AUTO_DIM")
<< QObject::tr("SMESH_MED_SAVE_NUMS");
SMESHGUI_FieldSelectorWdg* fieldSelWdg = new SMESHGUI_FieldSelectorWdg(); SMESHGUI_FieldSelectorWdg* fieldSelWdg = new SMESHGUI_FieldSelectorWdg();
QList< QWidget* > wdgList; QList< QWidget* > wdgList;
@ -798,6 +801,7 @@ namespace
fd->selectNameFilter( aDefaultFilter ); fd->selectNameFilter( aDefaultFilter );
fd->SetChecked( toCreateGroups, 0 ); fd->SetChecked( toCreateGroups, 0 );
fd->SetChecked( toFindOutDim, 1 ); fd->SetChecked( toFindOutDim, 1 );
fd->SetChecked( saveNumbers, 2 );
if ( !anInitialPath.isEmpty() ) if ( !anInitialPath.isEmpty() )
fd->setDirectory( anInitialPath ); fd->setDirectory( anInitialPath );
fd->selectFile(aMeshName); fd->selectFile(aMeshName);
@ -888,6 +892,7 @@ namespace
} }
toCreateGroups = fd->IsChecked(0); toCreateGroups = fd->IsChecked(0);
toFindOutDim = fd->IsChecked(1); toFindOutDim = fd->IsChecked(1);
saveNumbers = fd->IsChecked(2);
zTol = zTolCheck->isChecked() ? zTolSpin->value() : -1; zTol = zTolCheck->isChecked() ? zTolSpin->value() : -1;
fieldSelWdg->GetSelectedFields(); fieldSelWdg->GetSelectedFields();
if ( resMgr ) resMgr->setValue( "SMESH", "enable_ztolerance", zTolCheck->isChecked() ); if ( resMgr ) resMgr->setValue( "SMESH", "enable_ztolerance", zTolCheck->isChecked() );
@ -927,7 +932,6 @@ namespace
// } // }
if ( isMED && isOkToWrite ) if ( isMED && isOkToWrite )
{ {
const bool saveNumbers = resMgr->booleanValue( "SMESH", "med_save_numbers", true );
aMeshIter = aMeshList.begin(); aMeshIter = aMeshList.begin();
for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ ) for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
{ {

View File

@ -264,13 +264,15 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments); myPreviewCheckBox = new QCheckBox(tr("PREVIEW"), GroupArguments);
// layouting // layouting
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 2); GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 3, 2);
GroupArgumentsLayout->addWidget(PathGrp, 1, 0, 1, 2); GroupArgumentsLayout->addWidget(PathGrp, 0, 2, 1, 2);
GroupArgumentsLayout->addWidget(BasePointGrp, 2, 0, 1, 2); GroupArgumentsLayout->addWidget(BasePointGrp, 1, 2, 1, 2);
GroupArgumentsLayout->addWidget(AnglesGrp, 3, 0); GroupArgumentsLayout->addWidget(AnglesGrp, 2, 2);
GroupArgumentsLayout->addWidget(ScalesGrp, 3, 1); GroupArgumentsLayout->addWidget(ScalesGrp, 2, 3);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0); GroupArgumentsLayout->addWidget(myPreviewCheckBox, 3, 0);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0); GroupArgumentsLayout->addWidget(MakeGroupsCheck, 3, 1);
SelectorWdg->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
SelectorWdg->setMinimumWidth(320);
/***************************************************************/ /***************************************************************/
// common buttons group box // common buttons group box

View File

@ -766,38 +766,53 @@ SMESHGUI_ExtrusionDlg::SMESHGUI_ExtrusionDlg (SMESHGUI* theModule)
AnglesGrpLayout->setRowMinimumHeight(1, 10); AnglesGrpLayout->setRowMinimumHeight(1, 10);
AnglesGrpLayout->setRowStretch(3, 10); AnglesGrpLayout->setRowStretch(3, 10);
// Controls for advanced parameters
QGridLayout* AdvancedGrpLayout = new QGridLayout();
AdvancedGrpLayout->setSpacing(SPACING);
// layouting // layouting
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 9); AdvancedGrpLayout->addWidget(TextLabelDistance, 0, 0);
GroupArgumentsLayout->addWidget(ExtrMethod_RBut0, 1, 0, 1, 3); AdvancedGrpLayout->addWidget(TextLabelDx, 0, 2);
GroupArgumentsLayout->addWidget(ExtrMethod_RBut1, 1, 3, 1, 3); AdvancedGrpLayout->addWidget(SpinBox_Dx, 0, 3);
GroupArgumentsLayout->addWidget(ExtrMethod_RBut2, 1, 6, 1, 3); AdvancedGrpLayout->addWidget(TextLabelDy, 0, 4);
GroupArgumentsLayout->addWidget(TextLabelDistance, 2, 0); AdvancedGrpLayout->addWidget(SpinBox_Dy, 0, 5);
GroupArgumentsLayout->addWidget(TextLabelDx, 2, 2); AdvancedGrpLayout->addWidget(TextLabelDz, 0, 6);
GroupArgumentsLayout->addWidget(SpinBox_Dx, 2, 3); AdvancedGrpLayout->addWidget(SpinBox_Dz, 0, 7);
GroupArgumentsLayout->addWidget(TextLabelDy, 2, 4); AdvancedGrpLayout->addWidget(TextLabelVector, 1, 0);
GroupArgumentsLayout->addWidget(SpinBox_Dy, 2, 5); AdvancedGrpLayout->addWidget(SelectVectorButton, 1, 1);
GroupArgumentsLayout->addWidget(TextLabelDz, 2, 6); AdvancedGrpLayout->addWidget(TextLabelVx, 1, 2);
GroupArgumentsLayout->addWidget(SpinBox_Dz, 2, 7); AdvancedGrpLayout->addWidget(SpinBox_Vx, 1, 3);
GroupArgumentsLayout->addWidget(TextLabelVector, 3, 0); AdvancedGrpLayout->addWidget(TextLabelVy, 1, 4);
GroupArgumentsLayout->addWidget(SelectVectorButton, 3, 1); AdvancedGrpLayout->addWidget(SpinBox_Vy, 1, 5);
GroupArgumentsLayout->addWidget(TextLabelVx, 3, 2); AdvancedGrpLayout->addWidget(TextLabelVz, 1, 6);
GroupArgumentsLayout->addWidget(SpinBox_Vx, 3, 3); AdvancedGrpLayout->addWidget(SpinBox_Vz, 1, 7);
GroupArgumentsLayout->addWidget(TextLabelVy, 3, 4); AdvancedGrpLayout->addWidget(TextLabelDist, 2, 0);
GroupArgumentsLayout->addWidget(SpinBox_Vy, 3, 5); AdvancedGrpLayout->addWidget(SpinBox_VDist, 2, 3);
GroupArgumentsLayout->addWidget(TextLabelVz, 3, 6); AdvancedGrpLayout->addWidget(TextLabelNbSteps, 3, 0, 1, 3);
GroupArgumentsLayout->addWidget(SpinBox_Vz, 3, 7); AdvancedGrpLayout->addWidget(SpinBox_NbSteps, 3, 3);
GroupArgumentsLayout->addWidget(TextLabelDist, 4, 0); AdvancedGrpLayout->addWidget(ByAverageNormalCheck, 4, 0, 1, 4);
GroupArgumentsLayout->addWidget(SpinBox_VDist, 4, 3); AdvancedGrpLayout->addWidget(UseInputElemsOnlyCheck, 4, 4, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelNbSteps, 5, 0, 1, 3);
GroupArgumentsLayout->addWidget(SpinBox_NbSteps, 5, 3); // Controls for advanced parameters
GroupArgumentsLayout->addWidget(ByAverageNormalCheck, 6, 0, 1, 4); QGroupBox* RbGrp = new QGroupBox();
GroupArgumentsLayout->addWidget(UseInputElemsOnlyCheck, 6, 4, 1, 4); QHBoxLayout* RBLayout = new QHBoxLayout(RbGrp);
GroupArgumentsLayout->addWidget(BasePointGrp, 7, 0, 1, 9); RBLayout->setSpacing(SPACING); RBLayout->setMargin(MARGIN);
GroupArgumentsLayout->addWidget(ScalesGrp, 8, 0, 1, 4); RBLayout->addWidget(ExtrMethod_RBut0);
GroupArgumentsLayout->addWidget(AnglesGrp, 8, 5, 1, 4); RBLayout->addWidget(ExtrMethod_RBut1);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 9, 0, 1, 8); RBLayout->addWidget(ExtrMethod_RBut2);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 10,0, 1, 8);
GroupArgumentsLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding), 10, 0); // layouting
GroupArgumentsLayout->addWidget(RbGrp, 0, 0, 1, 4);
GroupArgumentsLayout->addWidget(SelectorWdg, 1, 0, 3, 2);
GroupArgumentsLayout->addLayout(AdvancedGrpLayout, 1, 2, 1, 2);
GroupArgumentsLayout->addWidget(BasePointGrp, 2, 2, 1, 2);
GroupArgumentsLayout->addWidget(ScalesGrp, 3, 2, 1, 1);
GroupArgumentsLayout->addWidget(AnglesGrp, 3, 3, 1, 1);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 4, 1);
GroupArgumentsLayout->setRowStretch(5, 10);
SelectorWdg->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
SelectorWdg->setMinimumWidth(320);
/***************************************************************/ /***************************************************************/
GroupButtons = new QGroupBox(this); GroupButtons = new QGroupBox(this);

View File

@ -42,6 +42,11 @@
#include <QString> #include <QString>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopoDS_Iterator.hxx>
namespace SMESH namespace SMESH
{ {
GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go ) GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go )
@ -244,4 +249,80 @@ namespace SMESH
} }
//================================================================================
/*!
* \brief Return type of shape contained in a group
*/
//================================================================================
TopAbs_ShapeEnum _getGroupType(const TopoDS_Shape& group)
{
if ( group.ShapeType() != TopAbs_COMPOUND )
return group.ShapeType();
// iterate on a compound
TopoDS_Iterator it( group );
if ( it.More() )
return _getGroupType( it.Value() );
return TopAbs_SHAPE;
}
//================================================================================
/*!
* \brief Check if a subGeom contains sub-shapes of a mainGeom
*/
//================================================================================
bool ContainsSubShape( GEOM::GEOM_Object_ptr mainGeom,
GEOM::GEOM_Object_ptr subGeom )
{
if ( CORBA::is_nil( mainGeom ) ||
CORBA::is_nil( subGeom ))
return false;
GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
if ( geomGen->_is_nil() ) return false;
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
if ( op->_is_nil() ) return false;
GEOM::GEOM_Object_var mainObj = op->GetMainShape( subGeom ); /* _var not _wrap as
mainObj already exists! */
while ( !mainObj->_is_nil() )
{
CORBA::String_var entry1 = mainObj->GetEntry();
CORBA::String_var entry2 = mainGeom->GetEntry();
if ( std::string( entry1.in() ) == entry2.in() )
return true;
mainObj = op->GetMainShape( mainObj );
}
if ( subGeom->GetShapeType() == GEOM::COMPOUND )
{
// is subGeom a compound of sub-shapes?
GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations();
if ( sop->_is_nil() ) return false;
GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( subGeom,
GEOM::SHAPE,/*sorted=*/false);
if ( ids->length() > 0 )
{
GEOM_Client geomClient;
TopoDS_Shape subShape = geomClient.GetShape( geomGen, subGeom );
TopoDS_Shape mainShape = geomClient.GetShape( geomGen, mainGeom );
if ( subShape.IsNull() || mainShape.IsNull() )
return false;
TopAbs_ShapeEnum subType = _getGroupType( subShape );
TopTools_IndexedMapOfShape subMap;
TopExp::MapShapes( subShape, subType, subMap );
for ( TopExp_Explorer exp( mainShape, subType ); exp.More(); exp.Next() )
if ( subMap.Contains( exp.Current() ))
return true;
}
}
return false;
}
} // end of namespace SMESH } // end of namespace SMESH

View File

@ -59,6 +59,9 @@ namespace SMESH
SMESHGUI_EXPORT bool GetGeomEntries( Handle(SALOME_InteractiveObject)& hypIO, SMESHGUI_EXPORT bool GetGeomEntries( Handle(SALOME_InteractiveObject)& hypIO,
QString& subGeom, QString& meshGeom); QString& subGeom, QString& meshGeom);
SMESHGUI_EXPORT bool ContainsSubShape( GEOM::GEOM_Object_ptr mainShape,
GEOM::GEOM_Object_ptr subShape );
} }
#endif // SMESHGUI_GEOMGENUTILS_H #endif // SMESHGUI_GEOMGENUTILS_H

View File

@ -1405,72 +1405,23 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
else if (myCurrentLineEdit == myGeomGroupLine) else if (myCurrentLineEdit == myGeomGroupLine)
{ {
myGeomObjects = new GEOM::ListOfGO(); myGeomObjects = new GEOM::ListOfGO();
myGeomObjects->length( aNbSel );
// The mesh SObject if ( aNbSel == 0 || myMesh->_is_nil() )
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
if (aNbSel == 0 || !aMeshSO)
{ {
myGeomObjects->length(0);
updateButtons(); updateButtons();
myIsBusy = false; myIsBusy = false;
return; return;
} }
myGeomObjects->length(aNbSel); GEOM::GEOM_Object_var mainGeom = myMesh->GetShapeToMesh();
GEOM::GEOM_Object_var aGeomGroup;
int i = 0; int i = 0;
for ( SALOME_ListIteratorOfListIO anIt( aList ); anIt.More(); anIt.Next() )
SALOME_ListIteratorOfListIO anIt (aList);
for (; anIt.More(); anIt.Next())
{ {
CORBA::Object_var aGroupObj = SMESH::IObjectToObject(anIt.Value());
if (CORBA::is_nil(aGroupObj))
continue;
// Check if the object is a geometry group
aGeomGroup = GEOM::GEOM_Object::_narrow(aGroupObj);
if (CORBA::is_nil(aGeomGroup))
continue;
// Check if group constructed on the same shape as a mesh or on its child // Check if group constructed on the same shape as a mesh or on its child
GEOM::GEOM_Object_var geomGroup = SMESH::GetGeom( anIt.Value() );
// The main shape of the group if ( SMESH::ContainsSubShape( mainGeom, geomGroup ))
GEOM::GEOM_Object_var aGroupMainShape; myGeomObjects[ i++ ] = geomGroup;
if (aGeomGroup->GetType() == 37)
{
GEOM::GEOM_IGroupOperations_wrap anOp =
SMESH::GetGEOMGen( aGeomGroup )->GetIGroupOperations();
aGroupMainShape = anOp->GetMainShape( aGeomGroup );
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
}
else
{
aGroupMainShape = aGeomGroup;
aGroupMainShape->Register();
}
CORBA::String_var entry = aGroupMainShape->GetStudyEntry();
_PTR(SObject) aGroupMainShapeSO =
SMESH::getStudy()->FindObjectID( entry.in() );
_PTR(SObject) anObj, aRef;
bool isRefOrSubShape = false;
if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
isRefOrSubShape = true;
} else {
_PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
_PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
if (aRef->GetID() == aFather->GetID())
isRefOrSubShape = true;
else
aFather = aFather->GetFather();
}
}
}
if (isRefOrSubShape)
myGeomObjects[i++] = aGeomGroup;
} }
myGeomObjects->length(i); myGeomObjects->length(i);

View File

@ -178,7 +178,7 @@ private:
QPushButton* myAddBtn; QPushButton* myAddBtn;
QPushButton* myRemoveBtn; QPushButton* myRemoveBtn;
QPushButton* mySortBtn; QPushButton* mySortBtn;
QGroupBox* mySelectBox; QGroupBox* mySelectBox;
QCheckBox* mySelectSubMesh; QCheckBox* mySelectSubMesh;
QPushButton* mySubMeshBtn; QPushButton* mySubMeshBtn;
@ -186,9 +186,9 @@ private:
QCheckBox* mySelectGroup; QCheckBox* mySelectGroup;
QPushButton* myGroupBtn; QPushButton* myGroupBtn;
QLineEdit* myGroupLine; QLineEdit* myGroupLine;
QtxColorButton* myColorBtn; QtxColorButton* myColorBtn;
QCheckBox* mySelectGeomGroup; QCheckBox* mySelectGeomGroup;
QToolButton* myGeomGroupBtn; QToolButton* myGeomGroupBtn;
QLineEdit* myGeomGroupLine; QLineEdit* myGeomGroupLine;
@ -198,9 +198,9 @@ private:
QPushButton* myApplyBtn; QPushButton* myApplyBtn;
QPushButton* myCloseBtn; QPushButton* myCloseBtn;
QPushButton* myHelpBtn; QPushButton* myHelpBtn;
SMESHGUI_ShapeByMeshOp* myShapeByMeshOp; SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_Mesh_var myMesh;
QList<SMESH_Actor*> myActorsList; QList<SMESH_Actor*> myActorsList;
SMESH::SMESH_Group_var myGroup; SMESH::SMESH_Group_var myGroup;
@ -209,22 +209,19 @@ private:
SMESH::Filter_var myFilter; SMESH::Filter_var myFilter;
QList<int> myIdList; QList<int> myIdList;
GEOM::ListOfGO_var myGeomObjects; GEOM::ListOfGO_var myGeomObjects;
int mySelectionMode; int mySelectionMode;
//Handle(SMESH_TypeFilter) myMeshFilter;
//Handle(SMESH_TypeFilter) mySubMeshFilter;
//Handle(SMESH_TypeFilter) myGroupFilter;
SUIT_SelectionFilter* myMeshFilter; SUIT_SelectionFilter* myMeshFilter;
SMESH_LogicalFilter* mySubMeshFilter; SMESH_LogicalFilter* mySubMeshFilter;
SMESH_LogicalFilter* myGroupFilter; SMESH_LogicalFilter* myGroupFilter;
SUIT_SelectionFilter* myGeomFilter; SUIT_SelectionFilter* myGeomFilter;
SMESHGUI_FilterDlg* myFilterDlg; SMESHGUI_FilterDlg* myFilterDlg;
bool myCreate, myIsBusy; bool myCreate, myIsBusy;
QString myHelpFileName; QString myHelpFileName;
QMap<QAction*, int> myActions; QMap<QAction*, int> myActions;
bool myNameChanged; //added by skl for IPAL19574 bool myNameChanged; //added by skl for IPAL19574

View File

@ -463,29 +463,23 @@ void SMESHGUI_GroupOnShapeOp::selectionDone()
// study // study
if (_PTR(Study) aStudy = SMESH::getStudy()) { if (_PTR(Study) aStudy = SMESH::getStudy()) {
// mesh // mesh
if (_PTR(SObject) meshSO = aStudy->FindObjectID( myMeshID.toUtf8().data() )) { if (_PTR(SObject) meshSO = aStudy->FindObjectID( myMeshID.toUtf8().data() ))
{
// shape to mesh // shape to mesh
_PTR(SObject) anObj, shapeToMesh; GEOM::GEOM_Object_var mainGeom = SMESH::GetGeom( meshSO );
if (meshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(shapeToMesh)) { // loop on selected
// loop on selected QStringList::iterator name = names.begin(), id = ids.begin(), idEnd = ids.end();
QStringList::iterator name = names.begin(), id = ids.begin(), idEnd = ids.end(); for (; id != idEnd; ++id, ++name )
for (; id != idEnd; ++id, ++name ) { {
// shape SO if ( goodIds.contains( *id ))
if (_PTR(SObject) shapeSO = aStudy->FindObjectID( id->toUtf8().data() )) { continue;
// check if shape SO is a child of shape to mesh // shape SO
while ( shapeSO && shapeSO->GetID() != shapeToMesh->GetID() ) _PTR(SObject) shapeSO = aStudy->FindObjectID( id->toUtf8().data() );
if ( shapeSO->Depth() < 2 ) GEOM::GEOM_Object_var subGeom = SMESH::GetGeom( shapeSO );
shapeSO.reset(); if ( SMESH::ContainsSubShape( mainGeom, subGeom ))
else {
shapeSO = shapeSO->GetFather(); goodIds.append( *id );
if ( shapeSO ) { goodNames.append( *name );
//printf( "selectionDone() %s %s\n", (*id).latin1(), (*name).latin1() );
if ( !goodIds.contains( *id )) {
goodIds.append( *id );
goodNames.append( *name );
}
}
}
} }
} }
} }

View File

@ -58,27 +58,15 @@ protected:
virtual void startOperation(); virtual void startOperation();
virtual void selectionDone(); virtual void selectionDone();
virtual SUIT_SelectionFilter* createFilter( const int ) const; virtual SUIT_SelectionFilter* createFilter( const int ) const;
//virtual bool isValid( SUIT_Operation* ) const;
private slots: private slots:
bool onApply(); bool onApply();
void onButtonClick(); void onButtonClick();
// void onSelectColor();
private: private:
void init(); void init();
// void setGroupColor( const SALOMEDS::Color& );
// SALOMEDS::Color getGroupColor() const;
// void setGroupQColor( const QColor& );
// QColor getGroupQColor() const;
// void setDefaultGroupColor();
private: private:
@ -86,7 +74,6 @@ private:
QString myMeshID; QString myMeshID;
QStringList myElemGeoIDs, myNodeGeoIDs; QStringList myElemGeoIDs, myNodeGeoIDs;
//GEOM::ListOfGO_var myElemGObj;
}; };
class SMESHGUI_EXPORT SMESHGUI_GroupOnShapeDlg : public SMESHGUI_Dialog class SMESHGUI_EXPORT SMESHGUI_GroupOnShapeDlg : public SMESHGUI_Dialog
@ -104,22 +91,14 @@ public slots:
private: private:
//QLineEdit* myGrpNameLine;
QPushButton* myMeshBtn; QPushButton* myMeshBtn;
QLineEdit* myMeshLine; QLineEdit* myMeshLine;
QPushButton* myElemGeomBtn; QPushButton* myElemGeomBtn;
QListWidget* myElemGeomList; QListWidget* myElemGeomList;
QPushButton* myNodeGeomBtn; QPushButton* myNodeGeomBtn;
QListWidget* myNodeGeomList; QListWidget* myNodeGeomList;
// QPushButton* myColorBtn;
// bool myCreate, myIsBusy;
// QString myHelpFileName;
friend class SMESHGUI_GroupOnShapeOp; friend class SMESHGUI_GroupOnShapeOp;
}; };

View File

@ -3432,6 +3432,9 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent ): SMESHGUI_Info( parent )
QIcon aComputeIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "SMESH", tr( "ICON_COMPUTE" ) ) ); QIcon aComputeIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "SMESH", tr( "ICON_COMPUTE" ) ) );
SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager(); SMESH::FilterManager_var aFilterMgr = SMESH::GetFilterManager();
// QToolBox with MeshInfo
myMeshTB = new QToolBox(this);
// name // name
QLabel* aNameLab = createLabel( tr( "NAME_LAB" ), this, Bold ); QLabel* aNameLab = createLabel( tr( "NAME_LAB" ), this, Bold );
QLabel* aName = createField( this, "ctrlName" ); QLabel* aName = createField( this, "ctrlName" );
@ -3547,50 +3550,82 @@ SMESHGUI_CtrlInfo::SMESHGUI_CtrlInfo( QWidget* parent ): SMESHGUI_Info( parent )
connect( aOverContVolumesBtn,SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ) ); connect( aOverContVolumesBtn,SIGNAL( clicked() ), this, SLOT( computeOverConstrainedVolumesInfo() ) );
connect( myToleranceWidget, SIGNAL( valueChanged( double ) ), this, SLOT( setTolerance( double ) ) ); connect( myToleranceWidget, SIGNAL( valueChanged( double ) ), this, SLOT( setTolerance( double ) ) );
l->addWidget( aNameLab, 0, 0 ); //0 l->addWidget( aNameLab, 0, 0 ); //0
l->addWidget( aName, 0, 1, 1, 2 ); //1 l->addWidget( aName, 0, 1 ); //1
l->addWidget( aNodesLab, 1, 0, 1, 3 ); //2
l->addWidget( aNodesFreeLab, 2, 0 ); //3 // Node group
l->addWidget( aNodesFree, 2, 1 ); //4 QWidget* NodeGrp = new QWidget();
l->addWidget( aFreeNodesBtn, 2, 2 ); //5 QGridLayout* NodeLayout = new QGridLayout(NodeGrp);
l->addWidget( aNodesNbConnLab, 3, 0 ); //6 NodeLayout->setSpacing(SPACING); NodeLayout->setMargin(MARGIN);
l->addWidget( aNodesNbConn, 3, 1 ); //7
l->addWidget( aNodesNbConnBtn, 3, 2 ); //8 NodeLayout->addWidget( aNodesFreeLab, 0, 0 );
l->addWidget( aNodesDoubleLab, 4, 0 ); //9 NodeLayout->addWidget( aNodesFree, 0, 1 );
l->addWidget( aNodesDouble, 4, 1 ); //10 NodeLayout->addWidget( aFreeNodesBtn, 0, 2 );
l->addWidget( aDoubleNodesBtn, 4, 2 ); //11 NodeLayout->addWidget( aNodesNbConnLab, 1, 0 );
l->addWidget( aToleranceLab, 5, 0 ); //12 NodeLayout->addWidget( aNodesNbConn, 1, 1 );
l->addWidget( myToleranceWidget, 5, 1 ); //13 NodeLayout->addWidget( aNodesNbConnBtn, 1, 2 );
l->addWidget( anEdgesLab, 6, 0, 1, 3 ); //14 NodeLayout->addWidget( aNodesDoubleLab, 2, 0 );
l->addWidget( anEdgesDoubleLab, 7, 0 ); //15 NodeLayout->addWidget( aNodesDouble, 2, 1 );
l->addWidget( anEdgesDouble, 7, 1 ); //16 NodeLayout->addWidget( aDoubleNodesBtn, 2, 2 );
l->addWidget( aDoubleEdgesBtn, 7, 2 ); //17 NodeLayout->addWidget( aToleranceLab, 3, 0 );
l->addWidget( aFacesLab, 8, 0, 1, 3 ); //18 NodeLayout->addWidget( myToleranceWidget, 3, 1 );
l->addWidget( aFacesDoubleLab, 9, 0 ); //19 NodeLayout->addWidget( myToleranceWidget, 3, 1 );
l->addWidget( aFacesDouble, 9, 1 ); //20 NodeLayout->setRowStretch(4, 5);
l->addWidget( aDoubleFacesBtn, 9, 2 ); //21
l->addWidget( aFacesOverLab, 10, 0 ); //22 myMeshTB->addItem(NodeGrp, aNodesLab->text());
l->addWidget( aFacesOver, 10, 1 ); //23 aNodesLab->setVisible(false);
l->addWidget( aOverContFacesBtn, 10, 2 ); //24
l->addWidget( anAspectRatioLab, 11, 0 ); //25 // Edge group
l->addWidget( aComputeFaceBtn, 11, 2 ); //26 QWidget* EdgeGrp = new QWidget();
l->addWidget( myPlot, 12, 0, 1, 3 );//27 QGridLayout* EdgeLayout = new QGridLayout(EdgeGrp);
l->addWidget( aVolumesLab, 13, 0, 1, 3 );//28 EdgeLayout->setSpacing(SPACING); EdgeLayout->setMargin(MARGIN);
l->addWidget( aVolumesDoubleLab, 14, 0 ); //29
l->addWidget( aVolumesDouble, 14, 1 ); //30 EdgeLayout->addWidget( anEdgesDoubleLab, 0, 0 );
l->addWidget( aDoubleVolumesBtn, 14, 2 ); //31 EdgeLayout->addWidget( anEdgesDouble, 0, 1 );
l->addWidget( aVolumesOverLab, 15, 0 ); //32 EdgeLayout->addWidget( aDoubleEdgesBtn, 0, 2 );
l->addWidget( aVolumesOver, 15, 1 ); //33 EdgeLayout->setRowStretch(1, 5);
l->addWidget( aOverContVolumesBtn,15, 2 ); //34
l->addWidget( anAspectRatio3DLab, 16, 0 ); //35 myMeshTB->addItem(EdgeGrp, anEdgesLab->text());
l->addWidget( aComputeVolumeBtn, 16, 2 ); //36 anEdgesLab->setVisible(false);
l->addWidget( myPlot3D, 17, 0, 1, 3 );//37
// Face group
l->setColumnStretch( 0, 0 ); QWidget* FaceGrp = new QWidget();
l->setColumnStretch( 1, 5 ); QGridLayout* FaceLayout = new QGridLayout(FaceGrp);
l->setRowStretch ( 12, 5 ); FaceLayout->setSpacing(SPACING); FaceLayout->setMargin(MARGIN);
l->setRowStretch ( 17, 5 );
l->setRowStretch ( 18, 1 ); FaceLayout->addWidget( aFacesDoubleLab, 0, 0 );
FaceLayout->addWidget( aFacesDouble, 0, 1 );
FaceLayout->addWidget( aDoubleFacesBtn, 0, 2 );
FaceLayout->addWidget( aFacesOverLab, 1, 0 );
FaceLayout->addWidget( aFacesOver, 1, 1 );
FaceLayout->addWidget( aOverContFacesBtn, 1, 2 );
FaceLayout->addWidget( anAspectRatioLab, 2, 0 );
FaceLayout->addWidget( aComputeFaceBtn, 2, 2 );
FaceLayout->addWidget( myPlot, 3, 0, 1, 3 );
myMeshTB->addItem(FaceGrp, aFacesLab->text());
aFacesLab->setVisible(false);
// Volume group
QWidget* VolumeGrp = new QWidget();
QGridLayout* VolumeLayout = new QGridLayout(VolumeGrp);
VolumeLayout->setSpacing(SPACING); VolumeLayout->setMargin(MARGIN);
VolumeLayout->addWidget( aVolumesDoubleLab, 0, 0 );
VolumeLayout->addWidget( aVolumesDouble, 0, 1 );
VolumeLayout->addWidget( aDoubleVolumesBtn, 0, 2 );
VolumeLayout->addWidget( aVolumesOverLab, 1, 0 );
VolumeLayout->addWidget( aVolumesOver, 1, 1 );
VolumeLayout->addWidget( aOverContVolumesBtn,1, 2 );
VolumeLayout->addWidget( anAspectRatio3DLab, 2, 0 );
VolumeLayout->addWidget( aComputeVolumeBtn, 2, 2 );
VolumeLayout->addWidget( myPlot3D, 3, 0, 1, 3 );
myMeshTB->addItem(VolumeGrp, aVolumesLab->text());
aVolumesLab->setVisible(false);
l->addWidget( myMeshTB, 1, 0, 1, 2 ); //2
l->setRowStretch( 2, 5 );
clearInternal(); clearInternal();
} }
@ -3673,8 +3708,8 @@ void SMESHGUI_CtrlInfo::showInfo( const SMESH::SelectionProxy& proxy )
} }
} }
else { else {
for( int i=2; i<=13; i++) myMeshTB->setItemEnabled(0, false );
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( false ); myMeshTB->widget(0)->setVisible( false );
} }
// edges info // edges info
@ -3686,8 +3721,8 @@ void SMESHGUI_CtrlInfo::showInfo( const SMESH::SelectionProxy& proxy )
myButtons[3]->setEnabled( true ); myButtons[3]->setEnabled( true );
} }
else { else {
for( int i=14; i<=17; i++) myMeshTB->setItemEnabled(1, false );
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( false ); myMeshTB->widget(1)->setVisible( false );
} }
// faces info // faces info
@ -3705,14 +3740,10 @@ void SMESHGUI_CtrlInfo::showInfo( const SMESH::SelectionProxy& proxy )
myButtons[5]->setEnabled( true ); myButtons[5]->setEnabled( true );
myButtons[6]->setEnabled( true ); myButtons[6]->setEnabled( true );
} }
#ifdef DISABLE_PLOT2DVIEWER
for( int i=25; i<=27; i++)
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( false );
#endif
} }
else { else {
for( int i=18; i<=27; i++) myMeshTB->setItemEnabled(2, false );
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( false ); myMeshTB->widget(2)->setVisible( false );
} }
// volumes info // volumes info
@ -3730,15 +3761,15 @@ void SMESHGUI_CtrlInfo::showInfo( const SMESH::SelectionProxy& proxy )
myButtons[8]->setEnabled( true ); myButtons[8]->setEnabled( true );
myButtons[9]->setEnabled( true ); myButtons[9]->setEnabled( true );
} }
#ifdef DISABLE_PLOT2DVIEWER
for( int i=35; i<=37; i++)
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( false );
#endif
} }
else { else {
for( int i=28; i<=37; i++) myMeshTB->setItemEnabled(3, false );
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( false ); myMeshTB->widget(3)->setVisible( false );
} }
myMeshTB->setCurrentIndex(0);
myMeshTB->setVisible( (nbNodes + nbElemsByType[ SMESH::EDGE ] +
nbElemsByType[ SMESH::FACE ] +
nbElemsByType[ SMESH::VOLUME ]) > 0 );
} }
//================================================================================ //================================================================================
@ -3892,8 +3923,10 @@ void SMESHGUI_CtrlInfo::computeAspectRatio3D()
*/ */
void SMESHGUI_CtrlInfo::clearInternal() void SMESHGUI_CtrlInfo::clearInternal()
{ {
for( int i=0; i<=37; i++) for (int i=0; i<=3;i++) {
dynamic_cast<QGridLayout*>(layout())->itemAt(i)->widget()->setVisible( true ); myMeshTB->setItemEnabled(i, true );
myMeshTB->widget(i)->setVisible( true );
}
for( int i=0; i<=9; i++) for( int i=0; i<=9; i++)
myButtons[i]->setEnabled( false ); myButtons[i]->setEnabled( false );
myPlot->detachItems(); myPlot->detachItems();

View File

@ -36,6 +36,7 @@
#include <QList> #include <QList>
#include <QMap> #include <QMap>
#include <QSet> #include <QSet>
#include <QToolBox>
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Filter) #include CORBA_SERVER_HEADER(SMESH_Filter)
@ -345,6 +346,7 @@ private:
ObjectType myObjectType; ObjectType myObjectType;
SMESHGUI_SpinBox* myToleranceWidget; SMESHGUI_SpinBox* myToleranceWidget;
QList<QLabel*> myWidgets; QList<QLabel*> myWidgets;
QToolBox* myMeshTB;
QwtPlot* myPlot; QwtPlot* myPlot;
QwtPlot* myPlot3D; QwtPlot* myPlot3D;
QList<QAbstractButton*> myButtons; QList<QAbstractButton*> myButtons;

View File

@ -319,25 +319,6 @@ SUIT_SelectionFilter* SMESHGUI_MeshOp::createFilter( const int theId ) const
return 0; return 0;
} }
//================================================================================
/*!
* \brief Return type of shape contained in a group
*/
//================================================================================
TopAbs_ShapeEnum getGroupType(const TopoDS_Shape& group)
{
if ( group.ShapeType() != TopAbs_COMPOUND )
return group.ShapeType();
// iterate on a compound
TopoDS_Iterator it( group );
if ( it.More() )
return getGroupType( it.Value() );
return TopAbs_SHAPE;
}
//================================================================================ //================================================================================
/*! /*!
* \brief check if selected shape is a sub-shape of the shape to mesh * \brief check if selected shape is a sub-shape of the shape to mesh
@ -365,60 +346,17 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
QStringList aGEOMs; QStringList aGEOMs;
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs); myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
if (aGEOMs.count() > 0) { // check all selected shapes
GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen(); for ( QString& aSubGeomEntry : aGEOMs )
if (geomGen->_is_nil()) return false; {
_PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID( aSubGeomEntry.toUtf8().data() );
if ( !pSubGeom ) return false;
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); GEOM::GEOM_Object_var subGeom =
if (op->_is_nil()) return false; GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
// check all selected shapes if ( SMESH::ContainsSubShape( mainGeom, subGeom ))
QStringList::const_iterator aSubShapesIter = aGEOMs.begin(); return true;
for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++)
{
QString aSubGeomEntry = (*aSubShapesIter);
_PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toUtf8().data());
if (!pSubGeom) return false;
GEOM::GEOM_Object_var aSubGeomVar =
GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
if (aSubGeomVar->_is_nil()) return false;
// skl for NPAL14695 - implementation of searching of mainObj
GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
mainObj already exists! */
while( !mainObj->_is_nil())
{
CORBA::String_var entry1 = mainObj->GetEntry();
CORBA::String_var entry2 = mainGeom->GetEntry();
if (std::string( entry1.in() ) == entry2.in() )
return true;
mainObj = op->GetMainShape(mainObj);
}
if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND )
{
// is aSubGeomVar a compound of sub-shapes?
GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations();
if (sop->_is_nil()) return false;
GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar,
GEOM::SHAPE,/*sorted=*/false);
if ( ids->length() > 0 )
{
GEOM_Client geomClient;
TopoDS_Shape subShape = geomClient.GetShape( geomGen, aSubGeomVar );
TopoDS_Shape mainShape = geomClient.GetShape( geomGen, mainGeom );
if ( subShape.IsNull() || mainShape.IsNull() )
return false;
TopAbs_ShapeEnum subType = getGroupType( subShape );
TopTools_IndexedMapOfShape subMap;
TopExp::MapShapes( subShape, subType, subMap );
for ( TopExp_Explorer exp( mainShape, subType ); exp.More(); exp.Next() )
if ( subMap.Contains( exp.Current() ))
return true;
}
}
}
} }
return false; return false;

View File

@ -202,13 +202,15 @@ SMESHGUI_RevolutionDlg::SMESHGUI_RevolutionDlg( SMESHGUI* theModule )
MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments); MakeGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
MakeGroupsCheck->setChecked(true); MakeGroupsCheck->setChecked(true);
GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 1, 4); GroupArgumentsLayout->addWidget(SelectorWdg, 0, 0, 3, 4);
GroupArgumentsLayout->addWidget(GroupAxis, 1, 0, 1, 4); GroupArgumentsLayout->addWidget(GroupAxis, 0, 4, 1, 4);
GroupArgumentsLayout->addWidget(GroupAngleBox, 2, 0, 1, 4); GroupArgumentsLayout->addWidget(GroupAngleBox, 1, 4, 1, 4);
GroupArgumentsLayout->addWidget(TextLabelTolerance, 3, 0, 1, 2); GroupArgumentsLayout->addWidget(TextLabelTolerance, 2, 4, 1, 2);
GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 3, 2, 1, 2); GroupArgumentsLayout->addWidget(SpinBox_Tolerance, 2, 6, 1, 2);
GroupArgumentsLayout->addWidget(myPreviewCheckBox, 4, 0, 1, 4); GroupArgumentsLayout->addWidget(myPreviewCheckBox, 3, 0, 1, 2);
GroupArgumentsLayout->addWidget(MakeGroupsCheck, 5, 0, 1, 4); GroupArgumentsLayout->addWidget(MakeGroupsCheck, 3, 2, 1, 2);
SelectorWdg->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
SelectorWdg->setMinimumWidth(320);
SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton ); SelectorWdg->GetButtonGroup()->addButton( SelectVectorButton );
SelectorWdg->GetButtonGroup()->addButton( SelectPointButton ); SelectorWdg->GetButtonGroup()->addButton( SelectPointButton );

View File

@ -1614,6 +1614,10 @@ Please enter correct values and try again</translation>
<source>SMESH_AUTO_DIM</source> <source>SMESH_AUTO_DIM</source>
<translation>Automatically define space dimension</translation> <translation>Automatically define space dimension</translation>
</message> </message>
<message>
<source>SMESH_MED_SAVE_NUMS</source>
<translation>Export indices</translation>
</message>
<message> <message>
<source>SMESH_ZTOLERANCE</source> <source>SMESH_ZTOLERANCE</source>
<translation>Z tolerance</translation> <translation>Z tolerance</translation>

View File

@ -535,7 +535,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishInStudy(SALOMEDS::SObject_ptr /*theSOb
//======================================================================= //=======================================================================
//function : PublishComponent //function : PublishComponent
//purpose : //purpose :
//======================================================================= //=======================================================================
SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent() SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
@ -547,7 +547,7 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = getStudyServant()->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = getStudyServant()->GetUseCaseBuilder();
std::string compDataType = ComponentDataType(); // SMESH module's data type CORBA::String_var compDataType = ComponentDataType(); // SMESH module's data type
std::string ior; std::string ior;
{ {
CORBA::String_var iorString = GetORB()->object_to_string( SMESH_Gen::_this() ); CORBA::String_var iorString = GetORB()->object_to_string( SMESH_Gen::_this() );
@ -562,12 +562,13 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
CORBA::String_var ior_i; CORBA::String_var ior_i;
bool ok = f_i->ComponentIOR(ior_i.out()); bool ok = f_i->ComponentIOR(ior_i.out());
CORBA::String_var cdt(f_i->ComponentDataType()); CORBA::String_var cdt(f_i->ComponentDataType());
if ( ok && compDataType == cdt.in() && ior == ior_i.in()) { if ( ok && strcmp( compDataType.in(), cdt.in() ) == 0 && ior == ior_i.in())
{
father = f_i; father = f_i;
break; break;
} }
} }
if ( !CORBA::is_nil( father ) ) { if ( !CORBA::is_nil( father ) ) {
// check that the component is added to the use case browser // check that the component is added to the use case browser
if ( !useCaseBuilder->IsUseCaseNode( father ) ) { if ( !useCaseBuilder->IsUseCaseNode( father ) ) {
@ -583,14 +584,14 @@ SALOMEDS::SComponent_ptr SMESH_Gen_i::PublishComponent()
if ( CORBA::is_nil( aCat ) ) if ( CORBA::is_nil( aCat ) )
return father._retn(); return father._retn();
SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( compDataType.c_str() ); SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( compDataType.in() );
if ( CORBA::is_nil( aComp ) ) if ( CORBA::is_nil( aComp ) )
return father._retn(); return father._retn();
SALOMEDS::GenericAttribute_wrap anAttr; SALOMEDS::GenericAttribute_wrap anAttr;
SALOMEDS::AttributePixMap_wrap aPixmap; SALOMEDS::AttributePixMap_wrap aPixmap;
father = aStudyBuilder->NewComponent( compDataType.c_str() ); father = aStudyBuilder->NewComponent( compDataType.in() );
aStudyBuilder->DefineComponentInstance( father, SMESH_Gen::_this() ); aStudyBuilder->DefineComponentInstance( father, SMESH_Gen::_this() );
anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" ); anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" );
aPixmap = anAttr; aPixmap = anAttr;

View File

@ -1118,7 +1118,7 @@ bool StdMeshers_Hexa_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheck
if ( nbFoundShells != 1 ) { if ( nbFoundShells != 1 ) {
if ( toCheckAll ) return false; if ( toCheckAll ) return false;
continue; continue;
} }
exp1.Init( exp0.Current(), TopAbs_FACE ); exp1.Init( exp0.Current(), TopAbs_FACE );
int nbEdges = SMESH_MesherHelper::Count( exp1.Current(), TopAbs_EDGE, /*ignoreSame=*/true ); int nbEdges = SMESH_MesherHelper::Count( exp1.Current(), TopAbs_EDGE, /*ignoreSame=*/true );
bool ok = ( nbEdges > 3 ); bool ok = ( nbEdges > 3 );
@ -1130,7 +1130,7 @@ bool StdMeshers_Hexa_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheck
//======================================================================= //=======================================================================
//function : ComputePentahedralMesh //function : ComputePentahedralMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh, SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh,
@ -1138,12 +1138,7 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh,
SMESH_ProxyMesh* proxyMesh) SMESH_ProxyMesh* proxyMesh)
{ {
SMESH_ComputeErrorPtr err = SMESH_ComputeError::New(); SMESH_ComputeErrorPtr err = SMESH_ComputeError::New();
if ( proxyMesh )
{
err->myName = COMPERR_BAD_INPUT_MESH;
err->myComment = "Can't build pentahedral mesh on viscous layers";
return err;
}
bool bOK; bool bOK;
StdMeshers_Penta_3D anAlgo; StdMeshers_Penta_3D anAlgo;
// //
@ -1165,13 +1160,31 @@ SMESH_ComputeErrorPtr ComputePentahedralMesh(SMESH_Mesh & aMesh,
err = aPrism3D->GetComputeError(); err = aPrism3D->GetComputeError();
} }
} }
if ( !bOK && proxyMesh )
{
// check if VL elements are present on block FACEs
bool hasVLonFace = false;
for ( TopExp_Explorer exp( aShape, TopAbs_FACE ); exp.More(); exp.Next() )
{
const SMESHDS_SubMesh* sm1 = aMesh.GetSubMesh( exp.Current() )->GetSubMeshDS();
const SMESHDS_SubMesh* sm2 = proxyMesh->GetSubMesh( exp.Current() );
if (( hasVLonFace = ( sm2 && sm1->NbElements() != sm2->NbElements() )))
break;
}
if ( hasVLonFace )
{
err->myName = COMPERR_BAD_INPUT_MESH;
err->myComment = "Can't build pentahedral mesh on viscous layers";
}
}
return err; return err;
} }
//======================================================================= //=======================================================================
//function : EvaluatePentahedralMesh //function : EvaluatePentahedralMesh
//purpose : //purpose :
//======================================================================= //=======================================================================
bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh, bool EvaluatePentahedralMesh(SMESH_Mesh & aMesh,

View File

@ -101,7 +101,9 @@
#include <unordered_map> #include <unordered_map>
#ifdef _DEBUG_ #ifdef _DEBUG_
#ifndef WIN32
#define __myDEBUG #define __myDEBUG
#endif
//#define __NOT_INVALIDATE_BAD_SMOOTH //#define __NOT_INVALIDATE_BAD_SMOOTH
//#define __NODES_AT_POS //#define __NODES_AT_POS
#endif #endif
@ -2775,13 +2777,12 @@ bool _ViscousBuilder::makeLayer(_SolidData& data)
if ( !setEdgeData( *edge, edgesByGeom[ shapeID ], helper, data )) if ( !setEdgeData( *edge, edgesByGeom[ shapeID ], helper, data ))
return false; return false;
if ( edge->_nodes.size() < 2 ) if ( edge->_nodes.size() < 2 && !noShrink )
edge->Block( data ); edge->Block( data ); // a sole node is moved only if noShrink
//data._noShrinkShapes.insert( shapeID );
} }
dumpMove(edge->_nodes.back()); dumpMove(edge->_nodes.back());
if ( edge->_cosin > faceMaxCosin && !edge->Is( _LayerEdge::BLOCKED )) if ( edge->_cosin > faceMaxCosin && edge->_nodes.size() > 1 )
{ {
faceMaxCosin = edge->_cosin; faceMaxCosin = edge->_cosin;
maxCosinEdge = edge; maxCosinEdge = edge;
@ -3905,7 +3906,7 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
getMeshDS()->SetNodeOnFace( tgtNode, TopoDS::Face( eos._sWOL ), uv.X(), uv.Y() ); getMeshDS()->SetNodeOnFace( tgtNode, TopoDS::Face( eos._sWOL ), uv.X(), uv.Y() );
} }
if ( edge._nodes.size() > 1 ) //if ( edge._nodes.size() > 1 ) -- allow RISKY_SWOL on noShrink shape
{ {
// check if an angle between a FACE with layers and SWOL is sharp, // check if an angle between a FACE with layers and SWOL is sharp,
// else the edge should not inflate // else the edge should not inflate
@ -3920,8 +3921,11 @@ bool _ViscousBuilder::setEdgeData(_LayerEdge& edge,
geomNorm.Reverse(); // inside the SOLID geomNorm.Reverse(); // inside the SOLID
if ( geomNorm * edge._normal < -0.001 ) if ( geomNorm * edge._normal < -0.001 )
{ {
getMeshDS()->RemoveFreeNode( tgtNode, 0, /*fromGroups=*/false ); if ( edge._nodes.size() > 1 )
edge._nodes.resize( 1 ); {
getMeshDS()->RemoveFreeNode( tgtNode, 0, /*fromGroups=*/false );
edge._nodes.resize( 1 );
}
} }
else if ( realLenFactor > 3 ) /// -- moved to SetCosin() else if ( realLenFactor > 3 ) /// -- moved to SetCosin()
//else if ( edge._lenFactor > 3 ) //else if ( edge._lenFactor > 3 )
@ -4739,7 +4743,7 @@ void _ViscousBuilder::computeGeomSize( _SolidData& data )
double thinkness = eos._hyp.GetTotalThickness(); double thinkness = eos._hyp.GetTotalThickness();
for ( size_t i = 0; i < eos._edges.size(); ++i ) for ( size_t i = 0; i < eos._edges.size(); ++i )
{ {
if ( eos._edges[i]->Is( _LayerEdge::BLOCKED )) continue; if ( eos._edges[i]->_nodes.size() < 2 ) continue;
eos._edges[i]->SetMaxLen( thinkness ); eos._edges[i]->SetMaxLen( thinkness );
eos._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon, eos, &face ); eos._edges[i]->FindIntersection( *searcher, intersecDist, data._epsilon, eos, &face );
if ( intersecDist > 0 && face ) if ( intersecDist > 0 && face )
@ -4930,7 +4934,7 @@ bool _ViscousBuilder::inflate(_SolidData& data)
if ( eos._edges[i]->_nodes.size() > 1 ) if ( eos._edges[i]->_nodes.size() > 1 )
avgThick += Min( 1., eos._edges[i]->_len / shapeTgtThick ); avgThick += Min( 1., eos._edges[i]->_len / shapeTgtThick );
else else
avgThick += shapeTgtThick; avgThick += 1;
nbActiveEdges += ( ! eos._edges[i]->Is( _LayerEdge::BLOCKED )); nbActiveEdges += ( ! eos._edges[i]->Is( _LayerEdge::BLOCKED ));
} }
} }
@ -5444,8 +5448,11 @@ bool _ViscousBuilder::smoothAndCheck(_SolidData& data,
// intersection not ignored // intersection not ignored
if ( toBlockInfaltion && double minDist = 0;
dist < ( eos._edges[i]->_len * theThickToIntersection )) if ( eos._edges[i]->_maxLen < 0.99 * eos._hyp.GetTotalThickness() ) // limited length
minDist = eos._edges[i]->_len * theThickToIntersection;
if ( toBlockInfaltion && dist < minDist )
{ {
if ( is1stBlocked ) { is1stBlocked = false; // debug if ( is1stBlocked ) { is1stBlocked = false; // debug
dumpFunction(SMESH_Comment("blockIntersected") <<data._index<<"_InfStep"<<infStep); dumpFunction(SMESH_Comment("blockIntersected") <<data._index<<"_InfStep"<<infStep);
@ -6192,9 +6199,11 @@ bool _Smoother1D::smoothAnalyticEdge( _SolidData& data,
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() ); tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode ); dumpMove( tgtNode );
SMDS_FacePositionPtr pos = tgtNode->GetPosition(); if ( SMDS_FacePositionPtr pos = tgtNode->GetPosition() ) // NULL if F is noShrink
pos->SetUParameter( newUV.X() ); {
pos->SetVParameter( newUV.Y() ); pos->SetUParameter( newUV.X() );
pos->SetVParameter( newUV.Y() );
}
gp_XYZ newUV0( newUV.X(), newUV.Y(), 0 ); gp_XYZ newUV0( newUV.X(), newUV.Y(), 0 );
@ -6304,10 +6313,11 @@ bool _Smoother1D::smoothAnalyticEdge( _SolidData& data,
tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() ); tgtNode->setXYZ( newPos.X(), newPos.Y(), newPos.Z() );
dumpMove( tgtNode ); dumpMove( tgtNode );
SMDS_FacePositionPtr pos = tgtNode->GetPosition(); if ( SMDS_FacePositionPtr pos = tgtNode->GetPosition() ) // NULL if F is noShrink
pos->SetUParameter( newUV.X() ); {
pos->SetVParameter( newUV.Y() ); pos->SetUParameter( newUV.X() );
pos->SetVParameter( newUV.Y() );
}
_eos[i]->Set( _LayerEdge::SMOOTHED ); // to check in refine() (IPAL54237) _eos[i]->Set( _LayerEdge::SMOOTHED ); // to check in refine() (IPAL54237)
} }
} }
@ -6939,14 +6949,14 @@ void _SolidData::PrepareEdgesToSmoothOnFace( _EdgesOnShape* eos, bool substitute
eos->_edgeForOffset = 0; eos->_edgeForOffset = 0;
double maxCosin = -1; double maxCosin = -1;
bool hasNoShrink = false; //bool hasNoShrink = false;
for ( TopExp_Explorer eExp( eos->_shape, TopAbs_EDGE ); eExp.More(); eExp.Next() ) for ( TopExp_Explorer eExp( eos->_shape, TopAbs_EDGE ); eExp.More(); eExp.Next() )
{ {
_EdgesOnShape* eoe = GetShapeEdges( eExp.Current() ); _EdgesOnShape* eoe = GetShapeEdges( eExp.Current() );
if ( !eoe || eoe->_edges.empty() ) continue; if ( !eoe || eoe->_edges.empty() ) continue;
if ( eos->GetData()._noShrinkShapes.count( eoe->_shapeID )) // if ( eos->GetData()._noShrinkShapes.count( eoe->_shapeID ))
hasNoShrink = true; // hasNoShrink = true;
vector<_LayerEdge*>& eE = eoe->_edges; vector<_LayerEdge*>& eE = eoe->_edges;
_LayerEdge* e = eE[ eE.size() / 2 ]; _LayerEdge* e = eE[ eE.size() / 2 ];
@ -6984,8 +6994,8 @@ void _SolidData::PrepareEdgesToSmoothOnFace( _EdgesOnShape* eos, bool substitute
// Try to initialize _Mapper2D // Try to initialize _Mapper2D
if ( hasNoShrink ) // if ( hasNoShrink )
return; // return;
SMDS_ElemIteratorPtr fIt = eos->_subMesh->GetSubMeshDS()->GetElements(); SMDS_ElemIteratorPtr fIt = eos->_subMesh->GetSubMeshDS()->GetElements();
if ( !fIt->more() || fIt->next()->NbCornerNodes() != 4 ) if ( !fIt->more() || fIt->next()->NbCornerNodes() != 4 )
@ -10841,12 +10851,20 @@ namespace VISCOUS_3D
std::vector< SMESH_NodeXYZ > _nodes; std::vector< SMESH_NodeXYZ > _nodes;
TopAbs_ShapeEnum _vertSWOLType[2]; // shrink part includes VERTEXes TopAbs_ShapeEnum _vertSWOLType[2]; // shrink part includes VERTEXes
AverageHyp* _vertHyp[2]; AverageHyp* _vertHyp[2];
double _edgeWOLLen[2]; // length of wol EDGE
double _tol; // to compare _edgeWOLLen's
BndPart(): BndPart():
_isShrink(0), _isReverse(0), _nbSegments(0), _hyp(0), _isShrink(0), _isReverse(0), _nbSegments(0), _hyp(0),
_vertSWOLType{ TopAbs_WIRE, TopAbs_WIRE }, _vertHyp{ 0, 0 } _vertSWOLType{ TopAbs_WIRE, TopAbs_WIRE }, _vertHyp{ 0, 0 }, _edgeWOLLen{ 0., 0.}
{} {}
bool IsEqualLengthEWOL( const BndPart& other ) const
{
return ( std::abs( _edgeWOLLen[0] - other._edgeWOLLen[0] ) < _tol &&
std::abs( _edgeWOLLen[1] - other._edgeWOLLen[1] ) < _tol );
}
bool operator==( const BndPart& other ) const bool operator==( const BndPart& other ) const
{ {
return ( _isShrink == other._isShrink && return ( _isShrink == other._isShrink &&
@ -10857,7 +10875,8 @@ namespace VISCOUS_3D
(( !_isShrink ) || (( !_isShrink ) ||
( *_hyp == *other._hyp && ( *_hyp == *other._hyp &&
vertHyp1() == other.vertHyp1() && vertHyp1() == other.vertHyp1() &&
vertHyp2() == other.vertHyp2() )) vertHyp2() == other.vertHyp2() &&
IsEqualLengthEWOL( other )))
); );
} }
bool CanAppend( const BndPart& other ) bool CanAppend( const BndPart& other )
@ -10875,10 +10894,12 @@ namespace VISCOUS_3D
bool hasCommonNode = ( _nodes.back()->GetID() == other._nodes.front()->GetID() ); bool hasCommonNode = ( _nodes.back()->GetID() == other._nodes.front()->GetID() );
_nodes.insert( _nodes.end(), other._nodes.begin() + hasCommonNode, other._nodes.end() ); _nodes.insert( _nodes.end(), other._nodes.begin() + hasCommonNode, other._nodes.end() );
_vertSWOLType[1] = other._vertSWOLType[1]; _vertSWOLType[1] = other._vertSWOLType[1];
if ( _isShrink ) if ( _isShrink ) {
_vertHyp[1] = other._vertHyp[1]; _vertHyp[1] = other._vertHyp[1];
_edgeWOLLen[1] = other._edgeWOLLen[1];
}
} }
const SMDS_MeshNode* Node(size_t i) const const SMDS_MeshNode* Node(size_t i) const
{ {
return _nodes[ _isReverse ? ( _nodes.size() - 1 - i ) : i ]._node; return _nodes[ _isReverse ? ( _nodes.size() - 1 - i ) : i ]._node;
} }
@ -11026,6 +11047,11 @@ namespace VISCOUS_3D
for ( int iE = 0; iE < nbEdgesInWire.front(); ++iE ) for ( int iE = 0; iE < nbEdgesInWire.front(); ++iE )
{ {
BndPart bndPart; BndPart bndPart;
std::vector<const SMDS_MeshNode*> nodes = fSide.GetOrderedNodes( iE );
bndPart._nodes.assign( nodes.begin(), nodes.end() );
bndPart._nbSegments = bndPart._nodes.size() - 1;
_EdgesOnShape* eos = _data1->GetShapeEdges( fSide.EdgeID( iE )); _EdgesOnShape* eos = _data1->GetShapeEdges( fSide.EdgeID( iE ));
bndPart._isShrink = ( eos->SWOLType() == TopAbs_FACE ); bndPart._isShrink = ( eos->SWOLType() == TopAbs_FACE );
@ -11054,10 +11080,14 @@ namespace VISCOUS_3D
bndPart._vertSWOLType[iV] = eov[iV]->SWOLType(); bndPart._vertSWOLType[iV] = eov[iV]->SWOLType();
} }
} }
bndPart._edgeWOLLen[0] = fSide.EdgeLength( iE - 1 );
bndPart._edgeWOLLen[1] = fSide.EdgeLength( iE + 1 );
bndPart._tol = std::numeric_limits<double>::max(); // tolerance by segment size
for ( size_t i = 1; i < bndPart._nodes.size(); ++i )
bndPart._tol = Min( bndPart._tol,
( bndPart._nodes[i-1] - bndPart._nodes[i] ).SquareModulus() );
} }
std::vector<const SMDS_MeshNode*> nodes = fSide.GetOrderedNodes( iE );
bndPart._nodes.assign( nodes.begin(), nodes.end() );
bndPart._nbSegments = bndPart._nodes.size() - 1;
if ( _boundary.empty() || ! _boundary.back().CanAppend( bndPart )) if ( _boundary.empty() || ! _boundary.back().CanAppend( bndPart ))
_boundary.push_back( bndPart ); _boundary.push_back( bndPart );
@ -11164,6 +11194,9 @@ namespace VISCOUS_3D
} }
SMESHDS_Mesh* meshDS = dataSrc->GetHelper().GetMeshDS(); SMESHDS_Mesh* meshDS = dataSrc->GetHelper().GetMeshDS();
dumpFunction(SMESH_Comment("periodicMoveNodes_F")
<< _shriFace[iSrc]->_subMesh->GetId() << "_F"
<< _shriFace[iTgt]->_subMesh->GetId() );
TNode2Edge::iterator n2e; TNode2Edge::iterator n2e;
TNodeNodeMap::iterator n2n = _nnMap.begin(); TNodeNodeMap::iterator n2n = _nnMap.begin();
for ( ; n2n != _nnMap.end(); ++n2n ) for ( ; n2n != _nnMap.end(); ++n2n )
@ -11193,6 +11226,8 @@ namespace VISCOUS_3D
SMESH_NodeXYZ pSrc = leSrc->_nodes[ iN ]; SMESH_NodeXYZ pSrc = leSrc->_nodes[ iN ];
gp_XYZ pTgt = trsf->Transform( pSrc ); gp_XYZ pTgt = trsf->Transform( pSrc );
meshDS->MoveNode( leTgt->_nodes[ iN ], pTgt.X(), pTgt.Y(), pTgt.Z() ); meshDS->MoveNode( leTgt->_nodes[ iN ], pTgt.X(), pTgt.Y(), pTgt.Z() );
dumpMove( leTgt->_nodes[ iN ]);
} }
} }
} }
@ -11201,6 +11236,7 @@ namespace VISCOUS_3D
<< _shriFace[iSrc]->_subMesh->GetId() << " -> " << _shriFace[iSrc]->_subMesh->GetId() << " -> "
<< _shriFace[iTgt]->_subMesh->GetId() << " -- " << _shriFace[iTgt]->_subMesh->GetId() << " -- "
<< ( done ? "DONE" : "FAIL")); << ( done ? "DONE" : "FAIL"));
dumpFunctionEnd();
return done; return done;
} }
@ -11735,6 +11771,8 @@ bool _ViscousBuilder::shrink(_SolidData& theData)
{ {
_EdgesOnShape& eos = * subEOS[ iS ]; _EdgesOnShape& eos = * subEOS[ iS ];
if ( eos.ShapeType() != TopAbs_EDGE ) continue; if ( eos.ShapeType() != TopAbs_EDGE ) continue;
if ( eos.size() == 0 )
continue;
const TopoDS_Edge& E = TopoDS::Edge( eos._shape ); const TopoDS_Edge& E = TopoDS::Edge( eos._shape );
data.SortOnEdge( E, eos._edges ); data.SortOnEdge( E, eos._edges );
@ -11757,8 +11795,8 @@ bool _ViscousBuilder::shrink(_SolidData& theData)
uvPtVec[ i ].param = helper.GetNodeU( E, edges[i]->_nodes[0] ); uvPtVec[ i ].param = helper.GetNodeU( E, edges[i]->_nodes[0] );
uvPtVec[ i ].SetUV( helper.GetNodeUV( F, edges[i]->_nodes.back() )); uvPtVec[ i ].SetUV( helper.GetNodeUV( F, edges[i]->_nodes.back() ));
} }
if ( edges.empty() ) // if ( edges.empty() )
continue; // continue;
BRep_Tool::Range( E, uvPtVec[0].param, uvPtVec.back().param ); BRep_Tool::Range( E, uvPtVec[0].param, uvPtVec.back().param );
StdMeshers_FaceSide fSide( uvPtVec, F, E, _mesh ); StdMeshers_FaceSide fSide( uvPtVec, F, E, _mesh );
StdMeshers_ViscousLayers2D::SetProxyMeshOfEdge( fSide ); StdMeshers_ViscousLayers2D::SetProxyMeshOfEdge( fSide );