home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / acad / fortran / autograf / autograf.pas < prev   
Encoding:
Pascal/Delphi Source File  |  1994-06-02  |  1.6 KB  |  68 lines

  1. { These procedures generate AUTOCAD readable files in .DXF -format
  2.  
  3. init (filename) opens the file and outputs the first introductory
  4.                 remarks to it. The filename should have the extension .DXF.
  5.  
  6. movea(x,y)       moves the pen to a position x,y without drawing
  7.  
  8. drawa(x,y)       draws a line from the current position to x,y
  9.  
  10. finit            closes the file
  11.  
  12. }
  13.  
  14. type dxaugrafiletype=string[20];
  15.  
  16. var xmomaugraf,ymomaugraf:real;
  17.     dxaugrafile:text;
  18.  
  19. procedure init(filename:dxaugrafiletype);
  20. {open the file for output }
  21.  
  22. begin
  23.   assign(dxaugrafile,filename);
  24.   rewrite(dxaugrafile);
  25.   xmomaugraf:=0.;
  26.   ymomaugraf:=0.;
  27.   writeln(dxaugrafile,'0');
  28.   writeln(dxaugrafile,'SECTION');
  29.   writeln(dxaugrafile,'2');
  30.   writeln(dxaugrafile,'ENTITIES');
  31. end;
  32.  
  33. procedure finit;
  34. {close the file}
  35. begin
  36.   writeln(dxaugrafile,'0');
  37.   writeln(dxaugrafile,'ENDSEC');
  38.   writeln(dxaugrafile,'0');
  39.   writeln(dxaugrafile,'EOF');
  40.   close(dxaugrafile);
  41. end;
  42.  
  43. procedure movea(x,y:real);
  44. { moves the current pointer to a new position }
  45. begin
  46.   xmomaugraf:=x;
  47.   ymomaugraf:=y;
  48. end;
  49.  
  50. procedure drawa(x,y:real);
  51. { Draws a line from the current position to x,y }
  52. begin
  53.   writeln(dxaugrafile,'0');
  54.   writeln(dxaugrafile,'LINE');
  55.   writeln(dxaugrafile,'  8');
  56.   writeln(dxaugrafile,'0');
  57.   writeln(dxaugrafile,' 10');
  58.   writeln(dxaugrafile,xmomaugraf:8:6);
  59.   writeln(dxaugrafile,' 20');
  60.   writeln(dxaugrafile,ymomaugraf:8:6);
  61.   writeln(dxaugrafile,' 11');
  62.   writeln(dxaugrafile,x:8:6);
  63.   writeln(dxaugrafile,' 21');
  64.   writeln(dxaugrafile,y:8:6);
  65.   xmomaugraf:=x;
  66.   ymomaugraf:=y;
  67. end;
  68.