Skip to content

Color different faces with different colors #3

@JonasKoziorek

Description

@JonasKoziorek

You could consider adding an option to display all the names defined for the geometry faces (3D) and edges (2D). Furthermore, have a toggle option that would color differently named faces with different colors.

Here is a MWE for 3D that I use with webgui:

pallete = [
("red", (1.0, 0.0, 0.0)),
("green", (0.0, 0.8, 0.0)),
("blue", (0.0, 0.0, 1.0)),
("yellow", (1.0, 1.0, 0.0)),
#...
]

def visualize_boundaries(mesh, geo):
    bnds = list(set(mesh.GetBoundaries()))
    shape = geo.shape
    tags = {}

    for face in shape.faces:
        for i, bnd_name in enumerate(bnds):
            if face.name == bnd_name:
                face.col = pallete[i][1]
                color_name = pallete[i][0]
                tags[bnd_name] = color_name
                break

    webgui.Draw(shape)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions