DupLayer only partially implemented

I got my hopes up when i typed “DupLayer” and didn’t get the “This feature is not yet implemented” dialog box… however, the dialog that DOES pop up isn’t much better. :confused:

Will this feature be complete in the released version, or is it not ready to come out and play yet? I do a lot of iterative design processes, and this feature would be a HUGE time saver!

Yep, looks like a bug to me…
http://mcneel.myjetbrains.com/youtrack/issue/MR-2061

Right click on layer>Duplicate is also in the pipeline for 5.x (not the first release version)
http://mcneel.myjetbrains.com/youtrack/issue/MR-1472
http://mcneel.myjetbrains.com/youtrack/issue/MR-1473

–Mitch

In the meantime @decibelguitars you can use the following script which will allow you to choose the layer in a dialog, then duplicate the layer and the objects on it.

–Mitch

(not sure if uploading/downloading is working again or not… OK, looks like a Zip file goes through, but a .py file doesn’t @stevebaer HELP!)

DupLayerAndObjs.zip (474 Bytes)

Simple solution if you don’t want to mess with a script:

Right click the hide icon in case you have anything hidden on the layer you want to copy.

Create new layer and name it.

Right click source layer and pick "select objects on this layer.

Right click target layer and select “copy selected objects to this layer.”

If you want to preserve the hidden attributes of the layer, do essentially the same thing but don’t unhide, rather copy the unhidden objects, swap hidden, copy the hidden then swap hidden again.

Is there a simple means of attaching a script to a button? Also is there any way to add icons for buttons outside of the generic question mark one?

You’ll have to mess with the Mac Rhino way of customizing your workspace… I don’t have an exact description here. It’s not quite as easy/flexible as the Win Rhino button interface.

You can also create an alias for the script. It’s a little bit more restrictive than under Windows, but very do-able.

The easiest thing is to put the script in your default scripts folder - it’s hidden in your libraries folder, you can find it from the “Go” menu if you hold the Alt key:

/Users/username/Library/Application Support/McNeel/Rhinoceros/Scripts

If you do that, you can run the script with just ! _-RunPythonScript Scriptname

Make an alias for that and you’re good to go.

Otherwise, you can put the script where you want, but then for your alias you need to use

! _-RunPythonScript path/to/script/Scriptname.py

HTH, --Mitch

Cool. Will give that a go.

@decibelguitars, @Helvetosaur did this one which also duplicates all sub-layers.

Works a treat, I have been using it at least once a week for the last year.

DupLayerSublayersAndObjs.py (2.4 KB)

Working here …

Yeah, it would upload (veeery slowly) but then you couldn’t download it, it would give you the message “Private page…” Wasn’t working most of the weekend and this morning, but started working again this afternoon.

–Mitch

Cool, thanks for the scripts, guys! I’ll give them a try.

Just out of curiosity, has anyone tried using Apple’s Automator and/or AppleScript with Rhino?

@jeff_hammond has used Automator to set Rhino Services to get python to work with Atom Editor. Other than that I am not sure if McNeel will implement AppleScript into Rhino.

Adding Rhino Script’s not working at all.

Here I’ve tried two different ways to get it onto the Transform Toolbar.

The first is to specify the script in the Run Python Script command from the lower half. This results in the blank icon between cage edit and Move X. It also underscores the need to be able to specify an icon for something that doesn’t have one for reasons I’ll get to in a second.

The second is to create a new item from the lower half with the + button, and manually type in the data as show, then drag that to the transform toolbar (that’s the one to the right of the blank with the generic “?” icon. (Again underscoring the need to assign icons, as if even if this approach worked (which it doesn’t), you’d have several in a row with identical icons, which makes the whole point of putting them on the toolbar pretty useless).

So next I save this, open a new document and get:

Absolutely nothing. They should both be between cage edit and move right but there’s absolutely nothing there. I’ve had this happen previously when trying similar things.

As mentioned in other posts, the whole customize portion of the UI is the most buggy and the IMO the largest obstacle to Rhino’s success as a mac product. It’s ok if the developer doesn’t totally “get” how mac people think and work, provided there’s a way from point a to point b, which generally involves workarounds to accommodate the workflow of the user, but when the mechanic to do that doesn’t work it leaves on pretty much dead in the water. So while the script for the original problem probably does exactly what’s needed, without the ability to get it up on a toolbar someplace I’m back at ground zero, doing many manual operations to achieve the same thing.

Furthermore in the process of trying to set up these customized buttons I ran into another issue: once I closed the customize dialog, Rhino stopped responding to mouse inputs in the viewports. I was just going to draw a couple quick objects on the layer to test the script and the polyline command wouldn’t draw the points unless I hammered the mouse button several times and it was very inconsistent (resulting in the scribble in the viewport). I closed that file, tried a new one, and had the same result. Opened an existing file, tried that and had the same result, finally had to quit Rhino, and relaunch it to get it to work correctly again.

And even post launch the script commands do not show up on the transform palette even though a subsequent trip into the customize UI shows them both being there.

If you do get it working, I forgot the dash in the command macro above: You need _-RunPythonScript and not _RunPythonScript… Sorry… --Mitch

you could control some rhino stuff with AppleScript via system events. but Python is better than AppleScript anyway. (I think(for one, you can’t loop in AppleScript))

I learned some applescript in the past but it didn’t really click with me the way Python has… idk, if there’s something you’d like to be able to do with rhino/AppleScript that can’t be done with Python, it might be better to put in a rhino/Python feature request.
(imo)

1 Like