gmsh.model.getParent(ent) returns (-1, -1) for all shapes even if they have parent
I have trouble with reading entity parent. I have imported shapes from step file (simplified script below). But when I iterate over entities, non of the shapes have parent set correctly, value (-1, -1) for all of them. Is this a bug or I'm doing something wrong?
import gmsh
import sys
import math
import multiprocessing
file = "some_step_file.stp"
gmsh.initialize()
# mesh
gmsh.option.setNumber("Mesh.Algorithm", 6)
gmsh.option.setNumber("Mesh.MeshSizeMin", 0.4)
gmsh.option.setNumber("Mesh.MeshSizeMax", 0.4)
gmsh.option.setNumber("Mesh.MeshSizeFromCurvature", 50)
gmsh.option.setNumber("General.NumThreads", multiprocessing.cpu_count())
gmsh.option.setNumber("Mesh.MeshOnlyVisible", 1)
gmsh.model.occ.import_shapes(file)
gmsh.model.occ.synchronize()
entities = gmsh.model.getEntities(3)
for e in entities:
partitions = gmsh.model.getPartitions(e[0], e[1])
print("Entity " + str(e) + " of type " +
gmsh.model.getType(e[0], e[1]), end="")
print(" - Parent: " + str(gmsh.model.getParent(e[0], e[1]))) # returns (-1, -1) for all of entities
gmsh.finalize()
Edited by Dominik Borkowski