Dan46 发表于 2022-7-5 23:24:07

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 :-)

David Bethel 发表于 2022-7-5 23:41:59

Look into DIMZIN sysvarThere is a setting that drops the leading zerosMaybeMaybe not
-David

Dan46 发表于 2022-7-5 23:52:22

Thanks for your help but it look like DimZin is only about suppressing not adding zero.. Unless i missed something..

David Bethel 发表于 2022-7-6 00:03:29

What is your current DIMZIN setting ?

Dan46 发表于 2022-7-6 00:05:23

 
 
it's currently set to zero

eldon 发表于 2022-7-6 00:21:12

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.

Madruga_SP 发表于 2022-7-6 00:30:45

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]
查看完整版本: angtos function: from 101°2