Hi all Python Genuises out there.
I Realy like this script to change object colors on the go ,
The only thing is that it lets you pick one object at a time.
Can someone tweak it so it is possible to pick multiple objects or a group .
Hi all Python Genuises out there.
I Realy like this script to change object colors on the go ,
The only thing is that it lets you pick one object at a time.
Can someone tweak it so it is possible to pick multiple objects or a group .
Something like this:
from System.Drawing import *
from Rhino import *
from Rhino.DocObjects import *
from Rhino.Geometry import *
from Rhino.Input import *
from Rhino.Commands import *
from Rhino.UI.Dialogs import ShowColorDialog
from scriptcontext import doc
def RunCommand():
rc, obj_refs = RhinoGet.GetMultipleObjects("Select object/s", False, ObjectType.AnyObject)
if rc != Result.Success:
return rc
b, color = ShowColorDialog(Display.ColorXYZ(0,0,0))
if not b: return Result.Cancel
for i in obj_refs:
rhino_object = i.Object()
rhino_object.Attributes.ObjectColor = color
rhino_object.Attributes.ColorSource = ObjectColorSource.ColorFromObject
rhino_object.CommitChanges()
doc.Views.Redraw()
return Result.Success
if __name__ == "__main__":
RunCommand()
Perfect !!