<?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: Lisp to turn on and off - Working drawing layers and black line in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8256032#M100008</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;brouchure&amp;nbsp;layer /black line layer starts with "B" and Working drawing layer starts with "W"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to show only working drawing layer when i type "WD" and Brouchure layer to show up when type "BD".&amp;nbsp; ….&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Try something like these, using the wildcard &lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt; to get all Layers starting with the letter that precedes it, in both the On and Off options:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:WD ()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (command "_.layer"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_thaw" "0" "_set" "0" ;;; assuming that can be on in any case&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_on" "W&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" "_off" "B&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" ""&lt;/P&gt;
&lt;P&gt;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (princ)&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:BD ()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (command "_.layer"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_thaw" "0" "_set" "0" ;;; assuming that can be on in any case&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_on" "B&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" "_off" "W&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" ""&lt;/P&gt;
&lt;P&gt;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (princ)&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to have one of the W... Layers set current in the WD command, rather than Layer 0, there would need to be either:&lt;/P&gt;
&lt;P&gt;1) a way of giving it a Layer name starting with W that you know will always be in the drawing, or;&lt;/P&gt;
&lt;P&gt;2) more complex code, to &lt;EM&gt;find&lt;/EM&gt;&amp;nbsp; such a Layer name [certainly possible].&lt;/P&gt;
&lt;P&gt;And likewise with a B... Layer in the BD command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They thaw Layer 0 before setting it current, in case it may be frozen at the time [in which case it would not be able to be made current]. &amp;nbsp;They don't deal with&amp;nbsp;whatever you may want to do, if anything, with any additional Layers that may exist starting with other characters.&lt;/P&gt;</description>
    <pubDate>Mon, 10 Sep 2018 02:58:07 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2018-09-10T02:58:07Z</dc:date>
    <item>
      <title>Lisp to turn on and off - Working drawing layers and black line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8253803#M100003</link>
      <description>&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;I am new to lisp think. i want to create&amp;nbsp; lisp and use to turn on and turn off Construction drawing layers&amp;nbsp;&amp;nbsp;verse to black line layers.&lt;/P&gt;&lt;P&gt;brouchure&amp;nbsp;layer /black line layer starts with "B" and Working drawing layer starts with "W"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i want to show only working drawing layer when i type "WD" and Brouchure layer to show up when type "BD".&lt;/P&gt;&lt;P&gt;please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 19:33:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8253803#M100003</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-07T19:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to turn on and off - Working drawing layers and black line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8253827#M100004</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there&amp;nbsp;is no need in&amp;nbsp;lisp for that, study layer properties filter (in layer property manager)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 19:44:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8253827#M100004</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2018-09-07T19:44:40Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to turn on and off - Working drawing layers and black line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8253947#M100005</link>
      <description>&lt;P&gt;Here is a function that just toggles layers using the layer command.&amp;nbsp; When you pass it a layer name filter as a text string it uses it in the layer command to turn on or off that set of layers.&amp;nbsp; The commands below (defined with a C:&amp;nbsp; e.g. C:WD) pass the filter string and prefix string to save the status to the toggle function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(Defun Layer_Toggle (layerFilter stname)
  (setq stname (strcat stname "_STATUS"))
  (if (not (eval (read stname)))
    (set (read stname) "OFF")
    (progn
      (if (= (eval (read stname)) "OFF")
	(progn
	  (command "layer" "on" layerfilter "")
	  (set (read stname) "ON")
	  );progn
	(progn
	  (command "layer" "off" layerfilter "")
	  (set (read stname) "OFF")
	  );progn
	);if
      );progn
    );if
  );defun

(Defun C:BD ()
  (layer_toggle "B*" "BD")
  (princ)
  );defun
(Defun C:WD ()
  (layer_toggle "W*" "WD")
  (princ)
  );defun&lt;/PRE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 20:41:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8253947#M100005</guid>
      <dc:creator>Shneuph</dc:creator>
      <dc:date>2018-09-07T20:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to turn on and off - Working drawing layers and black line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8255803#M100006</link>
      <description>&lt;P&gt;Are you sure you want to just turn layers on and off, rather than freezing and thawing?&lt;/P&gt;
&lt;P&gt;There can be a great difference when dealing with blocks that have attributes.&lt;/P&gt;
&lt;P&gt;For example if you have a block inserted on layer BLACK but it has attributes on layers RED, YELLOW, and GREEN then turning layer BLACK off will undisplay any linework or text it contains, but the attributes will still show if they are on different layers.&amp;nbsp; Whereas if you freeze layer BLACK, then the attributes will be undisplayed as well&lt;/P&gt;</description>
      <pubDate>Sun, 09 Sep 2018 21:23:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8255803#M100006</guid>
      <dc:creator>john.uhden</dc:creator>
      <dc:date>2018-09-09T21:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to turn on and off - Working drawing layers and black line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8256021#M100007</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3930636"&gt;@john.uhden&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... if you have a block inserted on layer BLACK but it has attributes on layers RED, YELLOW, and GREEN then turning layer BLACK off will undisplay any linework or text it contains, but the attributes will still show if they are on different layers. &amp;nbsp;….&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not only linework or text, but &lt;EM&gt;anything&lt;/EM&gt;&amp;nbsp; on either Layer BLACK or Layer 0, will be "undisplayed" by turning off the BLACK Layer in that situation.&amp;nbsp; Likewise &lt;EM&gt;anything&lt;/EM&gt;&amp;nbsp; [not just Attributes] in the Block definition that is drawn on other Layers will remain visible.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 02:45:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8256021#M100007</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-09-10T02:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Lisp to turn on and off - Working drawing layers and black line</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8256032#M100008</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;brouchure&amp;nbsp;layer /black line layer starts with "B" and Working drawing layer starts with "W"&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i want to show only working drawing layer when i type "WD" and Brouchure layer to show up when type "BD".&amp;nbsp; ….&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;Try something like these, using the wildcard &lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt; to get all Layers starting with the letter that precedes it, in both the On and Off options:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:WD ()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (command "_.layer"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_thaw" "0" "_set" "0" ;;; assuming that can be on in any case&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_on" "W&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" "_off" "B&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" ""&lt;/P&gt;
&lt;P&gt;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (princ)&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:BD ()&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (command "_.layer"&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_thaw" "0" "_set" "0" ;;; assuming that can be on in any case&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; "_on" "B&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" "_off" "W&lt;FONT color="#ff0000"&gt;*&lt;/FONT&gt;" ""&lt;/P&gt;
&lt;P&gt;&amp;nbsp; )&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (princ)&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to have one of the W... Layers set current in the WD command, rather than Layer 0, there would need to be either:&lt;/P&gt;
&lt;P&gt;1) a way of giving it a Layer name starting with W that you know will always be in the drawing, or;&lt;/P&gt;
&lt;P&gt;2) more complex code, to &lt;EM&gt;find&lt;/EM&gt;&amp;nbsp; such a Layer name [certainly possible].&lt;/P&gt;
&lt;P&gt;And likewise with a B... Layer in the BD command.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;They thaw Layer 0 before setting it current, in case it may be frozen at the time [in which case it would not be able to be made current]. &amp;nbsp;They don't deal with&amp;nbsp;whatever you may want to do, if anything, with any additional Layers that may exist starting with other characters.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Sep 2018 02:58:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-to-turn-on-and-off-working-drawing-layers-and-black-line/m-p/8256032#M100008</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2018-09-10T02:58:07Z</dc:date>
    </item>
  </channel>
</rss>

