Thanks Dan, that’s an awesome introduction to Ruby scripts for SketchUp. I dropped it in my plugins folder and it appears to be loading because when I type Sample::ShowAngles::FMT in the Ruby console it echoes back the format, but otherwise how do I get it to work? From ITEM it looks like it should be a menu option (under Camera perhaps?) but I don’t actually see anything under any of the menus. This is after restarting SketchUp.
Edit: Doh, I see it now under a Right Click, I was looking in the drop down menus. Awesome, thanks!
Yes you can add an item to a dropdown menu, by adding a line after the @cmd instance variable is created and it’s text is set to the ITEM string constant. For example, adding it to the bottom of the “Camera” menu:
UI.menu("Camera").add_item @cmd
Command instance references can also be used to make toolbar buttons.
Check out the API docs for the UI::Toolbar class. (But because they have extra image files for buttons, we usually package things up in a plugin sub-directory, and have a SketchupExtension registration script in the “Plugins” directory that loads the script in the subdir.)
Note that this gives the angle between the view and global model axes - not the drawing axes which the user might have set. Unfortunately the drawing axes isn’t exposed to the Ruby API yet.