+ Reply to Thread
Results 1 to 4 of 4

Thread: New Layer / Object Color

  1. #1

    New Layer / Object Color

    Hi

    I am creating new layers with different colors and then i put objects on them. When i programed this a few months ago it worked fine, objects were displayed with separate colors. However, recently the layer colors only show in print-display mode?

    Here i create the layer:
    Code:
    layer_index0 = scriptcontext.doc.Layers.Add(__ts()+'_name', System.Drawing.Color.FromArgb(255,0,0))
    then i create an object and attributes:
    Code:
    line = Rhino.Geometry.Line(p0,pt1)
    attr = Rhino.DocObjects.ObjectAttributes()
    attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
    attr.LayerIndex = layer_index0
    scriptcontext.doc.Objects.AddLine(line, attr)
    What am i doing wrong?

    Best, Nick

  2. #2
    does it help if you set the object color in the attributes? like this
    Code:
    attr.ColorSource = Rhino.DocObjects.ObjectColorSource.ColorFromObject
    attr.ObjectColor = System.Drawing.Color.FromArgb(0,150,0)

  3. #3
    thanks, this works nicely.

    However there must be an option for objects to automatically receive their print/display color from the layer color?

  4. #4
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    313
    Normally, if you don't specify anything else, objects will automatically have the display color of the layer they're on, and the print color will be set to by layer as well. Print color is different from display color - objects can display in one color and print in another if the "print color" box is checked in the Print dialog or scripted in the command line options. To set print color, looks like you need to use PlotColor and PlotColorSource.

    --Mitch

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts