* 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`.
virtual bool isOk (const SUIT_DataOwner*) const;
SMESH::MeshObjectType type() const;
+ void setType( SMESH::MeshObjectType theType ) { myType = theType; }
protected:
SMESH::MeshObjectType myType;
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
anApp->browseObjects( anEntryList, toShowObjects );
Init(false);
- mySelectedObject = SMESH::SMESH_IDSource::_nil();
SelectionIntoArgument();
return true;
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() )
{
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);
<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>
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;
}
// 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;
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() )
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();