请问SketchUp外掛Ruby:如何把一個下拉工具列執行程式改成按圖示執行?
原本如下圖執行
原本程式有3個,但我猜是下面這個觸動程式
--------------------------------
module Named_Scene
# Add menu items.
unless file_loaded? File::basename(__FILE__)
add_separator_to_menu('View')
UI.menu("View").add_item(NaScLH['Add Named Scene']) { self.add_namedScene }
end
@@scene_i = 1
def self.add_namedScene
model = Sketchup.active_model
pages = model.pages
# Ask user for scene name.
list =
prompts = [(NaScLH['Scene Name:'])]
defaults = ["Scene-" + "#{@@scene_i}" ]
input = UI.inputbox(prompts, defaults, list, NaScLH['Add Named Scene'])
# Check if the user cancelled.
return if input==false
# Get data from result array
scene_name = input[0]
@@scene_i = @@scene_i + 1
status = pages.add( scene_name.to_s )
end
end
#-----------------------------------------------------------------------------
file_loaded File::basename(__FILE__)
#-----------------------------------------------------------------------------
我自己寫一個圖示如下
mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection # 建立Command物件 tool_cmd = UI::Command.new("第一個工具"){ UI.messagebox "這是我第一個工具按鈕!" } # 檢查命令。本例放水,任何狀況都可正常執行。 tool_cmd.set_validation_proc { true ? MF_ENABLED : MF_GRAYED } # 設定命令的外觀圖示 tool_cmd.small_icon = "png/scenes_16.png" tool_cmd.large_icon = "png/scenes_24.png" tool_cmd.tooltip = "在這裡放置工具按鈕提示,以提醒使用者操作秘訣。" # 建立工具列 tool_toolbar = UI::Toolbar.new "第一工具列" tool_toolbar.add_item tool_cmd tool_toolbar.show=============
請問前輩如何把下拉工具列執行程式移除改成按圖示執行
改寫別人的程式
變成按圖示執行
謝謝
原本程式有3個,但我猜是下面這個觸動程式
--------------------------------
module Named_Scene
# Add menu items.
unless file_loaded? File::basename(__FILE__)
add_separator_to_menu('View')
UI.menu("View").add_item(NaScLH['Add Named Scene']) { self.add_namedScene }
end
@@scene_i = 1
def self.add_namedScene
model = Sketchup.active_model
pages = model.pages
# Ask user for scene name.
list =
prompts = [(NaScLH['Scene Name:'])]
defaults = ["Scene-" + "#{@@scene_i}" ]
input = UI.inputbox(prompts, defaults, list, NaScLH['Add Named Scene'])
# Check if the user cancelled.
return if input==false
# Get data from result array
scene_name = input[0]
@@scene_i = @@scene_i + 1
status = pages.add( scene_name.to_s )
end
end
#-----------------------------------------------------------------------------
file_loaded File::basename(__FILE__)
#-----------------------------------------------------------------------------
我自己寫一個圖示如下
mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection # 建立Command物件 tool_cmd = UI::Command.new("第一個工具"){ UI.messagebox "這是我第一個工具按鈕!" } # 檢查命令。本例放水,任何狀況都可正常執行。 tool_cmd.set_validation_proc { true ? MF_ENABLED : MF_GRAYED } # 設定命令的外觀圖示 tool_cmd.small_icon = "png/scenes_16.png" tool_cmd.large_icon = "png/scenes_24.png" tool_cmd.tooltip = "在這裡放置工具按鈕提示,以提醒使用者操作秘訣。" # 建立工具列 tool_toolbar = UI::Toolbar.new "第一工具列" tool_toolbar.add_item tool_cmd tool_toolbar.show=============
請問前輩如何把下拉工具列執行程式移除改成按圖示執行
改寫別人的程式
變成按圖示執行
謝謝
没有找到相关结果
已邀请:
0 个回复