Sketchup 2024 File
module MyFeature unless file_loaded?() UI.menu('Plugins').add_item('Start My Tool') do Sketchup.active_model.select_tool(MyTool.new) end file_loaded( FILE ) end end 4. Adding a UI Dialog (HTML/CSS/JS) SketchUp 2024 supports WebDialog :
def self.run model = Sketchup.active_model return UI.messagebox('Open a model first.') unless model sketchup 2024
class MyTool def activate puts 'Tool activated' end def onMouseMove(flags, x, y, view) # Update preview end module MyFeature unless file_loaded
def onLButtonDown(flags, x, y, view) UI.messagebox('You clicked!') end end sketchup 2024
UI.messagebox('My feature is running!') # Your feature code here end end Replace my_feature_main.rb with a tool:
module MyFeature unless file_loaded?() UI.menu('Plugins').add_item('Start My Tool') do Sketchup.active_model.select_tool(MyTool.new) end file_loaded( FILE ) end end 4. Adding a UI Dialog (HTML/CSS/JS) SketchUp 2024 supports WebDialog :
def self.run model = Sketchup.active_model return UI.messagebox('Open a model first.') unless model
class MyTool def activate puts 'Tool activated' end def onMouseMove(flags, x, y, view) # Update preview end
def onLButtonDown(flags, x, y, view) UI.messagebox('You clicked!') end end
UI.messagebox('My feature is running!') # Your feature code here end end Replace my_feature_main.rb with a tool: