เชื่อมต่อ Sketchup ผ่าน Javascript

Ruby & Sketchup by Keptcode.com

Last Updated: 2024-07-06 11:37

Ruby

Path: [skeleton]\ruby-sketchup\api.rb

Language: Ruby

# New: Html Dialog
dialog = UI::HtmlDialog.new({
  # .....
})
                    
# Callback function
dialog.add_action_callback('callback') do | action_context |
  puts 'Callback: callback()'
end

# Params & Callback function
dialog.add_action_callback('register') do | action_context, firstName, lastName |
  puts 'Register: register()'
  puts 'First Name: ' + firstName
  puts 'Last Name: ' + lastName
end

JavaScript

Path: [skeleton]\ruby-sketchup\api.js

Language: Javascript

// Callback function
sketchup.callback()
                    
// Params & Callback function
sketchup.register('Keptcode', 'Extension')