@unknownuser said:
TIG
I my studies of Ruby for Sketchup, I have no problem with finding the context menu, it just seems to me there is always an "if then" statement, proceeding the menu add statement, and I don't see on this the other menus. There are some plugins that appear in more than one menu, and I usually turn off the context menu, and move the plugin to an other memu selection where I wish to have the plugin appear. However, I have not been able to master the coding to get rid of just a context menu with the "if selection is.....".
Anyway, I will keep trying.
Thank
Ken
You could write a intermediate method to do the check. If ok, it runs the plugin. If not valid, then it pop up an error message:
def xLine_check_valid
if xLine_validate_selection
xLine
else
UI.messagebox "Invalid selection"
end
end
if( not file_loaded?("xLine.rb") )
UI.menu("Plugins").add_item("Convert lines to guide lines"){xLine_check_valid}
end
file_loaded("xLine.rb")