Re: removing items from list
Perhaps these will help....
_GetLayers:
Code:
(defun _GetLayers (/ layerNames)
;; Example: (setq myLayerList (_GetLayers))
(vlax-for oLayer
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)))
(setq layerNames (cons (vla-get-name oLayer) layerNames)))
(vl-sort layerNames '<))
_GetLayers (alternative):
This adaptation supplies the sub-function with the ActiveDocument Object as an argument
Code:
(defun _GetLayers (acDoc / layerNames)
;; Example:
;; (setq myLayerList
;; (_GetLayers
;; (vla-get-activedocument (vlax-get-acad-object))))
(vlax-for oLayer (vla-get-layers acDoc)
(setq layerNames (cons (vla-get-name oLayer) layerNames)))
(vl-sort layerNames '<))
_RemItems:
Code:
(defun _RemItems (removeList sourceList / newList)
;; Example: (_RemItems '("B") '("A" "B" "C"))
(setq newList sourceList)
(foreach item removeList
(setq newList (vl-remove item newList)))
newList)
** Note - The sub-functions above require that (vl-load-com) be loaded prior to calling.
HTH
Re: removing items from list
You sir, are my hero for the day! Command is working perfectly!
Re: removing items from list
Quote:
Originally Posted by
mixted570595
You sir, are my hero for the day! Command is working perfectly!
That is kind of you to say; you're welcome. :beer:
Re: removing items from list
I've added _GetLayers (alternative) to my previous post.
Re: removing items from list
You could also simply have tested inside the while loop if the layer name matches to another list. E.g.
Code:
(setq lay (tblnext "LAYER" t))
(while lay
(if (not (member (setq lname (cdr (assoc 2 lay))) standard_layer_names))
(setq lay_lst (cons lname lay_lst)))
(setq lay (tblnext "LAYER")))