Hello,
when we set a viscous layer hypothesis, we set a total thickness, lets say 1. sometimes the addition of the viscous layer does not achieve the desired thickness but a smaller one, for example:
“- “NETGEN_3D_3” on SOLID #2 - Warning. Thickness 0.015 of viscous layers not reached, average reached thickness is 0.000904799”
how can I get this ‘0.000904799’ value in the script itself?
I checked my mesh object properties, the Viscous_Layers (from NETGEN_3D.ViscousLayers), isDone and NETGEN_3D from the compute of the mesh and nothing that could help me solve this.
or at least get a boolean that there was an issue (warning) during the computation of the mesh? as isDone will be equal to True even if the viscous layer does not achieve the desired thickness.
and as bonus question: how can I hide in the object browser a mesh object? (similar to geompy.hideInStudy(geomObject)) as there is no smesh.hideInStudy()
thanks in advance
Hello Franco.
Indeed there is no interface to get the average thickness achieved by the viscous layer in SMESH. You can try to get the warning with the follow code snip in python.
import sys
stdout = sys.stdout
from io import StringIO
s = StringIO()
sys.stdout = s
##Call mesh.Compute()
sys.stdout = stdout
s.seek(0)
#Print the content of the internal emit warning.
print(s.read())
For your second question, there is the method SetEnablePublish( Bool )
implemented in smeshBuilder. Call with False if you don’t want to publish your mesh into the object browser, in case you want to publish certain objects or not, alternate between calls to this method with True/False and the Compute method.
Hope it helps.
Regards,
Cesar
1 Like
Hello Cesar,
regarding the publishing of meshes.
how can I remove an already published mesh?
if there is a simple way to do exactly what I am looking for I would also take it:
I have a geom object, I run a script which creates several objects, and defines some algos and hypothesis in mesh and also create a mesh.
I would like to if I re run the script, it will delate everything (objects created in geom and mesh (with the hypothesis and algos included)) so for the moment at least the geom objects I can hide them but i dont know how to do this for the mesh side (i could simply reset completly the mesh module while re running it if it is possible)
thanks in advance
Hello @cconopoima,
sorry for bothering, but couldnt find a solution for this:
how can I remove an already published mesh?
I have found the smesh.RemoveMesh() which will remove a published mesh, but couldn’t find anything for the Hypothesis and Algorithms… (I am specially looking for removing previously defined Hypothesis)
is this faisable? I can see that each element has an ID but from the ID I don’t have much to do with…
thanks in adnvace
Hello,
to remove an hypothesis or an algorithm from a mesh, you can use
Mesh_1.RemoveHypothesis(NETGEN_1D_2D)
Mesh_1.RemoveHypothesis(NETGEN_2D_Parameters_1)
Or to remove an object from the study (mesh, algorithm or hypothesis):
aStudyBuilder = salome.myStudy.NewBuilder()
theStudy = salome.myStudy
for obj in [Mesh_1.GetMesh(), NETGEN_1D_2D.GetAlgorithm(), NETGEN_2D_Parameters_1]:
SO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(obj))
if SO is not None:
aStudyBuilder.RemoveObjectWithChildren(SO)
Please have a look at test_remove_object.py (2,6 Ko).
Christophe
1 Like