Salome HOME
IMP 23201: Harmonisation of "0D Element" and "0D Elements on Element Nodes" V8_1_0b1
authoreap <eap@opencascade.com>
Thu, 11 Aug 2016 17:13:30 +0000 (20:13 +0300)
committereap <eap@opencascade.com>
Thu, 11 Aug 2016 17:13:30 +0000 (20:13 +0300)
14 files changed:
doc/salome/gui/SMESH/images/add0delement.png
doc/salome/gui/SMESH/images/dlg_0D_on_all_nodes.png
doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc
idl/SMESH_MeshEditor.idl
src/SMESH/SMESH_MeshEditor.cxx
src/SMESH/SMESH_MeshEditor.hxx
src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx
src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx
src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h
src/SMESHGUI/SMESH_msg_en.ts
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_MeshEditor_i.hxx
src/SMESH_SWIG/smeshBuilder.py

index ed27488c9a790a605a9d12ff2b47d45062f127a3..06621cc24cc6cf258d6f112e4e3a1ea01bcd82f5 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/add0delement.png and b/doc/salome/gui/SMESH/images/add0delement.png differ
index 842b3bb5b1b92f0439f8ad10285beb5567f93ab4..78ac7c84a6963a91f0ac8c243f63b229ff71a5b7 100644 (file)
Binary files a/doc/salome/gui/SMESH/images/dlg_0D_on_all_nodes.png and b/doc/salome/gui/SMESH/images/dlg_0D_on_all_nodes.png differ
index 173db3ce1e32f194696fe57a233f16327b1beb99..793525c02eebaf54c02ac8570b2f4d5fcfb543e0 100644 (file)
@@ -81,7 +81,8 @@ created:
 \image html add0delement.png
 
 In this dialog box specify nodes which will form your 0D elements by
-selecting them in the 3D viewer and click the \b Apply or
+selecting them in the 3D viewer. Activate <b>Allow duplicate
+  elements</b> to get several 0D elements on a node. Click the \b Apply or
 <b>Apply and Close</b> button. Your 0D elements will be created:
 
 \image html add_0delement.png
@@ -109,6 +110,8 @@ In this dialog
   <li><b> Set Filter </b> button allows selecting elements or nodes
     by filtering mesh elements or nodes with different criteria
     (see \ref filtering_elements "Filter usage").</li>
+  <li>Activate <b>Allow duplicate elements</b> to get several 0D
+    elements on a node. </li>
   <li> Switching on <b>Add to group</b> check-box allows specifying the
     name of the group to which all created or found (existing) 0D elements will
     be added. You can either select an existing group from a drop-down
index 120e41e49fa05a9cccdbd790fde417c56a12072f..7cbe67bfff19fb3b076c7cb1f0129664fc0866f1 100644 (file)
@@ -136,8 +136,10 @@ module SMESH
     /*!
      *  Create a 0D element on the given node.
      *  \param IdOfNode Node IDs for creation of element.
+     *  \param DuplicateElements to add one more 0D element to a node or not
      */
-    long Add0DElement(in long IDOfNode) raises (SALOME::SALOME_Exception);
+    long Add0DElement(in long    IDOfNode,
+                      in boolean DuplicateElements) raises (SALOME::SALOME_Exception);
 
     /*!
      *  Create a ball element on the given node.
@@ -201,16 +203,17 @@ module SMESH
     long AddPolyhedralVolumeByFaces (in long_array IdsOfFaces) raises (SALOME::SALOME_Exception);
 
     /*!
-     * Create 0D elements on all nodes of the given object except those 
-     * nodes on which a 0D element already exists.
+     * Create 0D elements on all nodes of the given object.
      *  \param theObject object on whose nodes 0D elements will be created.
      *  \param theGroupName optional name of a group to add 0D elements created
      *         and/or found on nodes of \a theObject.
+     *  \param theDuplicateElements to add one more 0D element to a node or not
      *  \return an object (a new group or a temporary SMESH_IDSource) holding
      *          ids of new and/or found 0D elements.
      */
     SMESH_IDSource Create0DElementsOnAllNodes(in SMESH_IDSource theObject,
-                                              in string         theGroupName)
+                                              in string         theGroupName,
+                                              in boolean        theDuplicateElements)
       raises (SALOME::SALOME_Exception);
 
     /*!
index f7fcec03e8fd5a6fdd42a1e261cdb4f0329a30f3..1f4f4289191dc22b8965870804f80c9a7f8e70c4 100644 (file)
@@ -474,27 +474,22 @@ int SMESH_MeshEditor::Remove (const list< int >& theIDs,
 
 //================================================================================
 /*!
- * \brief Create 0D elements on all nodes of the given object except those
- *        nodes on which a 0D element already exists.
+ * \brief Create 0D elements on all nodes of the given object.
  *  \param elements - Elements on whose nodes to create 0D elements; if empty, 
  *                    the all mesh is treated
  *  \param all0DElems - returns all 0D elements found or created on nodes of \a elements
+ *  \param duplicateElements - to add one more 0D element to a node or not
  */
 //================================================================================
 
 void SMESH_MeshEditor::Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
