Say I have an arbitrary face that I have meshed in an arbitrary way (triangles, quads, polygons, etc.). obtaining a polymesh.
I would like to be able to color each polygon of the mesh with a specific color so to represent an (unsmoothed) contour.
This first thing it comes to mind is the following:
1 - Create a face for each polygon of the mesh using the information from polygon_at
2 - Color the face
3 - Add face to a group called ‘contour’ (for example).
I am sure that there is a better way to achieve the same result without having to create new entities? I assume similar techniques are used to represents results from renderings.
Could you recommend a good approach?
Thanks for any advice.
Do you still need the PolygonMesh as such afterward? If not, you could create a Group and load the Faces from the mesh into its Entities collection via #add_faces_from_mesh. Then you could color the new Faces any way you want.
Thanks, but it does not solve the problem of having additional entities. I was wondering whether there was a way to assign the contour as I would do with a texture.
So I assume this is not possible or is it just a silly question?
You are conflating two things.
You can color the individual faces forming a surface ‘by height’ by simply iterating the faces and getting the
You then have a set of rules to decide the color of the material applied to the face.
when < 1.m
when <= 2.m
In this example all facets above z = 2m are colored ‘Red’, those below z = 1m are colored ‘Blue’ and all others are colored '‘Green’.
face.bounds.center.z but of course you could use
.max.z depending on what you want to do…
If you do not want to add "additional geometry", then how can you hope to triangulate the mesh ?
Unless the surface already wholly triangulated the operation must result in some new edges to split the faces of quads or higher. :frowning: