カスタム ボタンを作成するには、create_gui_custom_command
コマンドを使用します。
構文は次のとおりです。
create_gui_custom_command -name <arg> [-menu_name <arg>] [-description <arg>]
[-show_on_toolbar] [-run_proc <arg>]
[-toolbar_icon <arg>] [-command <arg>]
[-tcl_file <arg>] [-quiet] [-verbose]
Usage:
Name Description
-------------------------------
-name Unique name of the command to create.
[-menu_name] Menu name for the custom command.
[-description] Display this text for the description of the menu item
and optionally the toolbar button
[-show_on_toolbar] Add this command to the toolbar
[-run_proc] Needed when '-command' and 'tcl_file' options are both
specified.
If true, gui button will run command mentioned in
'-command' option otherwise source script mentioned in
'-tcl_file' option
[-toolbar_icon] The full path to the PNG or JPEG file to display on the
toolbar button
[-command] The command to execute
[-tcl_file] The full path to the Tcl file to source
[-quiet] Ignore command errors
[-verbose] Suspend message limits during command execution
-name
で指定する名前は固有のものである必要があり、スペースを含めることはできません。この名前は、ボタンに引数を追加する際に使用します。
例 1: myProc というプロシージャを呼び出すカスタム ボタンを作成:
create_gui_custom_command -name "myButton" \
-menu_name "Do something" \
-command "myProc" \
-show_on_toolbar \
-run_proc true
例 2: 選択したオブジェクトを通過して伝搬されるクロックを Tcl コンソールに表示するボタンを作成:
create_gui_custom_command -name "getClock" \
-menu_name "get_clock" \
-command {get_clocks -of [get_selected_objects]} \
-description {This button returns the clocks going through the selected objects} \
-show_on_toolbar