Fortran Coder

查看: 11088|回复: 1
打印 上一主题 下一主题

[求助] 编的读取CAD文件多段线程序

[复制链接]

1

帖子

1

主题

0

精华

新人

F 币
10 元
贡献
4 点
跳转到指定楼层
楼主
发表于 2017-10-30 16:20:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
编译没问题,运行后,,
Process returned -1073740940 (0xC0000374)   execution time : 6.129 s
Press any key to continue.
[Fortran] 纯文本查看 复制代码
01program main
02    implicit none
03    real,allocatable,dimension(:,:,:)::xyz(:,:,:)
04    integer npl,numbers
05    integer,allocatable,dimension(:)::np(:),mat(:)
06    character*20 aa1,aa2
07    real x0,y0,z0
08    integer i,nnn,j
09    800 FORMAT(A20)
10    write(*,*)'---------输入多段线中最多点数---------'
11    read*,numbers
12    allocate(np(numbers),xyz(100,100,100),mat(100))
13    npl=0
14    np(1:numbers)=0
15    open(10,FILE='shichong.dat',status='old')
16    do
17       read(10,800,end=900)aa1
18            if(aa1(1:8).eq.'POLYLINE')then
19              npl=npl+1
20               do
21                   read(10,800,end=900)aa2
22                       if(aa2(1:3).eq.'  8') then
23                           read(10,*,end=900)nnn
24                            mat(npl)=nnn
25                       else if(aa2(1:3).eq.' 10')then
26                           read(10,*)x0
27                           xyz(np(npl),1,npl)=x0
28                       else if(aa2(1:3).eq.' 20')then
29                            read(10,*)y0
30                            xyz(np(npl),2,npl)=y0
31                       else if(aa2(1:3).eq.' 30')then
32                            read(10,*)z0
33                            xyz(np(npl),3,npl)=z0
34                       else if(aa2(1:6).eq.'VERTEX')then
35                           np(npl)=np(npl)+1
36                       else if(aa2(1:6).eq.'SEQEND')then
37                           exit
38                      end if
39                end do
40           end if
41    end do
42900 write(*,*)'--------多段线读取完毕,共',npl,'条-------'
43close(10)
44deallocate(np,mat,xyz)
45end
分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

838

帖子

2

主题

0

精华

大宗师

F 币
3937 元
贡献
2339 点
沙发
发表于 2017-10-30 21:43:58 | 只看该作者
end 前一行 加上  read(*,*)   试试。
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2025-4-30 08:58

Powered by Discuz! X3.4

© 2013-2025 Comsenz Inc.

快速回复 返回顶部 返回列表