Filled contours on SU faces


#1

Hi

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.


#2

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.


#3

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.


#4

So I assume this is not possible or is it just a silly question? :smile:


#5

You are conflating two things.
You can color the individual faces forming a surface ‘by height’ by simply iterating the faces and getting the face.bounds.center.z
You then have a set of rules to decide the color of the material applied to the face.
e.g.

case face.bounds.center.z
  when < 1.m
    face.material='Blue'
  when <= 2.m
    face.material='Green'
  else
    face.material='Red'
end#case

In this example all facets above z = 2m are colored ‘Red’, those below z = 1m are colored ‘Blue’ and all others are colored '‘Green’.
This uses face.bounds.center.z but of course you could use .min.z or .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: