Hi
I have been hunting arround to find a way to read a survey file as per attached and output a polyline. It contains the start coordinate in x,y format then a list of distances and bearings in 4<120d35'34' format. I thought it would be easy, I would write some code but am flat out. For us 0d is north.
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
@richie_hodgson wrote:
Hi
I have been hunting arround to find a way to read a survey file as per attached and output a polyline. It contains the start coordinate in x,y format then a list of distances and bearings in 4<120d35'34' format. I thought it would be easy, I would write some code but am flat out. For us 0d is north.
It is easy. tell me, do you have any other info to add like layers?
Save the information as a .scr file.
Add "Pline" as the first line.
Add "@" in front of each line (you can use find and replace function in MS Word, replace ^pwith ^p@
Then use SCRIPT command to load and run above scr file.
Then you can rotate, mirror and do whatever to make 0d as north direction.
pline
25,25
@10<45d00'00"
@20<90d00'00"
@50<120d00'45"
@3wood wrote:
Save the information as a .scr file.
Add "Pline" as the first line.
Add "@" in front of each line (you can use find and replace function in MS Word, replace ^pwith ^p@
Then use SCRIPT command to load and run above scr file....
And then, there's that approach
Good one 3wood 🙂
@richie_hodgson wrote:
Nope I can deal with layers later
I see, you can try 3woods suggestion for scripts.
Holler if you still need a lisp routine approach.
@richie_hodgson wrote:
... I have been hunting arround to find a way to read a survey file as per attached and output a polyline. It contains the start coordinate in x,y format then a list of distances and bearings in 4<120d35'34' format. ...
Not very hard.... Here's a way to do it that doesn't require editing the text file, or making a different file type out of it, so you can use such files directly as received [minimally tested on only your sample file]:
(setq fil (open "C:/Your/File/Path/Survey File.txt" "r"))
(command "_.pline" (read-line fil)); first line = start point
(while (setq lin (read-line fil)) (command (strcat "@" lin))); subsequent bearings
(command ""); end Polyline
(close fil)
Hi Kent the previous post didn't apear to work, I have had a tinker to do the same thing with a coordinate file as per attached, it currently doesnt seem to work, its probably an easy fix, can you help.
@richie_hodgson wrote:
... I have had a tinker to do the same thing with a coordinate file as per attached, it currently doesnt seem to work....
Try something like this [untested] -- simpler because the first line isn't a different kind of input from the remaining lines:
(setq fil (open "C:/Your/File/Path/Survey File.txt" "r"))
(command "_.pline"); start Polyline
(while (setq lin (read-line fil)) (command lin)); feed in coordinates
(command ""); end Polyline
(close fil)