Color by parent

If I create lines from solids and surfaces using the section command with the color by object, and then want to set those lines on a different layer the lose the original color. How can I keep the original colors yet put them all on one layer? I thought that color ‘by parent’ would do this.

Hi Jody- set display color explicitly in object Properties - there are some defaults, and ‘Other’ (=Custom color for the object(s)

-Pascal

Thanks for the response Pascal but what I want is for them to keep the color they had before getting assigned to a new layer. It would be a lot of work to select by color and assign explicitly as you suggest before assigning to the new layer. I guess I’m just lazy. I often get GA’s from AutoCad users that have tons of layers with very obscure names and I just want to use their work as a reference and put all those tiny little lines and segments on a layer such a ‘profile’ or ‘plan’ as the case may be. To do so I loose all the original color assignments when it all goes to the new single layer. I’ll try and find an example and post.

Try the Block command first before changing the layer… the original layer color should stick.

Thanks Brian, I’ll try that. I read the help file about parent colored and it sort of hinted at that solution but I was too non savvy to figure that out.

Hi Jody - what I understand is that you are creating a pile of curves from the Section command, right? and these take on their layer color by default, this depending upon how you set the output (AssignLayersBy). So they have a color when created, are you asking to set the object color to an object’s layer color, so that it can be moved to a different layer and keep that color?

-Pascal

Hi Pascal,

After I have the native colors of the lines from the surfs that they were sectioned from, I wanted to call that group "sect xx" and make a new layer of them without loosing the colors that they had from their origin. Brians solution of making the multicolored section lines into a group before putting them on the new Sect XX layer does exactly what I want. Just tried it here to confirm. It always sort of bugged me that behavior of changing a layer color and not have everything in a block change as well, but I guess 'one mans bug is another mans feature'! I like that now and would have saved me huge headaches in my ACAD references imports. I mainly put that stuff on a new layer after 'super exploding' to get rid of the thousands of acad blocks that come in and hundreds of oddly named layers. It was worth it to me to give up the individual colors but now I should be able to keep them by re-blocking as per Brians suggestion. 

Thanks to you and Brian (and the rest of the gang!)

Jody

You guys are the best!

Hi All!

Had to post this solution to the problem as I absolutely HATE working with blocks. As useful as they are, I always try to find a better solution than putting things in blocks as I really don’t like the way Rhino handles them.

For the above problem, a super simple script is way more helpful after running the section command, particularly whilst the resulting curves are selected after the Section command.

import rhinoscriptsyntax as rs

#Object color by object layer color
objs = rs.GetObjects('Select objects')
for obj in objs:
    objLayer = rs.ObjectLayer(obj)
    objLayerColor = rs.LayerColor(objLayer)
    #set obj color to objLayerColor
    rs.ObjectColor(obj, objLayerColor)

You can then simply move the objects to any layer and they will retain their display color without grouping / blocking etc.

GM

c5-q-lockcolor.py (722 Bytes)

Here is the script that I use to lock objects color

HTH Cheers

Emilio, that is precisely what I had in mind, you are a salvation. Thanks so much. Amazing the help available here, I wish I understood scripting but this sort of solution will may me pay more attention to the power of scripting.

c5-q-resetcolor.py (648 Bytes)
Glad it works for you.
Here is the companion script to reset objects to Layer Colour … just in case. :smile:
Cheers

Thanks again Emilio!