3
$\begingroup$

The mesh analysis overhang tool gives me a coloured heatmap in edit mode. Is there any way to use these colours and apply them to the face material colours, so they are visible in object mode? perhaps using a python script.

I am using the 3d print toolbox at the moment to colour my faces, yet the mesh analysis tools gives a clearer indication.

Here is a comparison. 3d print toolbox coloured in object mode and mesh analysis in edit mode.

enter image description here enter image description here

$\endgroup$
1
2
$\begingroup$

It is currently not easy to get the data out of the mesh analysis tool via Python. The data is not available in Python. But there are possibilities.

Solution: implement overhang in python

Implement the mesh overhang functionality yourself. The C-code is located in source/blender/blenkernel/intern#statvis_calc_overhang and is quite easy to implement.

  • Calculate the face normals.
  • Determine angle between the face normal and the chosen axis (normalized dot product).
  • Use a color ramp between the angle to get a nice coloring.

Solution: change the API

Ask the developers or patch blender yourself to change the API so that the data can be read. The data is currently stored in the edit_bmesh so it might become part of the bmesh api. Personally I would suggest a more cleaner approach outside bmesh

Solution: Use as_pointer and interp the internal structures of Blender

Use as_pointer to get a reference to the internal DNA structure of the mesh and use ctypes to read the data from the internal structures. But note that changes in ctypes might make your code invalid.

$\endgroup$
1
  • $\begingroup$ I am looking at this project again and it may be easier for me to select all the faces which are not selected by the mesh analysis. My python is not as advanced, please help? $\endgroup$ Feb 13 '21 at 6:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.