How to set the draw order in Rhino Common

Is there a way to set the draw order on an entity when using rhino common?

So it would be like using the Rhino commands Sendtoback or Bringtofront, but in code.

I have looked at dp.SetZBiasMode(ZBM_TOWARDS_CAMERA)
but don’t understand how to use it, and was hoping for something simpler.

The best you can do is script the commands using RhinoApp.RunScript.

– Dale

Yes, I can see how to do that with RunScript. But I was hoping for something a bit more integrated.

To change an entities color we use code like:

          obj = doc.Objects.Find(object_uuid)
          obj.Attributes.ObjectColor = mycolor
          obj.Attributes.ColorSource = DocObjects.ObjectColorSource.ColorFromObject
          obj.CommitChanges()

Is there anything like this that we can do to send the entity to the front or back of the draw order?

Hi @andrew3, only if you know the display index of all objects in the doc. You might try

obj.Attributes.DisplayOrder

_
c.

Thanks, that worked OK.

For reference I used :

obj.Attributes.DisplayOrder = -1

to send the “old” object to the back.