23605: [EDF] HYDRO: parent mesh for Copy mesh with new geometry

23606: [EDF] HYDRO: Help for option Copy mesh with new geometry is absent
This commit is contained in:
eap 2018-10-17 17:35:08 +03:00
parent f4dd52ae3d
commit e9c5d169fa
5 changed files with 44 additions and 14 deletions

View File

@ -41,7 +41,13 @@ In the dialog:
* Click **Apply** or **Apply and Close** button to confirm the operation.
When copying the mesh to the new geometry, it can happen that a sub-shape used to define a sub-mesh, group or hypotheses is not found in the new geometry. In this case a new object depending on the not found sub-shape is marked with red color in the Object Browser in order to allow identifying such objects and to fix them, either by modifying their definition or by removing. If a depending object is a group on geometry, a standalone group is created instead. You can't transform it to a group on geometry, it can only be removed and re-created anew.
---------------------------------------------------
Limitations of copying the mesh to the new geometry
---------------------------------------------------
It can happen that a sub-shape used to define a sub-mesh, group or hypotheses is not found in the new geometry. In this case a new object depending on the not found sub-shape is marked with red color in the Object Browser in order to allow identifying such objects and to fix them, either by modifying their definition or by removing. If a depending object is a group on geometry, a standalone group is created instead. You can't transform it to a group on geometry, it can only be removed and re-created anew.
Empty standalone groups are not constructed.
**See Also** a sample script of :ref:`tui_copy_mesh`.

View File

@ -39,6 +39,7 @@ public:
virtual bool isOk (const SUIT_DataOwner*) const;
SMESH::MeshObjectType type() const;
void setType( SMESH::MeshObjectType theType ) { myType = theType; }
protected:
SMESH::MeshObjectType myType;

View File

@ -351,7 +351,7 @@ QString SMESHGUI_CopyMeshDlg::getErrorMsg( SMESH::string_array_var theInvalidEnt
QStringList & theEntriesToBrowse )
{
if ( theInvalidEntries->length() == 0 )
return tr("SMESH_OPERATION_FAILED");
return tr("OPERATION_FAILED");
// theInvalidEntries - SObject's that hold geometry objects whose
// counterparts are not found in the newGeometry, followed by SObject's
@ -508,7 +508,6 @@ bool SMESHGUI_CopyMeshDlg::ClickOnApply()
anApp->browseObjects( anEntryList, toShowObjects );
Init(false);
mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
return true;
@ -685,6 +684,16 @@ void SMESHGUI_CopyMeshDlg::SelectionIntoArgument()
mySelectedObject = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( mySelectedObject->_is_nil() )
return;
if ( isWithGeomMode() ) // only mesh selection allowed
{
myMesh = SMESH::SMESH_Mesh::_narrow( mySelectedObject );
if ( myMesh->_is_nil() )
{
myLineEditElements->setText("");
return;
}
}
}
else if ( !geom->_is_nil() )
{
@ -716,12 +725,10 @@ void SMESHGUI_CopyMeshDlg::SelectionIntoArgument()
else if ( !geom->_is_nil() )
{
myGeomNameEdit->setText( aString );
ok = ok && !myLineEditElements->text().isEmpty();
}
if ( ok && isWithGeomMode() && !myMesh->_is_nil() )
ok = myMesh->HasShapeToMesh();
if ( ok && isWithGeomMode() )
ok = ( !myMesh->_is_nil() && myMesh->HasShapeToMesh() && !myNewGeometry->_is_nil() );
buttonOk->setEnabled(ok);
buttonApply->setEnabled(ok);

View File

@ -8091,6 +8091,10 @@ as they are of improper type:
<source>COPY_ELEMENTS</source>
<translation>Copy Mesh Elements</translation>
</message>
<message>
<source>OPERATION_FAILED</source>
<translation>Not all mesh sub-objects have been copied</translation>
</message>
<message>
<source>SUBSHAPES_NOT_FOUND_MSG</source>
<translation>

View File

@ -3158,8 +3158,12 @@ namespace // utils for CopyMeshWithGeom()
if ( 0 < oldID && oldID < (int)myGIPMap->length() )
{
if ( myGIPMap[ oldID ].length() == 1 )
if (( myGIPMap[ oldID ].length() == 1 ) ||
( myGIPMap[ oldID ].length() > 1 &&
getShapeType( mySrcMesh_i, oldID ) == TopAbs_VERTEX ))
{
newID = myGIPMap[ oldID ][ 0 ];
}
}
return newID;
}
@ -3563,9 +3567,9 @@ throw ( SALOME::SALOME_Exception )
// copy mesh elements, keeping IDs
SMESHDS_Mesh* newMeshDS = newMesh_i->GetImpl().GetMeshDS();
if ( theToCopyElements && theSourceMesh->NbNodes() > 0 )
{
SMESHDS_Mesh* newMeshDS = newMesh_i->GetImpl().GetMeshDS();
::SMESH_MeshEditor editor( &newMesh_i->GetImpl() );
::SMESH_MeshEditor::ElemFeatures elemData;
@ -3646,12 +3650,20 @@ throw ( SALOME::SALOME_Exception )
if ( !stdlGroup->_is_nil() )
{
if ( theToCopyElements )
if ( newMeshDS->GetMeshInfo().NbElements( SMDSAbs_ElementType( elemType )) > 0 )
{
SMESH::long_array_var elemIDs = stdlGroup->GetIDs();
stdlGroup = theNewMesh->CreateGroup( elemType, name );
stdlGroup->Add( elemIDs );
newGroup = SMESH::SMESH_GroupBase::_narrow( stdlGroup );
const bool isElem = ( elemType != SMESH::NODE );
CORBA::ULong iE = 0;
for ( ; iE < elemIDs->length(); ++iE ) // check if any element has been copied
if ( newMeshDS->GetElementType( elemIDs[ iE ], isElem ) != SMDSAbs_All )
break;
if ( iE < elemIDs->length() )
{
stdlGroup = theNewMesh->CreateGroup( elemType, name );
stdlGroup->Add( elemIDs );
newGroup = SMESH::SMESH_GroupBase::_narrow( stdlGroup );
}
}
}
else if ( !geomGroup->_is_nil() )
@ -3766,7 +3778,7 @@ throw ( SALOME::SALOME_Exception )
SALOMEDS::SObject_wrap newSO = ObjectToSObject( newGroup );
if ( !srcSO->_is_nil() )
{
CORBA::String_var srcID, newID;
CORBA::String_var srcID, newID("");
srcID = srcSO->GetID();
if ( !newSO->_is_nil() )
newID = newSO->GetID();