# Compile issue in plotting 3d mesh

**URL:** <https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052>\
**Category:** General Discussion\
**Created:** [September 1, 2025, 1:01pm UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052 "2025-09-01T13:01:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RaghunathBandha](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/raghunathbandha/32/1843_2.png) [@RaghunathBandha](https://community.freefem.org/u/RaghunathBandha)\
**Post date:** [September 1, 2025, 1:01pm UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052/1 "2025-09-01T13:01:37Z")

</div>

Let \Omega is cubical the domain [-1,1]^3 and \Omega^1 is the spherical domain of radius 0.5. Let \Omega^2 is \Omega\setminus\Omega^1 is the cube with a spherical hole. Write a freefem code to build two different 3d meshes Sh1 for \Omega^1 and Sh2 for \Omega^2. Level the boundaries of both meshes.

I have written the code but its not working.

[cubewithsphere2.edp](https://community.freefem.org/uploads/short-url/rmuvYQmHymAnVBhZafYrmg7QS1I.edp) (2.0 KB)

---

<div class="post-metadata">

**Author:** ![fb77](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/fb77/32/3796_2.png) [@fb77](https://community.freefem.org/u/fb77)\
**Post date:** [September 3, 2025, 5:17pm UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052/2 "2025-09-03T17:17:19Z")

</div>

There is an example almost identical to what you want in the FreeFem documentation

> **[FreeFEM-documentation.pdf](https://doc.freefem.org/pdf/FreeFEM-documentation.pdf)**
>
> 33.85 MB

p.158 “Build a 3d mesh of a cube with a balloon”

(change load “TetGen” to load “tetgen” )

---

<div class="post-metadata">

**Author:** ![RaghunathBandha](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/raghunathbandha/32/1843_2.png) [@RaghunathBandha](https://community.freefem.org/u/RaghunathBandha)\
**Post date:** [September 4, 2025, 3:20am UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052/3 "2025-09-04T03:20:10Z")

</div>

Sir I have changed it to tetgen but still it is showing error.

 ![Screenshot (197)](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/f/f40c7976f28746f5fa0b2e07f21fff8a435db17e.png)

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://community.freefem.org/u/Loic)\
**Post date:** [September 4, 2025, 11:42am UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052/4 "2025-09-04T11:42:04Z")

</div>

Just like this for defining the sphere:

> load “msh3”  
> load “tetgen”  
> include “MeshSurface.idp”  
> // Parameters  
> real hs = 0.1; //mesh size on sphere  
> // Mesh  
> meshS ThS = Sphere(0.5, hs, 7, 1);

`Sphere` takes 4 arguments

> meshS ThS = Sphere(R, hs, L, 1);

where R is the radius, h is the mesh size of the sphere, L is the label of the sphere and the last one is the global orientation of the surface (1 for extern and -1 for intern)

Best regards,

Loïc,

---

<div class="post-metadata">

**Author:** ![RaghunathBandha](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/raghunathbandha/32/1843_2.png) [@RaghunathBandha](https://community.freefem.org/u/RaghunathBandha)\
**Post date:** [September 4, 2025, 4:31pm UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052/5 "2025-09-04T16:31:38Z")

</div>

I have tried to correct it but it still shows error. Can you please modify the code.

[cubewithsphere2.edp](https://community.freefem.org/uploads/short-url/rmuvYQmHymAnVBhZafYrmg7QS1I.edp) (2.0 KB)

---

<div class="post-metadata">

**Author:** ![Loic](https://avatars.discourse-cdn.com/v4/letter/l/e9c0ed/32.png) [@Loic](https://community.freefem.org/u/Loic)\
**Post date:** [September 5, 2025, 7:34am UTC](https://community.freefem.org/t/compile-issue-in-plotting-3d-mesh/4052/6 "2025-09-05T07:34:31Z")

</div>

Here the code  
[sphereincube.edp](https://community.freefem.org/uploads/short-url/71oYDxQLcCwJjFjlUua4rGf5xH6.edp) (1.0 KB)

 ![sphere_in_cube](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/4/4cf74c99655bac11267a752b822e588abeb6378d.png)

Best regards,

Loïc,
