Salome multi-body meshes form CAD files with python script

Mesh generators, CAD programs, and other tools
Post Reply
rainer.ochs
Posts: 22
Joined: 19 Oct 2012, 01:24
Antispam: Yes

Salome multi-body meshes form CAD files with python script

Post by rainer.ochs » 21 Nov 2012, 01:03

There is a description in the Wiki how to create a multi-body mesh with Salome. This works perfectly but assumes that the geometry is defined within Salome. And the process is fairly complicated including several steps.

I found that the process also works when the bodies are loaded into Salome from CAD files, usually IGES or STEP. This allows to generate the geometry in a graphical program of your choice that can write IGES or STEP and then mesh them in Salome. (I use SketchUp with an IGES export Plug-In to define my models)

To make the complicated process easier I have created a Python script that automates it.
Just edit a copy of the script to import your bodies and start it within Salome. (or start Salome with the script as a parameter) The script does the rest.

If the bodies are saved to separate CAD files the order of import also defines their index in the mesh. The boundaries however have only one index so the boundaries have to be separated in elmerGrid. The resulting mesh.unv can be opened in elmerGrid. To split the surface select it and use "Divide Surfaces" at an angle of 70 degrees. The mesh can then be saved in elmer format.

One Problem of Salome is that it is not very stable in a Windows environment. Starting up the GUI modules results in frequent crashes and even blue-screens.
The good news is that with the script this does not happen, at least at my computer. I start "run_salome.bat" with the script as a parameter. After the script finished I close down Salome immediately and restart it if needed in the same way. In this mode of operation it works reliably without crashes.

Rainer
Attachments
cad_import.zip
cad import and meshing script
(1.82 KiB) Downloaded 268 times

Takala
Posts: 182
Joined: 23 Aug 2009, 23:59

Re: Salome multi-body meshes form CAD files with python script

Post by Takala » 08 May 2013, 14:41

Very nice and simple.

Have you considered using filters to create the groups. You can do this in the mesh module (http://docs.salome-platform.org/salome_ ... _page.html).

The filter methods are quite extensive. You can filter a face, for example, using geometric properties: for example "those face elements which are in geometry B but not in geometry A".

However, I don't recommend the use of filters when the number of elements gets too high (in 3D this is usually the case): the filters are very slow...

Cheers,

Eelis

dymaxionkim
Posts: 2
Joined: 21 May 2015, 08:53
Antispam: Yes

Re: Salome multi-body meshes form CAD files with python script

Post by dymaxionkim » 02 Sep 2017, 12:51

Thank you!
This script save my time so much.

I modified it to excecute on terminal interactively like this :
https://github.com/dymaxionkim/ElmerFEM ... cad_import

And I rescript it to 'step2unv'
https://github.com/dymaxionkim/ElmerFEM ... t_STEP2UNV
This script can ...
(1) read sigle STEP file including multi solids
(2) devide every solids
(3) group external surfaces by each solids except contact others
(4) group intersection surfaces between each solids
(5) But it cannot handle interferenced solids

annier
Posts: 1090
Joined: 27 Aug 2013, 13:51
Antispam: Yes

Re: Salome multi-body meshes form CAD files with python script

Post by annier » 18 Sep 2017, 12:16

Kim,
Your works on creating an overall simulation environment with Elmer FEM software (in context of using external preprocessors and postprocessors tools) is remarkable. Hats off to your efforts.

Yours Sincerely,
Anil Kunwar

Post Reply