Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
Okay the following code below works perfect but I also want to be able to enter the letter A for line below to ajust the surface value. How can I do that?
(setq Z (getreal (strcat "\nSpecify the Z elevation [Adjust surface "(rtos SD 2 1)"] <"(rtos $Z 2 1)">: ")))
(defun c:XX () (setq PT# (getint "\nSpecify point number: ")) (setq SD (getreal "\nSpecify surface difference: ")) (setq Z (getreal "\nSpecify the Z elevation: ")) (if (= Z nil) (setq Z $Z)) (setq $Z Z) (setq PT (getpoint "\nSelect point: ")) (while PT (if (/= PT nil)(prnt2cad)) (setq Z (getreal (strcat "\nSpecify the Z elevation [Adjust surface "(rtos SD 2 1)"] <"(rtos $Z 2 1)">: "))) (if (= Z nil) (setq Z $Z)) (setq $Z Z) (setq PT (getpoint "\nSelect point: ")) ) ; end while ) ; end xx (defun prnt2cad () (setq TS (getvar "textsize")) (setq TPT (list (car PT) (+ (cadr PT) (* TS 5.0)) (last PT))) (command "TEXT" "J" "M" TPT "" "" PT#) (command "TEXT" "" (strcat "Z=" (rtos Z 2 1))) (command "TEXT" "" (strcat "A=" (rtos SD 2 1))) )
@smaher12 wrote:Okay the following code below works perfect but I also want to be able to enter the letter A for line below to ajust the surface value. How can I do that?
(setq Z (getreal (strcat "\nSpecify the Z elevation [Adjust surface "(rtos SD 2 1)"] <"(rtos $Z 2 1)">: ")))
....
This is a job for (initget) and its keyword option.
(initget "Adjust")
(setq Z (getreal (strcat "\nSpecify the Z elevation or [Adjust surface "(rtos SD 2 1)"] <"(rtos $Z 2 1)">: ")))
Then the (getreal) function will accept the typing of an A [or an a, or you can spell out more of the word Adjust], and the value set into Z will be the word "Adjust".
(if (= Z "Adjust")
(....do whatever....)
....