用到了page类控制场景,为什么不是sence呢?
require 'sketchup'
UI.menu("PlugIns").add_item("Camera: View Top") {
Sketchup.send_action("viewTop:")
}
UI.menu("PlugIns").add_item("Camera: Go To First Scene") {
pages = Sketchup.active_model.pages
first_page = pages[0]
pages.selected_page = first_page
}
UI.menu("PlugIns").add_item("Camera: Change Target") {
eye = [1000,1000,1000]
target = [0,0,0]
up = [0,0,1]
my_camera = Sketchup::Camera.new eye, target, up
view = Sketchup.active_model.active_view
view.camera = my_camera
}
第一句话应该是添加引用库,添加多级菜单的方式就是在菜单分级处用“:”隔开,视角控制有几个特定的方法,直接调用即可。