# Error of savemesh in 3D

**URL:** https://community.freefem.org/t/error-of-savemesh-in-3d/1839
**Category:** General Discussion
**Created:** [June 22, 2022, 1:44pm UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839 "2022-06-22T13:44:28Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![RYP](https://avatars.discourse-cdn.com/v4/letter/r/b9e5f3/32.png) [@RYP](https://community.freefem.org/u/RYP)
#### Post date: [June 22, 2022, 1:44pm UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/1 "2022-06-22T13:44:28Z")

</div>

Hello!everyone,

I install windows version FreeFem 4.11 in **win 10**. But there is something wrong when I save 3D mesh.  
So I test the following simple code:

```auto
load "msh3"
load "medit"
mesh3 Th3=cube(10,15,5);
plot(Th3);
medit("Th3",Th3);
savemesh(Th3, "surf.mesh");

```

The program is terminated when it runs to `savemesh`, then I get a empty `surf.mesh` file with 0KB, I don’t know what the problem is？

Thank you in advance.

---

<div class="post-metadata">

### Author: ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)
#### Post date: [August 24, 2022, 10:54am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/2 "2022-08-24T10:54:54Z")

</div>

Have you solved this problem yet?

I have the same problem as you

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [August 24, 2022, 2:43pm UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/3 "2022-08-24T14:43:32Z")

</div>

I think the problem is due to windows, add getpwd to know where you are !!!  
like is:  
[bb.edp](https://community.freefem.org/uploads/short-url/eOxidYJj2RUoz8XgPMOpFmcnSnM.edp) (177 Bytes)

---

<div class="post-metadata">

### Author: ![Yangshen](https://avatars.discourse-cdn.com/v4/letter/y/838e76/32.png) [@Yangshen](https://community.freefem.org/u/Yangshen)
#### Post date: [August 25, 2022, 8:18am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/4 "2022-08-25T08:18:07Z")

</div>

I ran your code, the program can run normally, but the grid file is still empty after opening.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/2/271bf45a881eb18da2b5bb96df4a1902da8521c0.png)

---

<div class="post-metadata">

### Author: ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)
#### Post date: [August 25, 2022, 12:41pm UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/5 "2022-08-25T12:41:20Z")

</div>

PLease remove the call to edit or exit of medif window by (esc in media windows) otherwise the program never execute the code after medif .

---

<div class="post-metadata">

### Author: ![jboyd](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jboyd](https://community.freefem.org/u/jboyd)
#### Post date: [October 26, 2022, 9:05am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/6 "2022-10-26T09:05:03Z")

</div>

Did you find a solution? I have the same problem.

I tried running the code in bb.edp, but surf.mesh is still an empty file with 0 KB.

I then tried commenting out medit and plot:

```auto
load "msh3"
load "medit"
load "shell"
mesh3 Th3=cube(10,15,5);
//plot(Th3);
//medit("Th3",Th3);
cout << "pwd = " << getcwd()<< endl;// add version 4.9.1
savemesh(Th3, "surf.mesh");

```

The console output is:  
 ![image](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/8/8c6ddb578b029be846af6a2e03d02722a48a4ced.png)

and then the console disappears, and surf.mesh is created as an empty file with 0 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: [October 26, 2022, 10:15am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/7 "2022-10-26T10:15:44Z")

</div>

This should be fixed in the next version of FreeFEM.

---

<div class="post-metadata">

### Author: ![jboyd](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jboyd](https://community.freefem.org/u/jboyd)
#### Post date: [October 26, 2022, 10:58am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/8 "2022-10-26T10:58:23Z")

</div>

OK, in the meantime is there another way to save 3D meshes in .msh or .mesh format for plotting in Octave without using savemesh?

---

<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: [October 26, 2022, 11:02am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/9 "2022-10-26T11:02:52Z")

</div>

Yes, use a Linux or macOS (virtual) machine.

---

<div class="post-metadata">

### Author: ![jboyd](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@jboyd](https://community.freefem.org/u/jboyd)
#### Post date: [October 26, 2022, 11:14am UTC](https://community.freefem.org/t/error-of-savemesh-in-3d/1839/10 "2022-10-26T11:14:12Z")

</div>

Ok thanks. I also found that uninstalling version 4.11 and installing version 4.9 ([Releases · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/releases)) works on Windows.
