kris 发表于 2017-10-30 16:20:50

编的读取CAD文件多段线程序

编译没问题,运行后,,
Process returned -1073740940 (0xC0000374)   execution time : 6.129 s
Press any key to continue.
program main
    implicit none
    real,allocatable,dimension(:,:,:)::xyz(:,:,:)
    integer npl,numbers
    integer,allocatable,dimension(:)::np(:),mat(:)
    character*20 aa1,aa2
    real x0,y0,z0
    integer i,nnn,j
    800 FORMAT(A20)
    write(*,*)'---------输入多段线中最多点数---------'
    read*,numbers
    allocate(np(numbers),xyz(100,100,100),mat(100))
    npl=0
    np(1:numbers)=0
    open(10,FILE='shichong.dat',status='old')
    do
       read(10,800,end=900)aa1
            if(aa1(1:8).eq.'POLYLINE')then
            npl=npl+1
               do
                   read(10,800,end=900)aa2
                     if(aa2(1:3).eq.'8') then
                           read(10,*,end=900)nnn
                            mat(npl)=nnn
                     else if(aa2(1:3).eq.' 10')then
                           read(10,*)x0
                           xyz(np(npl),1,npl)=x0
                     else if(aa2(1:3).eq.' 20')then
                            read(10,*)y0
                            xyz(np(npl),2,npl)=y0
                     else if(aa2(1:3).eq.' 30')then
                            read(10,*)z0
                            xyz(np(npl),3,npl)=z0
                     else if(aa2(1:6).eq.'VERTEX')then
                           np(npl)=np(npl)+1
                     else if(aa2(1:6).eq.'SEQEND')then
                           exit
                      end if
                end do
         end if
    end do
900 write(*,*)'--------多段线读取完毕,共',npl,'条-------'
close(10)
deallocate(np,mat,xyz)
end

li913 发表于 2017-10-30 21:43:58

end 前一行 加上read(*,*)   试试。
页: [1]
查看完整版本: 编的读取CAD文件多段线程序