# Buildmesh from meshL with a hole

**URL:** <https://community.freefem.org/t/buildmesh-from-meshl-with-a-hole/3938>\
**Category:** General Discussion\
**Created:** [May 26, 2025, 7:43am UTC](https://community.freefem.org/t/buildmesh-from-meshl-with-a-hole/3938 "2025-05-26T07:43:56Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [May 26, 2025, 7:43am UTC](https://community.freefem.org/t/buildmesh-from-meshl-with-a-hole/3938/1 "2025-05-26T07:43:56Z")

</div>

Dear all,

I would like to reconstruct a 2D from a `meshL` obtained with `extract()`. TO illustrate my problems I give a small example.

I have a 2D mesh of a square with a hole ( **ThBinder** )

 ![ThBinder](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/8/8540e153c17b670beb8b6ae2669ca2e410da6d14.png)

I have a 2D mesh of a sphere ( **ThParticle** )

 ![ThParticle](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/1/16dd5eb9bcbf37652ab5fc8f58a63888a62ac4f1.png)

Then, I extract the four external border of ThBinder;

> int[int] ll = [1,2,3,4];  
> meshL ThL0= extract(ThBinder, label=ll);

and the border of the sphere:

> meshL ThL1 = extract(ThParticle);

And combine the two mesh and rebuild the 2D mesh as:

> meshL ThL2 = ThL0 + ThL1;  
> ThBinder = buildmesh(ThL2);

And finally I get:

 ![ThBinderRebuild](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/c/c8ee8faad3f3eb0cb57cbc6f685f3c07a0312673.png)

However, what I would like, is a mesh with a hole inside.

I have tried to change the orientation of `ThL1` with a ` movemesh()` or during the `extract()`, but I have always the same results.

would anyone know how to do this ? (my code in attachment).

Thank you in advance,

Best regards,

Loïc

[MWE\_meshing\_Loic.edp](https://community.freefem.org/uploads/short-url/3L21rwbSw2twhD6e8shebOX0AZr.edp) (1.3 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:** [May 26, 2025, 2:15pm UTC](https://community.freefem.org/t/buildmesh-from-meshl-with-a-hole/3938/2 "2025-05-26T14:15:56Z")

</div>

Dear Loic,  
you should be able to do at end  
`ThBinder=trunc(ThBinder,ThBinder(x,y).region==1);`
