Personal tools
You are here: Home Forum Use Python command SetNodeOnEdge fail with error Invalid paramOnEdge

Python command SetNodeOnEdge fail with error Invalid paramOnEdge

Up to Use

Python command SetNodeOnEdge fail with error Invalid paramOnEdge

Posted by Moise Rousseau at February 05. 2020

Hi all,

I experience some problems with Salome 9.4 on Ubuntu 19.10. I try to make a Python plugin that create a Voronoi tesselation providing the Voronoi seed and the mesh boundary. I successfully create and importing the tesselation, and now I would like to assign nodes and elements to GEOM shapes to use other mesh algorithms (projection 1D-2D for example).

My plugin can assign nodes and elements for various basic shape, such as box, cylinder, torus, as well as GEOM/SHAPER construction (a box cut by a cylinder for example). Yet, I experience problems with the sphere basic object. I provide a Python dump for reproducing the error. The error is I can not assign any nodes on the edge nammed "Arc_1", with the function "SetNodeOnEdge' returning the error "Invalid paramOnEdge":

Traceback (most recent call last):
  File "/home/moise/Ecole/SALOME-9.4.0-UB18.04-SRC/BINARIES-UB18.04/SMESH/lib/python3.6/site-packages/salome/salome/smesh/smeshBuilder.py", line 4240, in SetNodeOnEdge
    self.editor.SetNodeOnEdge(NodeID, EdgeID, paramOnEdge)
  File "/home/moise/Ecole/SALOME-9.4.0-UB18.04-SRC/BINARIES-UB18.04/SMESH/lib/python3.6/site-packages/salome/SMESH_MeshEditor_idl.py", line 512, in SetNodeOnEdge
    return self._obj.invoke("SetNodeOnEdge", _0_SMESH.SMESH_MeshEditor._d_SetNodeOnEdge, args)
SALOME.SALOME_Exception: SALOME.SALOME_Exception(details=SALOME.ExceptionStruct(type=BAD_PARAM, text='Invalid paramOnEdge', sourceFile='/volatile/salome/jenkins/workspace/Salome9_UB18/SALOME-9.4.0-UB18.04/SOURCES/SMESH/src/SMESH_I/SMESH_MeshEditor_i.cxx', lineNumber=1393))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/moise/Ecole/SALOME-9.4.0-UB18.04-SRC/BINARIES-UB18.04/GUI/lib/python3.6/site-packages/salome/salome_pluginsmanager.py", line 238, in handler
    script(Context(sgPyQt))
  File "<string>", line 183, in convertForCVTCalculation
  File "/home/moise/.config/salome/Plugins/Voronoi_Diagram/Voronoi_utils.py", line 163, in importLpCVT
    Vmesh.SetNodeOnEdge(nodes[i], grp_edges_surface[grp], 0.5)
  File "/home/moise/Ecole/SALOME-9.4.0-UB18.04-SRC/BINARIES-UB18.04/SMESH/lib/python3.6/site-packages/salome/salome/smesh/smeshBuilder.py", line 4242, in SetNodeOnEdge
    raise ValueError(inst.details.text)
ValueError: Invalid paramOnEdge

For this parameter, I choose a dummy value since I can't find its value easily (maybe you have a solution for this ?). Yet, using a dummy value, the function works well for other shape (I could provide you a Python dump if you need). Moreover, if we try to assign the node to another edge (like "Edge_1"), it works well.

Thus, can you help me to figure out what append ?

Thanks a lot !

Moise

Attachments

Re: Python command SetNodeOnEdge fail with error Invalid paramOnEdge

Posted by SMESH expert at February 05. 2020

Hello Moise

The exception is raised by the following code in SMESH_MeshEditor_i.cxx:1390

  Standard_Real f,l;
  BRep_Tool::Range( TopoDS::Edge( shape ), f,l);
  if ( paramOnEdge < f || paramOnEdge > l )
    THROW_SALOME_CORBA_EXCEPTION("Invalid paramOnEdge", SALOME::BAD_PARAM);

This means that the parameter should fall into a parametrization range of an edge. You can find this range out by using Mesh Info dialog applied to the Mesh_1 built by NETGEN. See image

There you can see that 7.3 is a valid parameter. Actually the parameter varies in the range [ 1.5 * PI, 2.5 * PI ]

Best regards

Edward

Re: Python command SetNodeOnEdge fail with error Invalid paramOnEdge

Posted by Moise Rousseau at February 11. 2020

Hi Edward,

Thanks for the hel !. My meshing works now !

Regards,

Moise

Powered by Ploneboard
Document Actions