<?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: Cycle Current Layer up or down the Layer List in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9632208#M325307</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'll be able to check later today....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;... and did.&amp;nbsp; It seems to work.&amp;nbsp; Here's the revised version:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;;  LayerStepsCSS.lsp [command names: L&amp;gt; &amp;amp; L&amp;lt;]
;;  To Step through Layers, setting current the one after [L&amp;gt;] or the one
;;    before [L&amp;lt;] the current Layer in the alphabetical list of Layer names,
;;    and to Change a pre-selected Selection Set [if any] to that Layer.
;;    Notifies User of new current Layer.  If there is a pre-selection of object(s),
;;      changes them to that Layer.
;;  Only sets current -- does not e.g. turn all others off as LAYWALK does.
;;  Bypasses Frozen and Xref-dependent Layers [can't be set current], but
;;    not those that are Off.  Notifies User when bypassing Frozen Layer(s).
;;  Kent Cooper, 12 July 2020

(defun laylist (/ ldata lay)
  (while (setq ldata (tblnext "layer" (not ldata)))
    (if (not (wcmatch (setq lay (cdadr ldata)) "*|*")); not Xref-dependent
      (setq lays (cons lay lays)); list of all non-Xref-dependent Layers
    ); if
    (if (= (logand (cdr (assoc 70 ldata)) 1) 1); Frozen
      (setq layfr (cons lay layfr)); list of Frozen Layer(s)
    ); if
  ); while
  (setq lays (acad_strlsort lays))
); defun

(defun laych (/ lay layfrstr)
  (setq
    lay (getvar 'clayer)
    layfrstr "" ; initially empty
    ss (ssget "_I"); pre-selected object(s) if any
  ); setq
  (while
    (and
      (setq lay
        (cond
          ((cadr (member lay lays))); next one, or
          ((car lays)); back to beginning
        ); cond
      ); setq
      (member lay layfr); Frozen [stop (while) at un-Frozen Layer]
    ); and
    (setq layfrstr (strcat layfrstr " " lay)); add to string of Frozen Layer names, and
  ); while -- go on to next
  (setvar 'clayer lay)
  (if (/= layfrstr "") (prompt (strcat "\nBypassed Frozen Layer(s)" layfrstr ".")))
  (if ss ; pre-selection?
    (progn ; then
      (command "_.chprop" "_layer" lay ""); change to current Layer
      (sssetfirst nil ss); re-select/highlight/grip
    ); progn
  ); if
  (prompt
    (strcat
      "\nCurrent Layer set to"
      (if ss ", and object(s) moved to, " " ")
      lay
      "."
    ); strcat
  ); prompt
  (princ)
); defun

(defun C:L&amp;gt; (/ lays layfr clay)
  (laylist)
  (laych)
); defun

(defun C:L&amp;lt; (/ lays layfr clay)
  (laylist)
  (setq lays (reverse lays))
  (laych)
); defun

(prompt "\nType L&amp;gt; to make next Layer current, L&amp;lt; to make previous Layer current, and move selection (if any) to it.")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Jul 2020 13:05:06 GMT</pubDate>
    <dc:creator>Kent1Cooper</dc:creator>
    <dc:date>2020-07-13T13:05:06Z</dc:date>
    <item>
      <title>Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674305#M325293</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to figure a way to switch the current layer up/down the layer list by 1 layer, in attempt to bind a lisp or macro to Page Up and Page Down keys on my keyboard.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does anyone have a lisp built for handling something like this? Autocad doesn't seem to have anything built in to acheive this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And I've tried binding marcos to my keyboard keys via the keyboard software (Razer) and using ALT+H etc. but since I use the menu bar it doesn't get to the ribbon to hit the Home tab. (Idea was to bind a macro for Alt+H, LA, Up Arrow, ESC)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:48:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674305#M325293</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-11T20:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674308#M325294</link>
      <description>&lt;A href="http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-CAD3B7DA-0295-4ABE-91A4-AA7617BA263C" target="_blank"&gt;http://help.autodesk.com/view/ACD/2016/ENU/?guid=GUID-CAD3B7DA-0295-4ABE-91A4-AA7617BA263C&lt;/A&gt;</description>
      <pubDate>Thu, 11 Jun 2015 20:52:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674308#M325294</guid>
      <dc:creator>pendean</dc:creator>
      <dc:date>2015-06-11T20:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674365#M325295</link>
      <description>&lt;P&gt;This really has nothing to do with what I was asking.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:25:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674365#M325295</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-11T21:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674398#M325296</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to figure a way to switch the current layer up/down the layer list by 1 layer....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you talking about only changing what the current Layer is, without any other operations such as&amp;nbsp;turning off other Layers?&amp;nbsp; The LAYWALK command [an Express Tool in earlier versions, somewhere along the way made into a "native" command] lets you step up and down through the Layer list with the up and down arrow keys, setting each Layer current &lt;EM&gt;and turning off all others&lt;/EM&gt; as you go, if that will do for you -- you "walk" through the Layers and see each one isolated.&amp;nbsp; It&amp;nbsp;has an option to&amp;nbsp;leave you with the one you're looking at current and isolated when you close it, or revert to whatever the situation was when you started.&amp;nbsp; But if you just want to change the current Layer but leave others displayed, that shouldn't be difficult to&amp;nbsp;make a routine to do.&amp;nbsp; It would involve making a list of Layer names, sorting it alphabetically instead of in creation order if that's what you need, then for the stepping, finding the position of the current Layer in that list and making the one either before or after it current instead.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:47:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674398#M325296</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-06-11T21:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674410#M325297</link>
      <description>&lt;P&gt;Kent, yes I am trying to cycle trough without changing anything else. For a short and sweet explaination; I want to press "BUTTON X" to set the current layer&amp;nbsp;one up layer in the list, and "BUTTON Y" to set current&amp;nbsp;down one.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've recently discovered LAYWALK, very usefully command, but it doesn't do what I am trying to do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to avoid having to write a new LISP myself, but I'll start one up when I get some downtime at the office.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the input.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 21:56:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674410#M325297</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-11T21:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674426#M325298</link>
      <description>&lt;P&gt;The LISP could be like this. What shortcut you assign to this in CUI is up to you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(defun c:LayerNext (/ a b c d e )
  (while (setq a (tblnext "LAYER" (null a)))
    (if (not (wcmatch (cdr (assoc 2 a)) "*|*"))
      (setq b (cons (cdr (assoc 2 a)) b))))
  (setq b (acad_strlsort b)
	e (cond ((cadr (member (getvar 'CLAYER) b)))
		((car b))))
  (setvar 'CLAYER e)
  (princ)
)

(defun c:LayerPrevious (/ a b c d e )
  (while (setq a (tblnext "LAYER" (null a)))
    (if (not (wcmatch (cdr (assoc 2 a)) "*|*"))
      (setq b (cons (cdr (assoc 2 a)) b))))
  (setq b (acad_strlsort b)
	e (cond ((cadr (member (getvar 'CLAYER) (reverse b))))
		((car (reverse b)))))
  (setvar 'CLAYER e)
  (princ)
)&lt;/PRE&gt;&lt;P&gt;Based on&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/569456"&gt;@Lee_Mac&lt;/a&gt;'s&amp;nbsp;code found&amp;nbsp;&lt;A target="_self" href="http://forums.augi.com/showthread.php?133710-How-to-sort-layer-list-alphabetically-and-get-next-layer"&gt;here.&lt;/A&gt;&amp;nbsp;Thanks for that.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jun 2015 22:04:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674426#M325298</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2015-06-11T22:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674946#M325299</link>
      <description>&lt;P&gt;As for assigning macros to a key in AutoCAD, AutoHOOK makes anything possible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.command-digital.com/autohook.htm" target="_blank"&gt;http://www.command-digital.com/autohook.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 11:39:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5674946#M325299</guid>
      <dc:creator>M_Hensley</dc:creator>
      <dc:date>2015-06-12T11:39:35Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5675119#M325300</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;...&amp;nbsp;that shouldn't be difficult to&amp;nbsp;make a routine to do.&amp;nbsp; It would involve making a list of Layer names, sorting it alphabetically instead of in creation order if that's what you need, then for the stepping, finding the position of the current Layer in that list and making the one either before or after it current instead.&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Another approach, that eliminates&amp;nbsp;repetitions by pulling the repetitive parts out into functions that are called by the actual commands:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun laylist (/ lay)&lt;BR /&gt;&amp;nbsp; (while (setq lay (cdadr (tblnext "layer" (not lay))))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (if (not (wcmatch lay "*|*")) (setq lays (cons lay lays)))&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; (setq&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lays&amp;nbsp;(acad_strlsort lays)&lt;FONT color="#00ccff"&gt;; omit if you don't&amp;nbsp;want them alphabetical&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; clay (getvar 'clayer)&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun laych ()&lt;BR /&gt;&amp;nbsp; (setvar 'clayer&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (cond&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((cadr (member clay lays)))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ((car lays))&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;BR /&gt;&amp;nbsp; )&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:&lt;STRONG&gt;L&amp;gt;&lt;/STRONG&gt; (/ lays clay)&lt;BR /&gt;&amp;nbsp; (laylist)&lt;BR /&gt;&amp;nbsp; (laych)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:&lt;STRONG&gt;L&amp;lt;&lt;/STRONG&gt; (/ lays clay)&lt;BR /&gt;&amp;nbsp; (laylist)&lt;BR /&gt;&amp;nbsp; (setq lays (reverse lays))&lt;BR /&gt;&amp;nbsp; (laych)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT:&amp;nbsp; Would there ever be the possibility of &lt;EM&gt;Frozen Layers?&lt;/EM&gt;&amp;nbsp; Both BeekeeCZ's and my routines will have a problem with those.&amp;nbsp; Should it check for that?&amp;nbsp; It could just&amp;nbsp;leave them out of the list, or it could bypass them when it comes to them in stepping and go on to the next, or it could Thaw them, or it could report that it can't set the next Layer current and leave the present current Layer, or it could ask whether you want to Thaw it, or .....&lt;/P&gt;
&lt;P&gt;Also, if a Layer is &lt;EM&gt;Off&lt;/EM&gt;, it &lt;EM&gt;can&lt;/EM&gt; set it current, but is there any point?&amp;nbsp; Should it check for that, and what should it do with those Layers?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 14:18:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5675119#M325300</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-06-12T14:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5675300#M325301</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;....&amp;nbsp; Would there ever be the possibility of &lt;EM&gt;Frozen Layers?&lt;/EM&gt;&amp;nbsp; ....&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Here's a version with the same command names that bypasses any Frozen Layer(s), and notifies the User&amp;nbsp;if it has done so.&amp;nbsp; It notifies the User of the new current Layer in any case [even though that&amp;nbsp;will also&amp;nbsp;be apparent in the Layer indicator in the Ribbon or Properties box or Layer pulldown].&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 15:34:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5675300#M325301</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-06-12T15:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5675428#M325302</link>
      <description>&lt;P&gt;Thanks everyone, been a great help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They all work great, I do like the idea of having the frozen bypassed and alerted. Thanks for that Kent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 16:38:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/5675428#M325302</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-12T16:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9630256#M325303</link>
      <description>&lt;P&gt;Sorry about reviving this old thread, I was just looking for this exact functionality and found this script. Is there a way to adapt it so that it will also move pre-selected objects (if any) between layers?&lt;/P&gt;</description>
      <pubDate>Sat, 11 Jul 2020 21:59:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9630256#M325303</guid>
      <dc:creator>lecheconagujas</dc:creator>
      <dc:date>2020-07-11T21:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9630727#M325304</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7655497"&gt;@lecheconagujas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;.... Is there a way to adapt it so that it will also move pre-selected objects (if any) between layers?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try the attached &lt;STRONG&gt;&lt;FONT color="#000000"&gt;LayerStepsCSS.lsp&lt;/FONT&gt;&lt;/STRONG&gt; [the &lt;FONT color="#000000"&gt;&lt;STRONG&gt;CSS&lt;/STRONG&gt;&lt;/FONT&gt; is for &lt;FONT color="#000000"&gt;&lt;STRONG&gt;C&lt;/STRONG&gt;&lt;/FONT&gt;hange &lt;FONT color="#000000"&gt;&lt;STRONG&gt;S&lt;/STRONG&gt;&lt;/FONT&gt;election &lt;FONT color="#000000"&gt;&lt;STRONG&gt;S&lt;/STRONG&gt;&lt;/FONT&gt;et].&amp;nbsp; &lt;EM&gt;Untested&lt;/EM&gt;&amp;nbsp; [I'm on a computer without AutoCAD], so if it doesn't work, write back with any error messages or a description of what happened, and I'll try to fix it.&lt;/P&gt;</description>
      <pubDate>Sun, 12 Jul 2020 13:29:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9630727#M325304</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-07-12T13:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9631518#M325305</link>
      <description>&lt;P&gt;Thanks for the quick reply!&lt;/P&gt;&lt;P&gt;I just tried it and I get this when I use L&amp;lt; or L&amp;gt; on a pre-selected object&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Invalid option keyword.
; error: Function cancelled
Enter property to change [Color/LAyer/LType/ltScale/LWeight/Thickness/TRansparency/Material/Annotative]:&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;It works as usual when nothing is selected&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 05:45:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9631518#M325305</guid>
      <dc:creator>lecheconagujas</dc:creator>
      <dc:date>2020-07-13T05:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9631893#M325306</link>
      <description>&lt;P&gt;I'll be able to check later today, but for now, try taking the selection part [&amp;nbsp;&lt;FONT color="#FF0000"&gt;ss&amp;nbsp;""&lt;/FONT&gt;&amp;nbsp;] out of this line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(command "_.chprop" &lt;FONT color="#FF0000"&gt;ss&lt;/FONT&gt; "" "_layer" lay ""); change to current Layer&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(command "_.chprop" "_layer" lay ""); change to current Layer&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 10:34:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9631893#M325306</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-07-13T10:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9632208#M325307</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'll be able to check later today....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;... and did.&amp;nbsp; It seems to work.&amp;nbsp; Here's the revised version:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;;;  LayerStepsCSS.lsp [command names: L&amp;gt; &amp;amp; L&amp;lt;]
;;  To Step through Layers, setting current the one after [L&amp;gt;] or the one
;;    before [L&amp;lt;] the current Layer in the alphabetical list of Layer names,
;;    and to Change a pre-selected Selection Set [if any] to that Layer.
;;    Notifies User of new current Layer.  If there is a pre-selection of object(s),
;;      changes them to that Layer.
;;  Only sets current -- does not e.g. turn all others off as LAYWALK does.
;;  Bypasses Frozen and Xref-dependent Layers [can't be set current], but
;;    not those that are Off.  Notifies User when bypassing Frozen Layer(s).
;;  Kent Cooper, 12 July 2020

(defun laylist (/ ldata lay)
  (while (setq ldata (tblnext "layer" (not ldata)))
    (if (not (wcmatch (setq lay (cdadr ldata)) "*|*")); not Xref-dependent
      (setq lays (cons lay lays)); list of all non-Xref-dependent Layers
    ); if
    (if (= (logand (cdr (assoc 70 ldata)) 1) 1); Frozen
      (setq layfr (cons lay layfr)); list of Frozen Layer(s)
    ); if
  ); while
  (setq lays (acad_strlsort lays))
); defun

(defun laych (/ lay layfrstr)
  (setq
    lay (getvar 'clayer)
    layfrstr "" ; initially empty
    ss (ssget "_I"); pre-selected object(s) if any
  ); setq
  (while
    (and
      (setq lay
        (cond
          ((cadr (member lay lays))); next one, or
          ((car lays)); back to beginning
        ); cond
      ); setq
      (member lay layfr); Frozen [stop (while) at un-Frozen Layer]
    ); and
    (setq layfrstr (strcat layfrstr " " lay)); add to string of Frozen Layer names, and
  ); while -- go on to next
  (setvar 'clayer lay)
  (if (/= layfrstr "") (prompt (strcat "\nBypassed Frozen Layer(s)" layfrstr ".")))
  (if ss ; pre-selection?
    (progn ; then
      (command "_.chprop" "_layer" lay ""); change to current Layer
      (sssetfirst nil ss); re-select/highlight/grip
    ); progn
  ); if
  (prompt
    (strcat
      "\nCurrent Layer set to"
      (if ss ", and object(s) moved to, " " ")
      lay
      "."
    ); strcat
  ); prompt
  (princ)
); defun

(defun C:L&amp;gt; (/ lays layfr clay)
  (laylist)
  (laych)
); defun

(defun C:L&amp;lt; (/ lays layfr clay)
  (laylist)
  (setq lays (reverse lays))
  (laych)
); defun

(prompt "\nType L&amp;gt; to make next Layer current, L&amp;lt; to make previous Layer current, and move selection (if any) to it.")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Jul 2020 13:05:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9632208#M325307</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-07-13T13:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9633490#M325308</link>
      <description>&lt;P&gt;Works like a charm, thanks a lot!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jul 2020 00:06:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9633490#M325308</guid>
      <dc:creator>lecheconagujas</dc:creator>
      <dc:date>2020-07-14T00:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9678874#M325309</link>
      <description>&lt;P&gt;How do I use the lsp file after I load that? Please explain in normal language. I am not a techy guy.&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 12:12:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9678874#M325309</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-08-07T12:12:29Z</dc:date>
    </item>
    <item>
      <title>Re: Cycle Current Layer up or down the Layer List</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9678909#M325310</link>
      <description>&lt;P&gt;Both the beginning and the end of the code in Message 15, and of the file in Message 9 if that's what you're talking about, tell you.&amp;nbsp; [If you loaded the Code in Message 12, it needs the correction described in Message 14 and incorporated in Message 15.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For any custom-defined command, the command name that you type in [or put into a macro in a Tool Palette button or something] is always &lt;EM&gt;the part immediately following the C and colon&lt;/EM&gt;&amp;nbsp; in&amp;nbsp;&amp;nbsp;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;(defun C:&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; .&amp;nbsp; In this case, there are &lt;EM&gt;two&lt;/EM&gt;&amp;nbsp; commands defined in the file --&amp;nbsp; &amp;nbsp;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;L&amp;lt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;is the command to go to the previous Layer name, and&amp;nbsp; &amp;nbsp;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;L&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp; &amp;nbsp;to go to the next one.&amp;nbsp; [It's a little unusual to include punctuation characters in command names, but some of them are allowed.]&lt;/P&gt;</description>
      <pubDate>Fri, 07 Aug 2020 12:36:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/cycle-current-layer-up-or-down-the-layer-list/m-p/9678909#M325310</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-08-07T12:36:49Z</dc:date>
    </item>
  </channel>
</rss>

