(defun c:test (/ entis numb n ssnm en)
(setq entis (ssget '((0 . "*TEXT"))))
(if entis
(progn
(setq numb 0)
(setq n 0)
(while
(setq ssnm (ssname entis numb))
(setq en (entget ssnm))
(entmod (subst (cons 1 (itoa (setq n (1+ n)))); <<- I want numbers to be shown as in the previous image
(assoc 1 en) en))
(setq numb (1+ numb))
)
)
)
)
Well, as long as you aren't using AutoCAD 2011 you could use acad_strlsort .. or perhaps vl-sort ...What's wrong with acad_strlsort in 2011?
Well, as long as you aren't using AutoCAD 2011 you could use acad_strlsort .. or perhaps vl-sort ...What's wrong with acad_strlsort in 2011?
Well, as long as you aren't using AutoCAD 2011 you could use acad_strlsort .. or perhaps vl-sort ...What's wrong with acad_strlsort in 2011?
Unless they have fixed it in a service pack, the first drawing you use acad_strlsort in AC11 it works as expected, when you open a second drawing and use it, an error is generated that says "incorrect number of arguments".
The steps to reproduce are:
Open AutoCAD 2011
Ensure SDI is set to 1
At the command prompt type:Code - Lisp: [Select]
(acad_strlsort (list "d" "a" "b" "C"))
The return value is ("a" "b" "C" "d")
Now open a second drawing in the same session:
At the command prompt type:Code - Lisp: [Select]
(acad_strlsort (list "d" "a" "b" "C"))
The return value is: Error: incorrect number of arguments.
This issue has been escalated as a bug at Autodesk so they can resolve it .. hopefully they did .. don't use AC2k11 so I don't know.
Worked just fine for me (MEP 2011)