Last active
October 30, 2015 17:43
-
-
Save jimfoltz/b295d913abe318038278 to your computer and use it in GitHub Desktop.
make-dc-door.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# make dc door | |
# Right-click a Instance, select Make DC Door | |
UI.add_context_menu_handler do |menu| | |
if ((sel = Sketchup.active_model.selection).length == 1) | |
if sel[0].class == Sketchup::ComponentInstance | |
menu.add_item("Make DC Door") do | |
ret = UI.inputbox( ["From", "To"], [0, 90], "Degrees") | |
if ret | |
entity = sel[0] | |
dfn = entity.definition | |
dfn.set_attribute('dynamic_attributes', 'angle', 0) | |
dfn.set_attribute('dynamic_attributes', 'onclick', "animate(\"angle\", #{ret[0]}, #{ret[1]})") | |
dfn.set_attribute('dynamic_attributes', '_rotz_formula', 'angle') | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment