Product(s): | MicroStation | ||
Version(s): | V8i / CONNECT Edition | ||
Environment: | N\A | ||
Area: | Dimensions | ||
Subarea: | General |
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:
324.477,278.3686,0
81.8949,242.823,0
.....
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.
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
xy=-324.477,278.3686,0
xy=-81.8949,242.823,0
....
....
Reset
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.
@D:/temp/coordinate.txt
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"