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 265
    • Issues 265
    • 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
  • #693
Closed
Open
Created Nov 19, 2019 by Alessandro Banducci@alessand

How to Read Colors in STEP Files

Hi,

I would like to specify physical groups based on the colors of faces in an imported STEP file.

The idea is that I can specify boundary conditions in my CAD program by coloring faces and then exporting the geometry as a STEP file, which can then be read and meshed by gmsh.

The issues is I can't figure out how to get gmsh to read the colors off the face entities.

When I load a colored STEP file into the GUI the faces are not colored.

Also using the python sdk on gmsh 4.4.1 running:

import gmsh
gmsh.initialize()

gmsh.option.setNumber("General.Terminal", 1)
gmsh.option.setNumber("Mesh.Algorithm", 3) # Frontal-Delaunay
gmsh.option.setNumber("Geometry.OCCImportLabels", 1) # import colors from STEP

fname = r'cubez.stp'
#gmsh.merge(fname)
gmsh.model.occ.importShapes(fname,format="step")
gmsh.model.occ.synchronize()

gmsh.model.mesh.generate(2)

print([gmsh.model.getColor(*tag) for tag in gmsh.model.getEntities()])
print([gmsh.model.getEntityName(*tag) for tag in gmsh.model.getEntities()])

[gmsh.model.getColor(*tag) for tag in gmsh.model.getEntities()]

returns (0, 0, 255, 0) for all entities, rather than showing that 3 of the faces are red green and blue.

I'm not sure if gmsh.model.getColor() is actually the appropriate function to use though.

The test file, a cube with 3 faces colored: cubez.stp

Thank you!

Assignee
Assign to
Time tracking