本帖最后由 kucha007 于 2023-4-23 09:52 编辑
- ;根据图层名称拆分选择集SS
- (defun K:SSplit4Lay (SS / EntLst en Tmp LayLst Lay LayEnts)
- (defun LM:ss->ent (SS / i Lst)
- (if SS
- (repeat (setq i (sslength SS))
- (setq Lst (cons (ssname SS (setq i (1- i))) Lst))
- )
- )
- );将选择集转换为实体列表 by Lee Mac
- (setq EntLst (LM:ss->ent SS))
- (foreach en EntLst
- (setq Tmp (cdr (assoc 8 (entget en))))
- (if (not (member Tmp LayLst))
- (setq LayLst (cons Tmp LayLst))
- )
- );获取选择集包含的图层名称
- (foreach Lay LayLst
- (setq Tmp '())
- (foreach en EntLst
- (if (eq (strcase Lay) (strcase (cdr (assoc 8 (entget en)))))
- (setq Tmp (cons en Tmp))
- )
- )
- (setq LayEnts (cons (cons Lay Tmp) LayEnts))
- )
- (reverse LayEnts)
- )
大概是这种感觉:
- (K:SSplit4Lay SS) => (("Lay1" en1 en2 ... en_i) ("Lay2" en4 en5 en6 ...en_j)....)
复制代码
|