Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gmsh gmsh
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 276
    • Issues 276
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gmsh
  • gmshgmsh
  • Issues
  • #559
Closed
Open
Created May 10, 2019 by binoy@binoy

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()

`

fp2.stp

Assignee
Assign to
Time tracking