souvik Posted March 21, 2014 Posted March 21, 2014 Hi all, Is there any way to annotate a point with both X and Y as well as Lat long value? The drawing is in UTM coordinate Zone 45 and WGS 84 datum. Quote
BIGAL Posted March 22, 2014 Posted March 22, 2014 The lable x,y is easy there is lots of examples posted here also http://www.Lee-mac.com re Lat long you need a lisp or .net version to convert x,y to Lat/Long then lable, you may also be able to flip to Lat Long units read point value as you have CIV3d not sure what a (getpoint) returns will test. Read a post a few minutes ago about getting into properties and using the values. Quote
ymg3 Posted March 23, 2014 Posted March 23, 2014 souvik, Although I believe you could access the Lat Long in Civil3d, being on Vanilla I use the following projlib.lsp by David Allison. ymg Quote
souvik Posted March 23, 2014 Author Posted March 23, 2014 My problem is not the XY, But the Lat Long in DMS format. Actually I am stuck with two problems. One is the Lat Long annotation and the another is batch cross section creation with custom drafting in civil 3D. Quote
ymg3 Posted March 23, 2014 Posted March 23, 2014 (edited) souvik, Not sure I am following you. Is it only a matter to format the lat long in dms, or you need to transform the x y to lat and long ? Here for formatting, put together very fast so check: ; angtodms by ymg ; ; Given an angle in radian and number of decimal after the seconds ; ; Returns a string formatted in Degree Minutes and Seconds, ; ; with proper symblol for degree and leading 0 on the minutes and seconds ; ; 0°00'00.0" 271°05'06.3" etc. ; (defun angtodms (a prec /) (setq a (angtos a 1 (+ prec 4))) (while (< (vl-string-position (ascii "d") a) 3) (setq a (strcat " " a)) ) (if (< (vl-string-position (ascii "'") a) 6) (setq a (strcat (substr a 1 4) "0" (substr a 5))) ) (if (< (vl-string-position (ascii "\"") a) (+ 9 (if (= 0 prec) 0 (1+ prec)))) (setq a (strcat (substr a 1 7) "0" (substr a )) ) (vl-string-subst "°" "d" a) ) (defun dtr (a) (* pi (/ a 180.0))) ;; lltodms ; ;; ; ;; Arguments: ll, A list (lat lon) in decimal degree ; ;; prec, Number of decimals on the second ; ;; Returns: A string "S 24°34'08.2042\" - E 52°22'11.5320\"" ; ;; ; ;; Example: (lltodms '(-24.5689456 52.36987) 4) ; ;; Needs subroutine angtodms and dtr ; (defun lltodms (ll prec /) (setq lat (angtodms (abs (dtr (car ll))) prec) lon (angtodms (abs (dtr (cadr ll))) prec) ) (if (minusp (car ll)) (setq lat (strcat "S" lat)) (setq lat (strcat "N" lat)) ) (if (minusp (car ll)) (setq lon (strcat "W" lon)) (setq lon (strcat "E" lon)) ) (strcat lat " - " lon) ) ymg Edited March 23, 2014 by ymg3 Quote
ymg3 Posted March 24, 2014 Posted March 24, 2014 (edited) Here, I've changed the format to conform with Google Earth and parameters lat and lon are now separate instead of a list. You supply latitude and longitude in Decimal Degrees. You also supply an integer specifying the number of decimals after the seconds. ;;****************************************************************************; ;; lltodms by ymg ; ;; ; ;; Arguments: lat Latitude in decimal degree ; ;; lon Longitude in decimal degree ; ;; prec Number of decimals on the second ; ;; Returns: A string with lat and long in deg min sec ; ;; ; ;; Example: (lltodms -24.5689456 -52.369875 4) ; ;; Result : " 24°34'08.2042\"S - 52°22'11.5500\"W" ; ;;****************************************************************************; (defun lltodms (lat lon prec) ; Degree to radians routine ; (defun dtr (a) (* pi (/ a 180.0))) ; angtodms by ymg ; ; Given an angle in radian and number of decimal after the seconds ; ; Returns a string formatted in Degree Minutes and Seconds, ; ; with proper symblol for degree and leading 0 on the minutes and seconds ; ; 0°00'00.0" 271°05'06.3" etc. ; (defun angtodms (a prec) (setq a (angtos a 1 (+ prec 4))) (while (< (vl-string-position (ascii "d") a) 3) (setq a (strcat " " a)) ) (if (< (vl-string-position (ascii "'") a) 6) (setq a (strcat (substr a 1 4) "0" (substr a 5))) ) (if (< (vl-string-position (ascii "\"") a) (+ 9 (if (= 0 prec) 0 (1+ prec)))) (setq a (strcat (substr a 1 7) "0" (substr a )) ) (vl-string-subst "°" "d" a) ) ;-------------------------------------------------------------------------; (strcat (strcat (angtodms (abs (dtr lat)) prec)(if (minusp lat) "S" "N")) " - " (strcat (angtodms (abs (dtr lon)) prec)(if (minusp lon) "W" "E")) ) ) ymg Edited March 24, 2014 by ymg3 Quote
souvik Posted March 24, 2014 Author Posted March 24, 2014 Thanks Mr. YMG3 for your kind help. I have managed another process. I have extracted the coordinates of the points to a xls file. Then convert the UTM XY points to Lat long and import the lat long value as text at the cad. It solves my purpose. Thank you sir for your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.