python api: setPhysicalGroup with OCC
Maybe there is a bug setting physical groups. If the occ-kernel is choosen, the physical tags are 'o'. See following example (the new python-api is used)
edit: I compiled the sources from tody (2018-07-05)
import gmsh
model = gmsh.model
# factory = model.occ
factory = model.geo
gmsh.initialize(sys.argv)
gmsh.option.setNumber("General.Terminal", 1)
model.add("phys_name")
def add_square(l=0, lcar = .2):
p1 = factory.addPoint(0+l, 0, 0, lcar)
p2 = factory.addPoint(1+l, 0, 0, lcar)
p3 = factory.addPoint(1+l, 1, 0, lcar)
p4 = factory.addPoint(0+l, 1, 0, lcar)
l1 = factory.addLine(p1, p2)
l2 = factory.addLine(p2, p3)
l3 = factory.addLine(p3, p4)
l4 = factory.addLine(p4, p1)
ll = factory.addCurveLoop([l1, l2, l3, l4])
s = factory.addPlaneSurface([ll])
return s
s1 = add_square(0)
tag = model.addPhysicalGroup(2, [s1])
model.setPhysicalName(2, tag, 'square 1')
s2 = add_square(1.1)
tag = model.addPhysicalGroup(2, [s2])
model.setPhysicalName(2, tag, 'square 2')
s3 = add_square(2.2)
tag = model.addPhysicalGroup(2, [s3])
model.setPhysicalName(2, tag, 'square 3')
factory.synchronize()
model.mesh.generate(2)
gmsh.write("phys_name.msh")
gmsh.write("phys_name.geo_unrolled")
gmsh.finalize()
Edited by Martin Baun