AMS Library
Description
AMS Library is a collection of tools and functions used to interact with SketchUp window and its sub-windows using Microsoft Windows API. It's capable to switch SketchUp full screen, show/hide toolbar containers, status bar, scenes bar, and more elements of the window. It's also capable to observe and make decisions to various events of the window procedure. In many ways, this library is written to achieve things that cannot be done with standard SketchUp API.
This library includes Ruby FFI and and Win32 API extensions as part of the utility. Both of these gems are recompiled under my own name-space for compatibility with other extensions. I do not take ownership of such gems, nor I claim any credit for them. I just happen to rely on them so much that it was essential to include them in the library.
Synopsis
require 'ams_Lib/main'
# Get handle to SketchUp window.
AMS::Sketchup.get_main_window
# Setting SketchUp full screen.
AMS::Sketchup.switch_full_screen(true)
# Monitoring and processing SketchUp window events.
class MySketchupObserver
def swo_on_switch_full_screen(state)
if state
puts 'Main window switched full screen!'
else
puts 'Main window switched to original placement.'
end
end
def swp_on_mouse_wheel_rotate(x,y, dir)
puts "mouse wheel rotated - pos : (#{x}, #{y}), dir : #{dir}"
# Prevent mouse wheel from interacting with SU window. Returning 1 means
# mouse wheel zoom in/out operation would be blocked, which might be
# handy for those seeking more control over SketchUp window. Returning
# any other value won't block the event.
return 1
end
end # class MySketchupObserver
AMS::Sketchup.add_observer(MySketchupObserver.new)
Requirements
-
Microsoft Windows XP, Vista, 7, 8
-
SketchUp 6 or later
Version
2.1.0
Release Date
December 03, 2014
Licence
You have my permission to use code snippets for your own projects. Just give me credit ;)
Credits
-
Daniel J. Berger and Park Heesob for original Win32::API 1.5.2 gem.
-
Wayne Meissner and his contributors for original Ruby FFI 1.9.6 gem.
-
Mr.K, Dan Rathbun, ThomThom, Chris, Aerilius, and many other SketchUcation members for improving my scripting level.
-
Aleksey Synytsia (My dad) for helping out with MSFT Windows API.
Copyright
© 2013-2014 Anton Synytsia. All Rights Reserved.
Author
Anton Synytsia ( anton.synytsia@gmail.com )