7 June 2010

Listing the coordinates of Polygons/Closed polylines in AutoCAD MAP

In my last post, I discussed the process involved in exporting a listing of polygon positions through ArcGIS. So how could you export the same information using AutoCAD MAP?

Again, it's a fairly simple operation, the main trick being how to easily get the centre points of the polygons or closed polyline entities and this involves using the AutoCAD MAP Create Centroids command.

So, the first step is obviously to have your source data that you want to export the positions from. This could be an existing set of entities (with or without object data) or you can use the MAP->Import command to bring in a shp file of polygon objects and their associated object data. When you import the data in this way, you can also choose to convert all of the polygon entities to closed polylines.

Once the data is in AutoCAD, you can then use the Create Centroids command on either selected entities or on all closed objects within the drawing. This will create a point entity at the centre of each polygon that also contains the associated object data. Once the centroids have been created, save and close the drawing and start up a new drawing in which to run a Report Query in order to output the point data coordinates to a text file.

Select the MAP->Define query command and use the Drawings button to attach the drawing created above. Under the Query type, click the Location button and set the Boundary Type to All. Then click the Property button, select the Object Type radio button, make sure the Operator is set as '=' and click the Values button to choose the POINT object type. This will ensure that only the point objects representing the centres of the polygons will be included in the output.

Back in the Define Query dialog, set the Query Mode to Report and click the Options button to access the Report Options dialog. Click the Expression button, expand the Object Data folder to select the required Object Data field and click OK to return to the Report Options Dialog and click the Add button to add the expression to the Report Template list. Repeat the above steps for any other object data fields you want included in the listing. To include the Eastings and Northings in the Listing, again use the Expression button, but this time expand the 'Properties' folder and select X1. Press OK and then use the Add button to include it in the template. This gives the Eastings of the point objects so repeat the operation to select Y1 to add the Northings to the Listing.

Once the Report Template is set up as required, use the Browse button to define the output name and location for the listing and press OK to return to the main Define Query Dialog.
Finally, click the Execute Query button to generate the report. The data will be output as a comma delimited file that can be opened in Excel.

The entire process is illustrated in the video below:

No comments: