@C.Utzinger wrote:
....Yes, just A to Z, and 1 to max. 99.
I would be cool to have the posibility to switch between numbers an chars, from A to 1 or 1 to A.
Kind regards
(Defun c:FTGST ( / opt start ss attVal_collection attval)
;; Fill The Gap Section Tag ;;
;; pBe Feb 2018 ;;
(initget 1 "Letter Number")
(setq opt (getkword "\nChoose option [Letter/Number]: "))
(setq start
(cond
( (and (eq opt "Letter")
(setq str_T (strcase (getstring (strcat "\nEnter start Letter <" (cond (str) ("A")) ">: "))))
(setq str (cond ((snvalid str_T ) (strcase str_T)) (str) ("A")))
(wcmatch str "[A-Z]")
) (setq sym (list ascii chr))
str
)
( (eq opt "Number")
(setq num (cond ((getint (strcat "\nEnter start Number <" (itoa (setq num
(cond ( num ) ( 1 )))) ">: "
)
)
) ( num ) ))
(setq sym (list atoi itoa))
(itoa num)
)
)
)
(if (and
start
(setq attVal_collection nil
ss (ssget "_:L" '((0 . "INSERT")
(66 . 1)
(2 . "spi-schnitt,`*U*"))))
)
(progn
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
(if
(and
(eq "SPI-SCHNITT" (strcase (vla-get-effectivename e)))
(setq
attval (mapcar
(function
(lambda (at / num)
(list (vla-get-tagstring at)
(vla-get-textstring at)
at
)
)
)
(vlax-invoke e 'Getattributes)
)
)
(vl-every '(lambda (tag)
(member (Car tag) '("LINKS" "RECHTS"))) attval)
)
(setq attVal_collection
(cons
(list (cadar attval)
(mapcar 'last attval)
)
attVal_collection
)
)
)
)
(foreach itm (vl-sort attVal_collection '(lambda (a b) (< (car a) (car b))))
(cond
( (eq (Car itm) start) )
( (mapcar '(lambda (at)(vla-put-textstring at start)) (cadr itm)) )
)
(setq start (1+ ((car sym) start))
start ((cadr sym) start)
)
)
)
(princ (strcat "\n<<< "
(cond
( (null start) (setq str nil) "Invalid Input >>>" )
( (null ss) "Null Selection >>>" )
)
)
)
)
(princ)
)
Command: FTGST
Choose option [Letter/Number]: L
Enter start Letter <F>: a
Select objects: Specify opposite corner: 4 found
Select objects:
Command: FTGST
Choose option [Letter/Number]: N
Enter start Number <1>:
Select objects: Specify opposite corner: 4 found
Select objects:
HTH