Default Print Colour to By Display, All Objects

Output Colour, at the printing stage, By Display is obviously really handy.

What I often need is Print Widths + Display Colours at the same time - this is what changing all the Print:: By Display helps with.

Is there a way to script it? In rhinoscriptsyntax I don’t see a By Display option :frowning: Maybe it’s possibe in Rhinocommon?

But I guess for all new objects the default will still be ByLayer printing?

Controlling ByDisplay , by layer, would be cool maybe?

Hi @Jonathan_Hutchinson1,

Use ObjectAttributes.PlotColorSource.

– Dale

Hmm… okay, I don’t quite understand the documentation well enough.

Right, I got this though.

ObjectAttributes.PlotColorSource Property says there are three ways to set but only describes two.

import Rhino

#       Rhino.DocObjects.ObjectAttributes.PlotColorSource
#       Rhino.DocObjects.ObjectAttributes.GetType( )
#       Rhino.DocObjects.ObjectAttributes.PlotColor

string = "Prompting for Selection"
bool = False
filter  = Rhino.DocObjects.ObjectType.Curve

object = Rhino.Input.RhinoGet.GetOneObject(string, bool, filter)
attributes = Rhino.DocObjects.ObjectAttributes()

print attributes

#   Rhino.Input.Custom.GetObject.Get()
#   Rhino.Input.Custom.GetObject.GetMultiple()

# Set to By Display (2) ObjectPlotColorSource

attributes = Rhino.DocObjects.ObjectAttributes.ColorSource.Info


#   print object.PlotColour

I’ll try again once I’ve had a bit more practice.

Hi @Jonathan_Hutchinson1,

Try this:

import Rhino
import scriptcontext

def test_object_print_color():
    filter = Rhino.DocObjects.ObjectType.AnyObject
    rc, objrefs = Rhino.Input.RhinoGet.GetMultipleObjects("Select objects", False, filter)
    if rc != Rhino.Commands.Result.Success: return rc
    if not objrefs: return Rhino.Commands.Result.Failure
    for objref in objrefs:
        rh_obj = objref.Object()
        if rh_obj:
            if rh_obj.Attributes.PlotColorSource != Rhino.DocObjects.ObjectPlotColorSource.PlotColorFromDisplay:
                atts = rh_obj.Attributes.Duplicate()
                atts.PlotColorSource = Rhino.DocObjects.ObjectPlotColorSource.PlotColorFromDisplay
                scriptcontext.doc.Objects.ModifyAttributes(objref, atts, True)
    return Rhino.Commands.Result.Success

if __name__=="__main__":

– Dale

1 Like