angtos function: from 101°2
Does anyone have an idea how to add a zero to a single digit min or second return?Like my title said i get 101°2'4" and need 101°02'04"
Any clue is welcome :-) Look into DIMZIN sysvarThere is a setting that drops the leading zerosMaybeMaybe not
-David Thanks for your help but it look like DimZin is only about suppressing not adding zero.. Unless i missed something.. What is your current DIMZIN setting ?
it's currently set to zero I am not sure that you can get a display as you want. AutoCAD writers do not appear to have any surveying knowledge, but merely mathematical know-how where leading zeroes for degrees, minutes and seconds are not important
Maybe you will have to do it manually, unless some kind lisp guru can provide the necessary. Hi Dan46
Try this function from ymg.
; 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) )
Thank you ymg
页:
[1]