How to place a line using XYZ Coordinates using a Key-In Script

 Version(s):V8i / CONNECT Edition

How to place a line in a Design Model using XYZ coordinates contained within a Text file using a Key-In Script

Text file format:



A line can be placed manually in a Design Model, by first selecting the Place Line tool and then manually entering the XYZ coordinates of each vertex point. Alternatively, a long Key-In could be used such as:

Place Line;XY=324.477,278.3686,0;XY=81.8949,242.823,0;.............;Reset

Another approach may be to use the 'Import Coordinates' tool to place Points at each XYZ coordinate followed by the Place Line tool to join the Points.

However, these methods can be very tedious and time consuming as well as being prone to errors.

Steps to Accomplish

An alternative approach would be to copy and modify the Text file to include the required MicroStation Commands and then use a Key-In Script to place the Line in the Design Model.

To accomplish this first add a Line to the top of the file, containing the MicroStation Command to be run, in this Instance 'Place Line' but could be 'Place Curve' depending on required element type. Then at the end of the file add a line with 'Reset' to finish the selected command. Then in front of each XYZ coordinate add XY= for example:

Place Line

Tip: Use Microsoft Excel to modify / save the CSV file, its easier to add a column of XY= to each rows XYZ coordinate values. Plus, if required the 'X' 'Y' 'Z' columns can be reordered easily if required.

  1. Open the Design Model
  2. Set the Active Attributes as required (Level, Color, Weight ...)
  3. Open the 'Key-In' dialog (Drawing > Home > Primary > Key-In)
  4. Select the 'Top' View (The Coordinates in the text file being X,Y,Z in this example)
  5. Enter the following Key in:


Where D:/temp/coordinate.txt is the path and name of the file containing the coordinates. Note if there is a space character in the path use quotes for example @"D:/temp/import files/coordinate.txt"

See Also