Replace vl-sort with user sele
Below is attribute-numbering code from ASMI and modified by Fixo and pBe. Attached is the link to the original post, if anyone is interested: http://www.cadtutor.net/forum/showthread.php?20103-Sequential-numbering-a-single-attribute-value-in-multiple-attribute-block/page4The code automatically numbers attributes in dynamic blocks. I am trying unsuccessfully to modify the code so that the numbering follows the user pick order, instead of automatic numbering based on the block's position on the drawing.
It looks like the blocks are sorted and placed in a list (sLst). I am trying to eliminate the sorting portion of the code so the attributes enter the list in the pick order. If I remove the vl-sort code and associated parentheses, the program bombs.
Thank you for any help or suggestions.
Ray
Excerpt from the lisp program:
(setq sLst (mapcar 'vlax-ename->vla-object (mapcar 'car (vl-sort (vl-sort (mapcar '(lambda(x)(list x(cdr(assoc 10 (entget x))))) (vl-remove-if 'listp (mapcar 'cadr(ssnamex blSet)))) '(lambda(a b)(vla-object (mapcar 'car (vl-sort (vl-sort (mapcar '(lambda(x)(list x(cdr(assoc 10 (entget x))))) (vl-remove-if 'listp (mapcar 'cadr(ssnamex blSet)))) '(lambda(a b)( Do you want to modify this in a way that when you select the attribute the value is assigned to the selected attribute entityinstantaneously? If I've read the excerpt correctly, you should be able to replace it with the following bit of code:
(setq sLst ((lambda (ss / i l) (if (eq (type ss) 'PICKSET) (repeat (setq i (sslength ss)) (setq l (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) l)) ) ) ) blSet ))
You nailed it Alan
Sweet. I'm still good for something.
pBe,Instantaneous would be good, but I agree that Alan "nailed it."
Thank you for the help.Someday I hope to understand the lisp programming to the level of you guys.
Ray
页:
[1]