!ANSYS命令流
! 写单元及节点数据文件
! 作者:陆新征,清华大学土木系
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!选中所有单元
ALLSEL,ALL
! 得到当前模型中的总节点数
*GET,NNode,NODE,,COUNT, , , ,
!输出节点
*CFOPEN,Node,txt
*VWRITE
('coordinates')
*VWRITE,chrval(3),chrval(NNode),chrval(0),chrval(1)
(4A5)
*DO,I,1,NNode
*VWRITE,I,NX(I),NY(I),NZ(I)
(F8.0,3F13.5)
*ENDDO
*CFCLOS
!打开单元文件
*CFOPEN,ELEM,txt
!得到所有单元数
ESEL,S,ENAME,,65
ALLSEL,ALL
*GET,NElem,ELEM,,COUNT, , , ,
*VWRITE,chrval(NElem)
('Number of Element: ', A8)
!对单元集进行循环
*DO,I,1,NElem
!得到当前单元的类型
*GET,ENAME,ELEM,I,ATTR,ENAM
!如果是65号(65号单元)
*IF,ENAME,EQ,65,THEN
!得到该单元的节点编号
*GET,EN1,ELEM,I,NODE,1
*GET,EN2,ELEM,I,NODE,2
*GET,EN3,ELEM,I,NODE,3
*GET,EN4,ELEM,I,NODE,4
*GET,EN5,ELEM,I,NODE,5
*GET,EN6,ELEM,I,NODE,6
*GET,EN7,ELEM,I,NODE,7
*GET,EN8,ELEM,I,NODE,8
*VWRITE,I,EN1,EN2,EN3,EN4,EN5,EN6,EN7,EN8
(F8.0,8F8.0)
*END IF
*ENDDO
*CFCLOS
!Fortran程序,把ansys结果转换为MARC模型文件格式
program main
implicit none;
integer Key;
write(*,*) "Input 1 for node, 2 for element"
read(*,*) Key
if (Key==1) then
call Node_IO()
end if
if (Key==2) then
call Elem_IO()
end if
stop
end program
subroutine Node_IO()
implicit none
integer NNode,I, J
real*8,pointer :: Node(:,:)
real*8 x;
character :: filename*10;
write(*,*) "Please input node filename"
read(*,'(A10)') filename
open(66,file=filename)
read(66,*) NNode
allocate (Node(NNode,3))
do I=1,NNode
read(66,*) x, (Node(I,J), J=1,3)
end do
close (66)
filename=filename//"NEW"
open (66,file=filename)
write(66,'(4I10)') 3, NNode, 0, 1
do I=1, NNode
write(66,'(I10, 3E20.8)') I, (Node(I,J), J=1,3)
end do
close (66)
return
end subroutine Node_IO
subroutine Elem_IO()
implicit none
integer NElem,NumNode,ElemTyp,I, J
integer,pointer :: Elem(:,:)
real*8 x;
real*8,pointer :: y(:)
character :: filename*10, outformat*11,CharEtype;
write(*,*) "Please input node filename"
read(*,'(A10)') filename
write(*,*) "Please input Element type & Number of Nodes per element"
read(*,*) ElemTyp, NumNode
open(66,file=filename)
read(66,*) NElem
allocate (Elem(NElem, NumNode))
allocate (y(NumNode))
do I=1, NElem
read(66,*) x, (y(j),j=1,NumNode)
do J=1, NumNode
Elem(I,J)=int(y(j))
end do
end do
close (66)
filename=filename//"NEW"
write(CharEtype,'(I1)') NumNode
write(outformat,'(A6,A,A4)') "(2I10,", CharEtype, "I10)"
open (66,file=filename)
write(66,'(3I10)') 0, 0, 1
do I=1, NElem
write(66,outformat) I, ElemTyp, (Elem(I,J), J=1,ElemTyp)
end do
close (66)
return
end subroutine Elem_IO
相关文章
- 2021-09-08BIM技术丛书Revit软件应用系列Autodesk Revit族详解 [
- 2021-09-08全国专业技术人员计算机应用能力考试用书 AutoCAD2004
- 2021-09-08EXCEL在工作中的应用 制表、数据处理及宏应用PDF下载
- 2021-08-30从零开始AutoCAD 2014中文版机械制图基础培训教程 [李
- 2021-08-30从零开始AutoCAD 2014中文版建筑制图基础培训教程 [朱
- 2021-08-30电气CAD实例教程AutoCAD 2010中文版 [左昉 等编著] 20
- 2021-08-30电影风暴2:Maya影像实拍与三维合成攻略PDF下载
- 2021-08-30高等院校艺术设计案例教程中文版AutoCAD 建筑设计案例
- 2021-08-29环境艺术制图AutoCAD [徐幼光 编著] 2013年PDF下载
- 2021-08-29机械AutoCAD 项目教程 第3版 [缪希伟 主编] 2012年PDF