# Mesh a basic structure frame

**URL:** <https://community.freefem.org/t/mesh-a-basic-structure-frame/426>\
**Category:** General Discussion\
**Created:** [May 22, 2020, 3:35pm UTC](https://community.freefem.org/t/mesh-a-basic-structure-frame/426 "2020-05-22T15:35:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhngo97](https://avatars.discourse-cdn.com/v4/letter/m/779978/32.png) [@minhngo97](https://community.freefem.org/u/minhngo97)\
**Post date:** [May 22, 2020, 3:35pm UTC](https://community.freefem.org/t/mesh-a-basic-structure-frame/426/1 "2020-05-22T15:35:47Z")

</div>

Dear all,  
I’d like to mesh a basic structure frame like a picture in the link below.

> **[frame.png](https://drive.google.com/file/d/1i2SJpnLysRqnElgqgOuU5E5n7Wumh_in/view?usp=sharing)**
>
> Google Drive file.

  
This is my code.

// Mesh  
border a(t=5,10) { x=t; y=10 ;label=98;}; // topbeam 98  
border b(t=0,5) { x=t; y=t+5 ;label=84;}; // 84  
border c(t=10,0) { x=t; y=5 ;label=456;}; // 456  
border d(t=5,10) { x=t; y=t-5;label=62;}; // 62  
border e(t=10,0) { x=5; y=t;label=258;}; // 258  
border f(t=0,5) { x=t; y=10;label=87;}; // topbeam 87  
border g(t=0,10) { x=0; y=t;label=741;}; // leftbeam 741  
border h(t=10,0) { x=t; y=t;label=159;}; // 159  
border i(t=0,10) { x=10; y=t;label=963;}; // rightbeam 963  
border j(t=0,10) { x=t; y=0;label=321;}; // bottombeam 321  
mesh Th = buildmesh(j(10)+i(10)+h(10)+g(10)+f(5)+e(10)+d(5)+c(10)+b(5)+a(10));  
plot(Th,wait=true,ps=“final-report-meshTest.eps”);

and then, I have this error

Error in the definition of subdomain 0 boundary border 10/10: wrong direction 0 1  
Error in the definition of subdomain 5 boundary border 5/10: wrong direction 40 1  
Error in the definition of subdomain 6 boundary border 4/10: wrong direction 45 1  
Fatal error in the mesh generator 777  
current line = 11  
Meshing error: Bamg  
number : 777,  
catch Err bamg  
Meshing error: Bamg  
number : 777,  
err code 5 , mpirank 0

Is there anyone can give me some advise?  
Thanks for your help.

Best regards.

---

<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:** [May 22, 2020, 3:42pm UTC](https://community.freefem.org/t/mesh-a-basic-structure-frame/426/2 "2020-05-22T15:42:02Z")

</div>

If I were you, I’d use a `square(2, 2)`, then `ThTab[i] = trunc(Th, condition on x and y, label = something)` + call the `change` function to set a specific region for each triangle. Then, you can glue all `ThTab[i]` together, and call `trunc(ThGlued, 1, split = 10)` to refine the mesh.
