Home > Downloads > Draw a polygon with bearings and distances from Excel to Microstation

Draw a polygon with bearings and distances from Excel to Microstation

clip_image001

A few years ago I published an article showing how to concatenate data in Excel to construct a polygon with AutoCAD, without having to do all the protocol:

@ Distance <angle….

The other day we were in the AutoCAD course someone asked me if that could be done with the Microstation command line. The answer is YES, you just have to understand that Microstation KEYIN is not the same as the AutoCAD’s command line. Let’s see how can be built, by the way we learn little things few used in this program:

The table on the right is an example of a polygon based on bearings and distances.

With Microstation you can draw this as I explained before, with the obvious disadvantage, and the same as AutoCAD, that is tedious to be writing one by one: the possibility to fail and even not reset the previous bearing.

Well, the concatenate process is just the same as I explained with AutoCAD; you just have to understand something that differs from Microstation.

The keyin was not built in function to make commands’ line of text, but for orders call with objects orientation, so it only supports 56 characters. It additionally requires to use a semicolon (;) to separate orders because unlike AutoCAD that comes from a Basic programming logic, this has a Clipper’s logic with what Microstation has been done beyond when it was still called Ustation.clip_image003

Given this, the easiest way is to call commands from a text file with @ command which I find very few know but that is the procedure that has always used Microstation to process orders in batches. Even the points’ import from a txt list is an mdl that does this.

Using the Excel spreadsheet I previously worked to teach to convert coordinates distances and bearings; I will show how it should be concatenated with Microstation:

Concatenate the points.

What ultimately interests us is that final Key in will be:

place point ;xy=374037.736,1580735.145;

Place point is the point command, including the space, the semicolon is to indicate another order, the xy = is the order to input coordinates and the two coordinates blue and green are the known points. In the end, it must be put a new semicolon to indicate enter or switch to new command.

So then, assuming that the cells of my interest are U7 and V7 to concatenate it would be:

=CONCATENATE(“place point ;”,”xy=”,U7,”,”,V7,”;”)

clip_image004

In this way, I just copy the content of the AA column in a file txt; I’m going to call puntosgeofumadas2.txt. I suggest that must be placed directly in C so that the path is not so difficult.

In this case I’m placing it in my documents, the path would be: C: Users User Documents puntosgeofumadas2.txt

to run it, activate the window’s command-line (key in), this is done from Utilities > key in and then input the command:

@C:UsersUserDocumentspuntosgeofumadas2.txt

We do enter, and there are the points drawn in order. It should have a thick line width for display.

clip_image005

Concatenate lines.

For this, the operation is similar, the command line we must run is place line additionally we deal to indicate that the line has an origin and a destination point.

place line ;xy=374032.234,1580716.255;xy=374037.736,1580735.145;

=CONCATENATE(“place line ;”,”xy=”,U6,”,”,V6,”;”,”xy=”,U7,”,”,V7,”;”)

Copy and paste the txt file, store and re-run

@ C: Users User Documents puntosgeofumadas2.txt

And there you have it:

clip_image006

And an additional advantage is that building the bearings and distances box requires doing Copy in Excel and paste in Microstation. With the Paste Special you can choose between being an image, an embedded or linked spreadsheet

clip_image007

To complete the article, here I am uploading the file in Excel for example, in which should only be changed the origin point, bearings and distances and the template can be useful for any iguana with more than half a pound of ribs. It’s also here the .txt as an example.

2 comments

  1. Thanks for the article. It was quite helpful.

    I am only having one problem. The maximum number of line commands I can copy and paste is seven. I get the same results with your supplied .txt file. No more than seven place point commands can be pasted at a time. Do you have any idea as to why?

    • eg!

      Yes. The keyin is limited do a deffined number of characters.

      But you can do it as a script as is explained in the post:

      You can paste all the command content to a txt file, called as example allpoints.txt then you call it from the key in in this way: If you store it directly in the C: disc

      Type in the key in

      @c:\allpoints.txt

      and so, you will do it.

Leave a Reply

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