From: eap Date: Thu, 11 Aug 2016 17:13:30 +0000 (+0300) Subject: IMP 23201: Harmonisation of "0D Element" and "0D Elements on Element Nodes" X-Git-Tag: V8_1_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=commitdiff_plain;h=7c69e00bac6eb8b361a2dd2ba9d5f6f7aef9aa82 IMP 23201: Harmonisation of "0D Element" and "0D Elements on Element Nodes" --- diff --git a/doc/salome/gui/SMESH/images/add0delement.png b/doc/salome/gui/SMESH/images/add0delement.png index ed27488c9..06621cc24 100644 Binary files a/doc/salome/gui/SMESH/images/add0delement.png and b/doc/salome/gui/SMESH/images/add0delement.png differ diff --git a/doc/salome/gui/SMESH/images/dlg_0D_on_all_nodes.png b/doc/salome/gui/SMESH/images/dlg_0D_on_all_nodes.png index 842b3bb5b..78ac7c84a 100644 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 diff --git a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc index 173db3ce1..793525c02 100644 --- a/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc +++ b/doc/salome/gui/SMESH/input/adding_nodes_and_elements.doc @@ -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 Allow duplicate + elements to get several 0D elements on a node. Click the \b Apply or Apply and Close button. Your 0D elements will be created: \image html add_0delement.png @@ -109,6 +110,8 @@ In this dialog
  • Set Filter button allows selecting elements or nodes by filtering mesh elements or nodes with different criteria (see \ref filtering_elements "Filter usage").
  • +
  • Activate Allow duplicate elements to get several 0D + elements on a node.
  • Switching on Add to group 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 diff --git a/idl/SMESH_MeshEditor.idl b/idl/SMESH_MeshEditor.idl index 120e41e49..7cbe67bff 100644 --- a/idl/SMESH_MeshEditor.idl +++ b/idl/SMESH_MeshEditor.idl @@ -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); /*! diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx index f7fcec03e..1f4f42891 100644 --- a/src/SMESH/SMESH_MeshEditor.cxx +++ b/src/SMESH/SMESH_MeshEditor.cxx @@ -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() ); } } } diff --git a/src/SMESH/SMESH_MeshEditor.hxx b/src/SMESH/SMESH_MeshEditor.hxx index 5dd53807a..103e4a417 100644 --- a/src/SMESH/SMESH_MeshEditor.hxx +++ b/src/SMESH/SMESH_MeshEditor.hxx @@ -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, diff --git a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx index 6afe2708b..105568581 100644 --- a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.cxx @@ -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" ), diff --git a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h index e4664bf3f..b65c8c5ca 100644 --- a/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h +++ b/src/SMESHGUI/SMESHGUI_Add0DElemsOnAllNodesDlg.h @@ -31,13 +31,14 @@ #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 diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx index 00f8467b2..3994a40b0 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.cxx @@ -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& 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& i = SMDS_MeshCell::reverseSmdsOrder( myGeomType ); if ( i.empty() ) // polygon diff --git a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h index 5bf71e371..5325d267f 100644 --- a/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h +++ b/src/SMESHGUI/SMESHGUI_AddMeshElementDlg.h @@ -111,7 +111,7 @@ private: QLabel* TextLabelC1A1; QPushButton* SelectButtonC1A1; QLineEdit* LineEditC1A1; - QCheckBox* Reverse; + QCheckBox* ReverseOrDulicate; SMESHGUI_SpinBox* DiameterSpinBox; QString myHelpFileName; diff --git a/src/SMESHGUI/SMESH_msg_en.ts b/src/SMESHGUI/SMESH_msg_en.ts index 55a8f48b0..ad18b5d33 100644 --- a/src/SMESHGUI/SMESH_msg_en.ts +++ b/src/SMESHGUI/SMESH_msg_en.ts @@ -1241,6 +1241,10 @@ Please enter correct values and try again SMESH_ADD_ELEM0D_TITLE Add 0D Element + + SMESH_DUPLICATE_0D + Allow duplicate elements + SMESH_ADD_BALL Add Ball Element @@ -4389,6 +4393,14 @@ It can't be deleted Export Fields + + SMESHGUI_AddMeshElementDlg + + NB_ADDED + %1 elements have been added since 0D +elements already present on the selected nodes. + + SMESHGUI_Dialog diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index f9fb06334..a99acd2f6 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -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() ); diff --git a/src/SMESH_I/SMESH_MeshEditor_i.hxx b/src/SMESH_I/SMESH_MeshEditor_i.hxx index ab953091e..dd1212d8c 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.hxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.hxx @@ -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); /*! diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py index e257a4d6b..b82bbf55d 100644 --- a/src/SMESH_SWIG/smeshBuilder.py +++ b/src/SMESH_SWIG/smeshBuilder.py @@ -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.