舰艇、汽车、航空、航天的许多产品都具有光滑外形,生产中要大量模型、模线、样板、模具、夹具等,占用空间大、时间长、协调精度差。随着计算机技术的发展,曲面造型已数字化,替代了传统方法。本文介绍切曲线/切曲面(TC/TS)造型方法的曲线曲面数学公式、计算程序、以及和市场常用软件数据格式转换程序。
* 光滑曲面造型-切曲线和切曲面
一个TS曲面片由9个特征网格点定义,曲面片间一阶导数连续。TS曲面片方程为
式中J1(u),J2(u),J3(u)是沿u向的3个基函数;J1(w),J2(w),J3(w) 是沿w向的3个基函数;V是沿u向和w向特征网格的9个顶奌。
* 利用重顶点技术切曲面造型
* 长空2号(CK-2)超音速无人机切曲面造型
* 切曲线切曲面 Fortran程序
*切曲线/切曲面造型数据格式转换程序
character*12 select
print *,' NOTICE ! < Author: Yisui Jiang>'
print *,' ------- < Machine Vision Lab. U. of M.>'
print *,' This program is used to convert a data file into a'
print *,'.DXF graphics interchange file of AUTOCAD. Formats of'
print *,'2D plane curve, 3D space curve and 3D surface mesh'
print *,'data files are as follows :'
print *,' '
print *,' 1) 2D plane curve '
print *,' x(1) y(1) '
print *,' x(2) y(2) '
print *,' | | '
print *,' x(n) y(n) '
print *,' 2) 3D space curve '
print *,' x(1) y(1) z(1) '
print *,' x(2) y(2) z(2) '
print *,' | | | '
print *,' x(n) y(n) z(n) '
print *,' 3) 3D space surface mesh '
print *,' n m '
print *,' x(1,1) y(1,1) z(1,1) '
print *,' x(1,2) y(1,2) z(1,2) '
print *,' | | | '
print *,' x(m,n) y(m,n) z(m,n) '
pause ' <PRESS ANY KEY TO CONTINUE !>'
print *,' '
print *,'*****************************************'
print *,'* *'
print *,'* MENU *'
print *,'* *'
print *,'* 1) 2D plane curve data *'
print *,'* *'
print *,'* 2) 3D space curve data *'
print *,'* *'
print *,'* 3) 3D space surface mesh *'
print *,'* *'
print *,'* Select 1,2 or 3 *'
print *,'* *'
print *,'*****************************************'
do 5 i=1,10
print *,' '
5 continue
read (*,'(a)') select
if (select.eq.'1') then
call a2dc
elseif (select.eq.'2') then
call a3dc
elseif (select.eq.'3') then
call a3ds
endif
stop
end
subroutine a2dc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c c
c Program name: dxf2d.for c
c Purpose: This program is used to convert data file into a graphics c
c interchange file .dxf of AUTOCAD. c
c Format of data file: c
c x(1),y(1) /* coordinates of points of curve */ c
c | | c
c | | c
c x(n),y(n) c
c Date: Nov. 20, 1991. c
c Author: Yisui Jiang, Machine Vision Lab. University of Manitoba. c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
character*12 name,name1
Print *,' Enter 2D data file name :'
read (*,'(a)') name
print *,' Enter .DXF file name :'
read (*,'(a)') name1
open (6,file=name1)
call sta2c
open (5,file=name)
read (5,*) x,y
x0=x
y0=y
5 read (5,*,err=999) x,y
call lin2c(x0,y0,x,y)
x0=x
y0=y
goto 5
999 call eof2c
close (5)
close (6)
return
end
subroutine sta2c
write (6,'(a)') '0'
write (6,'(a)') 'SECTION'
write (6,'(a)') '2'
write (6,'(a)') 'ENTITIES'
return
end
subroutine eof2c
write (6,'(a)') '0'
write (6,'(a)') 'ENDSEC'
write (6,'(a)') '0'
write (6,'(a)') 'EOF'
return
end
subroutine lin2c(x0,y0,x1,y1)
write (6,'(a)') '0'
write (6,'(a)') 'LINE'
write (6,'(a)') '8'
write (6,'(a)') '0'
write (6,'(a)') '10'
write (6,*) x0
write (6,'(a)') '20'
write (6,*) y0
write (6,'(a)') '11'
write (6,*) x1
write (6,'(a)') '21'
write (6,*) y1
return
end
subroutine a3dc
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c c
c Name of program: DXF3DC.for c
c This program is used to convert a space curve data file into c
c a graphics interchange file .DXF of AUTOCAD. c
c Format of data file: c
c x(1) y(1) z(1) /* coordinates of space points */ c
c | c
c | c
c x(n) y(n) z(n) c
c Date: Dec. 12, 1991 c
c Author: Yisui Jiang, Machine Vision Lab. University of Manitoba. c
c cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
character*12 name,name1
print *,'Enter 3D curve data file name:'
read (*,'(a)') name
print *,'Enter .DXF file name:'
read (*,'(a)') name1
open(5,file=name)
open (6,file=name1)
call sta3c
call pol3c
5 read(5,*,end=10) x,y,z
call vetx3c(x,y,z)
goto 5
10 call end3c
close (5)
close (6)
return
end
subroutine sta3c
write(6,'(a)') ' 0'
write(6,'(a)') 'SECTION'
write(6,'(a)') ' 2'
write(6,'(a)') 'ENTITIES'
return
end
subroutine end3c
write(6,'(a)') ' 0'
write(6,'(a)') 'SEQEND'
write(6,'(a)') ' 8'
write(6,'(a)') '0'
write(6,'(a)') ' 0'
write(6,'(a)') 'ENDSEC'
write(6,'(a)') ' 0'
write(6,'(a)') 'EOF'
return
end
subroutine pol3c
write(6,'(a)') ' 0'
write(6,'(a)') 'POLYLINE'
write(6,'(a)') ' 8'
write(6,'(a)') '0'
write(6,'(a)') '66'
write(6,'(a)') ' 1'
write(6,'(a)') '10'
write(6,'(a)') '0.0'
write(6,'(a)') '20'
write(6,'(a)') '0.0'
write(6,'(a)') '30'
write(6,'(a)') '0.0'
write(6,'(a)') '70'
write(6,'(a)') ' 8'
return
end
subroutine vetx3c(x,y,z)
write(6,'(a)') ' 0'
write(6,'(a)') 'VERTEX'
write(6,'(a)') ' 8'
write(6,'(a)') '0'
write(6,'(a)') '10'
write(6,*) x
write(6,'(a)') '20'
write(6,*) y
write(6,'(a)') '30'
write(6,*) z
write(6,'(a)') '70'
write(6,'(a)') ' 32'
return
end
subroutine a3ds
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c c
c Name of program: DXF3DS.for c
c Purpose of the program: c
c This program is used to convert multi-surface data c
c files into graphics interchange file .DXF of AUTOCAD. c
c Format of data file c
c n /* the size of points in direction first read in. */ c
c m /* the size of points in direction secondly read in. */ c
c x(1,1) y(1,1) z(1,1) c
c x(1,2) y(1,2) z(1,2) c
c | | | c
c x(m,n) y(m,n) z(m,n) c
c Date: Dec. 1, 1991 c
c Author: Yisui Jiang, Machine Vision Lab. University of Manitoba c
c c
ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
character*12 name,name1,anser
dimension x(200,200),y(200,200),z(200,200)
print *,'Enter .DXF file name:'
read (*,'(a)') name1
open (5,file=name1)
1 print *,'Enter surface data file name:'
read(*,'(a)') name
open(7,file=name)
read(7,*) n,m
do 5 i=0,m-1
do 5 j=0,n-1
read(7,*) x(i,j),y(i,j),z(i,j)
5 continue
close(7)
call sta3s
call pol3s(m,n)
do 20 i=0,m-1
do 20 j=0,n-1
call vetx3s(x(i,j),y(i,j),z(i,j))
20 continue
call eof3s
print *,'Is there any other data file to enter (y/n) ?'
read (*,'(a)') anser
if (anser.eq.'y') then
goto 1
else
endif
call end3s
close(5)
return
end
subroutine sta3s
write(5,'(a)')' 0'
write(5,'(a)')'SECTION'
write(5,'(a)')' 2'
write(5,'(a)')'ENTITIES'
return
end
subroutine eof3s
write(5,'(a)')' 0'
write(5,'(a)')'SEQEND'
write(5,'(a)')' 0'
write(5,'(a)')'ENDSEC'
return
end
subroutine end3s
write(5,'(a)')' 0'
write(5,'(a)')'EOF'
return
end
subroutine poit3s(x,y,z)
write(5,'(a)')' 0'
write(5,'(a)')'POINT'
write(5,'(a)')' 8'
write(5,'(a)')'POINTS'
write(5,'(a)')' 10'
write(5,*) x
write(5,'(a)')' 20'
write(5,*) y
write(5,'(a)')' 30'
write(5,*) z
return
end
subroutine pol3s(m,n)
write(5,'(a)')' 0'
write(5,'(a)')'POLYLINE'
write(5,'(a)')' 8'
write(5,'(a)')'SMOOTH-1'
write(5,'(a)')' 66'
write(5,'(a)')' 1'
write(5,'(a)')' 10'
write(5,'(a)')'0.0'
write(5,'(a)')' 20'
write(5,'(a)')'0.0'
write(5,'(a)')' 30'
write(5,'(a)')'0.0'
write(5,'(a)')' 70'
write(5,'(a)')' 16'
write(5,'(a)')' 71'
write(5,'(i6)') m
write(5,'(a)')' 72'
write(5,'(i6)') n
return
end
subroutine vetx3s(x,y,z)
write(5,'(a)')' 0'
write(5,'(a)')'VERTEX'
write(5,'(a)')' 8'
write(5,'(a)')'SMOOTH-1'
write(5,'(a)')' 10'
write(5,*) x
write(5,'(a)')' 20'
write(5,*) y
write(5,'(a)')' 30'
write(5,*) z
write(5,'(a)')' 70'
write(5,'(a)')' 64'
return
end
* TC Curves and TS Surfaces and Their Applications in CAD/CAM
Yisui Jiang and R.P.S. Han
* 3D MEASUREMENT AND GEOMETRY MODELLING FOR CURFACED SURFACE
Yisui Jiang, Craig Muller, Hui Wang, Doug Strong
jajemasehere
博联社:Jiangyisui(871348)