<?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 LISP to change specific colors only in XREF layers in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12546833#M18079</link>
    <description>&lt;P&gt;Hello, folks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone has some LISP that runs automatically after loading, with no user input or selection, and do "all-in-one" task to change colors "2", "7" OR/AND "255" of only XREF layers (of every XREF inserted into drawing) making the following changes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Color "2" -&amp;gt; Color "51"&lt;/P&gt;&lt;P&gt;Colors "7" and "255" -&amp;gt; Color "8"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And after that, it sets all XREFs layers to 80% transparency&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for any help!&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 15:17:07 GMT</pubDate>
    <dc:creator>lzedCB</dc:creator>
    <dc:date>2024-02-08T15:17:07Z</dc:date>
    <item>
      <title>LISP to change specific colors only in XREF layers</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12546833#M18079</link>
      <description>&lt;P&gt;Hello, folks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone has some LISP that runs automatically after loading, with no user input or selection, and do "all-in-one" task to change colors "2", "7" OR/AND "255" of only XREF layers (of every XREF inserted into drawing) making the following changes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Color "2" -&amp;gt; Color "51"&lt;/P&gt;&lt;P&gt;Colors "7" and "255" -&amp;gt; Color "8"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And after that, it sets all XREFs layers to 80% transparency&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot for any help!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 15:17:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12546833#M18079</guid>
      <dc:creator>lzedCB</dc:creator>
      <dc:date>2024-02-08T15:17:07Z</dc:date>
    </item>
    <item>
      <title>Re: LISP to change specific colors only in XREF layers</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12549957#M18080</link>
      <description>&lt;P&gt;If you look through the layers, need to find a "|" that is normally used in xref layers so if exist, the check color and change if necessary and set transparency.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a bit rough the transparency is buried a bit deep in the XDATA of a layer. Its a bit slow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;; thanks lee-mac
(defun LM:trans-&amp;gt;dxf ( x )
    (logior (fix (* 2.55 (- 100 x))) 33554432)
)

(defun c:layxx ( / lay layers)
(setq Layers (vla-get-layers (vla-get-activedocument (vlax-get-Acad-Object))))
(vlax-for lay Layers
(princ (setq lname (vlax-get lay 'name)))
(If (vl-string-search "|" lname)
(progn
(setq col (vlax-get lay 'color))
(cond
((= col 2)(vlax-put lay 'color 51))
((= col 7)(vlax-put lay 'color 8))
((= col 255)(vlax-put lay 'color 8))
)
(vl-cmdf "._-layer" "transparency" 80 lname "")
)
)
)
(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Will look into a entmod method using this idea.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(setq tr 80) ; transparency
(cons -3	    			;transparency
	    (list(list "accmtransparency"
		       (cons 1071 (LM:trans-&amp;gt;dxf tr))	) ) )
      )
    )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 04:27:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12549957#M18080</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-02-09T04:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: LISP to change specific colors only in XREF layers</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12550514#M18081</link>
      <description>&lt;P&gt;Sorry if I didn't myself clear enough: my intention is to do that "all-in-one task" in the drawing where the XREF is inserted, just making layer overrides and not inside the XREF itself. Tested your lisp and it worked great inside the XREF file.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 11:18:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12550514#M18081</guid>
      <dc:creator>lzedCB</dc:creator>
      <dc:date>2024-02-09T11:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: LISP to change specific colors only in XREF layers</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12551048#M18082</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;.... the transparency is buried a bit deep in the XDATA of a layer. ....&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;.... Will look into a entmod method using this idea.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;There's an easier way to deal with Transparency.&amp;nbsp; To &lt;EM&gt;read&lt;/EM&gt; a Layer's current setting:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;(getpropertyvalue (tblobjname "layer" "&lt;FONT color="#00CCFF"&gt;&lt;EM&gt;YourLayerName&lt;/EM&gt;&lt;/FONT&gt;") "Transparency")&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;[Somehow, if it's &lt;STRONG&gt;0&lt;/STRONG&gt; and has never been changed, that returns&lt;STRONG&gt; -1&lt;/STRONG&gt;.&amp;nbsp; If it has been changed, and is changed back to 0, it returns &lt;STRONG&gt;0&lt;/STRONG&gt;, but it can be set to &lt;STRONG&gt;-1&lt;/STRONG&gt; with the below approach and will also then show &lt;STRONG&gt;0&lt;/STRONG&gt; in the Layer Manager.]&lt;/P&gt;
&lt;P&gt;To &lt;EM&gt;assign&lt;/EM&gt; a value [here the OP's 80]:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;(setpropertyvalue (tblobjname "layer" "&lt;EM&gt;&lt;FONT color="#00CCFF"&gt;YourLayerName&lt;/FONT&gt;&lt;/EM&gt;") "Transparency" 80)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF6600"&gt;&lt;STRONG&gt;EDIT:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;So, something like this [untested]:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:XLA ; = Xref Layer Adjustments
  (/ laydata layname)
  (while (setq laydata (tblnext "layer" (not laydata)))
    (if (wcmatch (setq layname (cdr (assoc 2 laydata))) "*|*"); Xref-dependent?
      (progn ; then
        (cond
          ((= (cdr (assoc 62 laydata)) 2)
            (setpropertyvalue (tblobjname "layer" layname) "Color" "51")
          )
          ((member (cdr (assoc 62 laydata)) '(7 255))
            (setpropertyvalue (tblobjname "layer" layname) "Color" "8")
          )
        ); cond
        (setpropertyvalue (tblobjname "layer" layname) "Transparency" 80)
      ); progn
    ); if
  ); while
  (prin1)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 15:35:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12551048#M18082</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-02-09T15:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: LISP to change specific colors only in XREF layers</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12551905#M18083</link>
      <description>&lt;P&gt;This one just worked perfeclty and fast! Thanks a LOT for this mate. Thanks a Zillion!&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 01:55:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12551905#M18083</guid>
      <dc:creator>lzedCB</dc:creator>
      <dc:date>2024-02-10T01:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: LISP to change specific colors only in XREF layers</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12551906#M18084</link>
      <description>&lt;P&gt;Thanks Kent, the only issue I have is generally using Bricscad V20 and setproperty is not a function available, so have to do work arounds. Did crack the get Xdata but stopped as your solution is simpler.&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2024 01:02:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-change-specific-colors-only-in-xref-layers/m-p/12551906#M18084</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-02-10T01:02:44Z</dc:date>
    </item>
  </channel>
</rss>

