ScriptSpot home

Forum topic · Scripts Wanted

copy name and wire

By jsrocha · 2011-02-16

Description

Hy guys, is too hard to make a scritp to copy the name and wire color from an object? something like: i have a selected object, and when i run the script, he ask me to pick an object, and then it copies the name and wire color to the selected object.
I looked for a script like that but i never found.
Thanks in advance,

Jsrocha

Comments (6)
jsrocha

ops...

Panayot Karabakalov

hope this help

--macroScript Copy_NameAndColor category:"Tests" tooltip:"..."
(
	me = selection[1]
	if isValidNode me do
	(
		ref = pickObject count:1
		if isValidNode ref do
		(
			me.name = ref.name
			me.wirecolor = ref.wirecolor
		)
	)
)
Reply to jsrocha
jsrocha

Hi Anubis, me again. The script you wrote does exactly what i asked. But now i figured that it would be good if it worked also with more than one object selected. Is that possible?
thanks again,

Jsrocha

Reply to jsrocha
Panayot Karabakalov

maby easy or not

This will assign the wire color from picked object to all selected objects:

ref = pickObject count:1
if isValidNode ref do
	selection.wirecolor = ref.wirecolor

But what about the names... hardly you like to end with dups names. I think you need a ui-dialog where to pick equal (to selected) amount of objects from which to copy their names (in obj-per-obj manner).

Thanks man, the wirecolor option is very useful, more than the name option.
thanks again for your help,

Jsrocha