!定义参数,具体说明参看李立峰教授图书:《ANSYS土木工程实例详解》,如有问题可询问:iCAX@dozan.cn*get,maxe,elem,0,num,max!获取最大单元号*get,mine,elem,0,num,min!获取最小单元号*get,totelem,elem,,count!获取单元总数*get,maxn,node,0,num,max!获取最大节点号*get,minn,node,0,num,min!获取最小节点号*get,totnode,node,,count!获取节点总数!定义数组*dim,elemcen,array,totelem,3,1!定义单元坐标数组*dim,elemis,array,totelem,1,1!定义单元应力数组*do,i,mine,totelem,1*get,elemcen(i,1,1),elem,i,cent,x!将所有单元x坐标存入数组*get,elemcen(i,2,1),elem,i,cent,y!将所有单元y坐标存入数组*get,elemcen(i,3,1),elem,i,cent,z!将所有单元z坐标存入数组*enddo!定义应力值*do,i,mine,totelem,1!将单元应力存入应力数组*if,elemcen(i,3,1),eq,0.0,then!储存应力数据*if,elemcen(i,2,1),le,-b2,thenelemis(i,1,1)=cyy*endif*if,elemcen(i,2,1),gt,-b2,and,elemcen(i,2,1),lt,b2,thenelemis(i,1,1)=fy*endif*if,elemcen(i,2,1),gt,b2,thenelemis(i,1,1)=cyy*endif*endif*if,elemcen(i,3,1),lt,0.0,then!写入腹板及底板应力文件*if,elemcen(i,3,1),gt,-h1,thenelemis(i,1,1)=fy*endif*if,elemcen(i,3,1),lt,-h1,thenelemis(i,1,1)=cyy*endif*endif*enddo!应力数据写入文件m1=1$p0=0*cfopen,'exam10.4','ist',''!打开文件*vwrite,'!'!写入文件(a)*vwrite,'!******','initial','stress','file:','exam10.4.ist'(5a)*do,i,mine,totelem,1*vwrite,'!'(a)*vwrite,'!initial','stress','for','element',i(4a,f8.0)*vwrite,'!sx','sy','sz','sxy','syz','sxz'(6a)*vwrite,'eis,',i,m1(a,2f8.0)pa=elemis(i,1,1)*do,j,1,5,1*vwrite,p0,pa,p0,p0,p0,p0(6f12.3)*enddo*enddo*cfclose!关闭文件finish