Hello,
Do you have an idea how can i create a custom button to change an object to LayerABC (already set) and add custom (xxx,xxx,xx)RGB display Color?
_ChangeLayer ask always me to choose manually.
Thanks
Hello,
Do you have an idea how can i create a custom button to change an object to LayerABC (already set) and add custom (xxx,xxx,xx)RGB display Color?
_ChangeLayer ask always me to choose manually.
Thanks
Custom color to the object(s) or to the layer? Is it a fixed color or do you want to choose every time (with the color picker)?
Only for the object, I want to keep the layer color from my template.
Here is a simple script to do that. The layer name and colors are fixed, you can edit them in a text editor to anything you want.
import rhinoscriptsyntax as rs
targ_layer="LayerABC" #can be changed
color=[255,0,0] #can be changed
if rs.IsLayer(targ_layer):
objs=rs.GetObjects(group=True,preselect=True)
if objs:
rs.EnableRedraw(False)
rs.ObjectColorSource(objs,1)
rs.ObjectColor(objs,color)
[rs.ObjectLayer(obj,targ_layer) for obj in objs]
else:
print "Target layer doesn't exist!"
ChangeLayerSpecial.py (381 Bytes)
To run the script via an alias or toolbar button, save the .py script file somewhere then use
! _-RunPythonScript "Full path to script"
(where the full path includes the filename and extension)
For more detailed info on running scripts, see here:
https://wiki.mcneel.com/rhino/macroscriptsetup
Thanks a lot! I need to learn python…