MoiseRousseau / SALOME-Voronoi

Interface between Salome and Vorpalite for polyhedral mesh generation
GNU General Public License v3.0
16 stars 2 forks source link

Exception occured error in Salome #1

Closed aw-96 closed 8 months ago

aw-96 commented 3 years ago

Hi,

I am interested in using the plugin for CFD mostly. I have installed geogram library and add the plugin in Salome. However, when try to convert a net-gen generated 3D mesh, I get an Exception occured error.

----------------------------------------------------------------------------------------------------------------------------------------------

Traceback (most recent call last): File "~/salome/appli_V8_4_0/lib/python2.7/site-packages/salome/salome_pluginsmanager.py", line 233, in handler script(Context(sgPyQt)) File "~/.config/salome/Plugins/Voronoi_converter.py", line 156, in convertForCVTCalculation boundary = smesh.Mesh(window.surface) File "~/salome/appli_V8_4_0/lib/python2.7/site-packages/salome/salome/smesh/smeshBuilder.py", line 418, in Mesh return Mesh(self,self.geompyD,obj,name) File "`~/salome/appli_V8_4_0/lib/python2.7/site-packages/salome/salome/smesh/smeshBuilder.py", line 1263, in init self.geom = self.mesh.GetShapeToMesh() AttributeError: 'int' object has no attribute 'GetShapeToMesh'

----------------------------------------------------------------------------------------------------------------------------------------------

Can you kindly please assist?

Kind Regards

MoiseRousseau commented 3 years ago

HI, Can you please provide more information on the problem ? What version of Salome are you running ? Did you modify the plugin ? Did you use the latest commit ? Note that the plugin was not tested for Salome version under 9.2 because it updated from Python 2 to Python 3. Can you provide your input meshes in MED format (if not so heavy) ? Thanks, Moise

aw-96 commented 3 years ago

Hi,

I have both Salome V8.4 and Salome V9.5 I have not modified the plugin. I tested vorpalite through the terminal and it does convert a tetrahedron mesh created in salome and exported as a .mesh file although the output from vorpalite. I have attached two images. The poly mesh was generated using vorpalite through the terminal with output in .obj form (not that usable for OpenFOAM). The tet mesh is the source mesh in salome. I have also attached .zip file of the .med file.

Mesh-pic-poly Mesh-pic-tet

Here is the code snippet in smesh python file:

-----------------------------------------------------------------------------------------

Convert tetra mesh to Voronoi mesh

try: import sys pathToPlugin = "~/Applications/Salome-Voronoi/SALOME-Voronoi/" sys.path.append(pathToPlugin)

import Voronoi_converter
salome_pluginsmanage.AddFunction(
    "Voronoi/Convert to Voronoi",
    " ",
    Voronoi_converter.convertForCVTCalculation
)

except Exception as e: salome_pluginsmanager.logger.info('Error: Convert to Voronoi is unavailable:{}'.format(e)) pass

---------------------------------------------------------------------------------------

The error occurred on Salome V8.4 and Salome V9.5. Here is the same errror on version V8.5: Mesh_1.zip

---------------------------------------------------------------------------------------

Traceback (most recent call last): File "~/Applications/Salome/SALOME-9.5.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 "~/Applications/Salome-Voronoi/SALOME-Voronoi/Voronoi_converter.py", line 146, in convertForCVTCalculation boundary = smesh.Mesh(window.surface) File "~/Applications/Salome/SALOME-9.5.0-UB18.04-SRC/BINARIES-UB18.04/SMESH/lib/python3.6/site-packages/salome/salome/smesh/smeshBuilder.py", line 462, in Mesh return Mesh(self, self.geompyD, obj, name) File "~/Applications/Salome/SALOME-9.5.0-UB18.04-SRC/BINARIES-UB18.04/SMESH/lib/python3.6/site-packages/salome/salome/smesh/smeshBuilder.py", line 1616, in init self.geom = self.mesh.GetShapeToMesh() AttributeError: 'int' object has no attribute 'GetShapeToMesh'

---------------------------------------------------------------------------------------

MoiseRousseau commented 3 years ago

Hi,

Unfortunately, I could not replicate the problem in my Salome installation, and the Voronoi diagram is computed successfully from the mesh you provide.

The error seems to be raised when loading the surface mesh, where the variable 'window.surface' is a integer and not a mesh object. Can you copy paste the following instruction in the TUI with your mesh selected in the object browser and send it to me ? obj = salome.sg.getSelected(0) #select mesh from TUI print(obj) i = salome.IDToObject(obj) #convert to meshproxy object print(i) smesh = salome.smesh.smeshBuilder.New() #load smesh instance print(smesh) smesh.Mesh(i) #convert to mesh

For instance, you could have a look at meshio to convert the obj mesh from Vorpalite to various format. However, I don't know if it support polyhedral meshes...

Moise

