Please correct this snippet of code

plugins_menu =‘Plugins’)
submenu = plugins_menu.add_submenu(‘myTest’)

submenu.add_item(‘aa’){load ‘C:/Users/imode/AppData/Roaming/SketchUp/SketchUp 2018/SketchUp/Plugins/ams_FixIt.rb’ }
#load “full path to/scripta.rb”
#submenu.add_item(‘a’){ams_FixIt.rb }
submenu.add_item(‘b’){ scriptb.rb }

I’m trying to get by clicking aa to run fixit

your codes ‘logic’ makes little sense…

SU will have already loaded ams_FixIt.rb before your menu item is even made…

submenu.add_item(‘b’){ scriptb.rb } will just cause an error…

what is your actual problem?


where did the ruby come from, I suspect it is very old and not working in v18?

FixIt 101 from SketchUcation works in v18…

I have moved move the post to the Ruby forum, and add the missing information to your question and your forum profile…

if you want to add a submenu under your own ‘title’ you need to structure your own plugin…


Thanks for reply. I found this code on the internet. Just started using ruby. I would like to build a toolbar with all my 3d printing plugins. Perhaps you could point me in the right direction to find samples.

How would I move this query to ruby forum

You would do well to study Ruby first so that you know what the syntax means. Then you would avoid issues such as


which can’t possibly work because scriptb.rb is not a Ruby object and there is a missing quote on 'b. This is a syntax error!

Then I’d study sample extensions from sketchUcation’s plugin store (I recommend that because fewer of the extensions there are encrypted) and look up the specific calls in the SketchUp Ruby API documentation to understand what they are doing.

Your code adds to the extensions menu not to a toolbar. For toolbars

unless file_loaded?(__FILE__)
	tb ="Toolbar Name")
	cmd ="Method Name") { Method to Execute }
	cmd.tooltip = "Plugin Name"
	# cmd.status_bar_text = "What the plugin does"
	# cmd.large_icon = Sketchup.find_support_file "Large Icon.png","Plugins/Icons/"
	# cmd.small_icon = Sketchup.find_support_file "Small Icon.png","Plugins/Icons/"
	#Repeat for other cmd's
	# unless tb.get_last_state == 0

I already did…

look at example ruby tutorials



Thanks. Found this

toolbar = "Action 3D Toolbar"
cmd =“Explode All”) {
cmd.small_icon = "3dtoolbar.png"
cmd.large_icon = "3dtoolbar.png"
cmd.tooltip = "Action 3D Toolbar"
cmd.status_bar_text = "Testing the toolbars class"
cmd.menu_text = "Test"
toolbar = toolbar.add_item cmd

Thank try it tomorrow.

@Hyman On the forum, please use color lexed code blocks with proper 2 space indentation.

1 Like

Thanks will look into that

#This is my entry

unless file_loaded?(FILE)
tb =“Toolbar Name”)

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