Broken button (script). Please help

Hi all,

I have this in a button to name objects inheriting their layer names:

'_NoEcho -_Runscript (

If not isArray(Rhino.SelectedObjects) then Rhino.Selectobjects(Rhino.NormalObjects)

_NoEcho -_Runscript (

If uBound(Rhino.SelectedObjects) = UBound(Rhino.NormalObjects) then _

but now when I run it I get this:

I think @pascal wrote this for me, and it worked for years. but now I just get this sad trombone sound. Any ideas?



wait, wait! I think all the junk in not just in the trunk, there’s more to it maybe? like this external script…

NameFromLayer.rvb (936 Bytes)

…and sure enough when I drag this script to the viewport button now works, like same problem than a lot of my other scripts have. I thought these are written in a way to auto-load from my designated scripts folder in preferences, no?


Does not look like one of mine… especially if it’s broken, but the macro should be:

'NoEcho -Runscript (NameFromLayerSel)

Assuming you have a script called NameFromLayerSel loaded into memory…

The rest of what you show there is a mix of bits of a script and bits of a macro that runs it…

OK- yeah- I see your next post - make sure that script is among your startup scripts (Options > RhinoScript page) and the macro above should be OK to fire it off.

No- don’t do that - hang on a sec.

OK- try this version - it’s set up for the Drag and Drop action to add these aliases:

Put those on your buttons etc. Does that work?

NameFromLayer_PG.rvb (1.1 KB)


Hi Pascal,

Thanks for taking a look at this, and please don’t judge me for mixing bits and pieces of stuff, I’m trying to get by without learning how to code :laughing:

What these chunks do, like in many of my other tools is trying to make my life simpler. I’ll explain.

For you guys at Rhino having to think if you need to preselect something or not and then deciding to run certain command or macro based on that decision it’s just too much friction and attention taken away from what I do: design stuff in Rhino. I much rather prefer the Photoshop, Sketchbook Pro, Modo approach.

I’m going to run a tool…

I I have nothing selected I mean run it to everything you see.
I I want to be specific and discretionary to which object/s / pixels should this tool run, then I will pre-select it.

In Summary I want to just Run a single command: NameFromLayers. And based on having preselection or not the script will be smart enough to run it to all visible/pickable objects, or just to what I preselected.

Any change we can bake that into the script?

BTW, I think it would be great if you guys consider this “Preselection vs. All” a global setting or preference for Rhino. It would save us thousands of clicks a month.

Example of a simple file with just 3 objects. Tool being used: move.

Current Rhino selection approach:
_Move (click 1)
"select objects to move"
drag marquee around my 3 objects (clicks 2 and 3)
“select objects to move. Press Enter when done”
_Enter (click 4)
“Point to move from” (click 5)
“point to move to” (click 6)

Preselection vs. All approach:
_Move (click 1)
“Point to move from” (click 2)
“point to move to” (click 3)

So Rhino is taking 200% the clicks that it should for any global operation. By global I mean anything that applies to all pickable objects in a viewport. You should maybe consider how often people work on single layer/ isolated modes where the edits being made apply to all pickable objects. Of course I have not really thought through all the negative implications of this preference/approach. But I can tell you I have been working like this on other apps and it seems very natural. Less clicky, less friction.



OK, I can look at how to tune up the script, I was only trying to get what you sent to run on a macro.
Hang on a bit…

Try this one - with no selection it acts on everything that could be selected - not on say, hidden objects - easy to change if you want it for really all objects.

DragonDrop adds the alias


NameFromLayer_PG2.rvb (660 Bytes)


This is so beautiful I want to cry now.

Thanks Pascal!


HAHA, I can think of a couple:



…ExtrudeCrv… Trim…


_Delete becoming _DeleteAllTheThings: I love it.

_Explode becoming _LetsBlowThisWholeFileUp: I’m game.

_ExtrudeCrv becoming _ExtrudeEveryCurveYouCanfind: magical

_Trim will only require a prompt: "just tell me with side you want gone and it will trim everything on that side of the border.

You guys are talking me into it even more. Why don’t we have this already? It’s just one global switch :wink:

1 Like

Why not inserting something like

if not rs.SelectedObjects():
    rs.Command( 'SelAll' )

before the buttons command texts ? :wink: