exporting .bdf file from mesh
Dear community, I want to extract the .bdf file from some lines existing in my mesh. Tag numbers of lines in the first .bdf file is 74, 1, 51 and for the second .bdf file I want to have lines with tag number 112, 2, 89. This is my script (I am using GMSH 4.9.0):
import gmsh
gmsh.initialize()
x_min, x_max = 0, 500
y_min, y_max = 0, 200
z_min, z_max = -100, 0
gmsh.model.occ.addPoint(200, 100, -20)
gmsh.model.occ.addPoint(200, 100, -80)
gmsh.model.occ.addPoint(300, 100, -20)
gmsh.model.occ.addPoint(300, 100, -80)
gmsh.model.occ.addLine (1, 2)
gmsh.model.occ.addLine (3, 4)
gmsh.model.occ.addRectangle(x_min, y_min, -20, x_max, y_max, 1)
gmsh.model.occ.addRectangle(x_min, y_min, -80, x_max, y_max, 2)
sl_th = 20
gmsh.model.occ.addBox(x_min, y_min, z_max, x_max, y_max, z_min, 1)
gmsh.model.occ.addBox(200-sl_th, 100-sl_th, 0, sl_th*2, sl_th*2, -100, 2)
gmsh.model.occ.addBox(300-sl_th, 100-sl_th, 0, sl_th*2, sl_th*2, -100, 3)
gmsh.model.occ.addLine (21, 27)
gmsh.model.occ.addLine (23, 25)
gmsh.model.occ.addLine (22, 28)
gmsh.model.occ.addLine (24, 26)
gmsh.model.occ.addLine (29, 35)
gmsh.model.occ.addLine (31, 33)
gmsh.model.occ.addLine (30, 36)
gmsh.model.occ.addLine (32, 34)
gmsh.model.occ.addCurveLoop([23, 47, 29, 49], tag = 799)
gmsh.model.occ.addPlaneSurface([799], tag = 800)
gmsh.model.occ.addCurveLoop([25, 48, 27, 50], tag = 801)
gmsh.model.occ.addPlaneSurface([801], tag = 802)
gmsh.model.occ.addCurveLoop([35, 51, 41, 53], tag = 803)
gmsh.model.occ.addPlaneSurface([803], tag = 804)
gmsh.model.occ.addCurveLoop([37, 52, 39, 54], tag = 805)
gmsh.model.occ.addPlaneSurface([805], tag = 806)
gmsh.model.occ.synchronize()
v = gmsh.model.occ.getEntities(3)
s = gmsh.model.occ.getEntities(2)
l = gmsh.model.occ.getEntities(1)
p = gmsh.model.occ.getEntities(0)
elements = p + l + s + v[1:]
gmsh.model.occ.fragment(elements , [v[0]])
gmsh.model.occ.synchronize()
gmsh.model.mesh.field.add("Distance", 1)
gmsh.model.mesh.field.setNumbers(1, "CurvesList", [1, 2])
gmsh.model.mesh.field.setNumber(1, "Sampling", 100)
gmsh.model.mesh.field.add("Threshold", 2)
gmsh.model.mesh.field.setNumber(2, "InField", 1)
gmsh.model.mesh.field.setNumber(2, "SizeMin", 1)
gmsh.model.mesh.field.setNumber(2, "SizeMax", 50)
gmsh.model.mesh.field.setNumber(2, "DistMin", 2)
gmsh.model.mesh.field.setNumber(2, "DistMax", 100)
gmsh.model.mesh.field.add("Min", 3)
gmsh.model.mesh.field.setNumbers(3, "FieldsList", [2])
gmsh.model.mesh.field.setAsBackgroundMesh(3)
gmsh.option.setNumber("Mesh.MeshSizeMax", 50)
gmsh.option.setNumber("Mesh.Algorithm3D", 10)
gmsh.model.mesh.generate(3)
gmsh.write("IC_mesh.msh")
gmsh.fltk.run()
gmsh.finalize()
Thanks for your support and help.
Edited by Jack Firth