Personal tools
You are here: Home Forum How to use Salome? [enhancement request] GEOM: preserving IDs after modification

[enhancement request] GEOM: preserving IDs after modification

Up to How to use Salome?

[enhancement request] GEOM: preserving IDs after modification

Posted by Cacciatorino at November 24. 2012

Related to the GEOMETRY module:

Currently, a new entity in the model tree is created as consequence of every operation in the geometry: adding a fillet, making a partition, making an hole etc. In my opinion, it could be better to leave to the user the final decision if every operation will create a new entity or not.


I have a solid and I create the mesh on it, with groups, submeshes, etc etc. Then I run the FEM analysis and after this, I want to modify the solid and update the related mesh to check what happen if I add an hole in a plate or a chamfer on an edge, as an example. With the normal behavior of the geometry module, I need to rebuild from scratch the whole mesh (and may be the solid model), just because I wanted to add the hole or the chamfer. If Salome was able to keep the existing entity after modification, it could be easier to study more alternative during analysis.

Windows-based CAD solid modeler work in this way: when a single solid is modified, the IDs of existing faces and bodies are preserved, so the constrains in assembly environments are preserved too.


Re: [enhancement request] GEOM: preserving IDs after modification

Posted by GĂ©rald NICOLAS at January 07. 2013

I do agree with this proposal. When groups are defined with the Ids of the structure, it's very difficult to make any modification: every thing has to be redefined. Hard work.

Re: [enhancement request] GEOM: preserving IDs after modification

Posted by William Tougeron at January 07. 2013


You can do such things thanks to my script: cfdmsh.

I initially developed this little script to accelerate the 2D viscous layer meshing for hybrid meshes. But I added also some functions to make Salome more flexible.

I give an example:

First, you install my script, then you type in the Python console import cfdmsh after opening a study. (or from cfdmsh import *)

Then, you create a geometry and create groups on it.

Then, you make a modification in the geometry.

Now, you can "copy" all the groups which weren't modify (regardless their IDs) from the first object to the other by typing: cfdmsh.CopyGeometricalGroups('Object_1','Object_2') (remove "cfdmsh." if you typed first from cfdmsh import * instead of import cfdmsh).

Then you just have to correct manually the groups which were impacted by your modification.

After that, you will have to apply on this new geometry all your mesh and submesh parameters.

You can first export the name of all algorithms/hypotheses you used in your first mesh and the name of its groups in a file by typing: cfdmsh.ExportMeshConfiguration('Mesh_1','meshConfigFileName'). It requires first to have a different name for all your hypotheses! (but this is not a big problem to check/fix it).

After, you can import this file in the mesh you created on your new geometry by typing: cfdmsh.ImportMeshConfiguration('Mesh_2','meshConfigFileName'). Like this, your algorithms/hypotheses will be applied to your new mesh. Also, the script will try to create "groups from geometry" by looking for geometrical groups having the same name as the mesh groups visible in the file.

Then you just have to correct manually the hypotheses which require special data like the orientation of edges (Nb. Segments), or the base vertexes (Quadrangle), and rebuild groups which weren't made "from geometry".

Of course, this is not perfect, but since I developed it I can't imagine how I did before: I can save a lot of time when modifying a mesh.

Finally, you can also export and import geometrical group IDs in files, using cfdmsh.ExportGeometricalGroups('Object_1','groupFileName') and cfdmsh.ImportGeometricalGroups('Object_1','groupFileName'). This is useful when you want to change only few parameters in several geometries (for example during optimization studies), or when you want to start a new study and import a geometry with its groups.

All is explained in the tutorials which are in the HTML documentation downloaded with the script.

Hope you will find it also useful :)


Powered by Ploneboard
Document Actions