rayg11757 发表于 2022-7-6 06:20:01

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/page4
 
The 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)(

pBe 发表于 2022-7-6 06:39:52

Do you want to modify this in a way that when you select the attribute the value is assigned to the selected attribute entityinstantaneously?

alanjt 发表于 2022-7-6 06:51:34

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          ))

pBe 发表于 2022-7-6 07:01:25

 
You nailed it Alan

alanjt 发表于 2022-7-6 07:17:35

 
Sweet. I'm still good for something.

rayg11757 发表于 2022-7-6 07:26:44

 
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]
查看完整版本: Replace vl-sort with user sele