* \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise
- * \sa DoubleNodeGroup(), DoubleNodes()
+ * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
*/
boolean DoubleNodeElemGroups( in ListOfGroups theElems,
in ListOfGroups theNodesNot,
in ListOfGroups theAffectedElems );
+ /*!
+ * \brief Creates a hole in a mesh by doubling the nodes of some particular elements.
+ * Works as DoubleNodeElemGroups() described above, but returns a new group with
+ * newly created elements.
+ * \param theElems - list of groups of elements (edges or faces) to be replicated
+ * \param theNodesNot - list of groups of nodes not to replicated
+ * \param theAffectedElems - group of elements to which the replicated nodes
+ * should be associated to.
+ * \return a new group with newly created elements
+ * \sa DoubleNodeElemGroups()
+ */
+ SMESH_Group DoubleNodeElemGroupsNew( in ListOfGroups theElems,
+ in ListOfGroups theNodesNot,
+ in ListOfGroups theAffectedElems );
+
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
* This method provided for convenience works as DoubleNodes() described above.
theCommand->SetMethod("FindCoincidentNodesOnPart");
}
// DoubleNodeElemGroupNew() -> DoubleNodeElemGroup()
- if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || method == "DoubleNodeGroupNew"))
+ // DoubleNodeGroupNew() -> DoubleNodeGroup()
+ // DoubleNodeElemGroupsNew() -> DoubleNodeElemGroups()
+ if ( !isPyMeshMethod && ( method == "DoubleNodeElemGroupNew" || method == "DoubleNodeGroupNew" || method == "DoubleNodeElemGroupsNew"))
{
isPyMeshMethod=true;
theCommand->SetMethod( method.SubString( 1, method.Length()-3));
\param theAffectedElems - group of elements to which the replicated nodes
should be associated to.
\return TRUE if operation has been completed successfully, FALSE otherwise
- \sa DoubleNodeGroup(), DoubleNodes()
+ \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
*/
//================================================================================
return aResult;
}
+//================================================================================
+/*!
+ * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
+ \param theElems - list of groups of elements (edges or faces) to be replicated
+ \param theNodesNot - list of groups of nodes not to replicated
+ \param theAffectedElems - group of elements to which the replicated nodes
+ should be associated to.
+ * \return a new group with newly created elements
+ * \sa DoubleNodeElemGroups()
+ */
+//================================================================================
+
+SMESH::SMESH_Group_ptr SMESH_MeshEditor_i::DoubleNodeElemGroupsNew(const SMESH::ListOfGroups& theElems,
+ const SMESH::ListOfGroups& theNodesNot,
+ const SMESH::ListOfGroups& theAffectedElems)
+{
+ SMESH::SMESH_Group_var aNewGroup;
+
+ initData();
+
+ ::SMESH_MeshEditor aMeshEditor( myMesh );
+
+ SMESHDS_Mesh* aMeshDS = GetMeshDS();
+ TIDSortedElemSet anElems, aNodes, anAffected;
+ listOfGroupToSet(theElems, aMeshDS, anElems, false );
+ listOfGroupToSet(theNodesNot, aMeshDS, aNodes, true );
+ listOfGroupToSet(theAffectedElems, aMeshDS, anAffected, false );
+
+ bool aResult = aMeshEditor.DoubleNodes( anElems, aNodes, anAffected );
+
+ storeResult( aMeshEditor) ;
+
+ myMesh->GetMeshDS()->Modified();
+ if ( aResult ) {
+ myMesh->SetIsModified( true );
+
+ // Create group with newly created elements
+ SMESH::long_array_var anIds = GetLastCreatedElems();
+ if (anIds->length() > 0) {
+ SMESH::ElementType aGroupType = myMesh_i->GetElementType(anIds[0], true);
+ string anUnindexedName (theElems[0]->GetName());
+ string aNewName = generateGroupName(anUnindexedName + "_double");
+ aNewGroup = myMesh_i->CreateGroup(aGroupType, aNewName.c_str());
+ aNewGroup->Add(anIds);
+ }
+ }
+
+ // Update Python script
+ TPythonDump() << "createdElems = " << this << ".DoubleNodeElemGroupsNew( " << &theElems << ", "
+ << &theNodesNot << ", " << &theAffectedElems << " )";
+ return aNewGroup._retn();
+}
+
//================================================================================
/*!
\brief Creates a hole in a mesh by doubling the nodes of some particular elements
* \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise
- * \sa DoubleNodes(), DoubleNodeGroups()
+ * \sa DoubleNodes(), DoubleNodeGroups(), DoubleNodeElemGroupNew()
*/
CORBA::Boolean DoubleNodeElemGroup( SMESH::SMESH_GroupBase_ptr theElems,
SMESH::SMESH_GroupBase_ptr theNodesNot,
* \param theAffectedElems - group of elements to which the replicated nodes
* should be associated to.
* \return TRUE if operation has been completed successfully, FALSE otherwise
- * \sa DoubleNodeGroup(), DoubleNodes()
+ * \sa DoubleNodeGroup(), DoubleNodes(), DoubleNodeElemGroupsNew()
*/
CORBA::Boolean DoubleNodeElemGroups( const SMESH::ListOfGroups& theElems,
const SMESH::ListOfGroups& theNodesNot,
const SMESH::ListOfGroups& theAffectedElems );
+ /*!
+ * \brief Creates a hole in a mesh by doubling the nodes of some particular elements
+ * Works as DoubleNodeElemGroups(), but returns a new group with newly created elements.
+ * \param theElems - list of groups of elements (edges or faces) to be replicated
+ * \param theNodesNot - list of groups of nodes not to replicated
+ * \param theAffectedElems - group of elements to which the replicated nodes
+ * should be associated to.
+ * \return a new group with newly created elements
+ * \sa DoubleNodeElemGroups()
+ */
+ SMESH::SMESH_Group_ptr DoubleNodeElemGroupsNew( const SMESH::ListOfGroups& theElems,
+ const SMESH::ListOfGroups& theNodesNot,
+ const SMESH::ListOfGroups& theAffectedElems );
+
/*!
* \brief Creates a hole in a mesh by doubling the nodes of some particular elements
# @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to.
# @param theMakeGroup forces the generation of a group containing new elements.
+ # @return TRUE or a created group if operation has been completed successfully,
+ # FALSE or None otherwise
# @ingroup l2_modif_edit
def DoubleNodeElemGroup(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
if theMakeGroup:
# @param theNodesNot - list of groups of nodes not to replicated
# @param theAffectedElems - group of elements to which the replicated nodes
# should be associated to.
- # @return TRUE if operation has been completed successfully, FALSE otherwise
+ # @param theMakeGroup forces the generation of a group containing new elements.
+ # @return TRUE or a created group if operation has been completed successfully,
+ # FALSE or None otherwise
# @ingroup l2_modif_edit
- def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems):
+ def DoubleNodeElemGroups(self, theElems, theNodesNot, theAffectedElems, theMakeGroup=False):
+ if theMakeGroup:
+ return self.editor.DoubleNodeElemGroupsNew(theElems, theNodesNot, theAffectedElems)
return self.editor.DoubleNodeElemGroups(theElems, theNodesNot, theAffectedElems)
## Creates a hole in a mesh by doubling the nodes of some particular elements