Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

select textsize lisp

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
nychoe1
853 Views, 2 Replies

select textsize lisp

hello, 

I'm writing a Lisp, and going to ask for help.
I do not know which part is wrong
 

(defun c:tt (/ ss textsi1 textsi2)
  (prompt "\nselect textsize")
  (setq textsi1 (getreal "\ninput textsize"))
  (setq textsi2 (getreal "\ninput textsize"))
  (setq ss (ssget '((-4 . "<and")
  (0 "text,mtext")
  (-4 "<") (40 textsi1)
  (-4 ">") (40 textsi2)
  (-4 . "and>"))
  ))
(sssetfirst nil ss)
(princ)
) ;defun

2 REPLIES 2
Message 2 of 3
ВeekeeCZ
in reply to: nychoe1

Guess you want to select texts outside specified range? Or if not, adjust conditions as required.

 

(defun c:SelectTextBySize (/ ss textsi1 textsi2)

  (if (and (setq textsi1 (getreal "\nMinimum textsize: "))
	   (setq textsi2 (getreal "\nMaximum textsize: "))
	   (setq ss (ssget (list '(0 . "text,mtext")
				 '(-4 . "<or")
				 '(-4 . "<") (cons 40 textsi1)
				 '(-4 . ">") (cons 40 textsi2)
				 '(-4 . "or>"))))
	   )
    (sssetfirst nil ss))
  (princ)
  )

The issue is the list building. Once you use a variable, you need to use (list) or (cons) to evaluate the variables. Constants as strings and integers could be just quoted (the black ones).

And be careful, there are many doted pairs needed.

 

Message 3 of 3
nychoe1
in reply to: ВeekeeCZ

thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta