Skip to content

Coloring By Material #3356

Aug 14, 2024 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

Hi @AidanMcConneheyOVT
The 'color' command is a APDL command that does not affect the eplot command when using VTK to plot. It's only affects the native MAPDL plots. To plot the elements with materials color coded we can use PyVista. Well we need to import it first, so after importing launch_mapdl you can use:

import pyvista as pv

Then after the mapdl.allsel() command we can create an instance of the PyVista plotter and add the mesh. The mesh.grid automatically includes the material ID number for each element. So we just need to use the right field name for the scalars value.

plot = pv.Plotter()
plot.add_mesh(mapdl.mesh.grid, scalars='ansys_material_type')
plot.show()

The tricky part is s…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@AidanMcConneheyOVT
Comment options

@AidanMcConneheyOVT
Comment options

@mikerife
Comment options

@AidanMcConneheyOVT
Comment options

@mikerife
Comment options

Answer selected by germa89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants