Module: AMS::Sketchup
- Defined in:
- docs/ams/sketchup.rb
Overview
Windows only!
The Sketchup namespace contains functions that allow user to get various information on SketchUp window and its child windows.
Class Method Summary collapse
-
.activate_scenes_bar_tab(tab_index) ⇒ Boolean
Activate (highlight) scene tab without activating the associated page.
-
.add_observer(object) ⇒ Boolean
Add object to the observers list.
-
.bring_to_top ⇒ Boolean
Set main window active.
-
.close ⇒ Boolean
Close current SketchUp application.
-
.close_dialogs ⇒ Integer
Close all dialogs and trays.
-
.close_toolbars ⇒ Integer
Close all floating toolbars.
-
.close_trays ⇒ Integer
Close all trays.
-
.find_child_window_by_caption(parent_handle, caption, include_sub_childs = false, full_match = true, case_sensitive = true) ⇒ Integer?
Find handle to a child window with a specific caption.
-
.find_child_window_by_class_name(parent_handle, class_name, include_sub_childs = false, full_match = true, case_sensitive = true) ⇒ Integer?
Find handle to a child window with a specific class name.
-
.find_window_by_caption(caption, full_match = true, case_sensitive = true) ⇒ Integer?
Find handle to a window with a specific caption.
-
.find_window_by_class_name(class_name, full_match = true, case_sensitive = true) ⇒ Integer?
Find handle to a window with a specific class name.
-
.get_active_dialogs ⇒ Array<Integer>
Get all used pop-up windows of the current SketchUp application.
-
.get_active_toolbars ⇒ Array<Integer>
Get all used floating toolbars.
-
.get_caption ⇒ String
Get main window title text.
-
.get_dialogs ⇒ Array<Integer>
Get all pop-up windows of the current SketchUp application.
-
.get_executable_path ⇒ String
Get full path to SketchUp.exe.
-
.get_executalbe_name ⇒ String
Get executable name of this application.
-
.get_main_window ⇒ Integer
Get handle to the main window of the current SketchUp application.
-
.get_menu_bar ⇒ Integer
Get handle to the menu bar of the main window.
-
.get_module_handle ⇒ Integer
Get module handle to the current SketchUp application.
-
.get_other_main_windows ⇒ Array<Integer>
Get handles to all SketchUp main windows, except for the current one.
-
.get_process_id ⇒ Integer
Get process id of the current SketchUp application.
-
.get_registry_path ⇒ String
Get registry path of the current SketchUp application.
-
.get_scenes_bar ⇒ Integer
Get handle to the scenes bar of the main window.
-
.get_status_bar ⇒ Integer
Get handle to the status bar of the main window.
-
.get_thread_id ⇒ Integer
Get thread id of the current SketchUp application.
-
.get_toolbar_containers ⇒ Array<Integer>
Get handles to the four toolbar containers of the main window.
-
.get_toolbars ⇒ Array<Integer>
Get all floating toolbars of the current SketchUp application.
-
.get_viewport ⇒ Integer
Get handle to the view window of the main window.
-
.get_viewport_center ⇒ Array<Integer>
Get viewport center in screen coordinates.
-
.get_viewport_origin ⇒ Array<Integer>
Get upper-left corner of the view window in screen coordinates.
-
.get_viewport_rect ⇒ Array<Integer>
Get upper-left and lower-right corners of the view window in screen coordinates, relative to the upper-left corner of the screen.
-
.get_viewport_size ⇒ Array<Integer>
Get width and height of the view window in pixels.
-
.get_visible_dialogs ⇒ Array<Integer>
Get all visible pop-up windows of the current SketchUp application.
-
.get_visible_toolbars ⇒ Array<Integer>
Get all visible floating toolbars of the current SketchUp application.
-
.ignore_dialog(handle) ⇒ Boolean
Exlude dialog from the Sketchup.show_dialogs and Sketchup.close_dialogs operations.
-
.ignore_toolbar(handle) ⇒ Boolean
Exlude toolbar from the Sketchup.show_toolbars and Sketchup.close_toolbars operations.
-
.include_dialog(handle) ⇒ Boolean
Include dialog in the Sketchup.show_dialogs and Sketchup.close_dialogs operations.
-
.include_toolbar(handle) ⇒ Boolean
Include toolbar in the Sketchup.show_toolbars and Sketchup.close_toolbars operations.
-
.is_active? ⇒ Boolean
Determine whether the current active window belongs to the current SketchUp application.
-
.is_full_screen? ⇒ Boolean
Determine whether main window is full screen.
-
.is_main_window_active? ⇒ Boolean
Determine whether SketchUp main window is active.
-
.is_maximized? ⇒ Boolean
Determine whether main window is maximized.
-
.is_menu_bar_set? ⇒ Boolean
Determine whether menu bar is set.
-
.is_minimized? ⇒ Boolean
Determine whether main window is minimized.
-
.is_restored? ⇒ Boolean
Determine whether main window is restored.
-
.is_scenes_bar_empty? ⇒ Boolean
Determine whether scenes bar is empty.
-
.is_scenes_bar_filled? ⇒ Boolean
Determine whether scenes bar is filled.
-
.is_scenes_bar_visible? ⇒ Boolean
Determine whether scenes bar is visible.
-
.is_status_bar_visible? ⇒ Boolean
Determine whether status bar is visible.
-
.is_toolbar_container_empty?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are empty.
-
.is_toolbar_container_filled?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are filled.
-
.is_toolbar_container_hidden?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are hidden.
-
.is_toolbar_container_visible?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are visible.
-
.is_viewport_border_set? ⇒ Boolean
Determine whether viewport border is set.
-
.is_viewport_focused? ⇒ Boolean
Check if the viewport window has the keyboard focus.
-
.maximize ⇒ Boolean
Set main window maximized.
-
.minimize ⇒ Boolean
Set main window minimized.
-
.refresh ⇒ Boolean
Refresh the current SketchUp application.
-
.remove_observer(object) ⇒ Boolean
Remove object from the observers list.
-
.restore ⇒ Boolean
Set main window to normal placement.
-
.send_user_message(receiver_handle, id, user_data) ⇒ Boolean
Send information to another window.
-
.set_caption(caption) ⇒ Boolean
Set main window title text.
-
.set_menu_bar(state) ⇒ Boolean
Set/remove menu bar.
-
.set_viewport_border(state) ⇒ Boolean
Set/remove viewport border, a thin edge surrounding the view.
-
.show_dialogs(state) ⇒ Integer
Show/hide all dialogs and trays.
-
.show_scenes_bar(state, refresh = true) ⇒ Boolean
Show/hide scenes bar.
-
.show_status_bar(state, refresh = true) ⇒ Boolean
Show/hide status bar.
-
.show_toolbar_container(bar, state, refresh = true) ⇒ Boolean
Show/hide toolbar container(s).
-
.show_toolbars(state) ⇒ Integer
Show/hide all floating toolbars.
-
.show_trays(state) ⇒ Integer
Show/hide all trays.
-
.switch_full_screen(state, reset_mode = 2, set_mode = 1) ⇒ Boolean
Set/unset the main window to/from the full-screen mode.
-
.threaded_messagebox(caption, text, type = 0x00002030, owner_handle = nil) {|result| ... } ⇒ Integer?
Display a messagebox on a separate thread.
Class Method Details
.activate_scenes_bar_tab(tab_index) ⇒ Boolean
Activate (highlight) scene tab without activating the associated page.
.add_observer(object) ⇒ Boolean
An observer can be a class, module, or a class instance. Your observer will work as long as the callback methods have a public access.
An observer is not required to utilize all of the callback methods from the observers list. Feel free to include/exlude those as you wish.
A unique suffix swp
or swo
is added in front of each observer
method. SWP stands for Sketchup Window Procedure, and SWO stands for
Sketchup Window Observer. Both SWP and SWO events monitor window
messages, but SWP events additionally permit you to make decisions to
the messages, whether or not to allow a message to interact with the
SketchUp window. If the return value for an SWP callback method is 1,
the message associated with the event will not interact with the
SketchUp window. For example, utilizing the swp_on_key_down
callback and returning 1 for a particular key, prevents the key from
interacting with the SketchUp window procedure, which means any keyboard
shortcut associated with the key will not be triggered. SWP events
come in handy for extensions requiring greater control over SketchUp.
Add object to the observers list.
.bring_to_top ⇒ Boolean
Set main window active.
.close ⇒ Boolean
This behaves the same way as clicking the 'X' button.
Close current SketchUp application.
.close_dialogs ⇒ Integer
Dialogs ignored via ignore_dialog are not included in this operation.
Close all dialogs and trays.
.close_toolbars ⇒ Integer
Close all floating toolbars.
.close_trays ⇒ Integer
Close all trays.
.find_child_window_by_caption(parent_handle, caption, include_sub_childs = false, full_match = true, case_sensitive = true) ⇒ Integer?
This function will iterate through windows belonging to the current SketchUp process only. All windows belonging to a different process or a different SketchUp application will not be searched.
Find handle to a child window with a specific caption.
.find_child_window_by_class_name(parent_handle, class_name, include_sub_childs = false, full_match = true, case_sensitive = true) ⇒ Integer?
This function will iterate through windows belonging to the current SketchUp process only. All windows belonging to a different process or a different SketchUp application will not be searched.
Find handle to a child window with a specific class name.
.find_window_by_caption(caption, full_match = true, case_sensitive = true) ⇒ Integer?
This function will iterate through windows belonging to the current SketchUp process only. All windows belonging to a different process or a different SketchUp application will not be searched.
Find handle to a window with a specific caption.
.find_window_by_class_name(class_name, full_match = true, case_sensitive = true) ⇒ Integer?
This function will iterate through windows belonging to the current SketchUp process only. All windows belonging to a different process or a different SketchUp application will not be searched.
Find handle to a window with a specific class name.
.get_active_dialogs ⇒ Array<Integer>
Ignored dialogs are not included in this list.
Get all used pop-up windows of the current SketchUp application.
.get_active_toolbars ⇒ Array<Integer>
Ignored toolbars are not included in this list.
Get all used floating toolbars.
.get_caption ⇒ String
Get main window title text.
.get_dialogs ⇒ Array<Integer>
Ignored dialogs are not included in this list.
Get all pop-up windows of the current SketchUp application.
.get_executable_path ⇒ String
Get full path to SketchUp.exe.
.get_executalbe_name ⇒ String
Get executable name of this application. In most cases it would be "SketchUp.exe".
.get_main_window ⇒ Integer
Get handle to the main window of the current SketchUp application.
.get_menu_bar ⇒ Integer
Get handle to the menu bar of the main window.
.get_module_handle ⇒ Integer
Get module handle to the current SketchUp application.
.get_other_main_windows ⇒ Array<Integer>
Get handles to all SketchUp main windows, except for the current one.
.get_process_id ⇒ Integer
Get process id of the current SketchUp application.
.get_registry_path ⇒ String
Get registry path of the current SketchUp application.
.get_scenes_bar ⇒ Integer
Get handle to the scenes bar of the main window.
.get_status_bar ⇒ Integer
Get handle to the status bar of the main window.
.get_thread_id ⇒ Integer
Get thread id of the current SketchUp application.
.get_toolbar_containers ⇒ Array<Integer>
Get handles to the four toolbar containers of the main window.
.get_toolbars ⇒ Array<Integer>
Ignored toolbars are not included in this list.
Get all floating toolbars of the current SketchUp application.
.get_viewport ⇒ Integer
Get handle to the view window of the main window.
.get_viewport_center ⇒ Array<Integer>
Get viewport center in screen coordinates.
.get_viewport_origin ⇒ Array<Integer>
Get upper-left corner of the view window in screen coordinates.
.get_viewport_rect ⇒ Array<Integer>
Get upper-left and lower-right corners of the view window in screen coordinates, relative to the upper-left corner of the screen.
.get_viewport_size ⇒ Array<Integer>
This is same as view.vp_width and view.vp_height.
Get width and height of the view window in pixels.
.get_visible_dialogs ⇒ Array<Integer>
Ignored dialogs are not included in this list.
Get all visible pop-up windows of the current SketchUp application.
.get_visible_toolbars ⇒ Array<Integer>
Ignored toolbars are not included in this list.
Get all visible floating toolbars of the current SketchUp application.
.ignore_dialog(handle) ⇒ Boolean
Exlude dialog from the show_dialogs and close_dialogs operations.
.ignore_toolbar(handle) ⇒ Boolean
Exlude toolbar from the show_toolbars and close_toolbars operations.
.include_dialog(handle) ⇒ Boolean
By default, all dialogs are included in the show/hide/close dialogs operation. This method is used to remove dialog from the ignore list.
Include dialog in the show_dialogs and close_dialogs operations.
.include_toolbar(handle) ⇒ Boolean
By default, all toolbars are included in the show/hide/close toolbars operation. This method is used to remove toolbar from the ignore list.
Include toolbar in the show_toolbars and close_toolbars operations.
.is_active? ⇒ Boolean
Determine whether the current active window belongs to the current SketchUp application.
.is_full_screen? ⇒ Boolean
Determine whether main window is full screen.
.is_main_window_active? ⇒ Boolean
Determine whether SketchUp main window is active.
.is_maximized? ⇒ Boolean
Determine whether main window is maximized.
.is_menu_bar_set? ⇒ Boolean
Determine whether menu bar is set.
.is_minimized? ⇒ Boolean
Determine whether main window is minimized.
.is_restored? ⇒ Boolean
Determine whether main window is restored.
.is_scenes_bar_empty? ⇒ Boolean
Determine whether scenes bar is empty. Scenes bar is empty if there are no pages in the model.
.is_scenes_bar_filled? ⇒ Boolean
Determine whether scenes bar is filled. Scenes bar is filled if there is at least one page in the model.
.is_scenes_bar_visible? ⇒ Boolean
This simply cheks if the the scenes bar window is visible. This can
return true
even if the scenes bar has none tabs.
Determine whether scenes bar is visible.
.is_status_bar_visible? ⇒ Boolean
Determine whether status bar is visible.
.is_toolbar_container_empty?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are empty.
.is_toolbar_container_filled?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are filled.
.is_toolbar_container_hidden?(bar) ⇒ Boolean
Determine whether toolbar container(s) is/are hidden.
.is_toolbar_container_visible?(bar) ⇒ Boolean
The "at least one filled bar" option was added in 3.7.0; "all filled bars" was moved to 8.
Determine whether toolbar container(s) is/are visible.
.is_viewport_border_set? ⇒ Boolean
Determine whether viewport border is set.
.is_viewport_focused? ⇒ Boolean
Check if the viewport window has the keyboard focus.
.maximize ⇒ Boolean
Set main window maximized.
.minimize ⇒ Boolean
Set main window minimized.
.refresh ⇒ Boolean
Refresh the current SketchUp application.
.remove_observer(object) ⇒ Boolean
Remove object from the observers list.
.restore ⇒ Boolean
Set main window to normal placement.
.send_user_message(receiver_handle, id, user_data) ⇒ Boolean
If a destination window that a message is sent to by this function has an active swo_on_user_message observer, in most cases, it will receive the message sent by this function; otherwise, it wont.
This function waits until the receiving window completes processing a message before returning.
32-bit SU windows cannot communicate to 64-bit SU windows; However, 64-bit SU windows can communicate to 32-bit SU windows. For example, assume you have two SU windows open, SU2014 (32-bit) and SU2016 (64-bit). Calling send_user_message from the SU2014 window to the SU2016 window, will not succeed in the SU2016 window receiving the message. However, if you call send_user_message from the SU2016 window to the SU2014 window, the message will succeed in being received by the SU2014 window.
Send information to another window.
.set_caption(caption) ⇒ Boolean
Set main window title text.
.set_menu_bar(state) ⇒ Boolean
Set/remove menu bar.
.set_viewport_border(state) ⇒ Boolean
Set/remove viewport border, a thin edge surrounding the view.
.show_dialogs(state) ⇒ Integer
Dialogs ignored via ignore_dialog are not included in this operation.
Show/hide all dialogs and trays.
.show_scenes_bar(state, refresh = true) ⇒ Boolean
Show/hide scenes bar.
.show_status_bar(state, refresh = true) ⇒ Boolean
Show/hide status bar.
.show_toolbar_container(bar, state, refresh = true) ⇒ Boolean
Show/hide toolbar container(s).
.show_toolbars(state) ⇒ Integer
Show/hide all floating toolbars.
.show_trays(state) ⇒ Integer
Show/hide all trays.
.switch_full_screen(state, reset_mode = 2, set_mode = 1) ⇒ Boolean
In 3.7.0, set_mode
can now be changed while in the full-screen
mode, without having to unset from the full-screen mode beforehand.
In 3.7.0, the main window is no longer activated when switching full screen. If you intend to also activate the main window, ensure to do it manually; see bring_to_top.
Set/unset the main window to/from the full-screen mode.
.threaded_messagebox(caption, text, type = 0x00002030, owner_handle = nil) {|result| ... } ⇒ Integer?
Any errors occurring in the threaded procedure are outed to console.
To handle errors manually, ensure to wrap your procedure with a custom
begin
-rescue
block.
See MessageBox for type configuration flags and result interpretation.
Display a messagebox on a separate thread.