找回密码
 注册
Simdroid-非首页
查看: 494|回复: 3

[H. 有限元编程] 【转帖】Tcl/Tk in ANSYS

[复制链接]
发表于 2004-1-26 02:17:36 | 显示全部楼层 |阅读模式 来自 安徽宿州
http://www.padtinc.com/support/ansys/tcltk/default.htm
  
Tcl/Tk in ANSYS
  
As the engineers at PADT have developed custom applications with the ANSYS software package, they have begun to use the Tcl/Tk command language more and more. In this time, they have learned some important lessons and have gathered some useful resources. This page has been put together for the ANSYS community to help them learn and apply this powerful capability in ANSYS. You can read through the following FAQ or jump right into some tutorials.
  
What is Tcl/Tk?  
Tcl/Tk (pronounced tickle-tee-kay) is a software command language that interfaces with the X11 windowing system. It was developed by John Ousterhout at the University of California, Berkeley in 1989, and has quickly become one of the most popular tools for creating applications with GUI interfaces.
   
What advantages does Tcl/Tk have over other GUI building tools?  
Price. First—and most importantly—Tcl/Tk is free.  
Facility. Tcl/Tk is relatively easy to learn in comparison to other software languages (e.g., C++, Fortran, etc.). And since it is an interpreted language, you can immediately see the effects of program modifications without recompiling code.  
Flexibility. Tcl/Tk has a wide variety of tools embedded into it which allow you to create entry boxes, canvases, scrollable forms, labels, etc., and allows you to arrange them in an orderly fashion. In addition, you can create your own tools and commands by creating procedures within the programming environment, or by editing the source code and creating your own custom interpreter.  
Compatibility. Tcl/Tk is cross-platform compatible. Scripts written for Windows NT will also run on HP-UX, SGI-IRIX, SunOS, and Linux—just to mention a few. Of course, you will have to install Tcl/Tk on each platform that you wish to run on, but since it's free, this is generally not a big problem.  
  
What advantages are there to using Tcl/Tk with ANSYS?  
The latest versions of ANSYS have custom Tcl/Tk interpreters compiled into the analysis environment. These custom interpreters have built into them several commands which can be used to send information back and forth between the Tcl/Tk and ANSYS environments. The interpreter can be invoked by simply typing a command; ~tk, ~tcl, or ~eui in the ANSYS input window. Each of these commands have unique functionality which is discussed later on.  
Using these tools, you can create an interface with Tcl/Tk to enter parameter values for a design, for example, then use these parameters to issue ANSYS commands or macros to build your model. Or you can create a wizard to guide new users through the process of building a simple model and running an analysis, or perhaps to produce a splash screen listing important phone numbers and email addresses.  
You can also combine the functions of Tcl/Tk and ANSYS UIDL (User Interface Design Language). This allows you to create new menu items in the main ANSYS menus which invoke Tcl/Tk scripts, thus enabling a seamless integration of any vertical application that uses ANSYS.  
  
Do I need the complete Tcl/Tk package?   
It is not actually required for you install Tcl/Tk in order to use the ANSYS Tcl/Tk interpreter. It will already be installed if you have ANSYS 5.5 or later on your system. However, it is highly recommended for two reasons. First, it is much easier to learn the basic functions of Tcl/Tk by building programs initially outside of the ANSYS analysis environment. Along with the Tcl/Tk core, a help system for Tcl programmers and several sample scripts are included in the basic installation. Second, it is often desirable—even for seasoned users—to build GUIs outside of the ANSYS environment. Besides freeing up a valuable ANSYS license, debugging scripts is a bit simpler to do using the basic Tcl/Tk interpreters.  
  
Which Tk commands are supported in the ANSYS version of Tcl/Tk?   
If you ever want to see what Tk commands are currently available in the ANSYS Tcl/Tk interpreters, simply type the following command in the ANSYS input window:
~tk,'puts [info commands]'
All of the available Tk commands will then be listed in the ANSYS output window. This includes ANSYS additions to the tool kit as well as the standard commands.  
  
Where do I get the Tcl/Tk package?  
Download the package from the Tcl Developer Exchange. If you are going to do a lot of development work in Tcl/Tk, we recommend that you try out the professional development environment, TclPro. This tool is now available as a free download and will greatly enhance the development experience.  
  
Are there any good Tcl/TK books?  
Although the information given here is enough to get you started, you will eventually want to acquire more complete resources. The best books on the subject are Tcl and the Tk ToolKit by John Ousterhout, and Effective Tcl/Tk Programming by Mark Harrison and Michael McLennan. We’ve found both to be invaluable, and both are usually in stock at both Amazon.com and Buy.com.  
  
Are there any good links you can recommend?  
There are two very useful sites on the web:  
Tcl Developer Exchange.
http://www.scriptics.com/   
Here you can post questions, view forums, or query the database for information about various workarounds, undocumented commands, etc. Very useful when your stumped.  
Tcl/Tk Info Site.
http://www.tcltk.com/   
Links and listings of lots of Tcl/Tk information and resources. A good place to start your hunt for scripts and widgets. It also has links to all of the resources on the web, so we won’t repeat them here.  
  
