ANSYS添加toolbar的方法
1. 创建命令abbr
*ABBR命令或者GUI操作Utility Menu> Macro> Edit Abbreviations or Utility Menu> MenuCtrls> Edit Toolbar
Abbr
The abbreviation name that will appear on the toolbar button. The name can contain up to eight characters.
String
The String argument is the name of the macro or command that Abbr represents. If String is the name of a macro, the macro must be within the macro search path. For more information about using macros, see "APDL as a Macro Language". If
de>Stringde> references an ANSYS picking menu or dialog box (using UIDL), then specify "Fnc_string." For example, in the abbreviation definitions for "QUIT" and "POWRGRPH" shown above, "Fnc_/QUIT" and "Fnc_/GRAPHICS" are unique UIDL function names which identify the ANSYS picking menu or dialog box associated with the QUIT and POWRGRPH abbreviations respectively. For more information about accessing UIDL functions, see Calling Dialog Boxes From a Macro. de>Stringde> can contain up to 60 characters but cannot include any of the following:
The character "$"
The commands C***, /COM, /GOPR, /NOPR, /QUIT, /UI, or *END
下面为创建Abbr的实例
/NOPR
*ABB,SAVE_DB ,SAVE
*ABB,RESUM_DB,RESUME
*ABB,QUIT,Fnc_/EXIT
*ABB,POWRGRPH,Fnc_/GRAPHICS
*ABBR, REPLOT_DB, REPLOT !!!Automatically reissues the last display command for convenience.
*ABBR, ALLSEL, ALLSEL !!!Selects all entities with a single command.
*ABBR, ETABLE_REFL, ETABLE,REFL !!!更新单元表数据
*ABB,DEDATE,/PLOPTS,DATE,0 !!调用一句话命令
/PLOPTS,DATE,0
*ABBR,PREP_ABR,ABBRES,,aaa,ABBR !!调用嵌套
toolbar,即调用ABBRES,,aaa,ABBR
*ABBR,Modal,Modal_analysis !!调
用宏,文件名Modal_analysis,文件后缀为mac
/GO
2. 保存和读取abbr
Utility Menu> MenuCtrls> Save Toolbar (ABBSAV command)
Utility Menu> MenuCtrls> Restore Toolbar(ABBRES command)
*ABBSAV, Lab, Fname, Ext, -- Writes the current abbreviation set to a coded file.
*ABBRES,lab,Fname,Ext,-- Reads abbreviations from a coded file.
3. 嵌套工具栏
下面这个命令例子就是调用文件名为prep.abbr的toolbar命令
*ABBR,PREP_ABR,ABBRES,,PREP,ABBR
可以达到效果:点击PREP_ABR这个toolbar将会切换到prep.abbr文件创造的toolbar。
如果想实现return功能,就创建一个嵌套工具栏切回原来的abbr。
4. 修改ANSYS启动文件的ABBR加载命令
解决方案是在C:\Program Files\ANSYS Inc\v121\ansys\apdl中有一个start121.ans文件,在管理员用户权限下可以编辑,用txt格式打开文件找到:
!!Once the commands are turned off per above, they can be turned back on again in a different order by the following commands (remove the !).
!*ABBR, SAVE_DB , SAVE
!*ABBR, QUIT , Fnc_/EXIT
!*ABBR, RESUM_DB, RESUME
!*ABBR, E-CAE, SIMUTIL
!*ABBR, POWRGRPH, Fnc_/GRAPHICS
在此处添加自己需要的指令如
*ABBR, REPLOT_DB, REPLOT !!!Automatically reissues the last display command for convenience.
*ABBR, ALLSEL, ALLSEL !!!Selects all entities with a single command.
*ABBR, ETABLE_REFL, ETABLE,REFL !!!更新单元表数据
保存文件,重启ansys后ok了。
重启之后会发现创建新的db文件T oolbar会更新成你想要的样子,新建的job工具栏会自动保存在db文件中,但是在旧的db文件中则还是需要自己加载ABB文件才能更新Toolbar。
将自己需要的常用操作写成abbr文件添加到Toolbar非常方便。