Maintain properties when copying to layer?

Hi all,

I’m trying to copy some curves to a layer, so I can retrieve them in case anything goes wrong, but all of the curves are differently colored to organize them easily. Is there a way to keep the color of each curve when copying, or is it a manual, one-by-one type of thing that I would have to do after copying them?

Thanks

Hello - if I understand, you need to set objects to have their display color set to match their current layer color but be set per object and not follow the layer color… ?

This script will do that- see if it work for you.

MatchObjectToLayerColor.py (344 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

-Pascal

2 Likes

Thanks Pascal, this was exactly what I was talking about!

Hi, Pascal, if you see this:

I have another question similar to this, and I remembered you were able to help me before. I’m in a similar situation, but I wanted to know if such a script (or alternative) existed, but for Linetypes? So, if I am able to maintain linetype per curve/group of curves, regardless of layer assignment?

Thanks again,
jricha

Hi jricha - do you need this as part of the color script or as a separate one?

@jricha38 - see if this works OK - it does both at once -
MatchObjectToLayerStuff.py (527 Bytes)

-Pascal

Thanks for the reply! Whatever is easiest for you. I already have the first script you gave me downloaded, and I still use it frequently. So, if it is easier, it can just be part of the same script.

Many thanks,
jricha

Hmm, I’m probably missing something, but when I run the command RunPythonScript in Rhino, and select the script from my Downloads folder (the method I typically use), I get this error:

"Message: name ‘MatchObjectToLayerStuff’ is not defined

Traceback:
line 19, in , “MatchObjectToLayerStuff.py”

Yeah, sorry - typo - I’ll update above in 30 seconds…
-Pascal

1 Like

Works like a charm! Thanks again, Pascal.

I came about the same issue in the past.
i think the interface could be finetuned:
// current behaviour:
have objects on a layer with display Color “By Layer” - change to “Custom” will default Color to black -
// wish
it would be really great if the color does not change in a first step, turn to custom should pop the layercolor to a custom color (like pascals script), then the obejcts will have the desired behaviour - and further fine-tuning of the color is possible.

If all the backup curves are in the same layer, it will take lots of effort to convert this backup into useful data when you need it, no matter what is the color of the curves. It is much more practicable to save the curves in a block (named junk-curves, for example), or in a separate model/file.

Hello !
Is there a command line to be able to match properties of different layer color material ?
Thanks !

Actually i dont know if its possible but i would like to be able to select an object in my 3d from an other layer and assign to my layer properties the color and material of this object ! it would make me save so much time !!!
thanks in advance i pay a beer for this person !

Hi Julien - is this it?

MatchLayerToObject.py (426 Bytes)

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

I prefer an amber beer.

-Pascal

1 Like

Its exactly that ! Is there a place where we can find all this python script ?
Amber beer its a good choice !

and do you think its possible to do the same but to skeep the question and to match directly to the current layer ?

Hi Julien -

MatchCurrentLayerToObject.py (557 Bytes)

@Julien_B - updated to pay attention to assignment by layer. Did I do that right?

-Pascal

1 Like

A second one for you !

Don’t get him drunk now, there’s no telling what he might do! :woozy_face:

1 Like

image

-Pascal

1 Like