Personal tools
You are here: Home Forum How to use Salome? Inconsistent behaviour of Python TUI in Salome 5.1.4

Inconsistent behaviour of Python TUI in Salome 5.1.4

Up to How to use Salome?

Inconsistent behaviour of Python TUI in Salome 5.1.4

Posted by JMB at August 12. 2010

Hello,

 

I have observed often what appears to be illogical behaviour when using Salome's TUI scripts.  Today on my setup for Salome 5.1.4. a perfectly simple illustration taken from the user manual worked when run as a batch script file, but crashed when I cut and pasted each line into the Python Console!  I tried this small script:

 

import SMESH_mechanic

smesh  = SMESH_mechanic.smesh

mesh   = SMESH_mechanic.mesh

salome = SMESH_mechanic.salome

 

# Get ids of all faces with area > 100

aFilter = smesh.GetFilter(smesh.FACE, smesh.FT_Area, smesh.FT_MoreThan, 100.)

anIds = mesh.GetIdsFromFilter(aFilter)

 

# create a group consisting of faces with area > 100

aGroup = mesh.MakeGroupByIds("Area > 100", smesh.FACE, anIds)

salome.sg.updateObjBrowser(1)

 

It has been taken from the TUI user manual.  I pasted this code into a file (say Test.py) then ran it in a Salome using [Ctrl-T] as batch file.  It worked fine.  Next I opened a new Salome session and cut and pasted each command line (one by one) into the Python Console and it crashed at about the 5 or 6th line.  At least it happened to me a few times and I have attached a screenshot so somebody does not think my imagination is getting the better of me.  At another time it works fine.  Inconsistent behaviour of this nature is aggravating and detracts from the ultimate goal of getting useful simulations done.  I don't know how I can help in re-creating the problem, but it appears that the code needs some top down review process for robustness.

 

Notice that after the import SMESH_mechanic there is no display of the nodes, elements, etc. that should normally appear.  That may give a clue to the source of the problem.   I hope someday, somebody can shed some light into this.  Thanks.

 

JMB

 

PS: If the image appears to small to see, that's because I needed to scale it down to fit the 100K file size limit that this forum specifies.  And yes I tried all kinds of compression methods (zip, bz2, tar.gz, 7zip) but could not squeeze it down from 190K to less than 100KB without using Gimp to physically reduce the size of the image!

Attachments

Re: Inconsistent behaviour of Python TUI in Salome 5.1.4

Posted by pierre_j at August 12. 2010

Hi JMB,

A question: could the "apparent randomness" ot the bug apparition be related to the apparition frequency of the bug you previoulsy noticed regarding python plug-in management in Salome: it works once, but not twice in the same study?

Bests,

Pierre

Re: Inconsistent behaviour of Python TUI in Salome 5.1.4

Posted by JMB at August 12. 2010

Previously pierre_j wrote:

Hi JMB,  A question: could the "apparent randomness" ot the bug apparition be related to the apparition frequency of the bug you previoulsy noticed regarding python plug-in management in Salome: it works once, but not twice in the same study?

Bests, Pierre

Hello pierre_j,

That is a good question, which I did not test for.  It was late in the night.  I will try it as and when I get the time, but it is an avenue to examine for all of us.  Thank you for your suggestion!

Regards,

JMB

Powered by Ploneboard
Document Actions