[BUG] Bug in Python command for merging coincident nodes

Hello!

I just noticed the following behaviour in Salome 9.12.
I loaded a mesh in the mesh module, then did Modification → Transformation → Merge nodes, picked some options, Apply and close and finally I dumped the study to a Python script. The generated script is

#!/usr/bin/env python

###
### This file is generated automatically by SALOME v9.12.0 with dump python functionality
###

import sys
import salome

salome.salome_init()
import salome_notebook
notebook = salome_notebook.NoteBook()

###
### SMESH component
###

import  SMESH, SALOMEDS
from salome.smesh import smeshBuilder

smesh = smeshBuilder.New()
#smesh.SetEnablePublish( False ) # Set to False to avoid publish in study if not needed or in some particular situations:
                                 # multiples meshes built in parallel, complex and numerous mesh edition (performance)

volumeMesh_unv = smesh.CreateMeshesFromUNV(r'volumeMesh.unv')
coincident_nodes_on_part = volumeMesh_unv.FindCoincidentNodesOnPart( [ volumeMesh_unv ], 0.0005, [], 0 )
volumeMesh_unv.MergeNodes([[ 45, 148551 ], [ 733, 145412 ], [ 1719, 147210 ], [ 1720, 1721, 147211 ], [ 1856, 147451 ], [ 1939, 147618 ], [ 2095, 148374 ], [ 3244, 3823, 152716 ], [ 3816, 152624 ], [ 3817, 3818, 152625 ], [ 4774, 153716 ], [ 9217, 160695 ], [ 18093, 18094, 179927 ], [ 19823, 242165 ], [ 21227, 21656, 270471 ], [ 22274, 22275, 283168 ], [ 23008, 23740, 322020 ], [ 24409, 24410, 342136 ], [ 38742, 742012 ], [ 39651, 745118 ], [ 41568, 748548 ], [ 41573, 748550 ], [ 53066, 53566, 1040389 ], [ 53927, 1041092 ], [ 54541, 1042399 ], [ 54542, 54543, 1042400 ], [ 54979, 54980, 1043306 ], [ 55473, 1045539 ], [ 56892, 1047330 ], [ 57431, 57435, 57648, 1049187, 1049188 ], [ 57436, 1049186 ], [ 57949, 1050887 ], [ 60269, 1309207 ], [ 60277, 1309203 ], [ 61966, 1097152 ], [ 63005, 1119192 ], [ 63006, 63007, 1119193 ], [ 63591, 1128717 ], [ 64315, 1141511 ], [ 65888, 65889, 1176049 ], [ 66646, 66647, 1193706 ], [ 68126, 68127, 1233977 ], [ 68485, 1241319 ], [ 68486, 68487, 1241320 ], [ 69051, 69856, 1266955 ], [ 69848, 1287054 ], [ 69852, 1287053 ], [ 81511, 81922, 1398442 ], [ 81515, 1398441 ], [ 81914, 1398358 ], [ 82827, 1417968 ], [ 82828, 82829, 1417969 ], [ 83371, 1432331 ], [ 84468, 84469, 1464904 ], [ 84985, 1497513 ], [ 86293, 1535836 ], [ 87482, 88269, 1574215, 1574216 ], [ 96660, 102682, 1880392 ], [ 97698, 97699, 1869472 ], [ 98025, 1870172 ], [ 98026, 98027, 1870173 ], [ 98031, 1870178 ], [ 98374, 98724, 1871802 ], [ 98721, 1872557 ], [ 99056, 1872465 ], [ 99732, 1874661 ], [ 100013, 100014, 1874581 ], [ 102129, 1879230 ], [ 112295, 112296, 2119491 ], [ 112893, 113118, 2121373 ], [ 113341, 2121771 ], [ 114006, 2124399 ], [ 115896, 2141798 ], [ 115899, 2129555 ], [ 115908, 115909, 2129623 ], [ 117564, 117568, 118084, 2170891, 2170892 ], [ 119116, 2193500 ], [ 119117, 119118, 2193501 ], [ 119119, 119120, 119121, 2193504, 2193505 ], [ 120719, 120720, 2229202 ], [ 121557, 121558, 2248390 ], [ 122432, 123073, 2278700, 2278701 ], [ 122438, 122439, 2265209 ], [ 123064, 123068, 123803, 2295961, 2295962 ], [ 131901, 131902, 2365656 ], [ 132947, 133249, 2405335 ], [ 134199, 134541, 2449331, 2449332 ], [ 134538, 2449269 ], [ 136298, 136299, 136300, 2512115, 2512116 ]], [], 1)
smesh.SetName(volumeMesh_unv, 'volumeMesh.unv')

where you can see that on the second-last line the script expanded the list of nodes to merge while the correct script should be

volumeMesh_unv = smesh.CreateMeshesFromUNV(r'volumeMesh.unv')
coincident_nodes_on_part = volumeMesh_unv.FindCoincidentNodesOnPart( [ volumeMesh_unv ], 0.0005, [], 0 )
volumeMesh_unv.MergeNodes(coincident_nodes_on_part, [], 1)
smesh.SetName(volumeMesh_unv, 'volumeMesh.unv')

reusing the computed variable.

1 Like

This is all around Salome dump, when entering in the function it enters a plain value instead of a variable. Is the variable and the value that enters the same? (or same in different order?)

escalated to core developers. thanks

1 Like

Hello Nabil,
this behavior happens also when you use a filter in geom that you finish with ids which is quite problematic. I am away from my pc, do you need an example or the description is already enough? If not I will post an example in a few days…