Hi,

in the tutorials the setting of the mesh size for a surface and for a point is demonstrated.

How can this be done for an edge, for example for a cube (for local refinement towards an edge) either in a python file or in the gui (How can I select an edge in the “Refinement dialog …”)?

Best regards,

Gerhard

Hi,

since the geometry is modeled by 3d objects and planes, you can not directly set the mesh size on an edge.

But you can restrict the mesh size in an arbitrary point. I would suggest a loop over points on the edge and using the “RestrictH(…)” function as in the following code.

```
from netgen.csg import *
cube = OrthoBrick(Pnt(-1,-1,-1),Pnt(1,1,1))
geo = CSGeometry()
geo.Add(cube)
maxh = 0.5
mp = MeshingParameters (maxh=maxh)
n = 40
for i in range(n+1):
loc_h = 2/n # edge length devided by number of points
mp.RestrictH(x=1,y=-1+i*loc_h,z=1,h=loc_h) # restrict local mesh size at a point
ngmesh = geo.GenerateMesh(mp=mp)
from ngsolve import *
Draw(Mesh(ngmesh))
```

Best

Christoph