Assigning boundary name

Hello, I’m looking for the way to name the plane to distinguish boundary easily.

I made a geometry like below.

I tried to name boundary and export geometry as Gmsh file.

However, when I check the boundaries, I cannot see the name “plane” surface.

I thought I follow the way correctly based on documentation.

Can you give me some tips for this?

Thank you.

Hokon Kim


# Add components for meshing.

test = cube * Plane(Pnt(0,0,0),Vec(64,0,0)).bc('plane')

# geo2.CloseSurfaces(cube,Plane(Pnt(0,0,0),Vec(64,0,0)))

Hello Kim,

As far as I understand from you code you try to build the common of a cube and a halfspace like plane (position and normal vector).
I am not sure if you can assign a bc argument as its not a face right now (it is created during the common process). So, I would guess it need to be created afterwards.

test.faces will provide you a list with all faces of your body, if you know the index you can assign the bc/name argument by
The index can be found using the gui (just click on the face you need)

from netgen.webgui import Draw as DrawGeo

Or you set the name of the bc of cube first and check via the names which on is the new, after you built the common of cube and plane.

# Setting the name of the cubes faces
for face in cube.faces: face.bc=”cube”

# build common
test = cube * plane

# Finds the face which is called default / not cube and set its bc
for face in test.faces:
	if == ‘default’

Another option is to you a positional argument like:


I hope this helps you.

All the best

Leonhard is referencing to the netgen.occ interface. I’d also advise to move to this more powerful interface to the opencascade geometry kernel.
However in the old csg kernel there are some caveats with boundary conditions: probably there is the same plane somewhere else defined in your geometry without the bc name. Csg then unifies them. To name the boundary save the plane in Python (for example as pl1) and then when adding to the Geo use bcmod:

geo2.Add(test, bcmod=[(pl1, "plane")])

This behavior is one of the very good reasons to move to occ… :wink:

Best Christopher