Code Red > AutoLISP (Vanilla / Visual)
LM:SentenceCase Use in routine
jlogan02:
I'm going to whittle with it today and see what I come up with.
kdub_nz:
@jlogan02.
Fairly clean from here.
run (:LayerFilterList) to determine the current complete filter list.
determine if the newName exists (position) or (member) in list
if so ; finished
determine if the 0ldName exists (position) or (member) in list
if so ; proceed
run the .-layer filter command as previously.
have a beer.
Regards,
stay well
jlogan02:
Took a little stab before calling it a day.
Keeps getting a nil.
--- Code - Auto/Visual Lisp: ---(defun C:LayerFilterList (/ :SubFilterList oldName newName) ; su returns list of main filter and sub filters right behind (defun :SubFilterList (dict / ent lst) (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict)) (setq lst (append lst (cons ent (if (assoc 360 (entget ent)) (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent))))))))))))) lst) (mapcar '(lambda (x) (cdr (assoc 300 (entget x)))) (:SubFilterList (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))) "ACLYDICTIONARY")))) (setq oldName "Stations Standard Layer" newName "Stations Standard Layers" ) (if (member newName lst) (princ "Stations Standard Layers already exists.")) (if (member oldName lst) (progn (command "._-layer" "filter" "Rename" oldName newName "") ))
Happy Thanksgiving. Back at it Monday.
kdub_nz:
perhaps something like this
--- Code - Auto/Visual Lisp: ---;;===========================================================(defun c:NewDoIt (/ oldName newName currentFilterList) (setq oldName "Stations Standard Layer" newName "Stations Standard Layers" currentFilterList (:LayerFilterList) ) (if (vl-position newname currentFilterList) (princ (strcat "\n\t'" newName "' filter already exists.") ) ;; else (if (vl-position oldname currentFilterList) (progn (command "._-layer" "filter" "Rename" oldName newName "" ) (princ (strcat "\n\t'" oldName "' filter changed to '" newName "'." ) ) ) ;;else (princ (strcat "\n\t'" oldName "' filter does not exists.") ) ) ) (princ)) ;;===========================================================(defun :LayerFilterList (/ :SubFilterList) ; su returns list of main filter and sub filters right behind (defun :SubFilterList (dict / ent lst) (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict)) ( setq lst (append lst (cons ent (if (assoc 360 (entget ent)) (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent))))))))))))) lst) (mapcar '(lambda (x) (cdr (assoc 300 (entget x)))) (:SubFilterList (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))) "ACLYDICTIONARY"))));;===========================================================
Enjoy your holiday.
jlogan02:
kdub, that did the trick. Made some minor adjustments to messaging but other than that, all is good. Thanks for your help. Much appreciated.
Navigation
[0] Message Index
[*] Previous page
Go to full version