Hi, I’m trying to block the CopyToClipboard
operation after detecting e.CommandEnglishName == "CopyToClipboard"
. Is there any way to prevent this action from being executed?
Hi, There’s no Handled
property in CommandEventArgs
. The only available properties are listed here: https://developer.rhino3d.com/api/rhinocommon/rhino.commands.commandeventargs
Currently, I am using the AddRhinoObject
event to delete the object after the paste, which solves what I want to achieve. However, I still couldn’t prevent the copy action.
Hi @ilterhan - what are you trying to accomplish, and why do you need to block a copy action?
Hi @menno I am creating an object consisting of 40 parts using a command, and I have operations inside the command. However, when I use copy-paste, my operations don’t work, so I wanted to block the copy action. Instead, I am currently using the onAdd
command to perform the same operations within that method, ensuring it works correctly. However, now I am unable to capture the copies created with Alt+drag.
Hi @ilterhan,
CopyToClipboard/Paste and Alt+Drag are two completely different operations.
CopyToClipboard/Paste is essentially a file export/import operation, while Alt+Drag operates similar to the Copy command (i.e. object transformation).
There is not a way of blocking the CopyToClipboard, sorry. Might be best to figure out how to support it.
– Dale
Hi,
I would seriously question why you have this requirement, It does raise an eyebrow.
You could do this thinking a bit outside the box :
// Start listening for key presses in the computer.
BeginListeningForKeys()
When a key is pressed:
If the key is "C" and the Control key is held down:
If the window we see on the screen is Rhino:
Empty whatever has been copied (clear the clipboard)
ì EndIf
EndIf
Let everything else work as usual
EndWhen
You could also empty the clipboard content before running the script, which I think would make this 100x less deranged in scope. Interfiring with keyboard events and clipboard events is always food for problems down the line.
Hope this helps you,
Farouk
Thanks a lot for your answer @dale I have solved my problem in other ways.
I have a group object that I call with a command. When I create it, I store its GeometryBase and attributes in a global dictionary, but this process doesn’t apply during copy-paste. I solved my problem using AddRhinoObject. Thanks for your answer @farouk.serragedine