I made this little plugin that opens a page inside SketchUp, but I can’t make the links that download skp work and insert the files in SketchUp.
If my website links to skp files, is it possible?
require 'sketchup'
module MyPlugin
def self.open_website
# Create a new HTML dialog
dialog = UI::HtmlDialog.new
# Set the width and height of the HTML dialog
dialog.set_size(800, 600)
# Set the URL of the HTML dialog
dialog.set_url("https://3dwarehouse.sketchup.com/user/2007bc5e-f8dc-4e22-a9ff-0fa999479db0/Fazt3ds")
# Set the callback for link clicks
dialog.add_action_callback("link_clicked") { |dialog, params|
# Get the clicked link URL from the action value
link_url = params
# Load the clicked URL in the same HTML dialog
dialog.set_url(link_url)
}
# Show the HTML dialog
dialog.show
end
end
unless file_loaded?(__FILE__)
cmd = UI::Command.new("Open Website") { MyPlugin.open_website }
cmd.tooltip = "Opens a specified website"
cmd.status_bar_text = "Opens a specified website"
cmd.menu_text = "Open Website"
toolbar = UI::Toolbar.new "My Toolbar"
toolbar = toolbar.add_item cmd
toolbar.show
file_loaded(__FILE__)
end