Professional Documents
Culture Documents
TCLTK CAEA
TCLTK CAEA
TCLTK CAEA
U
User
Interface
I t f
Programming with
Tcl/Tk
Presented By
CAE Associates,, Inc.
2013 CAE Associates
Presentation Topics
Introduction
Tcl/Tk in ANSYS
Parametric Design
g Entry
y Dialog
g Box
Copyright 2002
Computer Aided Engineering
Associates, Inc.
Example Application
What is Tcl/Tk?
Ad
Advantages
and
d Di
Disadvantages
d
off
Tcl/Tk
z
z
z
Material Modeler
Contact Wizard
Solution Controls
Time History Variable Viewer
Entire GUI (Revision 6.1)
Copyright 2002
Computer Aided Engineering
Associates, Inc.
z
z
Flexibility:
Compatibility:
p
y
Cross-platform compatible.
Copyright 2002
Computer Aided Engineering
Associates, Inc.
ANSYS documentation/training
g is sparse
p
compared
p
to UIDL and APDL.
Limited technical support since GUI programming is considered a nonstandard use of the software.
Performance:
Copyright 2002
Computer Aided Engineering
Associates, Inc.
z
z
z
z
z
Copyright 2002
Computer Aided Engineering
Associates, Inc.
Tcl Expression
Result
set x 2
x=2
set y $x
yy=2
2
z=4
set t z is $z
t=z is 4
set t {z is $z}
t=z is $z
There are various methods for calling your Tcl/Tk code from within ANSYS.
~tcl,source filename
~tk,source
,
filename
Enhanced UIDL for including object oriented and some ANSYS objects:
~eui,source filename
:N Fnc_MyTclFunc
:S
0,
0,
0
:T Command
:A My Tcl Function
Inp_P
Cmd_) ~eui,tcl/tk command
:E END
Copyright 2002
Computer Aided Engineering
Associates, Inc.
Access to the core ANSYS functionality is provided via ans_* series of commands.
ans_sendcommand ansysCommand
set n1 1
set n2 2
ans_sendcommand n,,$n1,$n2
ans_getvalue ansys*GetConstruct
set ansRev [ans_getvalue ACTIVE,,REV]
ans_g
getvector ansysAPDLarray
y
y
! APDL Command
! Tcl Commands
*dim,apdlArr,,2 set tclArr [ans_getvector apdlArr]
apdlArr(1) = 1,2 puts $tclArr
Copyright 2002
Computer Aided Engineering
Associates, Inc.
Passes a
command to
ANSYS for
processing
*GET an ANSYS
value
Returns an
ANSYS array
z
z
combobox .cmbFont
b tt
button
.btnOK
bt OK
checkbox .chbStyles
Copyright 2002
Computer Aided Engineering
Associates, Inc.
labeledframe .frmPrintRange
frmPrintRange
label
Entry Box:
z
The text
text option specifies a label for
the button
The command option specifies a series
of commands to perform once the button
is pressed.
pressed
Button:
Copyright 2002
Computer Aided Engineering
Associates, Inc.
entry box
10
z
z
Copyright 2002
Computer Aided Engineering
Associates, Inc.
11
z
z
Freely-available, high-quality
application development environment
environment.
Written entirely in Tcl/Tk and generate
pure Tcl/Tk code.
Visual Gypsy
http://www prs de/int/index html
http://www.prs.de/int/index.html
Visual Tcl
http://vtcl.sourceforge.net/
Copyright 2002
Computer Aided Engineering
Associates, Inc.
12
ANSYS Information:
z Chapters 5-7
5 7 of the ANSYS GUI Style Guide.
z ANSYS 2002 Users Conference
Generall Tcl/Tk
G
T l/Tk Information:
I f
ti
z Tcl Developers Exchange at
www.scriptics.com
p
z
Copyright 2002
Computer Aided Engineering
Associates, Inc.
13