乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 89|回复: 5

[编程交流] Replace vl-sort with user sele

[复制链接]

6

主题

21

帖子

13

银币

初来乍到

Rank: 1

铜币
33
发表于 2022-7-6 06:20:01 | 显示全部楼层 |阅读模式
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:

[code](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

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 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 entity  instantaneously?
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 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:
 
  1. (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

32

主题

2722

帖子

2666

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
211
发表于 2022-7-6 07:01:25 | 显示全部楼层
 
You nailed it Alan
回复

使用道具 举报

54

主题

3755

帖子

3583

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
438
发表于 2022-7-6 07:17:35 | 显示全部楼层
 
Sweet. I'm still good for something.
回复

使用道具 举报

6

主题

21

帖子

13

银币

初来乍到

Rank: 1

铜币
33
发表于 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
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-10 18:40 , Processed in 0.356275 second(s), 64 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表