明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3621|回复: 12

[讨论] [求助]如何用LISP取得群组名称

  [复制链接]
发表于 2010-9-5 16:53:00 | 显示全部楼层 |阅读模式

請問各位高手,

點選圖面物件取得群組名稱的LISP該如何寫?

发表于 2010-9-5 22:03:00 | 显示全部楼层

(entget(car(entsel)))

不知是不是你要的

 楼主| 发表于 2010-9-5 23:02:00 | 显示全部楼层
psufngah发表于2010-9-5 22:03:00(entget(car(entsel))) 不知是不是你要的

感謝樓上的回覆問題,

我已找到答案, 如下:

 

(dxf 3 (entget (dxf 330 (entget (dxf 330 (entget (car (entsel))))))))

发表于 2010-9-6 06:16:00 | 显示全部楼层
pizg发表于2010-9-5 23:02:00感謝樓上的回覆問題, 我已找到答案, 如下:   (dxf 3 (entget (dxf 330 (entget (dxf 330 (entget (car (entsel))))))))

选择对象: ; 错误: no function definition: DXF

请问楼上的好象不是在dwg里找。是吗?

请指教

谢谢

 楼主| 发表于 2010-9-6 12:10:00 | 显示全部楼层
461045462发表于2010-9-6 6:16:00选择对象: ; 错误: no function definition: DXF 请问楼上的好象不是在dwg里找。是吗? 请指教 谢谢

Dxf 為自訂函數, 如下:

 

(Defun Dxf(code ent)

   (cdr (assoc code ent))

)

发表于 2010-9-6 14:00:00 | 显示全部楼层

试了一下,一个组为AA,另一个组为BB,执行结果都是“AA”,为何没有“BB”?

 

发表于 2010-9-6 15:58:00 | 显示全部楼层
不记得是修改的谁的程序了.
  1. ;不记得是修改的谁的程序了.(if (setq EntName (car (entsel "\n选择组: ")))    (progn      (setq EntList (entget EntName))      (if (= (cdr (assoc 102 EntList)) "{ACAD_REACTORS")        (progn          (setq Group (cdr (assoc 330 EntList)))          (setq EntList (entget Group))          (setq Dictionary (cdr (assoc 330 EntList)))          (setq EntList (entget Dictionary))          (setq Previous "")          (foreach Item EntList            (setq Item (cdr Item))            (if (equal Item Group)              (setq GroupName Previous)            );if            (setq Previous Item)          );foreach                    (princ (strcat "\n组名为 " GroupName " ."))        );progn        (princ "\n选择的物体不是组中的成员.")      );if    );progn    (princ "\n没有选中物体.")  )
 楼主| 发表于 2010-9-6 16:31:00 | 显示全部楼层

感謝7樓的高手回覆問題,

您的做法才是正確的.

 楼主| 发表于 2010-9-6 17:06:00 | 显示全部楼层
发表于 2010-9-6 19:01:00 | 显示全部楼层
谢谢!学习学习。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-10-2 10:32 , Processed in 0.183039 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表