

In this example we will generate a mesh for following domain: Therefore you need to edit the msim_python.m file ans specify the path: arcpy_path = 'c:\Python27\ArcGIS10.2\' In our example this was the folder 'c:\Python27\ArcGIS10.2\'. To be able to run Arcpy commands one has to define inside the script the executable of Arcpy. This function is used to execute python scripts from Matlab. In the folder mUtil there is a function named msim_python. Note that the script is called from Matlab.
#Create mesh tutorial gmsh series
To use the ARCGIS we have written a small python script that executes a series of ARCGIS commands. ARCGIS has its own GUI, nevertheless all its functionalities can be scripted in several languages (python, C++, VBA etc.). Assuming that the complex domain is descibed by shapefiiles (this was our case) we use the functions of ARCGIS to create quite fast a CSG object. Because we have dealt with this situation, where the class CGSobj_v2 takes very long to create the CGS object, we use ARCGIS to overcome this. However for very complex problems it becomes very inefficient and time consuming. For problems with features on the order of several thousands the class CGSobj_v2 is quite fast. However the methods of this class perform many checks every time a new line or point is added to the geometry.
#Create mesh tutorial gmsh how to
In the previous example we explained how to create the Gmsh input file using the mSim Matlab class CGSobj_v2. However, in order to process automatically, it seems that considerable ingenuity is required to recognize the face number.| main | Tutorials | Functions | website | When cutting the mesh into the shape brought from CAD, depending on the application, it seems that the compound surface will come into play. To see the selected face, you can select multiple Surfaces (Ctrl-click) in the Visibility window and press the Apply button for Visibility to check them on the screen.Įnumerate the face numbers and specify them as follows (I also added the chamfer inside the hole to the explanatory figure above.) )Ĭompound Surface Tools - Select the Geometry panel in Options and check Curves, Surfaces, and Surface labels to display the shape and face numbers. In situations where the mesh does not cut off in the first place with more complex shapes, you may need to look for a Geometry label. Select Visibility, click Surface 1 (your selection won't take effect at that stage), and then use the down arrow key to switch between the selection elements to figure out the number. To specify a compound surface, you need to know the face number assigned to the Geometry Surface when you import the CAD. In this example, a small mesh is created at the sharp angle of a small yellow-green triangle, and Compound surface comes into play when you want to avoid creating a small mesh at the expense of shape reproducibility. You can load this file into the gmsh GUI and press 2D under Mesh to create a mesh like this: (In my installation 4.8.4, keyboard 2 was the shortcut key to this 2D meshing.), If you want the surface elements to appear colored, select the Mesh panel in Tools > Options and select the Mesh panel and select the 2D element You may need to check Faces.
