Create Own Buttons/Toolbar for Extensions

Today I installed a bunch of plugins that will help me with my workflow. However I soon descovered some of them do not have a toolbar/button developed for them. I’d prefer them to be on a toolbar rather than under the Extensions menu at the top.

Is it possible to create my own buttons for the extensions I’ve installed? I googled for this solution extensively today but never got a concrete answer.

(I’m currently using SketchUp Pro 2018. I’ve also tried the ToolBar Editor plugin but it required me inputting the Ruby code myself)

I don’t think there currently is a way to achieve this without writing any Ruby code. Creating an extension that allows people to do this without writing code of their own is in theory possible but would take quite a lot of work and bend the rules of what plugins are allowed to do (it would need to override SketchUp’s API method for adding menu entries to get a reference to whatever the other plugins do). @Aerilius’s LanchUp already does that, but rather than letting you create custom toolbars for the commands it lets you search them.

That’s a shame… some of the tools would be so useful as a one click button as opposed to searching through the drop-down menu. This may be a stupid question but is there a way to retrieve the Ruby code manually for the simple purpose of pasting in to the box provided by ToolBar Editor plugin?

What you can do is choose which toolbar buttons to use and how to combine them when the extensions you use already have toolbar buttons:

You can give then keyboard shortcuts.

What you can do is choose which toolbar buttons to use and how to combine them when the extensions you use already have toolbar buttons

I’ve already looked at the Toolbar Editor and unfortunately it doesn’t help accomplish what I’m after; the extensions I’ve installed don’t have a toolbar button scripted so they don’t appear for selection.

You can give then keyboard shortcuts.

This is a good option - I’ll just have to remember what keyboard shortcut I assign!

You can search the plugins for add_item. The code typicaly looks something like this. The code inside the curly brackets after add_item is the code that is executed when the entry is clicked."Draw").add_item("My Procedure") {
  UI.messagebox("My Procedure")

The code can also look like this. Here the add_item method references a command object nammed cmd. In that case, find the command object and copy the code within its curly brackets.

cmd ="My Procedure") {
  UI.messagebox("My Procedure")
cmd.menu_text = "My Procedure""Draw").add_item(cmd)

Notepad++ has a nice Find in Folder feature that can search multiple files at once.

This only works if the source isn’t scrambled though.

Thank you for the explanation and the examples.

# Select entities first...
### i.e. pick or filter what you want cp'ing first...
### Original by Jim ### 'All' version made by TIG..."Plugins").add_item("Add Centerpoint"){
  model.start_operation("Add Centerpoint")

Following your advice would I put:

model.start_operation(“Add Centerpoint”)

in to the Ruby console?

Typically the add_item method reference a method but in this example the whole business code is defined within the menu entry. I’m not familiar with ToolBar Editor but if it supports custom Ruby code (and doesn’t have restrictions on length) this should work.

NO, you’d paste it into the Toolbar Editor’s command creation dialog.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.