@Anonymous wrote:
I really appreciate the help, after modifying the routine, it works well in that aspect of skipping the first input if there is no valid value and the second, all right ...
now I just need it, and I just saw it now, what I need is the part of:
(defun C:CT_5 ( / sc p r pt1 pt2 y1 yy)
(setvar "cmdecho" 0)
(setvar "DIMZIN" 0)
(setvar "ATTREQ" 1)
(setvar "ATTDIA" 0)
(COMMAND "LAYER" "m" "A-00-COTA_NIV" "T"
"A-00-COTA_NIV" "S" "A-00-COTA_NIV" ""
)
(setq sc (getreal "\nscala ? "))
(setq P (getint "\ndecimal ? "))
(setq a "T")
(setq r 0)
(while
(progn
(and
(setq pt1 (getpoint "\npoint (NA) ? : "))
;;(setq aa (atof (rtos y1 2 p))) ;<-- y1 does not exist yet hence the error
(setq y1 (cadr pt1)) ;<- this will happen only if pt1 is valid
(setq yy (strcat (if (minusp y1) "" "+") ;<--at this point you can assign the value to yy
(rtos y1 2 P) " (NA)"))
)
(and (setq pt2 (getpoint "\npoint (NO) ? : "))
;;(setq aa1 (atof (rtos y2 2 p))) ;<-- y2 does not exist yet hence the error
(setq y2 (cadr pt2)) ;<- this will happen only if pt2 is valid
(setq yy1 (strcat (if (minusp y2) "" "+") ;<--at this point you can assign the value to yy1
(rtos y2 2 P) " (NO)"))
)
(or pt1 pt2)
)
(cond
((and pt1 pt2) )
( pt1 (setq yy1 " ") )
( pt2 (setq yy " " pt1 pt2) )
)
(command "insert" "nivel_corte_na+no" pt1 sc "" r yy yy1)
)
(command "insert" "nivel_corte_na+no" pause sc "" r "" "")
(princ)
)
minusp < -- Verifies that a number is negative | equivalent to your test of (< aa 0) and (< aa1 0)
HTH