home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / GRAPHICS / PLOT / SURFUTI3.ZIP / WRITEFIL.INC < prev    next >
Encoding:
Text File  |  1990-09-03  |  2.0 KB  |  63 lines

  1. procedure WRITEFILE (Filename: text80);
  2. { Write the new SURFMODL-format file }
  3.  
  4. var Outfile: text;              { file to write to }
  5.     Vert: integer;              { vertex # }
  6.     Node: integer;              { node # }
  7.     Mat: integer;               { material # }
  8.     Surf: integer;              { surface # }
  9.     Nvertex: integer;           { # vertices in surface }
  10.     Fileopen: boolean;          { flag opened file }
  11.     Yorn: char;                 { user response }
  12.  
  13. begin
  14. {$ifdef BIGMEM}
  15. with ptra^ do with ptrb^ do with ptrc^ do
  16. begin
  17. {$endif}
  18.   Fileopen := FALSE;
  19.   while (NOT Fileopen) do begin
  20.     assign (Outfile, Filename);
  21.     {$I-}
  22.     rewrite (Outfile);
  23.     {$I+}
  24.     if (ioresult <> 0) then begin
  25.       writeln ('Error opening output file ',Filename);
  26.       write ('Try again (Y or N)?');
  27.       readln (Yorn);
  28.       if (Yorn <> 'Y') and (Yorn <> 'y') then
  29.         halt;
  30.     end else
  31.       Fileopen := TRUE;
  32.   end; { while }
  33.  
  34.   writeln (Outfile, Flpurpose);
  35.   writeln (Outfile, 4);
  36.   writeln (Outfile, '* NMatls, Nnodes, Nsurf, Maxvert, Nsides');
  37.   writeln (Outfile, Nmatl,' ',Nnodes,' ',Nsurf,' ',Maxvert,' ',Nsides);
  38.  
  39.   writeln (Outfile, '************ MATERIAL DATA SECTION **************');
  40.   for Mat := 1 to Nmatl do
  41.     writeln (Outfile, R1[Mat],' ',R2[Mat],' ',R3[Mat],' ',Color[Mat],' ',
  42.              Ambient[Mat]);
  43.  
  44.   writeln (Outfile, '*************** NODAL DATA SECTION **************');
  45.   for Node := 1 to Nnodes do
  46.     writeln (Outfile, World[Node][1]:9:4,' ',World[Node][2]:9:4,' ',
  47.              World[Node][3]:9:4);
  48.  
  49.   writeln (Outfile, '************* SURFACE DATA SECTION **************');
  50.   for Surf := 1 to Nsurf do begin
  51.     Nvertex := nvert (Surf);
  52.     write (Outfile, Nvertex,' ',Matl[Surf],' ');
  53.     for Vert := 1 to Nvertex do
  54.       write (Outfile, konnec (Surf, Vert),' ');
  55.     writeln (Outfile);
  56.   end; { for Surf }
  57.  
  58.   close (Outfile);
  59. {$ifdef BIGMEM}
  60. end; {with}
  61. {$endif}
  62. end; { procedure WRITEFILE }
  63.