HI
I have a little quiestion.
Is there a possibility to influence the order?
I mean for example, take strictly the order of insert.
Difficult for me to explain.
For example I introduce 4 or 5 blocks, then i change the first ones and then i reorder them all. Somehow the last inserted one gets the now first one A-A.
It should be cool if it's possible to order them strictly by the order of insert.
(Defun ut:ordnen ( / opt start ss attVal_collection attval num str sstyp loop flt)
;; Fill The Gap Section Tag ;;
;; pBe Feb 2018 ;;
(setq *str* (cond ((not *str*) "A")
((numberp *str*)(itoa *str*))
(*str*)))
(while (not loop)
(setq opt (getstring (strcat "\nStartnummer/-buchstabe eingeben <" *str* ">: "))
opt (if (= opt "") *str* opt))
(cond ((= opt "0")(princ "\n0-Wert ist nicht erlaubt!"))
((< (atoi opt) 0)(princ "Keine negativen Werte erlaubt!"))
(T (setq loop 1)))
)
(setq start (cond ((and (= (atoi opt) 0)
(setq str (cond ((snvalid opt ) (strcase opt)) (*str*) ("A")))
(wcmatch str "[A-Z]")
)
(setq sym (list ascii chr))
str
)
((setq num (atoi opt))
(setq sym (list atoi itoa))
(itoa num)
)
)
)
(initget "Alle Wählen")
(setq sstyp (getkword "\nAuswahl Schnittbezeichnungen [Alle/ Wählen] <Alle>:")
flt "spi-schnitt,spi-schnitt-winkel,spi-schnitt-versetzt")
(if (and start
(setq attVal_collection nil
ss (if (= sstyp "Wählen")
(ssget (list '(-4 . "<OR")
'(-4 . "<AND") '(0 . "INSERT") (cons 2 flt) '(66 . 1)'(-4 . "AND>")
'(-4 . "OR>")))
(ssget "_X" (list '(-4 . "<OR")
'(-4 . "<AND") '(0 . "INSERT") (cons 2 flt) '(66 . 1) '(-4 . "AND>")
'(-4 . "OR>")))
)
)
)
(progn
(repeat (setq i (sslength ss))
(setq e (vlax-ename->vla-object (ssname ss (setq i (1- i)))))
(if
(and
(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 >>>" )
)
)
)
)
(setq *str* (cond (str) (num)))
(princ)
); end of defun
Kind regards