lsp error

lsp error

Anonymous
Not applicable
975 Views
3 Replies
Message 1 of 4

lsp error

Anonymous
Not applicable

hello, I made it, but does not working. what is the problem.

(defun c:ff (/ ss pe )
 (princ "text, mtext size:")
  (setq ss (ssget ":s" '((0 . "*TEXT"))))
  (setq pe (entget (ssname ss 0)))
  (setq pe (cdr (assoc 40 pe)))

(alert (strcat "\n" "dtext, mtext size " pe "\n  "))
(princ)
)

0 Likes
Accepted solutions (1)
976 Views
3 Replies
Replies (3)
Message 2 of 4

cadffm
Consultant
Consultant
Accepted solution

(defun c:ff (/ ss pe )
(princ "text, mtext size:")
(setq ss (ssget ":s" '((0 . "*TEXT"))))

; the next line of code you get an error message if you selected nothing: ; error: bad argument type: lselsetp nil

(setq pe (entget (ssname ss 0)))
(setq pe (cdr (assoc 40 pe)))

; the next line of code you get an error message because STRCAT want only STRINGS, but the value of dxf-code 40 is a REAL, not a STRING: ; error: bad argument type: stringp nil

(alert (strcat "\n" "dtext, mtext size " pe "\n "))
(princ)
)

;;;

 

(defun c:ff (/ ss pe )
(princ "text, mtext size:")
(if (setq ss (ssget ":s" '((0 . "*TEXT"))))
    (progn

       (setq pe (entget (ssname ss 0)))
       (setq pe (cdr (assoc 40 pe)))

       (alert (strcat "\n" "dtext, mtext size " (rtos pe 2) "\n "))

    )

)
(princ)
)

 

I could edit more thing, but for the start it should be enough.

Read about IF PROGN and RTOS in your Help[F1]

 

 

Sebastian

0 Likes
Message 3 of 4

Shneuph
Collaborator
Collaborator

; error: bad argument type: stringp 0.2

 

You are passing pe of data of type real and lisp is expecting a string.  Use:

(alert (strcat "\n" "dtext, mtext size " (rtos pe) "\n "))

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
0 Likes
Message 4 of 4

Anonymous
Not applicable

thank you...

0 Likes