Function SyntaxPolyInfoCurrent Version1.3DownloadView HTML VersionDonateProgram DescriptionThis program provides the user with detailed information about every segment of a selected LWPolyline in the form of either an AutoCADTable (if available), Text file, or CSV file.Upon calling the program with the command syntax polyinfo at the AutoCAD command-line, the user is promptedto select an LWPolyline to be queried from the active drawing.
![]() ![]()
AutoLISP Solutions: Export point coordinates 1 Dec, 2002 By: Create a comma-delimited text file of polyline and point coordinates.Pedro Gerstberger e-mailed a request to export x,y,z points from either polylines or AutoCAD point entities. The AutoLISP solution plist.lsp lets you select lightweight polylines, 2D polylines, or point objects, then makes a comma-delimited text file suitable for opening in Microsoft Excel.plist.lsp lists the points grouped in this order: lightweight polylines, 2D polylines, and point objects.
Alternatively, the user may select to extract only those layers in the current working drawing by selecting the Current Drawing Only option. The user is additionally required to specify an output file to which the data is to be written; this may be a Text file, Comma-Separated Value(CSV) file, or eXtensible Markup Language (XML) file.
Figure 1 shows an AutoCAD drawing with an assortment of polyline types and some point entities. Figure 2 shows a Microsoft Excel worksheet that displays the x,y,z locationsFigure 1. AutoCAD drawing with polylines and points.of points selected from the drawing in Figure 1.I wrote an AutoLISP Solution more than two years ago (Cadalyst, July 2000) that extracted the vertex points from polylines. That program, vertext.lsp, was suitable for early versions of AutoCAD.
This month's solution is an update that includes polylines and point entities and uses the more modern approach of object-oriented programming with ActiveX objects, methods, and properties.How to use PLIST.LSPDownload from Cadalyst's CAD Tips site and save it in the AutoCAD support directory. From the AutoCAD tools menu, choose Load Applications, or enter Appload at the AutoCAD Command prompt. In the Load/Unload Applications dialog box, select the plist.lsp file from the support directory where you installed it, then click Close. After you load the program, AutoCAD prompts you to enter PTS to start.Figure 2. Plist.lsp makes a point list you can open in Microsoft Excel.The program first prompts you to select objects. If you don't include any polylines or points in your selection, the routine prompts you to try again.
When you select appropriate entities, you are asked to enter a filename using AutoCAD's regular File dialog box, as shown in figure 3. Plist.lsp creates a comma-delimited text file that you can open using Microsoft Excel.Activex benefitsThe program uses ActiveX methods (functions) and therefore works only in AutoCAD 2000 or later.
The beauty of using ActiveX objects, properties, and methods in plist.lsp is that you can obtain the x,y,z coordinates of many entities simply by asking for the property 'coordinates:'(VLAX-GET-PROPERTY OBJ'COORDINATES')Figure 3. The File dialog box appears when plist.lsp creates its comma-delimited output file.I used this function to return the coordinates of all vertex points of both types of polyline and also of the point objects.The vertex points of lightweight polylines contain only x and y coordinates. Those of 2D polylines and point entities contain all three x,y,z coordinates, as seen in figure 2.The main function, (vert), calls a (make-filter) function to filter the objects produced by the subsequent function (get-objects), which returns a list of ActiveX objects separated into the categories of lightweight polylines, 2D polylines, and point objects. The (make-list) function processes each of these three categories in turn to generate three separate lists of points.Arrayed of the darkBecause the lightweight polylines have only two coordinates per point (the x and y values), the arrays that contain them must be grouped in pairs instead of threes.
![]() Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |