DisplayPipelineAttributes - Single Object Color?

Hello,

I’m dynamically setting display mode object properties for my scene and successfully set the attributes of my DisplayMode like so:

            vp_wf_dm_attr.SetFill(vp_bg_light if dark_mode else vp_bg_dark)  # Set Background Color

How can I also set the “Single Object Color” (from code) as shown here in the Document Properties:

I’ve tried these two methods but neither seem to do anything for me?

            #vp_wf_dm_attr.FrontDiffuse = vp_bg_light if dark_mode else vp_bg_dark  # Set Object Color
            vp_wf_dm_attr.ObjectColor = vp_bg_light if dark_mode else vp_bg_dark  # Set Object Color

the color variables are of type System.Drawing.Color.FromArgb()

I’m guessing this property is named something other than “Single object color” in the RhinoCommon docs but I can’t figure out which one… as I mentioned I thought ObjectColor was it or possibly FrontDiffuse though neither work.

Thanks for the clarification!

Hi @michaelvollrath,

i’ve made some tests in a CustomConduit using e.Display.DrawObject(rh_obj) in the PostDrawObjects event while culling the original object in the ObjectCulling event, so it is not drawn by shaded mode.

It seems e.Display.DisplayPipelineAttributes.ObjectColor does affect shadeable object colors (found the issue also on YT), but if i do this:

e.Display.DisplayPipelineAttributes.UseCustomObjectColor = True
e.Display.DisplayPipelineAttributes.FrontDiffuse = Color.Pink

for rh_obj in self.Objects: 
    e.Display.DrawObject(rh_obj)

it really uses Color.Pink for all shadeable geometries like extrusions, breps and meshes. For curves, there seems to exist something similar which also worked:

e.Display.DisplayPipelineAttributes.UseSingleCurveColor = True
e.Display.DisplayPipelineAttributes.CurveColor = Color.Magenta

however, i was not able to control the attribute CurveThickness and other attributes eg. setting surface edge colors…

What i don’t get, how to set the pipeline attributes at one time on init and not in the events ?

thanks,
c.

2 Likes

Thank you for your insights and help @clement!

I’m going to go test and report back