Draw points, lines and texts of a polygonal from Excel to AutoCAD

I have this list of coordinates in Excel. In these there is an X coordinate, a Y coordinate, and also a name for the vertex. What I want is to draw it in AutoCAD. In this case we will use the execution of scripts from a concatenated text in Excel.

Concatenate a command for the insertion of points in AutoCAD

The table shown in the graph, as you can see, includes a column with the name of vertex, then UTM coordinates for columns X, Y.

The first thing we must do is to concatenate the coordinates as the AutoCAD command waits for them. For example, to draw a point we will occupy: POINT X coordinate, Y coordinate.

So, what we will do is insert a new column with this concatenated data, in the form:

POINT 374037.8,1580682.4
POINT 374032.23,1580716.25
POINT 374037.73,1580735.14
POINT 374044.98,1580772.49
POINT 374097.77,1580771.83
POINT 374116.27,1580769.13

To do this concatenation I have done the following:

  • I have called the cell D4 with the name POINT,
  • I have created with the concatenate function, a string that includes the cell POINT, then I have left a space using »«, then I have concatenated the cell B5 with a double-digit rounding, then to draw the comma I used «,», then I have concatenated the C5 cell. Then I copied for the rest of the rows.

Draw the points in Excel

I have copied the contents of column D to a text file.

To execute it, it is written in the SCRIPT command bar, then the Enter key. That raises the scout and I look for the file that I have called geofumadas.scr. Once selected, the open button is pressed.

And voila, there we have the vertices drawn.

In case the points are not visible, it is necessary to approach the complete set of objects. For this we write the command Zoom, enter, Extent, enter.

In case the points appear not very visible, the PTYPE command is executed, then the one indicated in the image is selected.

Concatenate the command in Excel and draw the polygon in AutoCAD

To draw the polygon will be the same logic. with the variant that we will occupy the PLINE command, then the concatenated coordinates and finally the CLOSE command.

PLINE
374037.8,1580682.4
374032.23,1580716.25
374037.73,1580735.14
...
374111.31,1580644.84
374094.32,1580645.98
374069.21,1580647.31
374048.83,1580655.01
CLOSE

We will call this script geofumadas2.scr, and when executing it we will have the trace of the drawing. I selected yellow color to notice the difference with the red vertices.

Concatenate the command in Excel and note the vertices in AutoCAD

Finally, we take note of the texts in the first column as annotations in each vertex. For this, we will chain the command in the following way:

TEXT JC 374037.8,1580682.4 3 0 1

This command represents:

  • The TEXT command,
  • The condition of the text, in this case justified, that's why the letter J,
  • The central point of the text, we chose Center, that's why the letter C
  • The concatenated coordinate X, Y,
  • Then the size of the text, we have chosen 3,
  • The angle of rotation, in this case 0,
  • Finally the text that we hope, that in the first row will be the number 1

Already propagated to the other cells, it will be as follows:

TEXT JC 374037.8,1580682.4 3 0 1
TEXT JC 374032.23,1580716.25 3 0 2
TEXT JC 374037.73,1580735.14 3 0 3
TEXT JC 374044.98,1580772.49 3 0 3A
TEXT JC 374097.77,1580771.83 3 0 4
TEXT JC 374116.27,1580769.13 3 0 5
TEXT JC 374127.23,1580779.64 3 0 6
...

I called the geofumadas3.cdr file

I have activated green color, to notice the difference. Once the script is executed, we have the text in the indicated size, right in the center of the coordinate.

Download the AutoCAD file used in this example.

The article shows how the template is constructed. If you occupy the template in Excel, already built to only feed data, You can buy it here.

One Reply to “Draw points, lines and texts of a polygon from Excel to AutoCAD”

  1. I need help
    I must draw hundreds of rectangles that represent mining concessions, they are rectangles with midpoint and x and y sides, I need help, I have the data in excel

Leave an answer

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.