# Problem import 3D file .msh

**URL:** <https://community.freefem.org/t/problem-import-3d-file-msh/684>\
**Category:** General Discussion\
**Created:** [December 12, 2020, 5:12pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684 "2020-12-12T17:12:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [December 12, 2020, 5:12pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/1 "2020-12-12T17:12:10Z")

</div>

hello,  
i’m trying to import 3D mesh from gmsh by using:  
load"gmsh"  
mesh3 Th=gmshload3(“Part1.msh”);  
plot(Th,cmm=“Th mesh read from GMSH”,wait=1);  
savemesh(Th,“Th3.mesh”);  
but it give me :  
edges in 3D mesh are not considered yet in freefem++, skeep data  
Element of type 0 is not considered in Freefem++  
can you help me to overcome this problem?

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [December 13, 2020, 8:41am UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/2 "2020-12-13T08:41:35Z")

</div>

We can’t help you without the `.geo` and how you generate your `.mesh`. My guess is that you exported all the physical entities, which is not needed. Also, I think this is mostly a warning, is your `Th3.mesh` actually wrong? What gives `ffmedit Th3.mesh`?

---

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [December 13, 2020, 4:46pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/3 "2020-12-13T16:46:04Z")

</div>

Thank you for your response .  
in order to import .msh file from gmsh to freefeem++ I do the folowing steps :  
1- i open the .stp file in gmsh

2- i add volume in physical groups, and i create .geo file :  
Merge “Part1.stp”;  
Physical Volume(1) = {1};

3-i generate 3D mesh

4- i export a .msh file

5- i create .edp file wich contain:  
load"gmsh"  
mesh3 Th=gmshload3(“Part1.msh”);  
plot(Th,cmm=“Th mesh read from GMSH”,wait=1);  
savemesh(Th,“Th3.mesh”);

and i open it with freefem++

and i received this error :  
You chose the file “C:\Users\chaim\Desktop\test3.txt”  
– FreeFem++ v4.7 (Fri, Sep 04, 2020 1:37:14 AM - git v4.7-2-g3716c303)  
Load: lg\_fem lg\_mesh lg\_mesh3 eigenvalue  
1 : load"gmsh"(load: loadLibary C:\Program Files (x86)\FreeFem++\.\gmsh = 0)  
2 : mesh3 Th=gmshload3(“Part1.msh”);  
3 : plot(Th,cmm=“Th mesh read from GMSH”,wait=1);  
4 : savemesh(Th,“Th3.mesh”);  
5 : sizestack + 1024 =1256 ( 232 )

edges in 3D mesh are not considered yet in freefem++, skeep data  
0 tetrahedrons  
0 triangles  
1 numElements  
Return type false, your mesh is MeshS type, use gmshloadS function  
current line = 2  
Assertion fail : (0)  
line :1037, in file gmsh.cpp  
Assertion fail : (0)  
line :1037, in file gmsh.cpp  
err code 6 , mpirank 0  
try getConsole C:\Users\chaim\Desktop\test3.txt[test3.txt.log](https://community.freefem.org/uploads/short-url/9kqeD1cEgeyj4PMhUNL8GunjPjv.log) (826 Bytes)[docs.rar](https://community.freefem.org/uploads/short-url/uezcTx6GkJBGJxGnVuKQYQNR9gp.rar) (11.4 KB)

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [December 13, 2020, 4:48pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/4 "2020-12-13T16:48:12Z")

</div>

How do you export the `.msh` file?

---

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [December 13, 2020, 4:55pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/5 "2020-12-13T16:55:07Z")

</div>

i do just :file–\> export–\> .msh extension

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [December 13, 2020, 4:58pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/6 "2020-12-13T16:58:14Z")

</div>

Are you using Gmsh format version 2 or version 4?

---

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [December 13, 2020, 5:01pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/7 "2020-12-13T17:01:17Z")

</div>

i use gmsh version 4.6

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [December 13, 2020, 5:01pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/8 "2020-12-13T17:01:59Z")

</div>

You are not answering my question. Are you exporting the `.msh` using Gmsh format version 2 or version 4?

Edit: I see from your attached file that you are using format version 4. You need to switch to format version 2.

```auto
$ more Part1.msh
$MeshFormat
4.1 0 8
[...]

```

---

<div class="post-metadata">

**Author:** ![chaimaa](https://avatars.discourse-cdn.com/v4/letter/c/c0e974/32.png) [@chaimaa](https://community.freefem.org/u/chaimaa)\
**Post date:** [December 13, 2020, 5:06pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/9 "2020-12-13T17:06:48Z")

</div>

thank you fror your help.  
it works now.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [December 13, 2020, 5:14pm UTC](https://community.freefem.org/t/problem-import-3d-file-msh/684/10 "2020-12-13T17:14:28Z")

</div>

Use `Export` instead of `Save Mesh`.
