Professional Documents
Culture Documents
Macro Basics
Verifying Pressures
9. Macro Basics
Verifying Pressures
Create a macro called SFEPLOT to
verify and plot the pressure applied
on a specified face of a surface effect
element. The macro should have
arguments as follows:
SFEPLOT, TYPE, FACE
where TYPE is the element type
number for SURF154 and FACE is the
face number for which effective
pressure is desired.
Workshop Supplement
Octo
9. Macro Basics
Verifying Pressures
Workshop Supplement
Enter ANSYS in the working directory specified by your instructor using bpressure
as the jobname.
2.
3.
4.
1.
Octo
9. Macro Basics
Verifying Pressures
Now do the operations you want the macro to do. We can then use the
corresponding commands from the log file to create the macro.
a) Select elements of type 1 (SURF154 elements) and all nodes attached to them:
Choose [Elements], [By Attributes], "Elem type Num" and "From Full"
Min,Max,Inc = 1
[Apply]
[Apply]
Or issue:
ESEL,S,TYPE,,1
NSLE
5.
Workshop Supplement
Octo
9. Macro Basics
Verifying Pressures
(cont'd)
Main Menu > General Postproc > Element Table > Define Table
[Add]
Lab = peff
Item = By Sequence Num
Comp = SMISC, 17 (type in the number 17 in the selection box)
[OK]
[Close]
Or issue:
ETABLE,PEFF,SMISC,17
5.
Workshop Supplement
Octo
9. Macro Basics
Verifying Pressures
(cont'd)
c) Plot the element table item PEFF.
Itlab = PEFF
Or issue:
PLETAB,PEFF
d) Select everything.
Or issue:
ALLSEL
5.
Workshop Supplement
Octo
9. Macro Basics
Verifying Pressures
List the log file to see the commands that were just executed in step 5, then create a
macro with those commands. The only change is that the element type number and
SMISC item number are replaced by ARG1 and ARG2+12, respectively.
Then type one command per line as shown below. Note: The "Create Macro" dialog is
suitable only for short macros such as this one. It is not an editor and cannot be used to
edit an existing macro. Therefore, we recommend using your system's text editor to
create macros. If you wish, you may use a system editor now (but please be aware that
your favorite editor may not be available at this training facility!).
esel,s,type,,arg1
nsle,s
etable,peff,smisc,arg2+12
pletab,peff,noav
allsel,all
[OK]
6.
Workshop Supplement
Octo
9. Macro Basics
Verifying Pressures
Test the macro by typing the following command:
SFEPLOT,1,5
8.
If time permits, edit the macro using a text editor and add if-tests for valid values of
arg2. (Arg2 can only take values of 1 to 5.) Refer to the "Branching" section of
Chapter 10 in your Training Manual for a sample if-test.
9.
Exit ANSYS.
7.
Workshop Supplement
Octo