home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / dxfpas.zip / MANUAL.DOC < prev    next >
Text File  |  1992-07-02  |  23KB  |  730 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                   DXFTOOLS 1.0
  8.  
  9.                         Copyright (c) 1992 Dennis W. Webb
  10.  
  11.  
  12. DXFTOOLS is a shareware product.  You may feel free to make copies of these
  13. utilities and pass them on to friends for their evaluation.  If you make use
  14. of this software you are expected to pay a registration fee of $50 to:
  15.  
  16.                                 Dennis W. Webb
  17.                                  1801 Edna Dr.
  18.                               Vicksburg, MS  39180
  19.  
  20. Checks are accepted.  Purchase Orders are accepted from most companies,
  21. schools, and government agencies.
  22.  
  23. Your registration fee entitles you to use this software on a single computer
  24. and to make as many copies of this software as you wish for backup purposes. 
  25. Site licenses are available, call (601)636-7202.
  26.  
  27. DXFTOOLS is a complete product containing the functions and procedures
  28. required to read or write the DXF code for most 2D entities.  Upon receipt of
  29. your registration fee you will be upgraded to DXFTOOLS PLUS which includes
  30. TEXT, and BLOCK support, 3D entities, and additional 2D entities not included
  31. with DXFTOOLS.  You will also receive a printed manual for DXFTOOLS PLUS, and
  32. notice of future upgrades.
  33.  
  34. I will be able to offer telephone support of this product evenings and
  35. weekends.  You may call me in the evening between 5:00 and 9:00 CST.  If I am
  36. not home, leave a message and I will return your call.
  37.  
  38.                                   INVOICE
  39.  
  40. Remit to:                                                  From
  41.  
  42. Dennis W. Webb                _________________________________
  43. 1801 Edna Dr.                 _________________________________
  44. Vicksburg, MS  39180          _________________________________
  45. (601)636-7202                 _________________________________
  46.  
  47.                                             Contact Individual:
  48.  
  49.                               _________________________________
  50.                               _________________________________
  51.  
  52.  
  53.  
  54. Qyt                        Unit Price          Total
  55.  
  56. ____ DXFTOOLS PLUS 1.0       $50.00
  57.  
  58.  
  59.  
  60.  
  61. I use ____5 1/4"   ____ 3 1/2" disks
  62.  
  63. For your convenience units compiled with earlier version of Turbo Pascal are
  64. available at no additional charge. 
  65.   
  66.                                     ____ Turbo Pascal 4.0
  67.  
  68.                                     ____ Turbo Pascal 5.0
  69.   INTRODUCTION
  70.  
  71. In order for AutoCAD to exchange drawing files with other Computer-Aided
  72. Design/Drafting (CAD) packages, the "Drawing Interchange" file format (DXF)
  73. was developed.  DXF files are standard ASCII text files.  They contain an
  74. ASCII representation of the same information in the drawing database (.dwg
  75. file). AutoCAD has the ability to read and write DXF files through the DXFIN
  76. and DXFOUT commands.  In order to assist in the development of applications
  77. utilizing these DXF files, the DXF TOOLBOX has been developed.
  78.  
  79. The DXF TOOLBOX for Turbo Pascal consists of two Turbo Pascal units (.TPU
  80. files).  Each of these two units is a library of the necessary procedures and
  81. functions to output to and input from DXF files.  This manual assumes that
  82. you have a working knowledge of Turbo Pascal, the ability to link Turbo
  83. Pascal units with the USES command, and a basic understanding of AutoCAD.
  84.  
  85. The first unit DXFWRITE.TPU is a library of procedures and functions allowing
  86. your Turbo Pascal program to  create and wire output to a DXF file.  This
  87. feature is extremely powerful for any program that requires graphical output. 
  88. By creating a DXF file, you can load graphical results directly into AutoCAD,
  89. use AutoCAD to edit the figure, and produce a hard copy via any of AutoCAD's
  90. supported output devices.  Or, you could use AutoCAD to create a slide show
  91. of your graphics.  As a programmer, you no longer need to concern yourself
  92. with device drivers for video cards, plotters, and printer plotters.
  93.  
  94. The second unit DXFREAD.TPU is the library of procedures and functions that
  95. allows your program to read information stored in a drawing created in
  96. AutoCAD.  You can read the location, size, and orientation of AutoCAD
  97. entities.  This can be used to calculate a bill of materials for house plans,
  98. calculate volume, or any number of engineering or architectural applications.
  99.  
  100. These units have been developed for pc-compatibles using the MS-DOS operating
  101. systems.  They were compiled with Turbo Pascal versions 6.0.  For those still
  102. using Turbo Pascal versions 4 and 5, the units compatible with those versions
  103. are available at no additional charge if requested on the registration form.
  104.  
  105. We warrant that the software will function as described in this documentation
  106. for a period of 30 days from receipt.  If you encounter a bug or deficiency,
  107. a problem report will be required for us to fix the problem.  If you properly
  108. notify us of such a software problem within the warranty period, we will
  109. update the defective software at no cost.  Failing that we will refund the
  110. full purchase price of the software upon receipt of the original program
  111. diskette and documentation in undamaged condition.  We also warranty the
  112. original program diskette and documentation for a period of 30 days from
  113. receipt.
  114.  
  115. We do not assume any liability for the use of the DXF TOOLBOX beyond the
  116. original purchase price of the software.  In no event will we be liable for
  117. additional damages included lost profits, lost data, or any other damages out
  118. of the use or inability to use DXF TOOLBOX.
  119.  
  120. No royalties are required for any programs using the procedures and functions
  121. contained within DXF TOOLBOX provided that the fact that DXF TOOLBOX was used
  122. is contained in the program documentation. DXFWRITE
  123.  
  124. The unit DXFWRITE contains the procedures required to open and initialize a
  125. DXF output file, write the DXF code for 2D and 3D entities, and close the
  126. file.  Entities supported include lines, circles, points, arcs, polylines,
  127. meshes, and text.
  128.  
  129. Note concerning DXF2D_entity.  These procedures will write the DXF text to
  130. draw entity at the default elevation and thickness of 0.  If the programmer
  131. wishes to draw entities in two dimensions, but in a plane other than z=0, the
  132. global variable dxfelev may be set to the desired elevation.  Likewise, the
  133. global variable dxfthick may be set to a thickness other than 0.  You do not
  134. need to initialize these variables to 0.
  135.  
  136. To input your DXF file into AutoCAD, use AutoCAD's DXFIN command from the
  137. AutoCAD command line, and enter the name of the file you created in your
  138. Turbo Pascal program.  Your program's output will become part of an AutoCAD
  139. drawing.
  140.  
  141. An example using DXFWRITE, EXAMPLE1.PAS is included with the shareware
  142. version of this program.
  143.  
  144. -----------------------------------------------------------------------------
  145.  
  146. PROCEDURE INIT_DXFFILE(filename : string);
  147.  
  148. Purpose
  149. Assigns Filename to a TEXT variable, opens the file, and writes the DXF
  150. initialization records to the file.  This procedure must be called before any
  151. of the other DXF procedures are used.  You can only have one DXF file open at
  152. time. Therefore you must call the procedure CLOSE_DXFFILE before initializing
  153. a second DXF file in your program.
  154.  
  155. WARNING!  INIT_DXFFILE will not check to make sure that the DXF output file
  156. does not already exist.  Any existing filenames passed to INIT_DXFFILE will
  157. be overwritten.  It is up to the user to make certain that this does not
  158. happen, unless filename is intended to be overwritten.
  159.  
  160. -----------------------------------------------------------------------------
  161.  
  162. PROCEDURE CLOSE_DXFFILE;
  163.  
  164. Purpose
  165. Writes the closing records to the DXF file opened in the previous
  166. INIT_DXFFILE procedure and closes the file.
  167. DXF2D_POINT
  168.  
  169. Declaration
  170. PROCEDURE DXF2D_POINT(x,y:real;layer:string);
  171.  
  172. Definition of variables
  173. x,y => coordinates for point.
  174. layer  => AutoCAD layer for point.
  175.  
  176. Purpose
  177. Writes the DXF code to place a point at x,y in the assigned layer.  The point
  178. will be drawn at the default thickness and elevation.  The default thickness
  179. and elevation are both 0 unless the global variables dxfelev and dxfthick are
  180. changed.
  181.  
  182. Example
  183. Draw two points x=1 and y=2 in layer "POINTS".  Draw the second point at an
  184. elevation of 5.
  185.  
  186.    var
  187.       x,y : real;
  188.       filename:string[12];
  189.       layer : string[30];
  190.  
  191.     begin
  192.       x:=1;
  193.       y:=2;
  194.       filename:='output.dxf';
  195.       layer:='POINTS';
  196.       INIT_DXFFILE(filename);
  197.       DXF2D_POINT(x,y,layer);
  198.       dxfelev:=5.0;     {Change the default elevation to 5.0}
  199.       DXF2D_POINT(x,y,layer);
  200.       CLOSE_DXFFILE;
  201.     end;
  202. PROCEDURE DXF2D_LINE(x1,y1,x2,y2 real;layer:string);
  203.  
  204. Definition of variables
  205. x1,y1 => coordinates for beginning of line.
  206. x2,y2 => coordinates for ending of line.
  207. layer  => AutoCAD layer for line.
  208.  
  209. Purpose
  210. Writes the DXF code to draw a line from x1,y1 to x2,y2 in the appropriate
  211. layer.  The line will be drawn at the default thickness and elevation.  The
  212. default thickness and elevation are both 0 unless the global variables
  213. dxfelev and dxfthick are changed.
  214.  
  215. Example
  216. Draw a line at coordinate 1,2 to coordinate 11,21 in layer "LINES".  Draw a
  217. second line from 4,5 to 8,6 with a thickness of 1.5.  Place the second line a
  218. layer called "THICK-LINES".
  219.  
  220.  
  221.   var
  222.     x1,y1,x2,y2 : real;
  223.  
  224.   begin
  225.     x1:=1;
  226.     y1:=2;
  227.     x2:=11;
  228.     y2:=21;
  229.     INIT_DXFFILE('outfile.dxf');
  230.     DXF2D_LINE(x1,y1,x2,y2,'LINES');
  231.     dxfthick:=1.5;  {Change the default thickness to 1.5}
  232.     x1:=4;
  233.     y1:=5;
  234.     x2:=8;
  235.     y2:=6;
  236.     DXF2D_LINE(x1,y1,x2,y2,'THICK-LINES');
  237.     CLOSE_DXFFILE;
  238.   end;
  239. PROCEDURE DXF2D_ARC(x,y,radius,start_ang,end_ang:real;layer:string);
  240.  
  241. Definition of variables
  242. x,y => coordinates for center of arc.
  243. radius => length of radius.
  244. start_ang => starting angle of arc.
  245. end_ang => ending angle of arc.
  246. layer => AutoCAD layer for arc.
  247.  
  248. Purpose
  249. Writes the appropriate DXF text to draw an arc of a given radius from center
  250. point x,y in the appropriate layer.  The arc will begin at start_angle and
  251. terminate at end_angle.  Angles should be in agreement with the angle format
  252. selected via the AutoCAD UNITS command.  The arc will be drawn at the default
  253. thickness and elevation.  The default thickness and elevation are both 0
  254. unless the global variables dxfelev and dxfthick are changed.
  255.  
  256. Example
  257. Draw an angle of radius 2 from 45 to 90 degrees at location 5,6 in layer
  258. "ARC".
  259.  
  260.    var
  261.      x,y,rad,ang1,ang2 : real;
  262.      layer : string[30];
  263.  
  264.    begin
  265.      x:=5;
  266.      y:=6;
  267.      rad:=2;
  268.      ang1:=45;
  269.      ang2:=90;
  270.      layer:='ARC';
  271.      INIT_DXFFILE('outfile.dxf');
  272.      DXF2D_ARC(x,y,rad,ang1,ang2,layer);
  273.      CLOSE_DXFFILE;
  274.    end;
  275.  
  276. PROCEDURE DXF2D_CIRCLE(x,y,radius:real;layer:string);
  277.  
  278. Definition of variables
  279. x,y => coordinates for center point of the circle.
  280. radius => length of radius.
  281. layer  => AutoCAD layer for circle.
  282.  
  283. Purpose
  284. Writes the DXF code to draw a circle of a given radius from center point x,y
  285. in the appropriate layer.  The circle will be drawn at the default thickness
  286. and elevation.  The default thickness and elevation are both 0 unless the
  287. global variables dxfelev and dxfthick are changed.
  288.  
  289. Example
  290. Draw a circle of radius 8 at location 4,2 in layer "CIRCLES" with an
  291. elevation of 6.12.  The circles's thickness is 0.
  292.  
  293.     var
  294.      x,y,rad : real;
  295.      layer : string[30];
  296.    begin
  297.      x:=4;
  298.      y:=2;
  299.      rad:=8;
  300.      layer:='CIRCLES';
  301.      dxfelev:=6.12;
  302.      INIT_DXFFILE('outfile.dxf');
  303.      DXF2D_CIRCLE(x,y,rad,layer);
  304.      CLOSE_DXFFILE;
  305.    end;
  306.  
  307. -----------------------------------------------------------------------------
  308. 2D-POLYLINES
  309.  
  310.      Drawing polylines is accomplished by calling three different
  311. procedures.  The first BEGIN_2DPLINE is called to initialize the
  312. polyline, it is called once per polyline.  The second DXF2D_PLINE
  313. is called for each vertex to be included in the polyline.  The
  314. last END_PLINE is called to close the polyline, it is called once
  315. per polyline. 
  316.  
  317. -----------------------------------------------------------------------------
  318.  
  319. PROCEDURE BEGIN_2DPLINE(layer:string;closed:boolean);
  320.  
  321. Definition of variables
  322. layer => AutoCAD layer for polyline.
  323. closed => TRUE if polyline is closed, FALSE if open.
  324. PROCEDURE DXF2D_PLINE(x,y,w1,w2:real)
  325.  
  326. Definition of variables
  327. x,y => coordinates for vertex of polyline.
  328. layer => AutoCAD layer for polyline.
  329. w1 => beginning width for polyline.
  330. w2 => ending width for polyline.
  331.  
  332. -----------------------------------------------------------------------------
  333.  
  334. PROCEDURE END_PLINE;
  335.  
  336. Definition of variables
  337. No variables are required for this procedure.
  338.  
  339. Example
  340. Draw an open polyline representing the function Y=X2 from X=1 to X=10 in
  341. layer Function.  For this example all widths, the thickness, and elevation
  342. are 0.
  343.  
  344.     var
  345.       x,y,begin_width,end_width : real;
  346.       closed:boolean;
  347.       layer : string[30];
  348.       I:integer;
  349.  
  350.     begin
  351.       layer:='Function';
  352.       closed:=FALSE;
  353.       thick:=0.0;
  354.       elev:=0.0;
  355.       begin_width:=0.0;
  356.       end_width:=0.0;
  357.       INIT_DXFFILE('outfile.dxf');
  358.       begin2d_pline(layer,closed);
  359.       for I:=1 to 10 do
  360.       begin
  361.         x:=I;
  362.         y:=I*I;
  363.         dxf2d_pline(x,y,begin_width,end_width);
  364.       end;
  365.       end_pline;
  366.       close_dxfile;
  367.     end;
  368. DXFREAD
  369.  
  370. The unit DXFREAD contains the procedures required to open DXF file for input,
  371. read the DXF code for layer names, block names, and entities.  Entities
  372. supported include lines, circles, points, arcs, polylines, meshes, and text.
  373.  
  374. For the most part, the same procedures are used for reading 2D and 3D
  375. entities.  This is because the programmer may not know which to expect.  For
  376. 2D entities, the Z coordinates will be returned as 0.
  377.  
  378. In order to create the DXF file, enter DXFOUT from the AutoCAD command line. 
  379. Enter a new filename, or take the default.  DXFREAD will use the file you
  380. created (which contains all information concering the drawing) as your
  381. programs input file.
  382.  
  383. An example using DXFWRITE, EXAMPLE2.PAS is included with the shareware
  384. version of this program.
  385.  
  386. -----------------------------------------------------------------------------
  387.  
  388. PROCEDURE OPEN_DXF(filename:string);
  389.  
  390. Definition of variables
  391. filename => DXF file to be used for input.
  392.  
  393. Purpose
  394. Opens a DXF file for input and initializes certain variables required by
  395. DXFREAD.  ASSIGN_DXF must be called before any other procedures in the
  396. DXFREAD unit. 
  397.  
  398. -----------------------------------------------------------------------------
  399.  
  400. PROCEDURE CLOSE_DXF;
  401.  
  402. Definition of variables
  403. No variables are required for this procedure.
  404.  
  405. Purpose
  406. Closes the DXF file previously opened for input with the
  407. OPEN_DXF procedure.
  408.  
  409. FUNCTION GET_LAYER:string;
  410.  
  411. Definition of variables
  412. No parameters are passed to this function.
  413.  
  414. Purpose
  415. Returns all layer names used in the drawing that the DXF file was generated
  416. from.  The layer names will be returned in the order that they were created
  417. in the drawing.  When no more layer names are listed in the DXF file,
  418. GET_LAYER will return a null string ('').
  419.  
  420. Example
  421. Read all of the layer names in a DXF file into an array. 
  422.  
  423. PROGRAM TEST_DXFREAD;
  424.  
  425. USES DXFREAD;
  426.  
  427. const
  428.   maxlayers = 50;
  429.  
  430. var
  431.   layer : array [1..maxlayers] of string;
  432.   i,
  433.   numlayers : integer;
  434.   filename : string;
  435.  
  436. BEGIN
  437.   writeln('Enter name of input DXF file .');
  438.   readln(filename);
  439.   OPEN_DXF(filename);
  440.   numlayers:=0;
  441.   repeat;
  442.     numlayers:=numlayers+1;
  443.     layer[numlayers]:=GET_LAYER;
  444.   until layer[numlayers]='';
  445.   numlayers:=numlayers-1;
  446.   for i:=1 to numlayers do writeln(layer[i]);
  447.   CLOSE_DXF;
  448. end.
  449.  
  450.  
  451. PROCEDURE GET_ENT(var entid:byte;var enttype,layer:string);
  452.  
  453. Definition of variables
  454. entid => value is determined by type of entity.  This is useful if you use
  455. the Pascal CASE statement to control program branching.  The value of entid
  456. will be one of the following:  
  457.  
  458.      0 => No more entities in DXF file.
  459.      1 => Point.
  460.      2 => Line.
  461.      3 => 3DLine.
  462.      4 => Arc.
  463.      5 => Circle.
  464.      6 => Trace.
  465.      7 => Solid.
  466.      8 => 3DFace.
  467.      9 => Polyline or Mesh.
  468.     10 => Vertex.
  469.     11 => Seqend.
  470.  
  471. enttype => name of entity. Such as line, circle, etc.
  472. layer => layer that the entity resides in.
  473.  
  474. Purpose
  475. Returns the names and layers of all entities in drawing that the DXF file was
  476. generated from.  The entities will be returned in the order that they were
  477. drawn. Enttype will be one of the following type of entities:  POINT, LINE,
  478. 3DLINE, ARC, CIRCLE, TRACE, SOLID, 3DFACE, PLINE, or VERTEX.  After all
  479. entities have been returned, GET_ENT will return a null string ('') for both
  480. enttype, and layer.
  481.  
  482. Example
  483. List all the entities and their layers in a DXF file on the screen.
  484.   
  485. PROGRAM TEST_DXFREAD;
  486.  
  487. USES DXFREAD;
  488.  
  489. var
  490.   entid:byte;
  491.   entname,layer : string;
  492.   filename : string;
  493.  
  494. BEGIN
  495.   writeln('Enter name of input DXF file .');
  496.   readln(filename);
  497.   OPEN_DXF(filename);
  498.   repeat;
  499.     GET_ENT(entid,entname,layer);
  500.     WRITELN('ENTID=',entid,'     ENTITY=',entname,'     LAYER=',layer);
  501.   until entname='';
  502.   CLOSE_DXF;
  503. end.
  504. PROCEDURE GET_POINT(var x,y,z,elev,thick:real);
  505.  
  506. Definition of variables
  507. x,y,z => coordinates for point.
  508. elev => elevation of point.
  509. thick => thickness of point.
  510.  
  511. Example
  512. List the properties of all POINTS in a DXF file that were drawn in the layer
  513. "MYPOINTS".
  514.  
  515. PROGRAM TEST_DXFREAD;
  516.  
  517. USES DXFREAD;
  518.  
  519. var
  520.   entid:byte;
  521.   entname,layer,matchlayer : string;
  522.   x,y,z,elev,thick:real;
  523.   filename : string;
  524.  
  525. BEGIN
  526.   matchlayer:='MYPOINTS';
  527.   writeln('Enter name of input DXF file .');
  528.   readln(filename);
  529.   OPEN_DXF(filename);
  530.   repeat;
  531.     GET_ENT(entid,entname,layer);
  532.     if (entid=1) and (layer=matchlayer) then
  533.     begin
  534.       GET_POINT(x,y,z,elev,thick);
  535.       writeln('Point is ',x,',',y,',',z);
  536.       writeln('The elevation is ',elev,' and the thickness is',thick);
  537.     end;
  538.   until entid=0;
  539.   CLOSE_DXF;
  540. end.
  541.  
  542. PROCEDURE GET_LINE(var x1,y1,z1,x2,y2,z2,elev,thick:real);
  543.  
  544. Definition of variables
  545. x1,y1,z1 => coordinates for starting point of line.
  546. x2,y2,z2 => coordinates for ending point of line.
  547. elev => elevation of line.
  548. thick => thickness of line.
  549.  
  550. Example
  551. List the properties of all LINES in a DXF file regardless of their layer.
  552.  
  553. PROGRAM TEST_DXFREAD;
  554.  
  555. USES DXFREAD;
  556.  
  557. var
  558.   entid:byte;
  559.   entname,layer : string;
  560.   x1,y1,z1,x2,y2,z2,elev,thick:real;
  561.   filename : string;
  562.  
  563. BEGIN
  564.   writeln('Enter name of input DXF file .');
  565.   readln(filename);
  566.   OPEN_DXF(filename);
  567.   repeat;
  568.     GET_ENT(entid,entname,layer);
  569.     if (entid=2) then
  570.     begin
  571.       GET_LINE(x1,y1,z1,x2,y2,z2,elev,thick);
  572.       writeln('The line is from',x1,',',y1,',',z1,' to',x2,',',y2,',',z2);
  573.       writeln('The line was created in layer ',layer);
  574.       writeln('The elevation is ',elev,' and the thickness is ',thick);
  575.     end;
  576.   until entid=0;
  577.   CLOSE_DXF;
  578. end.
  579.  
  580. PROCEDURE  GET_ARC(var x,y,z,rad,ang1,ang2,elev,thick:real);
  581.  
  582. Definition of variables
  583. x,y,z => coordinate for the center point of the arc.
  584. rad => Radius of the arc.
  585. ang1 => starting angle of the arc.
  586. ang2 => ending angle of the arc.
  587. elev => elevation of arc.
  588. thick => thickness of arc.
  589.  
  590. Example
  591. List the center point, radius, and layer of all arcs in a DXF file.
  592.  
  593. PROGRAM TEST_DXFREAD;
  594.  
  595. USES DXFREAD;
  596.  
  597. var
  598.   entid:byte;
  599.   entname,layer : string;
  600.   x,y,z,rad,ang1,ang2,elev,thick:real;
  601.   filename : string;
  602.  
  603. BEGIN
  604.   writeln('Enter name of input DXF file .');
  605.   readln(filename);
  606.   OPEN_DXF(filename);
  607.   repeat;
  608.     GET_ENT(entid,entname,layer);
  609.     if (entid=4) then
  610.     begin
  611.       GET_ARC(x,y,z,rad,ang1,ang2,elev,thick);
  612.       writeln('The center point of the arc is ',x,',',y,',',z);
  613.       writeln('It was created in layer ',layer,' and has a radius of ',rad);
  614.     end;
  615.   until entid=0;
  616.   CLOSE_DXF;
  617. end.
  618.  
  619.  
  620. PROCEDURE  GET_CIRCLE(var x,y,z,rad,elev,thick:real);
  621.  
  622. Definition of variables
  623. x,y,z => coordinate for the center point of the circle.
  624. rad => Radius of the circle
  625. elev => elevation of circle
  626. thick => thickness of circle.
  627.  
  628. Example
  629. List the properties of all CIRCLES in a DXF file regardless of the layer.
  630.  
  631. PROGRAM TEST_DXFREAD;
  632.  
  633. USES DXFREAD;
  634.  
  635. var
  636.   entid:byte;
  637.   entname,layer : string;
  638.   x,y,z,rad,elev,thick:real;
  639.   filename : string;
  640.  
  641. BEGIN
  642.   writeln('Enter name of input DXF file .');
  643.   readln(filename);
  644.   OPEN_DXF(filename);
  645.   repeat;
  646.     GET_ENT(entid,entname,layer);
  647.     if (entid=5) then
  648.     begin
  649.       GET_CIRCLE(x,y,z,rad,elev,thick);
  650.       writeln('The center point of the circle is',x,',',y,',',z);
  651.       writeln('It was created in layer ',layer,' and has a radius of ',rad);
  652.       writeln('The elevation is ',elev,' and the thickness is ',thick);
  653.     end;
  654.   until entid=0;
  655.   CLOSE_DXF;
  656. end.
  657.  
  658. PROCEDURE GET_PLINE(var mesh,mclosed,nclosed:boolean;
  659.                     var m,n:integer; var
  660. begin_width,end_width,elev,thick:real);        
  661.            
  662.  
  663. Definition of variables
  664. mesh => returns TRUE if PLINE is a 3D polyline mesh.
  665. mclosed => returns TRUE if a polyline is closed,
  666.            or if a 3D mesh is closed in the m direction
  667. nclosed => returns TRUE if a 3D mesh is closed in the n direction
  668. m => the number of vertices in the m direction of a 3D mesh.
  669. n => the number of vertices in the n direction of a 3D mesh.
  670. begin_width => beginning width of polyline.
  671. end_width => ending width of polyline.
  672. elev => elevation of polyline.
  673. thick => thickness of polyline.
  674.  
  675. Example
  676. Example will be shown with the procedure GET_VERTEX.
  677.  
  678. -----------------------------------------------------------------------------
  679.  
  680. GET_VERTEX
  681.  
  682. PROCEDURE GET_VERTEX(var x,y,z,begin_width,end_width,elev,thick:real);
  683.  
  684. Definition of variables
  685. x,y,z => coordinates for the vertex.
  686. begin_width => beginning of polyline segment.
  687. end_width => ending width of polyline segment.
  688. elev => elevation of vertex.
  689. thick => thickness of vertex.
  690.  
  691. Example
  692. List the vertex points of all polylines in a DXF file. 
  693. PROGRAM TEST_DXFREAD;
  694.  
  695. USES DXFREAD;
  696.  
  697. var
  698.   entid:byte;
  699.   entname,layer : string;
  700.   x,y,z,begin_width,end_width,elev,thick : real;
  701.   mesh,mclosed,nclosed : boolean;
  702.   filename : string;
  703.   m,n:integer;
  704.  
  705. BEGIN
  706.   writeln('Enter name of input DXF file .');
  707.   readln(filename);
  708.   OPEN_DXF(filename);
  709.   repeat;
  710.     GET_ENT(entid,entname,layer);
  711.     if (entid=9) then
  712.     begin
  713.      
  714. GET_PLINE(mesh,mclosed,nclosed,m,n,begin_width,end_width,elev,thick);
  715.       if not mesh then
  716.       begin
  717.         writeln('Beginning polyline in layer ',layer);
  718.         repeat;
  719.           GET_ENT(entid,entname,layer);
  720.           if (entid=10) then
  721.           begin
  722.             GET_VERTEX(x,y,z,begin_width,end_width,elev,thick);
  723.             writeln(x,',',y,',',z);
  724.           end;
  725.         until entid=11;  {End of polyline}
  726.       end;
  727.     end;
  728.   until entid=0;
  729.   CLOSE_DXF;
  730. end.