Skip to content

Incorrect sendAction Command and Quote Marks in Documentation #1040

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
son-urban opened this issue Mar 28, 2025 · 4 comments
Open

Incorrect sendAction Command and Quote Marks in Documentation #1040

son-urban opened this issue Mar 28, 2025 · 4 comments

Comments

@son-urban
Copy link

Bug Report: Incorrect sendAction Command and Quote Marks in Documentation

Issue:
Sketchup::ModelObserver#onTransactionUndo & #onTransactionRedo
The documentation incorrectly suggests using:

Sketchup.sendAction(“editUndo”)
Sketchup.sendAction(“editRedo”)

Issues:

  1. sendAction is outdated; the correct method is send_action.
  2. The action strings require a colon (:) at the end.
  3. The quote marks (“ ”) are incorrect for Ruby; they should be standard double quotes (" ").

Correct Usage:

Sketchup.send_action("editUndo:")
Sketchup.send_action("editRedo:")

Steps to Reproduce:

  1. Run Sketchup.sendAction(“editUndo”) – Error.
Sketchup.sendAction(“editUndo”)
Error: 
#<NameError: undefined local variable or method `“editUndo”' for main:Object>
<main>:in `<main>'
SketchUp:in `eval'

=> nil
Sketchup.sendAction("editUndo:")
Error: 
#<NoMethodError: undefined method `sendAction' for Sketchup:Module
Did you mean?  send_action>
<main>:in `<main>'
SketchUp:in `eval
  1. Run Sketchup.send_action("editUndo:") – it correctly triggers undo.

Suggested Fix:
Update the documentation to use Sketchup.send_action("editUndo:") and Sketchup.send_action("editRedo:"), ensuring correct method names, colons, and quote marks.

@thomthom
Copy link
Member

Aside from the documentation issues, please avoid Sketchup.sendAction if possible. It's an API we should have marked deprecated a long time ago.

@son-urban
Copy link
Author

Aside from the documentation issues, please avoid Sketchup.sendAction if possible. It's an API we should have marked deprecated a long time ago.

I think since Sketchup.sendAction is not a valid method and raises a NoMethodError (checked back to SU2016), there's no need to worry about deprecating it - it simply doesn't exist.

@thomthom
Copy link
Member

thomthom commented Apr 2, 2025

I meant Sketchup.send_action.

@son-urban
Copy link
Author

son-urban commented Apr 2, 2025

Could you clarify why Sketchup.send_action should be avoided? Is it due to potential future deprecation, instability, or another reason? I'm currently using send_action for simple tool selections, like Sketchup.send_action('selectMoveTool:')

Edit: I found your comment on that #542 (comment) . Now I get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants