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

Lisp needed for alphabetizing text

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
7895 Views, 4 Replies

Lisp needed for alphabetizing text

Hi All,

I've looked around several places for a LISP that will alphabetize existing text.

I cant seem to find what I need. I am looking for a routine where I can manually select text in a given order to get the outcome of AA,AB,AC,AD, or BA,BB,BC., etc.

 

I've attached a drawing to better explain what I am looking for.

 

I do not know how to write LISP routines, but I know alittle to be able to modify an existing one.

If anyone know of anything like this, I'd love to see it.

 

Thanks in advance!

knj777

 

4 REPLIES 4
Message 2 of 5
stevor
in reply to: Anonymous

1. The basics: http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/Incrementing-pick-points-alphabetical... Kent1Cooper Re: Incrementing pick points alphabetically 08-08-2013 12:19 PM 2. Some extensive methods: http://lee-mac.com/columnreference.html#num2col
S
Message 3 of 5
Kent1Cooper
in reply to: Anonymous


@Anonymous wrote:

.... I am looking for a routine where I can manually select text in a given order to get the outcome of AA,AB,AC,AD, or BA,BB,BC., etc.

.... 


There are things out there, but finding the right one may be a challenge.  Some generate new Text that increments in one way or another, and some let you pick existing Text and modifies it incrementally.  Some are limited to numerical Text, and some will do Alphabetic.  Some do work with pairs of letters similar to yours.  I haven't tried it out, but maybe this can do what you need, or you can adjust it.  Or, this looks promising.

Kent Cooper, AIA
Message 4 of 5
phanaem
in reply to: Anonymous


@Anonymous wrote:

I do not know how to write LISP routines, but I know alittle to be able to modify an existing one.

If anyone know of anything like this, I'd love to see it.


Try this one. Is an old routine modified for your particular case.

It still need some error trap (for entering more than one letter as prefix or suffix etc)

(defun c:ttt ( / e prefix start)
  (setvar 'errno 0)
  (if
    (and
      (setq prefix (getstring "\nPrefix: "))
      (<= 65 (ascii prefix) 90)
      (setq start (getstring "\Start char: "))
      (<= 65 (ascii start) 90)
    )
     (while
       (or
         (setq e (car (entsel)))
         (= (getvar 'errno) 7)
       )
        (if e
          (if
            (eq (cdr (assoc 0 (setq e (entget e)))) "TEXT")
             (progn
               (entmod (append e (list (cons 1 (strcat "%%U" prefix start)))))
               (setq start (chr (1+ (ascii start))))
             )
             (princ "\nNot text. Try again.")
          )
          (progn
            (princ "\nNothing selected. Try again.")
            (setvar 'errno 0)
          )
        )
     )
  )
  (princ)
)

 

Message 5 of 5
Anonymous
in reply to: phanaem

Wow everyone...Thanks! I tested a a few so far and it looks like exactly what I need!

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

Post to forums  

Autodesk Design & Make Report

”Boost