Module: UI

Defined in:
lib/ui.rb,
lib/command.rb,
lib/toolbar.rb,
lib/webdialog.rb

Defined Under Namespace

Classes: Command, Toolbar, WebDialog

Class Method Summary collapse

Class Method Details

.add_context_menu_handlerObject


2
3
# File 'lib/ui.rb', line 2

def self.add_context_menu_handler
end

.beepObject

Examples:

UI.beep

7
8
# File 'lib/ui.rb', line 7

def self.beep
end

.create_cursor(filename, hot_x, hot_y) ⇒ Object

Since:

  • SketchUp 2016 - support for .svg icons added


11
12
# File 'lib/ui.rb', line 11

def self.create_cursor(filename, hot_x, hot_y)
end

.inputbox(*args) ⇒ Object


13
14
# File 'lib/ui.rb', line 13

def self.inputbox(*args)
end

.inspector_namesObject


15
16
# File 'lib/ui.rb', line 15

def self.inspector_names
end

Used to access SketchUp menus in order to add menu items.

Valid Strings are: File, Edit, View, Camera, Draw, Tools, Window, Plugins, Help

User-defined top-level menus will not be added., although users may define sub-menus.

A mis-typed menu name may return one of the valid menu with no error given, or it may produce an error.

The Plugins menu may or may not be visible when SketchUp starts. It will be created upon the first access.

References to Menus are time-sensitive. You have a limited amount of time to add your menu items before the menu reference no longer works. No error given in this case.

Examples:

menu = UI.menu("Plugins")
menu.add_item("My Plugin") { UI.messagebox("Hello!") }

Parameters:

  • menu_name (String) (defaults to: nil)

    the name of an existing SketchUp menu.

Returns:


41
42
# File 'lib/ui.rb', line 41

def self.menu(menu_name = nil)
end

.messagebox(message, type = IDOK) ⇒ Object


44
45
# File 'lib/ui.rb', line 44

def self.messagebox(message, type = IDOK)
end

.model_info_pagesObject

Display a list of the names of the available tabs in the Model Info Window.


48
49
# File 'lib/ui.rb', line 48

def self.model_info_pages
end

.openpanel(title, path, file_filter) ⇒ Object

File selection dialog.

Examples:

chosen_model = UI.openpanel("Open SKP File", "c:/", "model.skp")
chosen_image = UI.openpanel("Open Image File", "c:/", "Image Files|*.jpg;*.png;||")
chosen_file  = UI.openpanel("Open CAD File", "c:/", "DXF|*.dxf|DWG|*.dwg||")

Version:

  • 2014


61
62
# File 'lib/ui.rb', line 61

def self.openpanel(title, path, file_filter)
end

.openURL(url) ⇒ Object


51
52
# File 'lib/ui.rb', line 51

def self.openURL(url)
end

.play_sound(filename) ⇒ Object


64
65
# File 'lib/ui.rb', line 64

def self.play_sound(filename)
end

.preferences_pagesObject

See Also:


68
69
# File 'lib/ui.rb', line 68

def self.preferences_pages
end

.refresh_inspectorsObject


71
72
# File 'lib/ui.rb', line 71

def self.refresh_inspectors
end

.savepanel(title, path, file_filter) ⇒ Object

File save dialog


75
76
# File 'lib/ui.rb', line 75

def self.savepanel(title, path, file_filter)
end

.select_directory(opts = {}) ⇒ String, ...

Returns nil if user cancel

Parameters:

  • opts (Hash) (defaults to: {})

    the options

Options Hash (opts):

  • :title (String)
  • :directory (String)
  • :select_multiple (Boolean)

    false

Returns:

Since:

  • 2015


85
86
# File 'lib/ui.rb', line 85

def self.select_directory(opts = {})
end

.set_cursor(cursor_id) ⇒ Object


88
89
# File 'lib/ui.rb', line 88

def self.set_cursor(cursor_id)
end

.set_toolbar_visible(name, visible) ⇒ Object


90
91
# File 'lib/ui.rb', line 90

def self.set_toolbar_visible(name, visible)
end

.show_inspector(name) ⇒ Object


92
93
# File 'lib/ui.rb', line 92

def self.show_inspector(name)
end

.show_model_info(page) ⇒ Object


94
95
# File 'lib/ui.rb', line 94

def self.show_model_info(page)
end

.show_preferences(page) ⇒ Object


96
97
# File 'lib/ui.rb', line 96

def self.show_preferences(page)
end

.start_timer(interval, repeat = false) { ... } ⇒ Fixnum

Note:

In SketchUp 7.1 and lower, the interval was rounded down to the nearest integer. A timer with interval 0.9 would execute immediately.

Note:

There is a bug that if you open a modal window in a non-repeating timer the timer will repeat until the window is closed.

The start_timer method is used to start a timer and execute deferred code.

Parameters:

  • interval (Numeric)

    The time in seconds before your code should be called.

  • repeat (Boolean) (defaults to: false)

    whether to repeat the timer

Yields:

  • The procedure you want to execute after the amount of seconds has expired.

Returns:

  • (Fixnum)

    id a timer ID to identify the timer for stopping it


108
109
# File 'lib/ui.rb', line 108

def self.start_timer(interval, repeat=false, &block)
end

.stop_timer(id) ⇒ nil

The stop_timer method is used to stop a timer based on its id.

Parameters:

  • id (Fixnum)

    The timer id for the timer that you want to stop.

Returns:

  • (nil)

114
115
# File 'lib/ui.rb', line 114

def self.stop_timer(id)
end

.toolbar(name) ⇒ Object


117
118
# File 'lib/ui.rb', line 117

def self.toolbar(name)
end

.toolbar_namesObject


119
120
# File 'lib/ui.rb', line 119

def self.toolbar_names
end

.toolbar_visible?(name) ⇒ Boolean

Returns:

  • (Boolean)

121
122
# File 'lib/ui.rb', line 121

def self.toolbar_visible?(name)
end