<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: strange request: Switch all colors from bylayer to the same color in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889051#M106808</link>
    <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that you are visiting as a new member to the AutoCAD forum.&amp;nbsp;&lt;SPAN style="color: #808000;"&gt;Welcome to the Autodesk Community!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Have you checked in the &lt;A href="https://apps.autodesk.com/ACD/en/Detail/Index?id=66834035945224706&amp;amp;appLang=en&amp;amp;os=Win32_64" target="_blank"&gt;Autodesk App Store&lt;/A&gt;? It looks like there might be some tools to help with this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #808000;"&gt;Please select the &lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt; button if my post solves your issue or answers your question.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Mar 2018 21:13:49 GMT</pubDate>
    <dc:creator>john.vellek</dc:creator>
    <dc:date>2018-03-27T21:13:49Z</dc:date>
    <item>
      <title>strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889002#M106807</link>
      <description>&lt;P&gt;Okay, here's fairly strange request (as most people would like to do the opposite).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to grab a drawing and have every single line and polyline&amp;nbsp;switch their color from bylayer to the same color the layer&amp;nbsp;is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, Layer-01 is yellow, then the line would be set&amp;nbsp;to color yellow.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Currently, I isolate each layer individually, select all the lines, and switch them manually.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm kind of looking for a 1 click solution (bonus points if it switches all polylines with global width other than 0 to 0, and then put every layer on 0).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I imagine, I would need some type of Lisp routine, but I have never messed with anything&amp;nbsp;lisp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to export the CAD file, but bylayer shows as black (instead of the color of the layer).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 20:54:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889002#M106807</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-27T20:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889051#M106808</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see that you are visiting as a new member to the AutoCAD forum.&amp;nbsp;&lt;SPAN style="color: #808000;"&gt;Welcome to the Autodesk Community!&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Have you checked in the &lt;A href="https://apps.autodesk.com/ACD/en/Detail/Index?id=66834035945224706&amp;amp;appLang=en&amp;amp;os=Win32_64" target="_blank"&gt;Autodesk App Store&lt;/A&gt;? It looks like there might be some tools to help with this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="color: #808000;"&gt;Please select the &lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt; button if my post solves your issue or answers your question.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 21:13:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889051#M106808</guid>
      <dc:creator>john.vellek</dc:creator>
      <dc:date>2018-03-27T21:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889061#M106809</link>
      <description>&lt;P&gt;There must be something in the air....&amp;nbsp; &lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/change-all-objects-onto-a-new-layer-amp-keep-all-existing/m-p/7888135#M367030" target="_blank"&gt;This thread&lt;/A&gt; also started&amp;nbsp;today is pretty much the same request, except for also wanting linetypes.&amp;nbsp;&amp;nbsp;Follow the link in Post 2 there, and see what you think.&amp;nbsp; Its operation could easily be restricted to color only, if that's all you need.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 21:17:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889061#M106809</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-03-27T21:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889126#M106810</link>
      <description>&lt;P&gt;Wow, that actually worked pretty well...&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 21:52:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889126#M106810</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-27T21:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889203#M106811</link>
      <description>&lt;P&gt;I'm a little late to the party, but i have already spent&amp;nbsp;time writing the code, might aswell post it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:test ( / )

;select all lines and polylines in the entire drawing
(if (ssget "X" '((0 . "LWPOLYLINE,LINE")))

;loop all objects and set their color, to the color of the layer they are in
(vlax-for obj (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))
  (vla-put-color obj (vla-get-color (vla-item (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))) (vla-get-layer obj))))
  ;if the object is a polyline set its width to 0
  (if (equal (vlax-get-property obj 'ObjectName) "AcDbPolyline")
    (vla-put-constantwidth obj 0)
  )
)
(princ "No Lines and/or Polylines found in the drawing.")
)
(princ)
)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Mar 2018 22:55:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7889203#M106811</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2018-03-27T22:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7890887#M106812</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;doaiena, your works perfect&amp;nbsp;&amp;nbsp;too (plus it switches all the polylines gloval width's to zero... which is fantastic!!)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One last request, how could I add into the script so it erases the context of a particular layer... let's call it "Layer-X"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, I know I don't really need to export the content of "defpoint" and "area-calculation" layers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for all your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT- I just notice, it doesn't do anything on blocks. Could we also make the blocks to remain as blocks, but switch them to color of the layer?&lt;/P&gt;&lt;P&gt;I don't really need them to change their properties inside the block (if they are in layer 0 and "by layer" or a different color it won't matter after I export them).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 13:50:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7890887#M106812</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-28T13:50:45Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7890974#M106813</link>
      <description>&lt;P&gt;If i understand you correctly, you want to select lines and polylines from all layers,&amp;nbsp;&lt;STRONG&gt;except&lt;/STRONG&gt;&amp;nbsp;from&amp;nbsp;&lt;SPAN&gt;"defpoint"&amp;nbsp;and&amp;nbsp;"area-calculation". If that is the case just&amp;nbsp;substitute this:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;(ssget "X" '((0 . "LWPOLYLINE,LINE")))&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;with this:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;(ssget "X" '((0 . "LWPOLYLINE,LINE")
            (-4 . "&amp;lt;NOT")(-4 . "&amp;lt;OR")
                                     (8 . "defpoint")
                                     (8 . "area-calculation")
            (-4 . "OR&amp;gt;")(-4 . "NOT&amp;gt;")
            )
)&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;PS:&lt;BR /&gt;If you want to add blocks to the selection, just change&amp;nbsp;&lt;STRONG&gt;"LWPOLYLINE,LINE"&lt;/STRONG&gt; to&amp;nbsp;&lt;STRONG&gt;"LWPOLYLINE,LINE,INSERT"&lt;/STRONG&gt;.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:05:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7890974#M106813</guid>
      <dc:creator>doaiena</dc:creator>
      <dc:date>2018-03-28T14:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: strange request: Switch all colors from bylayer to the same color</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7891018#M106814</link>
      <description>&lt;P&gt;I actually want to "delete" the content of those two layers.&lt;/P&gt;&lt;P&gt;If I was doing it manually, I would un-freeze the layer, select all it's content, and then press delete and the purge the drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I Will add "&lt;STRONG&gt;INSERT&lt;/STRONG&gt;" and test it out... thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Mar 2018 14:12:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/strange-request-switch-all-colors-from-bylayer-to-the-same-color/m-p/7891018#M106814</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-03-28T14:12:26Z</dc:date>
    </item>
  </channel>
</rss>

