bonacad 发表于 2022-7-6 17:25:11

请阻碍

如果插入(块)对象中有线条和文字。
 
如何检索该对象实体的列表?
 
我的意思是在块或插入对象中?

lpseifert 发表于 2022-7-6 17:46:41


(entget (car (nentsel)))

将为您提供块中实体的实体列表

bonacad 发表于 2022-7-6 17:53:46

是的,但我不想选择对象。
 
例如,我有:
 
如何检索块中所有实体名称的列表?

ASMI 发表于 2022-7-6 18:06:46

每个块参照包含相同的图元集。您需要从块表中提取块定义,并使用ENTNEXT函数查找所有嵌套实体:
 
(defun GetEntitiesList(Name / blLst cEnt oLst)
(if(setq blLst(tblsearch "BLOCK" Name))
   (progn
   (if(setq cEnt(cdr(assoc -2 blLst)))
(progn
(setq oLst(list cEnt))
(while(setq cEnt(entnext cEnt))
    (setq oLst(cons cEnt oLst))
    ); end while
); end progn
); end if
   ); end progn
   ); end if
oLst
); end of GetEntitiesList
 
用法示例:
 
Command: (GetEntitiesList "01-06-Adr_Isolator")
(<Entity name: 7efe2508> <Entity name: 7efe2500> <Entity name: 7efe24f8>
<Entity name: 7efe24f0> <Entity name: 7efe24e8> <Entity name: 7efe24e0> <Entity
name: 7efe24d8> <Entity name: 7efe24d0> <Entity name: 7efe24c8> <Entity name:
7efe24c0> <Entity name: 7efe24b8>)

bonacad 发表于 2022-7-6 18:21:06

完美的
非常感谢阿斯米。

bonacad 发表于 2022-7-6 18:26:54

我已经对我的需求做出了调整。
ename代替blkname表示arg。
函数只返回块中的文本实体。
 
4
命令:(setq my block(entlast))
 
函数调用(txtlstfromblk my block)
 
将(=text?“text”)替换为其他类型,可用于
正在检索其他实体类型。
 
---
页: [1]
查看完整版本: 请阻碍