home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / acad / fortran / autograf / autograf.for next >
Encoding:
Text File  |  1994-06-02  |  1.6 KB  |  65 lines

  1. C
  2. C   These subroutines produce output to a file that can be read by
  3. C   the AUTOCAD package as .DXF files with the command DXFIN.
  4. C
  5. C   CALL INIT(filename,ichannel) opens the file on channel
  6. C        ICHANNEL and outputs the first introductory lines
  7. C        to it. Filename should have the extension '.DXF'.
  8. C
  9. C   CALL MOVEA(X,Y)  moves the pen to a position X,Y without
  10. C        drawing
  11. C
  12. C   CALL DRAWA(X,Y)  draws a line from the last current position
  13. C        to X,Y
  14. C
  15. C   CALL FINIT closes the file
  16. C
  17. C
  18.       SUBROUTINE INIT(FILNAM,ICHAN)
  19. C
  20. C  *** Program was written for Fortran 77 - modify the following
  21. C      line for FIV.    
  22.       CHARACTER*20 FILNAM
  23.       COMMON /AUTOGR/ICHAN1,XMOM,YMOM
  24. C
  25. C     OPENING THE FILE FOR DXF
  26.       OPEN(ICHAN,FILE=FILNAM,STATUS='UNKNOWN' )
  27.       ICHAN1=ICHAN
  28.       XMOM=0
  29.       YMOM=0
  30. C
  31.       WRITE(ICHAN,1000)
  32. 1000  FORMAT('0',/'SECTION'/,'2',/'ENTITIES')
  33.       RETURN
  34.       END
  35.  
  36.  
  37.       SUBROUTINE FINIT
  38.       COMMON /AUTOGR/ICHAN1,XMOM,YMOM
  39.       WRITE(ICHAN1,1000)
  40. 1000  FORMAT('0'/ 'ENDSEC' /'0'/'EOF'/)
  41.       CLOSE(ICHAN1)
  42.       RETURN
  43.       END
  44.  
  45.       SUBROUTINE MOVEA(X,Y)
  46. C
  47. C     MOVES THE CURRENT POINTER TO A NEW POSITION
  48.       COMMON /AUTOGR/ICHAN1,XMOM,YMOM
  49.       XMOM=X
  50.       YMOM=Y
  51.       RETURN
  52.       END
  53.  
  54.       SUBROUTINE DRAWA(X,Y)
  55. C
  56. C     DRAWS A LINE FROM THE CURRENT POSITION  TO X,Y
  57.       COMMON /AUTOGR/ICHAN1,XMOM,YMOM
  58.       WRITE(ICHAN1,1000) XMOM,YMOM,X,Y
  59. 1000  FORMAT('0' / 'LINE' /'  8'/ '0' / ' 10' /F15.7 /' 20' /
  60.      %  F15.7/ ' 11'/ F15.7 / ' 21' / F15.7)
  61.      XMOM=X
  62.      YMOM=Y
  63.      RETURN
  64.      END
  65.