rajrehman 发表于 2022-7-6 07:42:05

LISP, Bad Argument Type

I have problem to lsp programme run the programe autocad give ; error: bad argument type: numberp: nil error please help me
here is my programme
 
        (DEFUN C:nallano()
       (COMMAND "LAYER" "m" "nalano""c" "w""" "m" "cbarea""c" "r" """m" "boundary""c" "y" """")
        (SETQ NANO(GETSTRING"\nENTER NALLA NUMBER :"))
       (setq cbno(getreal"enter catch basin no :"))
      (while(SETQ PT (GETPOINT"SELECT THE POINT FOR CALCULATING AREA OF BOUNDARY :"))
      (COMMAND "LAYER" "S" "boundary" "")
 
      (command"boundary" PT "")
      (setq ENTl (entget (entlast)))
      (command "area" "Object" "last")
      (setq plotarea (getvar "area" ))
;       (princ plotarea)(getreal"....")
;      (command"erase" "last" "" )
       ;(COMMAND"DDATTE" PAUSE)
       (WRITETEXT plotarea pt)
       (setq chno (+ 1 chno))
       )
)               
 
(defun writetext(plotarea pt)
 
      (SETQ MAXLV(GETSTRING"\ENTER THE Maximum High Level :"))
      (SETQ NALVL(GETSTRING"\ENTER THE Nala Invert Level :"))
 
       (setq orgpt pt)
       (setq wrtpt(list (car orgpt)(+(cadr orgpt)2)))
       (setq wrtpt1(list (car orgpt)(+(cadr orgpt)4)))
       (command"insert" "nalano" pt "" "" "0"   SHNO surno hno (rtos chno 2 0) (rtos plotarea 2 3))
       ;(COMMAND "LAYER" "S" "chaltano" "")
       ;(command"text" "Ml" ORGPT 1 0(rtos chno 1 0))
 
      ; (COMMAND "LAYER" "S" "hissa-number" "")
      ; (command"text" "MC" WRTPT 1 0hno)
 
;       (COMMAND "LAYER" "S" "charea" "")
;       (command"text" "MC" WRTPT1 2 0(rtos plotarea 2 3))
)

SLW210 发表于 2022-7-6 08:34:03

Please Read the CODE POSTING GUIDELINES and edit your post!
 
Please create new threads and not add posts to unrelated topics.

MSasu 发表于 2022-7-6 09:11:20

You should check this line - the value for first 4 variables (in red) that you attempt to pass as attributes are evaluated to nil:

(command "insert" "nalano" pt "" "" "0" SHNO surno hno (rtos chno 2 0) (rtos plotarea 2 3))Also this line would generate an error since the variable isn't initialized:

(setq chno (+ 1 chno))
页: [1]
查看完整版本: LISP, Bad Argument Type