Class: DFC::SketchupUtil

Inherits:
Object show all

Overview

Sketchup相关工具

Class Method Summary # collapse

Class Method Details

.activateBoolean

Set main window active.

Returns:

  • (Boolean)

    success

.find_window_by_caption(caption, full_match = true, case_sensitive = true) ⇒ Fixnum?

Note:

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.

Parameters:

  • caption (String)

    Text to match.

  • full_match (Boolean) (defaults to: true)

    Whether to match full (true) or part (false) of the window text.

  • case_sensitive (Boolean) (defaults to: true)

    Whether to consider uppercased/lowercased letters.

Returns:

  • (Fixnum, nil)

    Handle to the first found window if any.

Since:

  • 3.0.0

.get_dialogsArray<Fixnum>

Note:

Ignored dialogs are not included in this list.

Get all pop-up windows of the current SketchUp application.

Returns:

  • (Array<Fixnum>)

    An array of window handles.

.get_main_windowObject

获取当前Sketchup主窗口句柄

Examples:

DFC::SketchupUtil.get_main_window

.get_other_main_windowsArray<Fixnum>

Get handles to all SketchUp main windows, except for the current one.

Returns:

  • (Array<Fixnum>)

Since:

  • 3.1.0

.get_viewportFixnum

Get handle to the view window of the main window.

Returns:

  • (Fixnum)

.get_viewport_centerArray<Fixnum>

Get viewport center in screen coordinates.

Returns:

  • (Array<Fixnum>)

    [x,y]

.get_viewport_originArray<Fixnum>

Get upper-left corner of the view window in screen coordinates.

Returns:

  • (Array<Fixnum>)

    [x,y]

.get_viewport_rectArray<Fixnum>

Get upper-left and lower-right corners of the view window in screen coordinates, relative to the upper-left corner of the screen.

Returns:

  • (Array<Fixnum>)

    [x1,y1, x2,y2]

.get_viewport_sizeArray<Fixnum>

Note:

This is same as view.vp_width and view.vp_height.

Get width and height of the view window in pixels.

Returns:

  • (Array<Fixnum>)

    [width, height]

.ignore_toolbar(handle) ⇒ Boolean

Elude toolbar from the show_toolbars operations.

Parameters:

  • handle (Fixnum)

    A handle to a valid toolbar window.

Returns:

  • (Boolean)

    success

Since:

  • 3.0.0

.load_save(path, save_path, version = 8) ⇒ Fixnum

文件任意版本另存-1 参数个数错误-2 标志位错误-3 版本错误-4 DFC用户目录出错>0 SUAPI调用错误

Parameters:

  • path (String)

    文件路径

  • save_path (String)

    文件另存路径

  • version (Fixnum) (defaults to: 8)

    版本 3-8 13-18

Returns:

  • (Fixnum)

    错误代码0 成功

.set_menu_bar(state) ⇒ Boolean

Set/Remove menu bar.

Parameters:

  • state (Boolean)

Returns:

  • (Boolean)

    success

.set_viewport_border(state) ⇒ Boolean

Set/Remove viewport border, a thin edge surrounding the view.

Parameters:

  • state (Boolean)

Returns:

  • (Boolean)

    success

.show_scenes_bar(state, refresh = true) ⇒ Boolean

Show/hide scenes bar.

Parameters:

  • state (Boolean)
  • refresh (Boolean) (defaults to: true)

    Whether to update after changing state.

Returns:

  • (Boolean)

    success

.show_status_bar(state, refresh = true) ⇒ Boolean

Show/hide status bar.

Parameters:

  • state (Boolean)
  • refresh (Boolean) (defaults to: true)

    Whether to update after changing state.

Returns:

  • (Boolean)

    success

.show_toolbar_container(bar, state, refresh = true) ⇒ Boolean

Show/hide toolbar container(s).

Parameters:

  • bar (Fixnum)

    A number representing which bar(s) to show/hide. Use one of the following numbers:

    1. top bar

    2. bottom bar

    3. left bar

    4. right bar

    5. all filled bars

    6. all bars

  • state (Boolean)

    true to show; false to hide.

  • refresh (Boolean) (defaults to: true)

    Whether to update after changing state.

Returns:

  • (Boolean)

    success

.show_toolbars(state) ⇒ Fixnum

Show/hide all floating toolbars.

Parameters:

  • state (Boolean)

Returns:

  • (Fixnum)

    Number of floating toolbars shown or hidden.

.switch_full_screen(state, reset_mode = 2, set_mode = 1) ⇒ Boolean

Switch main window full screen.

Parameters:

  • state (Boolean)

    true to set full screen; false unset from full screen.

  • reset_mode (Fixnum) (defaults to: 2)

    This parameter has effect only when main window is unset from full screen mode. Use one of the following reset modes:

    • 0 - Set to restored mode.

    • 1 - Set to maximized mode.

    • 2 - Set to original placement.

  • set_mode (Fixnum) (defaults to: 1)

    This parameter was added in 3.1.4 and has an effect only when main window is set to full screen. Use one of the following set modes:

    • 0 - Set full screen on the primary/main monitor.

    • 1 - Set full screen on the monitor SU window is associated to.

    • 2 - Set full screen on all monitors.

Returns:

  • (Boolean)

    success

.version_change(path, version = 8) ⇒ Fixnum

文件任意版本保存-1 参数个数错误-2 标志位错误-3 版本错误-4 DFC用户目录出错>0 SUAPI调用错误

Parameters:

  • path (String)

    文件路径

  • version (Fixnum) (defaults to: 8)

    版本 3-8 13-18

Returns:

  • (Fixnum)

    错误代码0 成功