• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

search not working

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,

I have a problem with this simple code:
Code:
 (defun c:ps (/ str txt1 ed1 pos1 pos2 ang1)

        (setq str nil)

        (while (= str nil)
            (setq str (nentsel "\nseleziona la stringa "))
        );;while

    (princ "\nstr xxxxxxx ")
    (princ str)
    (princ "\n")

        (setq ed1 (entget (car str)))
    (setq txt1 (cdr (assoc 1 ed1)))   ;; 10:00:00    8.25°    129.88°

    (princ "\ntxt1 xxxxxxx ")
    (princ txt1)
    (princ "\n")

        (setq pos1 (vl-string-search "°" txt1 1))

    (princ "\npos1 xxxxxxx ")
    (princ pos1)
    (princ "\n")
    
    );;defun
the "°" character is not found in the txt1 string (10:00 am 8.25° 129.88°), if I insert the string instead of the variable, pos1 assumes the right value 13, otherwise nil"

Thank you.
 
Thanks, so it works!
How would you write, the same command that seeks the next "°"?

(setq pos1 (vl-position 176 (vl-string->list txt1)))
(setq pos2 (vl-position 176 (vl-string->list txt1 (pos1 + 1))))

The first line works, the second one gives me error.

Thank you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
ciao
Back
Top