Author Topic: Filter By a Layer Color  (Read 423 times)

0 Members and 1 Guest are viewing this topic.

MSTG007

  • Water Moccasin
  • Posts: 2397
  • I can't remeber what I already asked! I need help!
Filter By a Layer Color
« on: July 26, 2019, 07:57:22 AM »
I am trying to figure out a way to select all the Color "8"'s in a drawing and then Change them to Color "47".

Just received new plotters and color 8 does not plot right for our pen styles in our department. (I know, we could change the CTB file but it is used company wide).

So to print, we need color 8 to be changed before we plot.

Any ideas? lol. Don't you love brain storming in the morning!

Thanks for your ideas.
Autodesk Infrastructure Design Suite 2019

CAB

  • Global Moderator
  • Seagull
  • Posts: 10365
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MSTG007

  • Water Moccasin
  • Posts: 2397
  • I can't remeber what I already asked! I need help!
Re: Filter By a Layer Color
« Reply #2 on: July 26, 2019, 08:03:31 AM »
thanks CAB,

I start looking into these.

Question is, I wonder if I should create a custom button that will execute the command before it plots.
Autodesk Infrastructure Design Suite 2019

Master_Shake

  • Swamp Rat
  • Posts: 1447
Re: Filter By a Layer Color
« Reply #3 on: July 26, 2019, 08:27:40 AM »
You might want to use a network stored style file, update it once and everyone has the new version.

Also I do not know how your color 8 is setup but I would check to see what is causing the issue and look for a remedy rather than the band-aid. From a standards perspective it'll be a nightmare getting everyone to change their plotting style just for this issue.

MSTG007

  • Water Moccasin
  • Posts: 2397
  • I can't remeber what I already asked! I need help!
Re: Filter By a Layer Color
« Reply #4 on: July 26, 2019, 08:34:54 AM »
My understanding is we no longer use a plotter "in a sense". Its a large format ink printer. So our Color 8 looks the same as our Color 9.
Autodesk Infrastructure Design Suite 2019

ronjonp

  • Needs a day job
  • Posts: 7027
Re: Filter By a Layer Color
« Reply #5 on: July 26, 2019, 09:15:11 AM »
Code - Auto/Visual Lisp: [Select]
  1. (defun c:foo (/ d)
  2.   (vlax-for x (vla-get-layers d) (and (= 8 (vla-get-color x)) (vla-put-color x 47)))
  3.     (vlax-for b a (and (= 8 (vla-get-color b)) (vl-catch-all-apply 'vla-put-color (list b 47))))
  4.   )
  5.   (princ)
  6. )
« Last Edit: July 26, 2019, 03:24:28 PM by ronjonp »

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

MSTG007

  • Water Moccasin
  • Posts: 2397
  • I can't remeber what I already asked! I need help!
Re: Filter By a Layer Color
« Reply #6 on: July 26, 2019, 10:32:08 AM »
Thank you Ron for this guide!
Autodesk Infrastructure Design Suite 2019

Lee Mac

  • Seagull
  • Posts: 12267
  • London, England
Re: Filter By a Layer Color
« Reply #7 on: July 26, 2019, 12:19:11 PM »
@Ron: Re this line:

Code - Auto/Visual Lisp: [Select]
  1. (vlax-for b a (and (= 8 (vla-get-color b)) (vl-catch-all-apply 'vla-put-color (list b 256))))

Changing an object's colour property from colour 8 to ByLayer could potentially alter the resulting display colour if the object resides on a layer whose layer colour is not colour 8 - I would advise that objects with an overridden colour property should have such property changed to the new colour (that is, unless you were to test whether the colour of the layer on which the object is assigned is equal to the colour override).

ronjonp

  • Needs a day job
  • Posts: 7027
Re: Filter By a Layer Color
« Reply #8 on: July 26, 2019, 03:23:38 PM »
@Ron: Re this line:

Code - Auto/Visual Lisp: [Select]
  1. (vlax-for b a (and (= 8 (vla-get-color b)) (vl-catch-all-apply 'vla-put-color (list b 256))))

Changing an object's colour property from colour 8 to ByLayer could potentially alter the resulting display colour if the object resides on a layer whose layer colour is not colour 8 - I would advise that objects with an overridden colour property should have such property changed to the new colour (that is, unless you were to test whether the colour of the layer on which the object is assigned is equal to the colour override).

Agreed .. that should have been setting the color to 47. Will update above *cheers*!

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

BIGAL

  • Bull Frog
  • Posts: 318
  • 30 + years of using Autocad
Re: Filter By a Layer Color
« Reply #9 on: August 01, 2019, 12:47:24 AM »
Forget the code make a copy of your ctb edit it call it your plotter name, you can set pen 8 to any of the 256 colors, we had various ctb's depending on where it was being plotted. Just click on the color.
A man who never made a mistake never made anything