Author Topic: List layername & entity's layername that is in/or has overridden with magenta  (Read 2444 times)

0 Members and 1 Guest are viewing this topic.

tive29

  • Guest
part of my job involves checking if any layername & entity is in/or has overridden with magenta colour
Short of eyeballing the whole drawing visually & missing out some obsecure entity, is there a LISP or LISPs that can do it faster :
1) list out the layer name that is in magenta colour
2) list out the layer name of the entity that is override with magenta colour
3) (if possible) a way to isolate or zoom in to those entity that is in magenta colour or entity override with magenta colour

ronjonp

  • Needs a day job
  • Posts: 7526
Paste this into the command line: (sssetfirst nil (ssget "_x" '((62 . 6))))  It will highlight all objects that have a magenta color by object setting.
I'm not sure about your layer question?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
The following will select all objects in the current space which are displaying a colour of magenta:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:magenta ( / l x )
  2.     (while (setq x (tblnext "layer" (not x)))
  3.         (if (= 6 (abs (cdr (assoc 62 x))))
  4.             (setq l (vl-list* "," (cdr (assoc 2 x)) l))
  5.         )
  6.     )
  7.     (sssetfirst nil
  8.         (ssget "_X"
  9.             (append
  10.                 (if l
  11.                     (list
  12.                        '(-4 . "<OR")
  13.                            '(62 . 6)
  14.                            '(-4 . "<AND")
  15.                            '(62 . 256)
  16.                             (cons 8 (apply 'strcat (cdr l)))
  17.                            '(-4 . "AND>")
  18.                        '(-4 . "OR>")
  19.                     )
  20.                    '((62 . 6))
  21.                 )
  22.                 (if (= 1 (getvar 'cvport))
  23.                     (list (cons 410 (getvar 'ctab)))
  24.                    '((410 . "Model"))
  25.                 )
  26.             )
  27.         )
  28.     )
  29.     (princ)
  30. )

tive29

  • Guest
Hello Lee Mac Thank you for the lisp. I forgot to mention that these entities are mainly in blocks & nested blocks hence i need to visually spot them out. If you could see a way to this that that will be fantastic.

That said, this LISP will be very useful in another of my project.
« Last Edit: March 27, 2017, 09:29:08 PM by tive29 »

ronjonp

  • Needs a day job
  • Posts: 7526
Next question. What do you do once you spot these items out ?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tive29

  • Guest
Next question. What do you do once you spot these items out ?

Visually, I can determine which to change to another colour through override & which to remain as magenta.

If it makes it clearer, all I really need the LISP to do is to isolate only magenta colour regardless of entity type. I can manually zoom in to the colour myself
« Last Edit: March 27, 2017, 11:04:30 PM by tive29 »

ronjonp

  • Needs a day job
  • Posts: 7526
Maybe this will help you see the items:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ ad ll transp)
  2.   ;; Transparency from 0 - 90
  3.   (setq transp 75)
  4.   ;; Compile list of layers that are color 6
  5.     (if   (= 6 (vla-get-color x))
  6.       (setq ll (cons (vla-get-name x) ll))
  7.     )
  8.   )
  9.     (vlax-for y   x
  10.       (vl-catch-all-apply
  11.    'vla-put-entitytransparency
  12.    (list y
  13.          (if (or (vl-position (vla-get-layer y) ll) (= 6 (vla-get-color y)))
  14.       0
  15.       transp
  16.          )
  17.    )
  18.       )
  19.     )
  20.   )
  21.   (princ)
  22. )
  23. ;; Put all transparency back to 0
  24. (defun c:unfoo nil
  25.     (vlax-for y x (vl-catch-all-apply 'vla-put-entitytransparency (list y 0)))
  26.   )
  27.   (princ)
  28. )
« Last Edit: March 28, 2017, 11:53:10 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tive29

  • Guest
ronjonp, I tested it lightly at home & I really like what you did. Will do more heavy testing during office hours on the affected project.
A couple of questions.
- How do i  get back to a normal view?
- How do i lower the transparency even more?

Thanks
« Last Edit: March 28, 2017, 12:40:16 PM by tive29 »

ronjonp

  • Needs a day job
  • Posts: 7526
I updated the code above. The most you can set transparency to is 90 AFAIK.
If you really want to only see the magenta items, the visibility property could be toggled :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tive29

  • Guest
I updated the code above. The most you can set transparency to is 90 AFAIK.
If you really want to only see the magenta items, the visibility property could be toggled :)

Thanks ronjonp for the update

There were some issues I encounter.
- unfoo did not revert the view
- All text attributes that is not magenta did not go transparent.
- dimension and/or dimension text override with magenta became faded (which should not since it is magenta)
- mtext format override with magenta became faded (which should not since it is magenta)
- please add colour 2 (yellow) as well
« Last Edit: March 28, 2017, 09:19:13 PM by tive29 »

ronjonp

  • Needs a day job
  • Posts: 7526
I updated the code above. The most you can set transparency to is 90 AFAIK.
If you really want to only see the magenta items, the visibility property could be toggled :)

Thanks ronjonp for the update

There were some issues I encounter.
- unfoo did not revert the view
- All text attributes that is not magenta did not go transparent.
- dimension and/or dimension text override with magenta became faded (which should not since it is magenta)
- mtext format override with magenta became faded (which should not since it is magenta)
- please add colour 2 (yellow) as well
The 'unfoo' above should work now. As far as the other shortcomings, the base code was offered as more of an idea than a full solution.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tive29

  • Guest
I updated the code above. The most you can set transparency to is 90 AFAIK.
If you really want to only see the magenta items, the visibility property could be toggled :)

Thanks ronjonp for the update

There were some issues I encounter.
- unfoo did not revert the view
- All text attributes that is not magenta did not go transparent.
- dimension and/or dimension text override with magenta became faded (which should not since it is magenta)
- mtext format override with magenta became faded (which should not since it is magenta)
- please add colour 2 (yellow) as well
The 'unfoo' above should work now. As far as the other shortcomings, the base code was offered as more of an idea than a full solution.

No worries about the other short comings. You have been a huge help.

But regardin the unfoo, it still does not work I have this error

Command: foo

Initializing...

Command:
Command: unfoo
; error: too many arguments

Command:

If you could resolve this that would be good.  Thanks

ronjonp

  • Needs a day job
  • Posts: 7526
Try now .. my bad.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

tive29

  • Guest
Nice ronjonp. Very very nice. :smitten: