Rename portion of a 3d boundary

Hi Everyone,

Probably this is a basic question, but I need to create this domain:

\Omega = (-32,32) \times (-32,32) \times (0,64),

with boundaries

\Gamma_1 = {(x,y,z): z= 64, |x| \leq 16, |y| \leq 16}, \\ \Gamma_2 ={(x,y,z): z= 64, |x| > 16, |y| > 16}, \\ \Gamma_3 = \partial \Omega \backslash (\Gamma_1 \cup \Gamma_2),

I have tried this:

from netgen.csg import *

geo    = CSGeometry()
domain1 = OrthoBrick((-32, -32,  0), (32,  32, 64))
domain2 = OrthoBrick((-16, -16,  0), (16,  16, 64))
top  = Plane (Pnt(0,0,64), Vec(0,0,-1) )

cube_hole = domain1 - top
cube_hole.bc("Gamma3")
#geo.Add(cube_hole)

small_top = domain2 * top
#small_top.bc("Gamma1")
#geo.Add(small_top, bcmod=[(cube_hole, "Gamma1")])

complem_small_top = (top - small_top) * domain1
#complem_small_top.bc("Gamma2")
#geo.Add(complem_small_top, bcmod=[(cube_hole, "Gamma2")])

cube =  small_top.bc("Gamma1") + complem_small_top.bc("Gamma2") + cube_hole
geo.Add(cube)

mesh = geo.GenerateMesh(maxh=5)
mesh.Save("cube.vol")

mesh = Mesh("cube.vol")

But I get this labels for the boundaries:

boundary labels: (‘Gamma1’, ‘Gamma3’, ‘Gamma1’, ‘Gamma3’, ‘Gamma3’, ‘Gamma3’)

I don’t know what I’m doing wrong.

Thanks in advance :slight_smile:

I recommend for this to switch to the newer occ interface, one way to do this there would be

from netgen.occ import *
from ngsolve import *

box = Box((-32,-32,0), (32,32,64))

line1 = Edge(Segment((16,-32,64), (16,32,64)))
line2 = Edge(Segment((-32,16,64), (32,16,64)))
box = Glue([box,line1,line2])
box.faces.name = "Gamma3"
top_faces = box.faces[Z > 63] # all faces with center above Z == 63
top_faces.Min(X+Y).name = "Gamma1"
top_faces.Max(X+Y).name = "Gamma2"
geo = OCCGeometry(box)
mesh = Mesh(geo.GenerateMesh(maxh=5))
Draw(mesh)