aw-96 commented 3 years ago

Hi,

Ok, I will do that and reply to you.

Regards

On Mon, Nov 23, 2020 at 5:30 PM MoiseRousseau notifications@github.com wrote:

Hi,

Unfortunately, I could not replicate the problem in my Salome installation, and the Voronoi diagram is computed successfully from the mesh you provide.

The error seems to be raised when loading the surface mesh, where the variable 'window.surface' is a integer and not a mesh object. Can you copy paste the following instruction in the TUI with your mesh selected in the object browser and send it to me ? obj = salome.sg.getSelected(0) #select mesh from TUI print(obj) i = salome.IDToObject(obj) #convert to meshproxy object print(i) smesh = salome.smesh.smeshBuilder.New() #load smesh instance print(smesh) smesh.Mesh(i) #convert to mesh

For instance, you could have a look at meshio to convert the obj mesh from Vorpalite to various format. However, I don't know if it support polyhedral meshes...

Moise

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MoiseRousseau/SALOME-Voronoi/issues/1#issuecomment-732234006, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMKY74LC55YZG7ETJ3T2BTSRJ5ZBANCNFSM4T4V2N6Q .

aw-96 commented 3 years ago

Hi,

Here is the output after applying the instructions you sent.

#

#

obj = salome.sg.getSelected(0) #select mesh from TUI print(obj) 0:1:3:3 i = salome.IDToObject(obj) #convert to meshproxy object print(i) <omniORB.CORBA.Object object at 0x558d592dbbe8> smesh = salome.smesh.smeshBuilder.New() #load smesh instance Traceback (most recent call last): File "", line 1, in AttributeError: module 'salome' has no attribute 'smesh' print(smesh) Traceback (most recent call last): File "", line 1, in NameError: name 'smesh' is not defined #

#

Regards

On Mon, Nov 23, 2020 at 5:57 PM Andani siavhe awvenda@gmail.com wrote:

Hi,

Ok, I will do that and reply to you.

Regards

On Mon, Nov 23, 2020 at 5:30 PM MoiseRousseau notifications@github.com wrote:

Hi,

Unfortunately, I could not replicate the problem in my Salome installation, and the Voronoi diagram is computed successfully from the mesh you provide.

The error seems to be raised when loading the surface mesh, where the variable 'window.surface' is a integer and not a mesh object. Can you copy paste the following instruction in the TUI with your mesh selected in the object browser and send it to me ? obj = salome.sg.getSelected(0) #select mesh from TUI print(obj) i = salome.IDToObject(obj) #convert to meshproxy object print(i) smesh = salome.smesh.smeshBuilder.New() #load smesh instance print(smesh) smesh.Mesh(i) #convert to mesh

For instance, you could have a look at meshio to convert the obj mesh from Vorpalite to various format. However, I don't know if it support polyhedral meshes...

Moise

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MoiseRousseau/SALOME-Voronoi/issues/1#issuecomment-732234006, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMKY74LC55YZG7ETJ3T2BTSRJ5ZBANCNFSM4T4V2N6Q .

MoiseRousseau commented 3 years ago

I can reproduce your problem. It seems that in your installation, the module smeshBuilder is not properly imported. Can you add the following line in your smesh_plugin.py file and retry: from salome.smesh import smeshBuilder

aw-96 commented 3 years ago

Thank you, I will do that.

I will send you a response immediately afterwards adding the line. I am currently not with the PC that has all the files.

Thanks for your response

On Tue, Nov 24, 2020 at 5:50 PM MoiseRousseau notifications@github.com wrote:

I can reproduce your problem. It seems that in your installation, the module smeshBuilder is not properly imported. Can you add the following line in your smesh_plugin.py file and retry: from salome.smesh import smeshBuilder

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MoiseRousseau/SALOME-Voronoi/issues/1#issuecomment-733062088, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMKY74IPV4XZC27OXFLQ33SRPI3RANCNFSM4T4V2N6Q .

MoiseRousseau commented 3 years ago

Did you finally get the time to test the fix ? I would like to update the README to prevent other to have the same problem.

aw-96 commented 3 years ago

I did, I still get the same error. I tried to implement a script that does not require the use of gui but the same error still occurs. The main reason is my smeshBuilder is not instantiating the mesh data member at line 1568 in the class Mesh in the smeshBuilder.py The resulting calls on an smesh builder still have mesh object value of 0. Its probably due to the installation of salome v9.5 I might have to re-installing and install again.

Kind Regards AW

On Mon, Dec 7, 2020 at 11:51 PM MoiseRousseau notifications@github.com wrote:

Did you finally get the time to test the fix ? I would like to update the README to prevent other to have the same problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MoiseRousseau/SALOME-Voronoi/issues/1#issuecomment-740201408, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANMKY7ZBBQWV5W7RFZ75FS3STVE6HANCNFSM4T4V2N6Q .