Step Entity labels not showing
I am not able to retrieve stp entity names using gmsh.model.getEntityName(e[0], e[1])
.
Following is the code [slightly modified version of "step_assembly.py" and step file attached.
import gmsh
gmsh.initialize()
gmsh.option.setNumber("Geometry.OCCImportLabels", 1)
# load step file
ent = gmsh.model.occ.importShapes("fp2.stp",format="step")
gmsh.model.occ.synchronize()
print(gmsh.model.list())
# get all model entities
#ent = gmsh.model.getEntities()
physicals = {}
for e in ent:
n = gmsh.model.getEntityName(e[0], e[1])
print(e, gmsh.model.occ.getMass(e[0], e[1]))
# get entity labels read from STEP and create a physical group for all
# entities having the same 3rd label in the /-separated label path
#print(e, gmsh.model.getType(e[0], e[1]))
if n:
print('Entity ' + str(e) + ' has label ' + n + ' (and mass ' +
str(gmsh.model.occ.getMass(e[0], e[1])) + ')')
path = n.split('/')
if e[0] == 3 and len(path) > 3:
if(path[2] not in physicals):
physicals[path[2]] = []
physicals[path[2]].append(e[1])
# create the physical groups
for name, tags in physicals.items():
p = gmsh.model.addPhysicalGroup(3, tags)
gmsh.model.setPhysicalName(3, p, name)
gmsh.fltk.run()
`