Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ansys script

Status
Not open for further replies.

S1224

Mechanical
Jul 8, 2015
1
Need to create a script to output the minimum temperature value (*elseif,arg2,eq,'SCAP'$*set,pos,9 $/title,Calculated Capability Min of LS) to an array to be transfered into excel eventurally. I was informed to use the mask command to sift through the data faster. Any ideas would be helpful?

The code so far is below:


C*** *use,PGD,'hs188e','mALT','%aname%',9
C***
C*** arg1 = 'component'
C*** arg2 = 'Parameter'
C*** arg3 = 'name of Goodman data array to be plotted'
C*** arg4 = Max Value for Capabilities Contour
C***
C*** Parameters Stored
C***
C*** enumb ! Element number
C*** mTEMP ! Average Element Temperature for Goodman Evaluation
C*** mMEAN ! Mean Stress for Goodman Curve
C*** mFPS ! Maximum Average 1st Principal Stress
C*** mALT ! Peak Alternating Stress Over Frequency Range for Goodman
C*** mVMS ! Maximum Average von Mises Eqvalent over LCF Load Step Range
C*** CAP ! Calculated Alternating Stress Capability in PSI
C*** UNCAP ! Calculated Capability in Units of Forcing Function
C*** SCAP ! Calculated Capability in Units of Forcing Function LS by LS
C***
C***

*if,arg2,eq,'enumb',then $*set,pos,1 $/title,Element number
*elseif,arg2,eq,'mTEMP' $*set,pos,2 $/title,Average Element Temperature for Goodman Evaluation
*elseif,arg2,eq,'mMEAN' $*set,pos,3 $/title,Mean Stress for Goodman Curve
*elseif,arg2,eq,'mFPS' $*set,pos,4 $/title,Maximum Average 1st Principal Stress
*elseif,arg2,eq,'mALT' $*set,pos,5 $/title,Peak Alternating Stress Over Frequency Range for Goodman
*elseif,arg2,eq,'mVMS' $*set,pos,6 $/title,Maximum Average von Mises Eqvalent over LCF Load Step Range
*elseif,arg2,eq,'CAP' $*set,pos,7 $/title,Calculated Alternating Stress Capability in PSI
*elseif,arg2,eq,'UNCAP' $*set,pos,8 $/title,Calculated Capability in Units of Forcing Function
*elseif,arg2,eq,'SCAP' $*set,pos,9 $/title,Calculated Capability Min of LS
*endif

fini
/prep7

*set,aname,arg3 ! Calls parameter name containing data to be ploted.
etchg,tts ! Ensures Model is Structural to enable BF plots.

alls
cmsel,,arg1
*get,ntot,elem,,count
*get,nnext,elem,,num,min
*set,comp,arg1

*set,minbfe,10e6
*set,maxbfe,0

*do,i,1,ntot ! Assign data to be plotted to BF values.

temz=%aname%(%nnext%,%pos%)

*if,temz,lt,minbfe,then $*set,minbfe,temz $*endif
*if,temz,gt,maxbfe,then $*set,maxbfe,temz $*endif

bfe,nnext,temp,,temz
*get,nnext,elem,nnext,nxth
*enddo

*set,max_%arg1%_%arg2%_%arg3%,maxbfe
*set,min_%arg1%_%arg2%_%arg3%,minbfe
*del,ztmp,,nopr


C*** General Plot Controls

/NOPR
!/RESET
/DEVICE,VECT,OFF

! General Graphics Settings
/PLOP,FRAM, 0
/PLOP,LEG1, 0
/PLOP,LEG2, 0
/PLOP,INFO, 3
/PLOP,MINM, 0
/TRIAD,OFF
/GTHK,CURV, 2
/GROPT,CURL, 1
/PBF,TEMP,, 1
/COL, PU ,YGRE
/COL, PROT,RED
/TRLCY,ON
/TXTRE,ON
/COL, PBAK,0, 1, 4

! Window Settings
/WIND,1, -1.0000 , 1.6660 , -1.0000 , 1.0000
/TYPE,1, 6
/EDG, 1, 1, 45.000
/CONT,1, 9,AUTO
/UDOC,1,CNTR,RIGH
/GO
/pbf,temp,1
/auto
/contour



C*** End Plot Controls
C*** Set Reverse Contours for Units Capability Plots

*if,arg2,EQ,'UNCAP',then
/title,Vibes Capability (max Temp)
/contour,1,9,0,,arg4
/color,cntr,red,1
/color,cntr,oran,2
/color,cntr,yell,3
/color,cntr,ygre,4
/color,cntr,gree,5
/color,cntr,gcya,6
/color,cntr,cyan,7
/color,cntr,cblu,8
/color,cntr,blue,9

*elseif,arg2,EQ,'SCAP',then
/title,Vibes Capability (Match)
/contour,1,9,0,,arg4
/color,cntr,red,1
/color,cntr,oran,2
/color,cntr,yell,3
/color,cntr,ygre,4
/color,cntr,gree,5
/color,cntr,gcya,6
/color,cntr,cyan,7
/color,cntr,cblu,8
/color,cntr,blue,9

*else,

/color,cntr,red,9
/color,cntr,oran,8
/color,cntr,yell,7
/color,cntr,ygre,6
/color,cntr,gree,5
/color,cntr,gcya,4
/color,cntr,cyan,3
/color,cntr,cblu,2
/color,cntr,blue,1
/cont,1,9,auto

*endif

/ANNO,DELE

*set,lab1,arg1
*set,lab2,%aname%_lab2
*set,lab3,%aname%_lab3
*set,lab4,%aname%_lab4
*set,lab5,%aname%_lab5
*set,lab6,%aname%_lab6
*set,lab7,%aname%_lab7
*set,lab8,%aname%_lab8
*set,lab9,%aname%_lab9

*set,lab11,%aname%_lab11
*set,lab12,%aname%_lab12

/ANUM ,0, 1, 0.78326 ,-0.74066
/TLAB, 0.766,-0.741,RUN: %lab7% MAT: %lab6%
/ANUM ,0, 1, 0.78326 ,-0.79066
/TLAB, 0.766,-0.791,COMPONENT: %lab1%
/ANUM ,0, 1, 0.78326 ,-0.84066
/TLAB, 0.766,-0.841,Mean Stress LS %lab2% to %lab3%
/ANUM ,0, 1, 0.78326 ,-0.89066
/TLAB, 0.766,-0.891,Alt Stress %lab4% to %lab5% HZ
/ANUM ,0, 1, 0.78326 ,-0.94066
/TLAB, 0.766,-0.941,%lab8% @ %lab9% PSI P-P
/ANUM ,0, 1, 0.78326 ,-0.99066
/TLAB, 0.766,-0.991,mFACT = %lab11% aFACT = %lab12%
/ANUM ,0, 5, 1.1747 ,-0.82977
!
!/POLY,4, 0.722,-0.664, 1.628,-0.664, 1.628,-0.996, 0.722,-0.996
!

nsle
eplot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor