argh, help please?
how come (cdr (assoc 10 (entget s)))
doesn't work?
(defun c:rotatetextfrominsert (/ s en e)
(if (and (setq s (entsel "\nSelect any TEXT or MTEXT: "))
(wcmatch (setq en (cdr (assoc 0 (setq e (entget (car s))))))
"*TEXT"
)
)
(progn
(command "rotate" s (cdr (assoc 10 (entget s))) pause)
)
(prompt "\nObject is not a TEXT or MTEXT.")
)
(princ)
)
Thanks.
(setq s (entsel "\nSelect any TEXT or MTEXT: "))
This line uses
entsel to select your text entity. But
entsel doesn't just return the name of the selected entity; it returns a 2-item list (s) containing the entity name, and the coordinates of where it was selected.
(cdr (assoc 10 (entget s)))
In this, you're trying to feed
entget the whole 2-item list (s) that you got from the
entsel.
entget chokes when you try to feed it a list. That's why it doesn't work; you have to feed
entget just the entity name.
So, by adding an extra
car to the sequence, you specify that you only want to feed it the first element of list (s), which is the entity name.
(cdr (assoc 10 (entget (car s))))
You have the extra
car in line 3, where you're checking to see if the selected entity is text or mtext. You just left it out of line 8. Don't forget to add the extra right parentheses when you put it in there!