Message 1 of 1
Layer Filter with Status
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Everyone,
I have a question about how to add/create the status option inside the layer filter itself. In other words I would like for the filter to look like this "~*|*" but I would also like the box to the left called Status to be set to On. This way we only see the actual layers that we can work with and are actually being used. Any help would be great!
I am using this one right now but I cannot add the STATUS option.
;;;Reply From: kojacek
;;;Date: Mar/25/03 - 08:29 (GMT)
;;;
;;; Re: Named layer filter
;;;Hi Marcel
;;;It is possible, but I don't now how set it current via lisp.
;;;
;;; Function can define a named layer filter
;;; by Jacek (kojacek) kojacek@poczta.onet.pl (2000)
;;;
(defun dict:MlayerF (NAME FILTER / LayTbl ExtDict LayColl ExtDictData GrpList NewDict Temp XdLst
XrecData NewXRec)
(setq LayTbl (cdr (assoc 330 (entget (tblobjname "LAYER" "0")))))
(setq ExtDict (cdr (assoc 360 (entget LayTbl))))
(if
(not ExtDict)
(progn
(vl-load-com)
(setq LayColl (vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)
(setq ExtDict (vla-GetExtensionDictionary LayColl))
(setq ExtDict (vlax-vla-object->ename ExtDict))
)
)
(setq ExtDictData (entget ExtDict))
(while ExtDictData
(setq Temp
(if (= (caar ExtDictData) 3)
(list (cons (cdr (car ExtDictData))
(cdr (cadr ExtDictData))
)
)
)
ExtDictData (cdr ExtDictData)
)
(setq GrpList (append GrpList Temp))
)
(if
(or (not GrpList)
(not (cdr (assoc "ACAD_LAYERFILTERS" GrpList)))
)
(progn
(setq DictList (list (cons 0 "DICTIONARY")
(cons 100 "AcDbDictionary")
)
)
(setq NewDict (entmakex DictList))
(setq NewDict (dictadd ExtDict "ACAD_LAYERFILTERS" NewDict))
)
(setq NewDict (cdr (assoc "ACAD_LAYERFILTERS" GrpList)))
)
(setq ExtDictData Nil
Temp Nil
GrpList Nil
)
(setq ExtDictData (entget NewDict))
(while ExtDictData
(setq Temp
(if (= (caar ExtDictData) 3)
(list (cons (cdr (car ExtDictData))
(cdr (cadr ExtDictData))
)
)
)
ExtDictData (cdr ExtDictData)
)
(setq GrpList (append GrpList Temp))
)
(if
(or (not GrpList)
(not (cdr (assoc FILTER GrpList)))
)
(progn
(setq XdLst (list (cons 0 "XRECORD")
(cons 100 "AcDbXrecord")
)
)
(setq XrecData
(append XdLst
(list (cons 1 NAME)
(cons 1 FILTER)
(cons 1 "*") ;color
(cons 1 "*") ;linetype
(cons 70 0) ;on off
(cons 1 "*") ;lineweight
(cons 1 "*") ;plot style
)
)
)
(setq NewXRec (entmakex XRecData))
(dictadd NewDict Name NewXRec)
)
Nil
)
)
THANKS for you help!
dg
I have a question about how to add/create the status option inside the layer filter itself. In other words I would like for the filter to look like this "~*|*" but I would also like the box to the left called Status to be set to On. This way we only see the actual layers that we can work with and are actually being used. Any help would be great!
I am using this one right now but I cannot add the STATUS option.
;;;Reply From: kojacek
;;;Date: Mar/25/03 - 08:29 (GMT)
;;;
;;; Re: Named layer filter
;;;Hi Marcel
;;;It is possible, but I don't now how set it current via lisp.
;;;
;;; Function can define a named layer filter
;;; by Jacek (kojacek) kojacek@poczta.onet.pl (2000)
;;;
(defun dict:MlayerF (NAME FILTER / LayTbl ExtDict LayColl ExtDictData GrpList NewDict Temp XdLst
XrecData NewXRec)
(setq LayTbl (cdr (assoc 330 (entget (tblobjname "LAYER" "0")))))
(setq ExtDict (cdr (assoc 360 (entget LayTbl))))
(if
(not ExtDict)
(progn
(vl-load-com)
(setq LayColl (vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
)
(setq ExtDict (vla-GetExtensionDictionary LayColl))
(setq ExtDict (vlax-vla-object->ename ExtDict))
)
)
(setq ExtDictData (entget ExtDict))
(while ExtDictData
(setq Temp
(if (= (caar ExtDictData) 3)
(list (cons (cdr (car ExtDictData))
(cdr (cadr ExtDictData))
)
)
)
ExtDictData (cdr ExtDictData)
)
(setq GrpList (append GrpList Temp))
)
(if
(or (not GrpList)
(not (cdr (assoc "ACAD_LAYERFILTERS" GrpList)))
)
(progn
(setq DictList (list (cons 0 "DICTIONARY")
(cons 100 "AcDbDictionary")
)
)
(setq NewDict (entmakex DictList))
(setq NewDict (dictadd ExtDict "ACAD_LAYERFILTERS" NewDict))
)
(setq NewDict (cdr (assoc "ACAD_LAYERFILTERS" GrpList)))
)
(setq ExtDictData Nil
Temp Nil
GrpList Nil
)
(setq ExtDictData (entget NewDict))
(while ExtDictData
(setq Temp
(if (= (caar ExtDictData) 3)
(list (cons (cdr (car ExtDictData))
(cdr (cadr ExtDictData))
)
)
)
ExtDictData (cdr ExtDictData)
)
(setq GrpList (append GrpList Temp))
)
(if
(or (not GrpList)
(not (cdr (assoc FILTER GrpList)))
)
(progn
(setq XdLst (list (cons 0 "XRECORD")
(cons 100 "AcDbXrecord")
)
)
(setq XrecData
(append XdLst
(list (cons 1 NAME)
(cons 1 FILTER)
(cons 1 "*") ;color
(cons 1 "*") ;linetype
(cons 70 0) ;on off
(cons 1 "*") ;lineweight
(cons 1 "*") ;plot style
)
)
)
(setq NewXRec (entmakex XRecData))
(dictadd NewDict Name NewXRec)
)
Nil
)
)
THANKS for you help!
dg