马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Delete LayerFilters using LISP (non-ActiveX) by Fenton Webb
So maybe you want to write an AutoLISP function (not ActiveX) to delete layerFilters.
With ActiveX (vla-xxx) functions, you can obtain the ACADLAYERS_DICTIONARY dictionary by calling
(vla-getextensiondictionary <layerscollection>)
but how can we access ACAD_LAYERFILTERS and delete the layerfilters, using just plain old AutoLISP?
Here’s how…- (defun C:DelLyrFlt ( / tbl lyr xlist xrec filt)
- (setq tbl (tblnext "LAYER" T)
- lyr (tblobjname "LAYER" (cdr(assoc 2 tbl)))
- ) ;setq
- ;;Find the"ACAD_LAYERFILTERS" xrecord in the extension dictionary of the layer
- (setq xlist (dictsearch
- (cdr (assoc 360 (entget (cdr (assoc 330 (entget lyr))))))
- "ACAD_LAYERFILTERS")
- ) ;setq
- (if xlist
- (progn
- ;;Get the first layer_filter
- (setq xrec (cdr (assoc -1 xlist))
- filt (dictnext xrec t)
- ) ;setq
- ;;Remove each layer_filter
- (while filt
- (dictremove xrec (cdr (assoc 1 filt)))
- (setq filt (dictnext xrec t))
- ) ;while
- ;;Find the"ACAD_LAYERFILTERS" xrecord
- (dictremove
- (cdr (assoc 360 (entget (cdr (assoc 330 (entget lyr))))))
- "ACAD_LAYERFILTERS"
- )
- ) ;progn
- ) ;if
- (princ)
- )
|