-                                                   TIDSortedElemSet&       all0DElems )
+                                                   TIDSortedElemSet&       all0DElems,
+                                                   const bool              duplicateElements )
 {
   SMDS_ElemIteratorPtr elemIt;
-  vector< const SMDS_MeshElement* > allNodes;
   if ( elements.empty() )
   {
-    allNodes.reserve( GetMeshDS()->NbNodes() );
     elemIt = GetMeshDS()->elementsIterator( SMDSAbs_Node );
-    while ( elemIt->more() )
-      allNodes.push_back( elemIt->next() );
-
-    elemIt = elemSetIterator( allNodes );
   }
   else
   {
@@ -509,12 +504,13 @@ void SMESH_MeshEditor::Create0DElementsOnAllNodes( const TIDSortedElemSet& eleme
     {
       const SMDS_MeshNode* n = cast2Node( nodeIt->next() );
       SMDS_ElemIteratorPtr it0D = n->GetInverseElementIterator( SMDSAbs_0DElement );
-      if ( it0D->more() )
-        all0DElems.insert( it0D->next() );
-      else {
+      if ( duplicateElements || !it0D->more() )
+      {
         myLastCreatedElems.Append( GetMeshDS()->Add0DElement( n ));
         all0DElems.insert( myLastCreatedElems.Last() );
       }
+      while ( it0D->more() )
+        all0DElems.insert( it0D->next() );
     }
   }
 }
index 5dd53807a813bcac52c0ba0270c3b0c8f1d4f79b..103e4a4172ca4b0028106ccea29044ed35d6b3bd 100644 (file)
@@ -129,9 +129,9 @@ public:
   // Modify a compute state of sub-meshes which become empty
 
   void Create0DElementsOnAllNodes( const TIDSortedElemSet& elements,
-                                   TIDSortedElemSet&       all0DElems);
-  // Create 0D elements on all nodes of the given object except those
-  // nodes on which a 0D element already exists. \a all0DElems returns
+                                   TIDSortedElemSet&       all0DElems,
+                                   const bool              duplicateElements);
+  // Create 0D elements on all nodes of the given. \a all0DElems returns
   // all 0D elements found or created on nodes of \a elements
 
   bool InverseDiag (const SMDS_MeshElement * theTria1,
index 6afe2708ba9166cf1631d74a13063c86f98e4d69..105568581d0c75947aa30406e96d3125e0bdb85d 100644 (file)
@@ -104,6 +104,8 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
 
   myFilterBtn = new QPushButton( tr( "SMESH_BUT_FILTER" ), mainFrame() );
 
+  myDuplicateElemsChkBox = new QCheckBox( tr( "SMESH_DUPLICATE_0D" ), mainFrame() );
+
   // List of groups
 
   myGroupBox = new QGroupBox( tr( "SMESH_ADD_TO_GROUP" ), mainFrame() );
@@ -132,8 +134,9 @@ SMESHGUI_Add0DElemsOnAllNodesDlg::SMESHGUI_Add0DElemsOnAllNodesDlg()
   aLay->addWidget( objectWg( 0, Btn    ), 1, 1 );
   aLay->addWidget( objectWg( 0, Control), 1, 2, 1, 2 );
   aLay->addWidget( myFilterBtn,           1, 4 );
+  aLay->addWidget( myDuplicateElemsChkBox,2, 0 );
   //
-  aLay->addWidget( myGroupBox,            2, 0, 1, 5 );
+  aLay->addWidget( myGroupBox,            3, 0, 1, 5 );
 
   // Signals
 
@@ -439,7 +442,8 @@ bool SMESHGUI_Add0DElemsOnAllNodesOp::onApply()
 
     QString groupName = myDlg->myGroupListCmBox->currentText();
     SMESH::SMESH_IDSource_var newObj =
-      editor->Create0DElementsOnAllNodes( meshObject, groupName.toLatin1().data() );
+      editor->Create0DElementsOnAllNodes( meshObject, groupName.toLatin1().data(),
+                                          myDlg->myDuplicateElemsChkBox->isChecked() );
 
     int newNb0D = mesh->Nb0DElements() - prevNb0D;
     SUIT_MessageBox::information( myDlg, tr( "SMESH_INFORMATION" ),
index e4664bf3fc9c529f7a7a173d7d6e69ccf5d5af00..b65c8c5cac09ed2ac9d0875a70ba6e368e88dcb1 100644 (file)
 #include "SMESHGUI_Dialog.h"
 #include "SMESHGUI_IdValidator.h"
 
-class SMESHGUI_FilterDlg;
-class SMESHGUI_Add0DElemsOnAllNodesOp;
 class QButtonGroup;
-class QPushButton;
+class QCheckBox;
+class QComboBox;
 class QGroupBox;
 class QLabel;
-class QComboBox;
+class QPushButton;
+class SMESHGUI_Add0DElemsOnAllNodesOp;
+class SMESHGUI_FilterDlg;
 
 //---------------------------------------------------------------------------------
 /*!
@@ -72,6 +73,7 @@ signals:
   QGroupBox*    myGroupBox;
   QLabel*       myGroupLabel;
   QComboBox*    myGroupListCmBox;
+  QCheckBox*    myDuplicateElemsChkBox;
 
   SMESHGUI_IdValidator myIDValidator;
 };
@@ -106,7 +108,6 @@ class SMESHGUI_EXPORT SMESHGUI_Add0DElemsOnAllNodesOp : public SMESHGUI_Selectio
   SMESHGUI_Add0DElemsOnAllNodesDlg* myDlg;
   SMESHGUI_FilterDlg*               myFilterDlg;
   Handle(SALOME_InteractiveObject)  myIO;
-  //SUIT_SelectionFilter*             myObjectFilter;
 };
 
 #endif
index 00f8467b28ad77b6c8a0e07c4c783f90d1f529cd..3994a40b06bb2ef31545089428711f4e5c7075c2 100644 (file)
@@ -413,7 +413,9 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI*          theMo
   LineEditC1A1->setValidator
     (new SMESHGUI_IdValidator(this, ( myIsPoly || myNbNodes == 1 ) ? 1000 : myNbNodes));
 
-  Reverse = (myElementType == SMDSAbs_Face || myElementType == SMDSAbs_Volume ) ? new QCheckBox(tr("SMESH_REVERSE"), GroupC1) : 0;
+  ReverseOrDulicate = (myElementType == SMDSAbs_Face || myElementType == SMDSAbs_Volume ) ? new QCheckBox(tr("SMESH_REVERSE"), GroupC1) : 0;
+  if ( myElementType == SMDSAbs_0DElement )
+    ReverseOrDulicate = new QCheckBox(tr("SMESH_DUPLICATE_0D"), GroupC1);
 
   DiameterSpinBox = ( myGeomType == SMDSEntity_Ball ) ? new SMESHGUI_SpinBox(GroupC1) : 0;
   QLabel* diameterLabel = DiameterSpinBox ? new QLabel( tr("BALL_DIAMETER"),GroupC1) : 0;
@@ -421,8 +423,8 @@ SMESHGUI_AddMeshElementDlg::SMESHGUI_AddMeshElementDlg( SMESHGUI*          theMo
   GroupC1Layout->addWidget(TextLabelC1A1,    0, 0);
   GroupC1Layout->addWidget(SelectButtonC1A1, 0, 1);
   GroupC1Layout->addWidget(LineEditC1A1,     0, 2);
-  if ( Reverse ) {
-    GroupC1Layout->addWidget(Reverse, 1, 0, 1, 3);
+  if ( ReverseOrDulicate ) {
+    GroupC1Layout->addWidget(ReverseOrDulicate, 1, 0, 1, 3);
   }
   if ( DiameterSpinBox ) {
     GroupC1Layout->addWidget(diameterLabel,   1, 0);
@@ -524,8 +526,8 @@ void SMESHGUI_AddMeshElementDlg::Init()
   connect(mySMESHGUI,      SIGNAL(SignalActivatedViewManager()),  SLOT(onOpenView()));
   connect(mySMESHGUI,      SIGNAL(SignalCloseView()),             SLOT(onCloseView()));
 
-  if (Reverse)
-    connect(Reverse,       SIGNAL(stateChanged(int)),             SLOT(CheckBox(int)));
+  if (ReverseOrDulicate)
+    connect(ReverseOrDulicate,       SIGNAL(stateChanged(int)),             SLOT(CheckBox(int)));
 
   // set selection mode
   SMESH::SetPointRepresentation(true);
@@ -553,10 +555,10 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
     SMESH::long_array_var anArrayOfIndices = new SMESH::long_array;
     anArrayOfIndices->length(aListId.count());
     const std::vector<int>& revIndex = SMDS_MeshCell::reverseSmdsOrder( myGeomType );
-    if ( Reverse && Reverse->isChecked() && !revIndex.empty() )
+    if ( ReverseOrDulicate && ReverseOrDulicate->isChecked() && (int)revIndex.size() == aListId.count() )
       for (int i = 0; i < aListId.count(); i++)
         anArrayOfIndices[i] = aListId[ revIndex[i] ].toInt();
-    else if ( Reverse && Reverse->isChecked() && revIndex.empty() ) // polygon
+    else if ( ReverseOrDulicate && ReverseOrDulicate->isChecked() && revIndex.empty() ) // polygon
       for (int i = 0; i < aListId.count(); i++)
         anArrayOfIndices[i] = aListId[ aListId.count()-1 - i ].toInt();
     else
@@ -598,16 +600,23 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
     SMESH::long_array_var anIdList = new SMESH::long_array;
     anIdList->length( 1 );
     anIdList[0] = -1;
-    //const bool onlyNodesInMesh = ( myMesh->NbElements() == 0 );
     int nbElemsBefore = 0;
 
     switch (myElementType) {
-    case SMDSAbs_0DElement:
+    case SMDSAbs_0DElement: {
+      bool duplicateElements = ReverseOrDulicate->isChecked();
       nbElemsBefore = myMesh->Nb0DElements();
       anIdList->length( anArrayOfIndices->length() );
       for ( size_t i = 0; i < anArrayOfIndices->length(); ++i )
-        anIdList[i] = aMeshEditor->Add0DElement(anArrayOfIndices[i]);
+        anIdList[i] = aMeshEditor->Add0DElement(anArrayOfIndices[i], duplicateElements);
+
+      CORBA::ULong nbAdded = myMesh->Nb0DElements() - nbElemsBefore;
+      if ( !duplicateElements && nbAdded < anArrayOfIndices->length() )
+        SUIT_MessageBox::information(SMESHGUI::desktop(),
+                                     tr("SMESH_INFORMATION"),
+                                     tr("NB_ADDED").arg( nbAdded ));
       break;
+    }
     case SMDSAbs_Ball:
       if ( myGeomType == SMDSEntity_Ball ) {
         nbElemsBefore = myMesh->NbBalls();
@@ -672,8 +681,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
     mySelectionMgr->setSelectedObjects( aList, false );
 
     mySimulation->SetVisibility(false);
-    // if ( onlyNodesInMesh )
-    //   myActor->SetRepresentation( SMESH_Actor::eEdge ); // wireframe
+
     if ( nbElemsBefore == 0  )
     {
       // 1st element of the type has been added, update actor to show this entity
@@ -908,7 +916,7 @@ void SMESHGUI_AddMeshElementDlg::displaySimulation()
     for (int i = 0; i < aListId.count(); i++)
       anIds.push_back(myActor->GetObject()->GetNodeVTKId(aListId[ i ].toInt()));
 
-    if (Reverse && Reverse->isChecked())
+    if (ReverseOrDulicate && ReverseOrDulicate->isChecked())
     {
       const std::vector<int>& i = SMDS_MeshCell::reverseSmdsOrder( myGeomType );
       if ( i.empty() ) // polygon
index 5bf71e3711029714404068f4e319f3ee6bb80782..5325d267f05b0586ab848696cfe3a8a6a5014658 100644 (file)
@@ -111,7 +111,7 @@ private:
   QLabel*                     TextLabelC1A1;
   QPushButton*                SelectButtonC1A1;
   QLineEdit*                  LineEditC1A1;
-  QCheckBox*                  Reverse;
+  QCheckBox*                  ReverseOrDulicate;
   SMESHGUI_SpinBox*           DiameterSpinBox;
   
   QString                     myHelpFileName;
index 55a8f48b0013978d3128ce24c52770c58795d669..ad18b5d338091e1d24b51c10e91e33ff7d85fd54 100644 (file)
@@ -1241,6 +1241,10 @@ Please enter correct values and try again</translation>
         <source>SMESH_ADD_ELEM0D_TITLE</source>
         <translation>Add 0D Element</translation>
     </message>
+    <message>
+        <source>SMESH_DUPLICATE_0D</source>
+        <translation>Allow duplicate elements</translation>
+    </message>
     <message>
         <source>SMESH_ADD_BALL</source>
         <translation>Add Ball Element</translation>
@@ -4389,6 +4393,14 @@ It can&apos;t be deleted </translation>
         <translation>Export Fields</translation>
     </message>
 </context>
+<context>
+    <name>SMESHGUI_AddMeshElementDlg</name>
+    <message>
+        <source>NB_ADDED</source>
+        <translation>%1 elements have been added since 0D
+elements already present on the selected nodes.</translation>
+    </message>
+</context>
 <context>
     <name>SMESHGUI_Dialog</name>
     <message>
index f9fb06334cc561f588da2a1262c7a2f9ca49bfab..a99acd2f68a0b38478bfde505718539e0204667b 100644 (file)
@@ -903,14 +903,19 @@ CORBA::Long SMESH_MeshEditor_i::AddNode(CORBA::Double x,CORBA::Double y, CORBA::
  */
 //=============================================================================
 
-CORBA::Long SMESH_MeshEditor_i::Add0DElement(CORBA::Long IDOfNode)
+CORBA::Long SMESH_MeshEditor_i::Add0DElement(CORBA::Long    IDOfNode,
+                                             CORBA::Boolean DuplicateElements)
   throw (SALOME::SALOME_Exception)
 {
   SMESH_TRY;
   initData();
 
   const SMDS_MeshNode* aNode = getMeshDS()->FindNode(IDOfNode);
-  SMDS_MeshElement* elem = getMeshDS()->Add0DElement(aNode);
+  SMDS_ElemIteratorPtr it0D = aNode->GetInverseElementIterator( SMDSAbs_0DElement );
+  
+  SMDS_MeshElement* elem = 0;
+  if ( DuplicateElements || !it0D->more() )
+    elem = getMeshDS()->Add0DElement(aNode);
 
   // Update Python script
   TPythonDump() << "elem0d = " << this << ".Add0DElement( " << IDOfNode <<" )";
@@ -1243,11 +1248,11 @@ CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces (const SMESH::long_ar
 
 //=============================================================================
 //
-// \brief Create 0D elements on all nodes of the given object except those 
-//        nodes on which a 0D element already exists.
+// \brief Create 0D elements on all nodes of the given object.
 //  \param theObject object on whose nodes 0D elements will be created.
 //  \param theGroupName optional name of a group to add 0D elements created
 //         and/or found on nodes of \a theObject.
+//  \param DuplicateElements to add one more 0D element to a node or not.
 //  \return an object (a new group or a temporary SMESH_IDSource) holding
 //          ids of new and/or found 0D elements.
 //
@@ -1255,7 +1260,8 @@ CORBA::Long SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces (const SMESH::long_ar
 
 SMESH::SMESH_IDSource_ptr
 SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
-                                               const char*               theGroupName)
+                                               const char*               theGroupName,
+                                               CORBA::Boolean            theDuplicateElements)
   throw (SALOME::SALOME_Exception)
 {
   SMESH_TRY;
@@ -1266,7 +1272,7 @@ SMESH_MeshEditor_i::Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObje
 
   TIDSortedElemSet elements, elems0D;
   if ( idSourceToSet( theObject, getMeshDS(), elements, SMDSAbs_All, /*emptyIfIsMesh=*/1))
-    getEditor().Create0DElementsOnAllNodes( elements, elems0D );
+    getEditor().Create0DElementsOnAllNodes( elements, elems0D, theDuplicateElements );
 
   SMESH::long_array_var newElems = new SMESH::long_array;
   newElems->length( elems0D.size() );
index ab953091e279df55263738538b9012936d602461..dd1212d8c602ee089d674495ced42429d2c3b727 100644 (file)
@@ -108,7 +108,7 @@ public:
    */
   CORBA::Long AddNode(CORBA::Double x, CORBA::Double y, CORBA::Double z)
     throw (SALOME::SALOME_Exception);
-  CORBA::Long Add0DElement(CORBA::Long IDOfNode)
+  CORBA::Long Add0DElement(CORBA::Long IDOfNode, CORBA::Boolean DuplicateElements)
     throw (SALOME::SALOME_Exception);
   CORBA::Long AddBall(CORBA::Long IDOfNodem, CORBA::Double diameter)
     throw (SALOME::SALOME_Exception);
@@ -134,11 +134,13 @@ public:
    *  \param theObject object on whose nodes 0D elements will be created.
    *  \param theGroupName optional name of a group to add 0D elements created
    *         and/or found on nodes of \a theObject.
+   *  \param theDuplicateElements to add one more 0D element to a node or not
    *  \return an object (a new group or a temporary SMESH_IDSource) holding
    *          ids of new and/or found 0D elements.
    */
   SMESH::SMESH_IDSource_ptr Create0DElementsOnAllNodes(SMESH::SMESH_IDSource_ptr theObject,
-                                                       const char*               theGroupName)
+                                                       const char*               theGroupName,
+                                                       CORBA::Boolean            theDuplicateElements)
     throw (SALOME::SALOME_Exception);
 
   /*!
index e257a4d6bb3e836c0c2b4c79908a3735dcd65918..b82bbf55d1b3ecebe185f6e62d58e8c3cc9dcd84 100644 (file)
@@ -2264,6 +2264,8 @@ class Mesh:
     #          idSrc.UnRegister()
     #  @ingroup l1_auxiliary
     def GetIDSource(self, ids, elemType = SMESH.ALL):
+        if isinstance( ids, int ):
+            ids = [ids]
         return self.editor.MakeIDSource(ids, elemType)
 
 
@@ -2828,10 +2830,11 @@ class Mesh:
 
     ## Creates a 0D element on a node with given number.
     #  @param IDOfNode the ID of node for creation of the element.
+    #  @param DuplicateElements to add one more 0D element to a node or not
     #  @return the Id of the new 0D element
     #  @ingroup l2_modif_add
-    def Add0DElement(self, IDOfNode):
-        return self.editor.Add0DElement(IDOfNode)
+    def Add0DElement( self, IDOfNode, DuplicateElements=True ):
+        return self.editor.Add0DElement( IDOfNode, DuplicateElements )
 
     ## Create 0D elements on all nodes of the given elements except those 
     #  nodes on which a 0D element already exists.
@@ -2840,18 +2843,19 @@ class Mesh:
     #         of nodes IDs created by calling mesh.GetIDSource( nodes, SMESH.NODE )
     #  @param theGroupName optional name of a group to add 0D elements created
     #         and/or found on nodes of \a theObject.
+    #  @param DuplicateElements to add one more 0D element to a node or not
     #  @return an object (a new group or a temporary SMESH_IDSource) holding
     #          IDs of new and/or found 0D elements. IDs of 0D elements 
     #          can be retrieved from the returned object by calling GetIDs()
     #  @ingroup l2_modif_add
-    def Add0DElementsToAllNodes(self, theObject, theGroupName=""):
+    def Add0DElementsToAllNodes(self, theObject, theGroupName="", DuplicateElements=False):
         unRegister = genObjUnRegister()
         if isinstance( theObject, Mesh ):
             theObject = theObject.GetMesh()
-        if isinstance( theObject, list ):
+        elif isinstance( theObject, list ):
             theObject = self.GetIDSource( theObject, SMESH.ALL )
             unRegister.set( theObject )
-        return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName )
+        return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName, DuplicateElements )
 
     ## Creates a ball element on a node with given ID.
     #  @param IDOfNode the ID of node for creation of the element.