Hi all!
I’m trying to change the Mesh Edge Thickness from a Rhino Display mode directly in Python. I could save a custom display mode somewhere in the server and use it company-wide but there are some IT issues that I cannot bypass at the moment, that’s why I need to change the display mode in each machine.
I can change the Mesh Wireframe Thickness using “DisplayAttributes.MeshSpecificAttributes.MeshWireThickness = int”, but that doesn’t overwrite the mesh edge thicknesses. If you set the MeshWireThickness to 0 but the MeshEdgeThickness is 2, edges will still show with a thickness of 2.
Does anybody know what’s the method to use and if it can be accessed via Python? I read the documentation, but the methods proposed do not work for Python so maybe I’m missing something out (https://developer.rhino3d.com/api/rhinocommon/rhino.display.displaypipelineattributes).
This is my code so far:
import Rhino
def SetMeshEdgeThickness(display_mode_name, edge_thickness):
# Find the display mode by name
display_mode = Rhino.Display.DisplayModeDescription.FindByName(display_mode_name)
# Modify the mesh edge thickness
display_mode.DisplayAttributes.MeshSpecificAttributes.MeshEdgeThickness = edge_thickness
# Save the changes to the display mode
if Rhino.Display.DisplayModeDescription.UpdateDisplayMode(display_mode):
print("Set mesh edge thickness to {} for display mode '{}'.".format(edge_thickness, display_mode_name))
else:
print("Failed to update display mode '{}'.".format(display_mode_name))
# Example
SetMeshEdgeThickness("Shaded", 10)
And here is the error message:
Runtime error (MissingMemberException): 'MeshDisplayAttributes' object has no attribute 'MeshEdgeThickness'
Traceback:
line 18, in SetMeshEdgeThickness, "<string>"
line 27, in script