Move/Copy command

No. But it’s not expected that you can freely change everything written by someone else.

The thing is, all the Ruby methods are available to write your own Move/Copy tool that works the way you want.

Summary

but it’s just not worth it when it already exists and you just have to press a fucking button.

Sorry if this is not a direct match for your efforts, but I have a Logi MX Creative Console (short cut key device) This allows us to pre-set steps and assign to a single button. I used Keyboard short cut M (as what I use for move - W on yours), then I added keyboard shortcut “CTRL” 3 times. Then save. and in SketchUp I select an object, hit this button and it goes straight to stamp mode. If I use ctrl twice in the console setup it goes to single copy mode like your code:

Thank you, Simon.

I think I can see what your extension does now, and I suspect half the fun was simply creating it yourself using AI.

It looks a bit like selecting a component on a PC and pressing Ctrl+C and Ctrl+V, although perhaps it works a little differently on a Mac.

Cheers,

Kevin :+1:

Simon
Along the lines of Mark’s suggestion, I use an Elgato Stream Deck. It is also a shortcut key device.

It is easy and stable on PC to use the Windows Scripting Host via WIN32OLE to click the CTRL key.

I asked Gemini to give me C calls to the Mac library for clicking ALT/Option. So the Mac portion is all AI.

I do not have a Mac to test, but it works on Windows. I.e., using a ToolsObserver it goes into Copy mode each time the MoveTool gets to state 1 (which is after you click the first point of displacement.) This CopyToolSpy is only active during the Copy command.

I label it as an Example as it’s nothing I’d claim copyright upon.

Example_CopyCommand.rb → See newer RBZ posted below

The Copy command is placed on the Tools menu by default. You can change this and the menu item text at the top of the file.


REFERENCES

Also … since the observer waits until after the first point is clicked, it is expected that whilst the Move tool initializes there will not be a race condition swallowing ALT/Option or CTRL clicks (forcing extra clicks in macros, etc.)

Is an .rb file not supported on Mac? It is greyed out after download.

The .rb will work on Mac. I’m not a Mac user but it may be greyed out because your system ‘knows’ it is code that can run.

If you put it in your Plugins folder, restart SU, and then look under Tools, you should see “Copy”.

Why wouldn’t it be supported? I’m sorry to say, but if handling a simple ruby ​​(.rb) file - esencial for the extensions - is a problem for you, why do you think anyone should trust the extension you’re posting here? :tired_face:

I did not package up a rbz archive with the extension registrar script. I figured that you already had it.

  • EDIT: I’ve since posted a complete RBZ below

Besides copying it into the “Plugins” folder, you can manually copy the contents from an editor into SketchUp’s Ruby Console to load it.

ALSO, you can always manually wrap it in a ZIP and rename it RBZ, then use the Extension Manager Install button as usual. (But without a registrar script you’ll not be able to switch it off and on like a normal extension.)

I am not a programmer and do not pretend to be. I wrote in my very first post: “It seems to work but I would be interested to know if anyone else who might find it useful comes across any glitches.” So you are right. There is no reason anyone should “trust” the extension that AI wrote for me. I wanted to find out how trustworthy AI was. But this has been a rather bruising exercise. One which I am not sure I want to repeat.

Did you try what I posted above?

I did. As it stands, it is not Mac compatible. However, AI amended it and turned it into a RBZ file and then it did work. So, many thanks Dan.

It doesn’t have the full functionality of the native tool but it does work on raw geometry as well as grouped geometry. So it essentially does what I wanted.

Simon

It not being an RBZ does not make it non-Mac compatible. That is just extension packaging.
As we said (in order to test) you could have copied the content of the file into the Ruby Console, or the file itself into the “Plugins” folder.

You asked for a command to put the Move tool into Copy mode. The observer mechanism does this by clicking the ALT/Option (or CTRL) key each time you pick the 1st point.

You did not ask for a way to bail out of this loop. But you can via SPACE then M or try hitting the Option key. I think it will revert to normal Move. (It does on PC when I tap CTRL.)
Basically, activating any other tool will detach the CopyToolSpy observer.

But I really wanted to know if the keycode sent via Fiddle functions working on Mac.

So thank you for the feedback.


REMEMBER - MAKE A NOTE

Sometime in the future the means of activating the Move tool in this Copy command will need to be fixed when the send_action method is removed from the API. When that happens there should be tool activation method(s) added to the Tools class.

Just to clarify, I started by putting the RB file into the plugins folder. But as soon as I opened SU, I got a warning that the extension could not be loaded.

I think AI said something about the fiddle command needing to be written differently for a Mac, but as it was way over my head, I rather skipped over all that.

The RBZ thing was just an added nicety to allow the extension to be loaded in the usual way.

And yes, it does revert to ordinary Move as you suppose.

I guess the main thing to know for anyone interested is that it can be made to work on PC or Mac. I would post the Mac version here but I want to make sure it is stable first before entering the lion’s den again!

Simon

Hello Dan, I copied the .rb to my mac plugin folder and started the sketchup.
here is the error pop up:

Extension Errors Report
SketchUp: 26.2.242
OS: Tahoe
Ruby: 3.2.2

Extension: [unknown]
Error: NameError (uninitialized constant Fiddle::TYPE_UINT16)
/Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand.rb:34:in <class:CopyToolSpy>' /Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand.rb:9:in module:CopyCommand’
/Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand.rb:2:in <module:Example>' /Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand.rb:1:in <top (required)>’

Edit: confirmed working in win11 with SU2024. Found under Tools menu new “Copy” command. With an object selected, click this Copy command and it goes straight to Move/Copy as expected.
and no load errors for the script. (copied .rb to plugins folder as instructed)

Thanx Mark. I’ll look into this tomorrow.

MORE INFO: The dumb Gemini AI admitted that it actually does not look up existing constant names. That it just made assumptions based generally on C constant names. It also said that there is no way for us to ensure that it actually refers to Ruby documentation before it generates code.

Okay (hopefully) the type constants are now correct for Mac.

Here is a complete RBZ archive:

Example_CopyCommand_1.1.0.rbz See update below.

Custom toolbar icons can be added. (See the registrar file for explanation.)

Thanks Dan. Tested on Win11 works great. Even lets you click and copy multiple times, nice touch.
Did notice the NumLock display pops up momentarily when using this command (not a problem for me, just an observation)

I’ll test on Mac tonight :slight_smile:

Edit: On Mac, was able to install no errors. The tool pallat icon is missing.
when activating it lets me click an unselected objet and move it (but does not copy)
If i preselect an object and activate the tool same result, move only no copy.

from the ruby console I get this activity when using the tool:

#<TypeError: no implicit conversion of true into Integer>

/Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand/copy_main.rb:70:in `call'

/Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand/copy_main.rb:70:in `copy_modifier_key'

/Users/markperrah/Library/Application Support/SketchUp 2026/SketchUp/Plugins/Example_CopyCommand/copy_main.rb:80:in `onToolStateChanged'

Yes I did also. Weird.

EDIT: AI tells me that I can switch off the key lock notifications in Logi Options(+). (I switched them off and it works. No more popup.) It blames the mouse / keyboard software that they are not used to modifier clicks without other keys.