Author Topic: LM:SentenceCase Use in routine  (Read 4895 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: LM:SentenceCase Use in routine
« Reply #15 on: November 22, 2022, 05:04:48 PM »
For Properties Filter :
consecutive changes => ok

I'll have a look at the Groups . .

Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: LM:SentenceCase Use in routine
« Reply #16 on: November 22, 2022, 05:25:17 PM »
@jlogan02,
You're correct.
The Group filters can be changed from the 'Rename' in the Layer Properties Manager,
and from the command Line manually,
but NOT using the function

I'll have a better look tonight.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: LM:SentenceCase Use in routine
« Reply #17 on: November 22, 2022, 05:40:50 PM »
Looks like the Group data is kept somewhere else than theDictionary attached to the Table !!


added:
Unless the report from MgdDbg snoop is incomplete ??
« Last Edit: November 22, 2022, 05:50:04 PM by kdub »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

jlogan02

  • Bull Frog
  • Posts: 327
Re: LM:SentenceCase Use in routine
« Reply #18 on: November 22, 2022, 06:52:55 PM »
ACLYDICTIONARY ???

Code - Auto/Visual Lisp: [Select]
  1. (defun :LayerFilterList (/ :SubFilterList)
  2.  
  3.   ; su returns list of main filter and sub filters right behind
  4.   (defun :SubFilterList (dict / ent lst)
  5.     (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict))
  6.       (setq lst (append lst
  7.                         (cons ent (if (assoc 360 (entget ent))
  8.                                     (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent)))))))))))))
  9.     lst)
  10.  
  11.   (mapcar '(lambda (x) (cdr (assoc 300 (entget x))))
  12.           (:SubFilterList (dictsearch
  13.                             (vlax-vla-object->ename
  14.                               (vla-getextensiondictionary
  15.                                 (vla-get-layers
  16.                                   (vla-get-activedocument
  17.                                     (vlax-get-acad-object)))))
  18.                             "ACLYDICTIONARY"))))

This returns the list of Property and Group filters.

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/layer-filter-existence-test/m-p/7910315#M367448
« Last Edit: November 22, 2022, 07:13:51 PM by jlogan02 »
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: LM:SentenceCase Use in routine
« Reply #19 on: November 22, 2022, 11:23:18 PM »
Cool, That looks like it will return names of Properties, Groups and nested Filters.

Could solve most of your issues :)

I learnt something 'cause I've not played with these before.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

jlogan02

  • Bull Frog
  • Posts: 327
Re: LM:SentenceCase Use in routine
« Reply #20 on: November 23, 2022, 10:50:53 AM »
I'm going to whittle with it today and see what I come up with.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: LM:SentenceCase Use in routine
« Reply #21 on: November 23, 2022, 12:37:49 PM »
@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
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

jlogan02

  • Bull Frog
  • Posts: 327
Re: LM:SentenceCase Use in routine
« Reply #22 on: November 23, 2022, 06:25:53 PM »
Took a little stab before calling it a day.

Keeps getting a nil.

Code - Auto/Visual Lisp: [Select]
  1. (defun C:LayerFilterList (/ :SubFilterList oldName newName)
  2.  
  3.   ; su returns list of main filter and sub filters right behind
  4.   (defun :SubFilterList (dict / ent lst)
  5.     (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict))
  6.       (setq lst (append lst
  7.                         (cons ent (if (assoc 360 (entget ent))
  8.                                     (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent)))))))))))))
  9.     lst)
  10.  
  11.   (mapcar '(lambda (x) (cdr (assoc 300 (entget x))))
  12.           (:SubFilterList (dictsearch
  13.                             (vlax-vla-object->ename
  14.                               (vla-getextensiondictionary
  15.                                 (vla-get-layers
  16.                                   (vla-get-activedocument
  17.                                     (vlax-get-acad-object)))))
  18.                             "ACLYDICTIONARY"))))
  19.  
  20.  
  21.   (setq oldName "Stations Standard Layer"
  22.         newName "Stations Standard Layers"
  23.   )
  24.  
  25. (if (member newName lst)
  26.   (princ "Stations Standard Layers already exists.")
  27. )
  28.  
  29. (if (member oldName lst)
  30.   (progn
  31.    (command "._-layer" "filter" "Rename" oldName newName "")
  32.   )
  33. )
  34.  
  35.  

Happy Thanksgiving. Back at it Monday.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2121
  • class keyThumper<T>:ILazy<T>
Re: LM:SentenceCase Use in routine
« Reply #23 on: November 23, 2022, 07:43:48 PM »
perhaps something like this

Code - Auto/Visual Lisp: [Select]
  1. ;;===========================================================
  2. (defun c:NewDoIt (/ oldName newName currentFilterList)
  3.   (setq oldName           "Stations Standard Layer"
  4.         newName           "Stations Standard Layers"
  5.         currentFilterList (:LayerFilterList)
  6.   )
  7.   (if (vl-position newname currentFilterList)
  8.     (princ
  9.       (strcat "\n\t'" newName "' filter already exists.")
  10.     )
  11.     ;; else
  12.     (if (vl-position oldname currentFilterList)
  13.       (progn (command "._-layer"  "filter"    "Rename"
  14.                       oldName     newName     ""
  15.                      )
  16.              (princ (strcat "\n\t'"
  17.                             oldName
  18.                             "' filter changed to '"
  19.                             newName
  20.                             "'."
  21.                            )
  22.              )
  23.       )
  24.       ;;else
  25.       (princ
  26.         (strcat "\n\t'" oldName "' filter does not exists.")
  27.       )
  28.     )
  29.   )
  30.   (princ)
  31. )
  32.  
  33.  
  34.  
  35. ;;===========================================================
  36. (defun :LayerFilterList (/ :SubFilterList)
  37.  
  38.   ; su returns list of main filter and sub filters right behind
  39.   (defun :SubFilterList (dict / ent lst)
  40.   (foreach ent (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 350)) dict))
  41.   ( setq lst (append lst
  42.                 (cons ent (if (assoc 360 (entget ent))
  43.                             (:SubFilterList (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget ent)))))))))))))
  44.   lst)
  45.  
  46.   (mapcar '(lambda (x) (cdr (assoc 300 (entget x))))
  47.     (:SubFilterList (dictsearch
  48.                     (vlax-vla-object->ename
  49.                       (vla-getextensiondictionary
  50.                         (vla-get-layers
  51.                           (vla-get-activedocument
  52.                             (vlax-get-acad-object)))))
  53.                     "ACLYDICTIONARY"))))
  54. ;;===========================================================
  55.  

Enjoy your holiday.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

jlogan02

  • Bull Frog
  • Posts: 327
Re: LM:SentenceCase Use in routine
« Reply #24 on: November 29, 2022, 05:06:02 PM »
kdub, that did the trick. Made some minor adjustments to messaging but other than that, all is good. Thanks for your help. Much appreciated.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10