I have a issue id like to solve.
In my substr i want to replace 16 with with pos..
i dont know how to get around it and make it work..
thanks.
(defun c:001 () (setq plan "1"); (setq pos "2") (setq name (getvar "dwgname")) (setq pos2 (substr name 16 1))
;(setq pos2 (substr name pos 1)) <---- someone that could give me some help and explain why it wint work? (if (= plan pos2) (princ "This is true") (princ "This is false") );end of if statement );defun
Solved! Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
Solved by john.uhden. Go to Solution.
your pos variable must be an INTEGER not a STRING
(setq pos 2)
then for your father comparison must be plan an integer as well
(defun c:001 () (setq plan 1); (setq pos 2) (setq name (getvar "dwgname")) (setq pos2 (substr name 16 1)) ;(setq pos2 (substr name pos 1)) <---- someone that could give me some help and explain why it wint work? (if (= plan pos2) (princ "This is true") (princ "This is false") );end of if statement );defun
Read HERE about integers, real, strings... and conversions between them...
How can (= plan pos2) ever be true?
plan is an integer, but pos2 is a string.
John F. Uhden
@john.uhden wrote:
How can (= plan pos2) ever be true?
plan is an integer, but pos2 is a string.
Good point. Thx
@andreas7ZYXQ Then keep your plan a string.
Can't find what you're looking for? Ask the community or share your knowledge.