home *** CD-ROM | disk | FTP | other *** search
- rem name: cylint.cdl
-
- rem date: 111787 simon izraelevitz
-
- rem task: creates a spline intersection of two cylinders.
-
- rem error checking: impossible input conditions are
- rem checked and appropiate messages prompted.
-
- rem -----------------------------------------------
-
- clear
- array vm1[9]
- array vm2[9]
- array vm3[9]
- array int1[75][3]
- array int2[75][3]
-
- :start
- set mask,3
- errflag =0
-
- rem *** get present view ***
- getview @view
-
- i =-1
-
- :vmloop3
- i=i + 1
- vm3[i] =@fltdat[i]
- if (i < 8)
- goto vmloop3
-
- rem *** get first cylinder data ***
- :cir1cyl1
- getent "Indicate first circular end of first cylinder", etype
- if (@key <= -2)
- goto done
- goto rdc1cyl1
-
- :rdc1cyl1
- cy1x1 =@fltdat[0]
- cy1y1 =@fltdat[1]
- cy1z1 =@fltdat[2]
- cy1rad =@fltdat[3]
-
- getview @intdat[8]
-
- i =-1
-
- :vmloop1
- i=i + 1
- vm1[i] =@fltdat[i]
- if (i < 8)
- goto vmloop1
-
- :cir2cyl1
- getent "Indicate second circular end of first cylinder", etype
- on (@key + 3) goto done,start,cir2cyl1,rdc2cyl1,
-
- :rdc2cyl1
- cy1x2 =@fltdat[0]
- cy1y2 =@fltdat[1]
- cy1z2 =@fltdat[2]
-
- rem *** get second cylinder data ***
- :cir1cyl2
- getent "Indicate first circular end of second cylinder", etype
- on (@key + 3) goto done,cir2cyl1,cir1cyl2,rdc1cyl2,
-
- :rdc1cyl2
- cy2x1 =@fltdat[0]
- cy2y1 =@fltdat[1]
- cy2z1 =@fltdat[2]
- cy2rad =@fltdat[3]
-
- getview @intdat[8]
-
- i =-1
-
- :vmloop2
- i=i + 1
- vm2[i] =@fltdat[i]
- if (i < 8)
- goto vmloop2
-
- :cir2cyl2
- getent "Indicate second circular end of second cylinder", etype
- on (@key + 3) goto done,cir1cyl1,cir2cyl2,rdc2cyl2,
-
- :rdc2cyl2
- cy2x2 =@fltdat[0]
- cy2y2 =@fltdat[1]
- cy2z2 =@fltdat[2]
-
- rem *** print present view data ***
- set devout,.\cdlout.dat,0
- print "%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,\n",\
- vm3[0],vm3[1],vm3[2],vm3[3],vm3[4],vm3[5],vm3[6],vm3[7],vm3[8]
-
- rem *** print first cylinder data data ***
- set devout,.\cdlout.dat,1
- print "%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,\n",\
- cy1x1,cy1y1,cy1z1,cy1x2,cy1y2,cy1z2,cy1rad
-
- rem *** print first cylinder view data ***
- print "%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,\n",\
- vm1[0],vm1[1],vm1[2],vm1[3],vm1[4],vm1[5],vm1[6],vm1[7],vm1[8]
-
- rem *** print second cylinder data data ***
- print "%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,\n",\
- cy2x1,cy2y1,cy2z1,cy2x2,cy2y2,cy2z2,cy2rad
-
- rem *** print second cylinder view data ***
- print "%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,%.8f,\n",\
- vm2[0],vm2[1],vm2[2],vm2[3],vm2[4],vm2[5],vm2[6],vm2[7],vm2[8]
-
- rem *** execute "entfil.com" ***
- :execute
- set devout, NULL
- exec 2,"cylint"
-
- rem *** read intersection flag ***
- read .\pascout.dat,0,intflag
-
- on (intflag) goto none,intrsect,
-
- rem *** read number of intersection points ***
- :intrsect
- read .\pascout.dat,1,numpts
-
- on (intflag - 1) goto total,partial,
-
- :total
- rem *** read first intersection points and create int spline ***
- i =-1
- :pts1
- i=i + 1
- j=-1
- :coord1
- j=j + 1
- read .\pascout.dat,1,int1[i][j]
- if (j < 2)
- goto coord1
- if (i < (numpts - 1))
- goto pts1
-
- spline P3NN,int1,numpts,
-
- rem *** read second intersection points and create int spline ***
- i =-1
- :pts2
- i=i + 1
- j=-1
- :coord2
- j=j + 1
- read .\pascout.dat,1,int2[i][j]
- if (j < 2)
- goto coord2
- if (i < (numpts - 1))
- goto pts2
-
- spline P3NN,int2,numpts,
- goto start
-
- :partial
- i =-1
-
- rem *** read intersection points ***
- :pts3
- i=i + 1
- j=-1
- :coord3
- j=j + 1
- read .\pascout.dat,1,int1[i][j]
- if (j < 2)
- goto coord3
- if (i < (2 * numpts - 3))
- goto pts3
- int1[2 * numpts -2][0] = int1[0][0]
- int1[2 * numpts -2][1] = int1[0][1]
- int1[2 * numpts -2][2] = int1[0][2]
-
- spline P3NN,int1,(2 * numpts - 1),
- goto start
-
- rem *** error messages ***
-
- :none
- prompt " cylinders do not intersect, select again"
- wait 2.0
- goto start
-
- rem *** exit to CADKEY ***
- :done
- set mask
- exit