Are there any examples on how to implement Tcl/Tk with ANSYS?   
We have a few examples that should get you started on the path to ANSYS customization with Tcl/Tk:  
Tcl/Tk Puts a New Face on ANSYS. An article from the Winter 2000 issue of PADT News. http://www.padtinc.com/support/ansys/tcltk/from_news.pdf
My First Splash Screen. A tutorial that steps the user through the creation of a simple dialog box.http://www.padtinc.com/support/ansys/tcltk/splash.htm  
Tcl/Tk for ANSYS. A PowerPoint chapter From PADT’s Advanced Customization class(http://www.padtinc.com/support/training/course.asp?c=802). It assumes you know Tcl/Tk already. http://www.padtinc.com/support/ansys/tcltk/advcust/default.htm
Entry Variables and Procs. A response to an XANSYS posting about how to use entry values in procs. http://www.padtinc.com/support/ansys/tcltk/namespace.htm
Also, the GUI subdirectory of your ANSYS56 directory contains the Tcl/Tk scripts that ANSYS uses for the contact wizard, the Mechanical Tool Bar, and other interfaces. These are good intermediate and advanced examples of using Tcl/Tk with ANSYS.
[Warning: Don’t work with these files directly! These files are needed in their original form for ANSYS to work correctly. Make a copy them in a safe directory away from the ANSYS directory, and then work with the copies.]
发表于 2008-3-12 19:19:44 | 显示全部楼层 来自 广东深圳
Simdroid开发平台
来点实际的例题,工程实际问题
回复 不支持

使用道具 举报

发表于 2017-7-24 16:56:29 | 显示全部楼层 来自 上海
微信公众号名称:TclTk语言开发
公众号:Tcl-Tk
分享TclTk语言编程开发技术干货
回复 不支持

使用道具 举报

发表于 2018-5-6 18:16:13 | 显示全部楼层 来自 中国
如果您有ABAQUS使用中的疑问或想凭借技术服务来赚取咨询费用,那快快来加入悬赏群吧。悬赏群吧采用的是支付技术咨询费用模式,不仅您提出的技术问题能通过自定悬赏来得到快速响应,而且每一个技术人都能自由提供有价技术服务。悬赏群吧的目的是促进CAE技术在整个行业中的有效交流融合与进步,CAE的小伙伴们快来共同努力吧。
Abaqus航天领域悬赏交流QQ群744086061
Abaqus航空领域悬赏交流QQ群748276158
Abaqus车辆领域悬赏交流QQ群748811457
Abaqus机械领域悬赏交流QQ群750326187
Abaqus建筑领域悬赏交流QQ群748503960
Abaqus桥梁领域悬赏交流QQ群748317597
Abaqus水利领域悬赏交流QQ群750886708
Abaqus岩土领域悬赏交流QQ群469995008
Abaqus船海领域悬赏交流QQ群748303708
Abaqus风电领域悬赏交流QQ群751894613
Abaqus石化领域悬赏交流QQ群752874287
Abaqus电子领域悬赏交流QQ群283693543
Abaqus生物领域悬赏交流QQ群750685324
Abaqus焊接领域悬赏交流QQ群753060195
Abaqus二次开发悬赏交流QQ群750348858
Abaqus冲击爆炸悬赏交流QQ群753048402
Abaqus加工成型悬赏交流QQ群750354969
Abaqus损伤断裂悬赏交流QQ群722607791
Abaqus拓扑优化悬赏交流QQ群651298198
如果您有ANSYS使用中的疑问或想凭借技术服务来赚取咨询费用,那快快来加入悬赏群吧。悬赏群吧采用的是支付技术咨询费用模式,不仅您提出的技术问题能通过自定悬赏来得到快速响应,而且每一个技术人都能自由提供有价技术服务。悬赏群吧的目的是促进CAE技术在整个行业中的有效交流融合与进步,CAE的小伙伴们快来共同努力吧。
Ansys航天领域悬赏交流QQ群755313750
Ansys航空领域悬赏交流QQ群625119768
Ansys车辆领域悬赏交流QQ群753845876
Ansys机械领域悬赏交流QQ群722279622
Ansys建筑领域悬赏交流QQ群757237901
Ansys桥梁领域悬赏交流QQ群757251151
Ansys水利领域悬赏交流QQ群757273243
Ansys岩土领域悬赏交流QQ群760498840
Ansys船海领域悬赏交流QQ群755283718
Ansys风电领域悬赏交流QQ群754741945
Ansys石化领域悬赏交流QQ群757266648
Ansys电子领域悬赏交流QQ群755290146
Ansys生物领域悬赏交流QQ群757767383
Ansys焊接领域悬赏交流QQ群551640968
Ansys流体领域悬赏交流QQ群761034561
Ansys电磁领域悬赏交流QQ群760503704
Ansys多场耦合悬赏交流QQ群761040067
Ansys二次开发悬赏交流QQ群755294487
Ansys冲击爆炸悬赏交流QQ群681957979
Ansys加工成型悬赏交流QQ群757736148
Ansys损伤断裂悬赏交流QQ群757789846
Ansys拓扑优化悬赏交流QQ群757291487
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-5-13 15:10 , Processed in 0.039885 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表