Quick question, is there any plugin to control draw order of rhino layers using grasshopper,
ie, can i command rhino to ‘BringToFront’ any layers or objects i specify
I.e, i am using Human to control plot weights and print color, would like to be able to control draw order also
thanks
I’ve wrote a little code that can help you achieve what you’re looking for:
if(!run)
return;
for(int i = 0; i < layers.Count; i++)
{
Rhino.DocObjects.RhinoObject[] rhobjs = doc.Objects.FindByLayer(layers[i]);
foreach(Rhino.DocObjects.RhinoObject rhobj in rhobjs)
{
rhobj.Attributes.DisplayOrder = i;
rhobj.CommitChanges();
}
}
Arkadius Belov.3dm (56.3 KB)
Arkadius Belov.gh (15.7 KB)
7 Likes
Thank you very much Mahdiyar,
the definition works as given,
and your presentation of it was very easy to understand
arkadius
Alex31
(Alex)
September 26, 2022, 3:27pm
4
Hi,
Thanks for the script. Is it possible to adapt it to work for sub-layers using the full layer path as well as layers?
Thank you!
coby
February 5, 2023, 6:05pm
5
@Mahdiyar – Much appreciate the work you did. I have been testing it to see I can integrate into a workflow and cannot completely figure out what is going on but seems to not work with sublayers or really more layers than two. Any ideas here? (Revised test files linked).
Arkadius Belov_Coby Test.3dm (182.3 KB)
Arkadius Belov_Coby Test.gh (18.1 KB)
private void RunScript(List<string> layers, bool run)
{
if(!run) return;
for(int i = 0; i < layers.Count; i++)
{
var layer = RhinoDocument.Layers.FindByFullPath(layers[i], -1);
if (layer < 0) return;
var rhobjs = doc.Objects.FindByLayer(RhinoDocument.Layers.FindIndex(layer));
foreach(var rhobj in rhobjs)
{
rhobj.Attributes.DisplayOrder = i;
rhobj.CommitChanges();
}
}
}
Arkadius Belov_Coby Test.gh (9.2 KB)
AndyPayne
(Andy Payne)
February 5, 2023, 9:14pm
7
Rhino 8 has draw order as an attribute which can be assigned to objects. It’s part of the Drafting Attributes component.
1 Like