<?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: Help with a LISP code. in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655291#M91281</link>
    <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the suggestion. I added the (vl-load-com) My LISP currently looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="3" color="#3366FF"&gt;(defun C:FIXBLKS (/ SSET intCount ENAM ELST BNAM FLST FIX1)
(defun FIX1 (BNAM / BENAM BONAM)
(if (not (member BNAM FLST))
(progn
(setq FLST (cons BNAM FLST)
BENAM (tblobjname "block" BNAM)
)
(while (setq BENAM (entnext BENAM))
(if (= (cdr (assoc 0 (entget BENAM))) "INSERT")
(fix1 (cdr (assoc 2 (entget BENAM))))
(progn
(setq BONAM(vlax-ename-&amp;gt;vla-object BENAM))
(vl-catch-all-apply 'vla-put-layer (list BONAM "0"))
(vl-catch-all-apply 'vla-put-color (list BONAM 0))
(vl-catch-all-apply 'vla-put-linetype (list BONAM "Byblock"))
(vl-catch-all-apply 'vla-put-Lineweight (list BONAM -2))
; (vl-catch-all-apply 'vla-put-PlotStyleName (list BONAM "Byblock"))
)
)
)
)
)
)
(setq SSET (ssget (list (cons 0 "INSERT"))))
(vl-cmdf "undo" "BEgin")
(repeat (setq intCount (sslength SSET))
(setq intCount (1- intCount)
ENAM (ssname SSET intCOunt)
ELST (entget ENAM)
BNAM (cdr (assoc 2 ELST))
FLST nil
)
(fix1 BNAM)
)
(vl-cmdf "undo" "End")
(vl-cmdf "regen")
(princ)
)
(vl-load-com)&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I am still getting this error message [Command line script enclosed]:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Command: FIXBLKS&lt;BR /&gt;Select objects: 1 found&lt;BR /&gt;Select objects: undo Current settings: Auto = On, Control = All, Combine = Yes, Layer = Yes&lt;BR /&gt;Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] &amp;lt;1&amp;gt;: BEgin&lt;BR /&gt;Command: ; &lt;FONT color="#FF0000"&gt;error: no function definition: VLAX-ENAME-&amp;gt;VLA-OBJECT&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Maybe i added the &amp;lt; (vl-load-com) &amp;gt; at a wrong place ? &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Attached is the .lsp as well to review. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 13 Mar 2019 11:49:26 GMT</pubDate>
    <dc:creator>UNKNOWN.DESIGN.LAB</dc:creator>
    <dc:date>2019-03-13T11:49:26Z</dc:date>
    <item>
      <title>Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8654834#M91279</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;Hello i am trying to add a super practical LISP code i found that will change all block items layer to "0" layer and end the "CANNOT DELETE LAYER BECAUSE IT IS BEING USED BY BLOCK(S)" issue.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT size="5"&gt;It is my first time creating a LISP, though i followed a tutorial before this one and got the code they were using to work properly.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;I found this code code i want to use here: &amp;lt;&amp;nbsp;&lt;A href="http://forums.augi.com/showthread.php?127731-changing-multiple-blocks-to-quot-0-quot-layer" target="_blank" rel="noopener"&gt;http://forums.augi.com/showthread.php?127731-changing-multiple-blocks-to-quot-0-quot-layer&lt;/A&gt; &amp;gt; &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#3366FF"&gt;&lt;STRONG&gt;Here is the error message COPIED FROM MY COMMAND LINE:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;Command: FIXBLKS&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="5"&gt;Select objects: 1 found&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="5"&gt;Select objects: undo Current settings: Auto = On, Control = All, Combine = Yes, Layer = Yes&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="5"&gt;Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] &amp;lt;1&amp;gt;: BEgin&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="5"&gt;Command: ; &lt;FONT color="#FF0000"&gt;error: no function definition: VLAX-ENAME-&amp;gt;VLA-OBJECT&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#3366FF"&gt;&lt;STRONG&gt;I will attach a copy of the .lsp i created with this post as well for anyone who wished to review.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#3366FF"&gt;&lt;STRONG&gt;Here is the code copied &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5" color="#3366FF"&gt;&lt;STRONG&gt;[This is an amateur question but should not the code start at the "(defun.....)" and not "; written by:....." ??]:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE class="bbcode_code" style="height: 372px;"&gt;&lt;FONT size="3"&gt;; Written By: Tom Beauford
; Changes all block entities to layer "0" with color, linetype &amp;amp; lineweight ByBlock
(defun C:FIXBLKS (/ SSET intCount ENAM ELST BNAM FLST FIX1)
  (defun FIX1 (BNAM / BENAM BONAM)
    (if (not (member BNAM FLST))
   (progn
     (setq FLST  (cons BNAM FLST)
     BENAM (tblobjname "block" BNAM)
     )
   (while (setq BENAM (entnext BENAM))
      (if (= (cdr (assoc 0 (entget BENAM))) "INSERT")
       (fix1 (cdr (assoc 2 (entget BENAM))))
       (progn
         (setq BONAM(vlax-ename-&amp;gt;vla-object BENAM))
                (vl-catch-all-apply 'vla-put-layer (list BONAM "0"))
                (vl-catch-all-apply 'vla-put-color (list BONAM 0))
                (vl-catch-all-apply 'vla-put-linetype (list BONAM "Byblock"))
                (vl-catch-all-apply 'vla-put-Lineweight (list BONAM -2))
;                (vl-catch-all-apply 'vla-put-PlotStyleName (list BONAM "Byblock"))
       )
     )
   )
        )
    )
  )
  (setq SSET (ssget (list (cons 0 "INSERT"))))
  (vl-cmdf "undo" "BEgin")
  (repeat (setq intCount (sslength SSET))
    (setq intCount     (1- intCount)
          ENAM (ssname SSET intCOunt)
    ELST (entget ENAM)
    BNAM (cdr (assoc 2 ELST))
    FLST nil
    )
    (fix1 BNAM)
  )
  (vl-cmdf "undo" "End")
  (vl-cmdf "regen")
  (princ)
)&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 08:23:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8654834#M91279</guid>
      <dc:creator>UNKNOWN.DESIGN.LAB</dc:creator>
      <dc:date>2019-03-13T08:23:28Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655157#M91280</link>
      <description>&lt;P&gt;Add the line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;(vl-load-com)&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at the very top or very bottom of the file.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 11:00:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655157#M91280</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2019-03-13T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655291#M91281</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the suggestion. I added the (vl-load-com) My LISP currently looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="3" color="#3366FF"&gt;(defun C:FIXBLKS (/ SSET intCount ENAM ELST BNAM FLST FIX1)
(defun FIX1 (BNAM / BENAM BONAM)
(if (not (member BNAM FLST))
(progn
(setq FLST (cons BNAM FLST)
BENAM (tblobjname "block" BNAM)
)
(while (setq BENAM (entnext BENAM))
(if (= (cdr (assoc 0 (entget BENAM))) "INSERT")
(fix1 (cdr (assoc 2 (entget BENAM))))
(progn
(setq BONAM(vlax-ename-&amp;gt;vla-object BENAM))
(vl-catch-all-apply 'vla-put-layer (list BONAM "0"))
(vl-catch-all-apply 'vla-put-color (list BONAM 0))
(vl-catch-all-apply 'vla-put-linetype (list BONAM "Byblock"))
(vl-catch-all-apply 'vla-put-Lineweight (list BONAM -2))
; (vl-catch-all-apply 'vla-put-PlotStyleName (list BONAM "Byblock"))
)
)
)
)
)
)
(setq SSET (ssget (list (cons 0 "INSERT"))))
(vl-cmdf "undo" "BEgin")
(repeat (setq intCount (sslength SSET))
(setq intCount (1- intCount)
ENAM (ssname SSET intCOunt)
ELST (entget ENAM)
BNAM (cdr (assoc 2 ELST))
FLST nil
)
(fix1 BNAM)
)
(vl-cmdf "undo" "End")
(vl-cmdf "regen")
(princ)
)
(vl-load-com)&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I am still getting this error message [Command line script enclosed]:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Command: FIXBLKS&lt;BR /&gt;Select objects: 1 found&lt;BR /&gt;Select objects: undo Current settings: Auto = On, Control = All, Combine = Yes, Layer = Yes&lt;BR /&gt;Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back] &amp;lt;1&amp;gt;: BEgin&lt;BR /&gt;Command: ; &lt;FONT color="#FF0000"&gt;error: no function definition: VLAX-ENAME-&amp;gt;VLA-OBJECT&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Maybe i added the &amp;lt; (vl-load-com) &amp;gt; at a wrong place ? &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;Attached is the .lsp as well to review. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 11:49:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655291#M91281</guid>
      <dc:creator>UNKNOWN.DESIGN.LAB</dc:creator>
      <dc:date>2019-03-13T11:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655388#M91282</link>
      <description>&lt;P&gt;Then follow&amp;nbsp;&lt;A href="https://www.cadforum.cz/cadforum_en/error-no-function-definition-vlax-ename-vla-object-tip12131" target="_blank" rel="noopener"&gt;THESE&lt;/A&gt; suggestions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 12:23:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655388#M91282</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-03-13T12:23:34Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655423#M91283</link>
      <description>&lt;P&gt;I'm glad you want to learn lisp but this doesn't necessarily seem a real need since there are already several&amp;nbsp; built-in commands that do that:&lt;/P&gt;
&lt;P&gt;1) Setbylayer See&amp;nbsp;&lt;A href="http://tinyurl.com/yyhnrau5&amp;nbsp;" target="_blank"&gt;http://tinyurl.com/yyhnrau5&amp;nbsp;&lt;/A&gt; This command has an option to include blocks.&lt;/P&gt;
&lt;P&gt;2) laymrg&amp;nbsp; This express tool is a better alternative to laydel since it allows you to merge any layer with 0, thus deleting that layer.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 12:31:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8655423#M91283</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2019-03-13T12:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8657287#M91284</link>
      <description>&lt;P&gt;Greetings &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt; , &lt;/P&gt;
&lt;P&gt;Thank you for your reply! I work with several other people on projects and my layering structure gets messed up on account of all the manufacturers block i have to import and the ones others use when they edits the model. I want to solve this problem once and for all so i appreciate your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I tried LAYMERG and it does work to an extent but creates other problems. Scenario:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have a block, dubbed &lt;STRONG&gt;[dubbed B1]&lt;/STRONG&gt; that in its definition is on layer "X" and may also have a nested block &lt;STRONG&gt;[Dubbed B2]&lt;/STRONG&gt; that is on another layer, lets say "Z". I want to merge layer "X" to layer "0". &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;LAYMERGE does successfully merge layer "X" to layer "0" and deletes therein layer "X" from my drawing. &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;The issue is LAYMERGE leaves &lt;STRONG&gt;B1&lt;/STRONG&gt; that was defined to layer "X" now undefined + the nested &lt;STRONG&gt;B2&lt;/STRONG&gt; that was defined to layer "Z" unchanged and still define to layer "Z". &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I end up with no layer "X", which is a win. But then have to go into &lt;STRONG&gt;B1&lt;/STRONG&gt; to change its undefined layer to layer "0" and then while in &lt;STRONG&gt;B1&lt;/STRONG&gt; go into &lt;STRONG&gt;B2 &lt;/STRONG&gt;that is nested in &lt;STRONG&gt;B1&lt;/STRONG&gt; to changes its layer to "0" as well. Which required time and defeats the purpose of what i want to do. [Note not all block i deal with have nested blocks, this is is the full scenario]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000FF"&gt;I am trying to find a LISP routine or a way to quickly change the layers defined in a block's definition and also include in the change to layer "0" any nested blocks that might be in the main block.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Mar 2019 23:45:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8657287#M91284</guid>
      <dc:creator>UNKNOWN.DESIGN.LAB</dc:creator>
      <dc:date>2019-03-13T23:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8657860#M91285</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7167450"&gt;@UNKNOWN.DESIGN.LAB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT style="--darkreader-inline-color: #4a92ff;" color="#0000FF" data-darkreader-inline-color=""&gt;I am trying to find a LISP routine or a way to quickly change the layers defined in a block's definition and also include in the change to layer "0" any nested blocks that might be in the main block.&lt;/FONT&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7167450"&gt;@UNKNOWN.DESIGN.LAB&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You forgot to mention that you are using AutoCAD for Mac, which doesn't support Visual LISP, unfortunately.&lt;/P&gt;
&lt;P&gt;So you need routine in plain AutoLISP (without using VL- functions). I think it is possible to create such routine (or even find a ready-made AutoLISP routine that solves a similar problem). An example of such kind of routine can be found here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/change-layer-inside-a-block/td-p/7651934" target="_blank"&gt;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/change-layer-inside-a-block/td-p/7651934&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As fo me, sorry, but I don't have enough time for now to help you directly with this LISP, but maybe some of AutoLISP gurus here - &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;, &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;&amp;nbsp;- &amp;nbsp;can help you with creating (or finding) such routine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 08:29:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8657860#M91285</guid>
      <dc:creator>maxim_k</dc:creator>
      <dc:date>2019-03-14T08:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658242#M91286</link>
      <description>&lt;P&gt;Ok, back to your original question.&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;Try to type to the command line:&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;&lt;STRONG&gt;(&lt;/STRONG&gt;&lt;/STRIKE&gt;vl&lt;STRIKE&gt;&lt;STRONG&gt;-load-com)&lt;/STRONG&gt;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;then&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;&lt;STRONG&gt;!vlax-ename-&amp;gt;vla-object&lt;/STRONG&gt;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRIKE&gt;If you receive &lt;EM&gt;nil&lt;/EM&gt;, then it's a major issue that has to be&amp;nbsp;resolved by fixing the Registry, follow the link I gave you before. Then will your code work!&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;Edited: Never mind, didn't see that you're on Mac.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your question about starting with&lt;/P&gt;
&lt;P&gt;; written by...&lt;/P&gt;
&lt;P&gt;If the line is initiated with a semicolon, it means its a commentary and that line is ignored by the interpreter. That said, the code starts with (defun&amp;nbsp;...) in fact.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 11:35:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658242#M91286</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-03-14T11:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658254#M91287</link>
      <description>Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt; ,&lt;BR /&gt;&lt;BR /&gt;OP uses AutoCAD for Mac and  (vl-load-com) function IS NOT SUPPORTED in AutoCAD for Mac as well as other Visual LISP functions. OP needs plain AutoLISP code which will work on Mac platform.&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Mar 2019 11:24:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658254#M91287</guid>
      <dc:creator>maxim_k</dc:creator>
      <dc:date>2019-03-14T11:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658257#M91288</link>
      <description>&lt;P&gt;Try this quick and dirty solution. No error checking. It iterates the block table and changes the layer of every non layer "0" entity to layer "0"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:fixblks ( / blk ent e_lst)

  (while (setq blk (tblnext "Block" nil))
    (setq ent (tblobjname "block" (cdr (assoc 2 blk))))
    (while (setq ent (entnext ent))
      (if (/= (cdr (assoc 8 (setq e_lst (entget ent)))) "0")
        (entmod (subst (cons 8 "0") (assoc 8 e_lst) e_lst))  
      );end_if
    );end_while
  );end_while
  (command "_.regen")
  (princ)
);end_defun 
&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Mar 2019 11:25:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658257#M91288</guid>
      <dc:creator>dlanorh</dc:creator>
      <dc:date>2019-03-14T11:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658276#M91289</link>
      <description>Hi Ron,&lt;BR /&gt;&lt;BR /&gt;Thank you for your help.&lt;BR /&gt;Your code works fine in AutoCAD for Mac. Just tested it with one of drawings and 16 layers which were inside blocks were PURGEd successfully after using FIXBLKS.&lt;BR /&gt;&lt;BR /&gt;PS Cannot mark as a solution, let's wait for OP &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;</description>
      <pubDate>Thu, 14 Mar 2019 11:35:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658276#M91289</guid>
      <dc:creator>maxim_k</dc:creator>
      <dc:date>2019-03-14T11:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658283#M91290</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/665765"&gt;@maxim_k&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt; ,&lt;BR /&gt;&lt;BR /&gt;OP uses AutoCAD for Mac...&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ohh, thanks for that note. Unfortunately, I didn't read your previous post before. Now it makes sense.&lt;/P&gt;
&lt;P&gt;Hopefully,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5644077"&gt;@dlanorh&lt;/a&gt;&amp;nbsp;gets that resolved.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 11:37:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658283#M91290</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-03-14T11:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658299#M91291</link>
      <description>Not a problem. If you hadn't pointed out the "MAC" issue we would all still be scratching our heads. &lt;BR /&gt;</description>
      <pubDate>Thu, 14 Mar 2019 11:44:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658299#M91291</guid>
      <dc:creator>dlanorh</dc:creator>
      <dc:date>2019-03-14T11:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658546#M91292</link>
      <description>&lt;BLOCKQUOTE&gt;"LAYMERGE does successfully merge layer "X" to layer "0" and deletes therein layer "X" from my drawing The issue is LAYMERGE leaves B1 that was defined to layer "X" now undefined the nested B2 that was defined to layer "Z" unchanged and still define to layer "Z".&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please attach a drawing that would exhibit this behavior. I've never heard of laymrg undefining blocks. It should move the insertion layer from X to 0 and move all of the nested objects that were on layer X to layer 0. It should not affect anything on any other layer.&amp;nbsp; The setbylayer&amp;nbsp;command also works very well.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 13:12:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658546#M91292</guid>
      <dc:creator>dbroad</dc:creator>
      <dc:date>2019-03-14T13:12:13Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658587#M91293</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Doug,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp; The setbylayer&amp;nbsp;command also works very well.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Unfortunately SETBYLAYER command is not available in AutoCAD for Mac.&lt;/P&gt;
&lt;P&gt;And&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7167450"&gt;@UNKNOWN.DESIGN.LAB&lt;/a&gt;&amp;nbsp; works in AutoCAD for Mac.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 13:22:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658587#M91293</guid>
      <dc:creator>maxim_k</dc:creator>
      <dc:date>2019-03-14T13:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658929#M91294</link>
      <description>&lt;P&gt;Hello &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt;, thank you for your interest and support.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;FIND COPIED FROM MY COMMAND LINE THE SCRIPT OF MY ACTIONS:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4" color="#0000FF"&gt;Command: LAYMER&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;-LAYMRG&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Select object on layer to merge or [Name]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Selected layers: Nessuna.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Select object on layer to merge or [Name/Undo]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Selected layers: Nessuna.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Select object on layer to merge or [Name/Undo]&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Select object on target layer to merge or [Name]:&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;You are about to merge layer "Nessuna" into layer "0"&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="4" color="#0000FF"&gt;Do you wish to continue?[Yes/No]Y&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I have also attached reference images for you as requested for you to look at what happens. They will be as follows:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. A shot from inside the block before any action is taken with everything in the block selected. This block has a nested one in it. It is the object with what resembles marble veins. You can see they are both on a layer labelled "&lt;EM&gt;Nessuna&lt;/EM&gt;" . Please refer to the properties manager in the lower right corner to see that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Only the nested block selected showing in the properties manager that it is also on "&lt;EM&gt;Nessuna&lt;/EM&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. A shot from inside the block after running the -LAYMERGE command with the reference script copied that was mentioned above. Refer to the properties manager box again to see that now the objects in the block have undefined layers. The field is blank !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps you determine the cause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 14:53:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658929#M91294</guid>
      <dc:creator>UNKNOWN.DESIGN.LAB</dc:creator>
      <dc:date>2019-03-14T14:53:31Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658958#M91295</link>
      <description>Run AUDIT command to bring back layer property to these objects. It will be not 0, but "AUDIT...." layer.&lt;BR /&gt;LAYMGR cannot work correctly with layers inside blocks.&lt;BR /&gt;Have you tried AutoLISP routine provided by &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1779365"&gt;@ВeekeeCZ&lt;/a&gt;?&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Mar 2019 15:04:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8658958#M91295</guid>
      <dc:creator>maxim_k</dc:creator>
      <dc:date>2019-03-14T15:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8659035#M91296</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hey guys&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5644077"&gt;@dlanorh&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/665765"&gt;@maxim_k&lt;/a&gt;,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to run the code now, bare with me but i think it worked fine ! I ran in on a drawing and was able to the previously mentioned to &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt;&amp;nbsp;layer "Nessuna" and others like it easily now. I checked the blocks afterwards and they were all set inside their definitions to layer "0".&amp;nbsp; This is exactly the routine outcome i was seeking ! I am sure this will be of use to many &lt;STRONG&gt;Autocad for Mac&lt;/STRONG&gt; users.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;I will take it out for a spin today and by tomorrow EETime and if all is good will close this thread with an accepted solution and a big cheers to everyone ! &lt;img id="robotvery-happy" class="emoticon emoticon-robotvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_robot-very-happy.png" alt="Robot Very Happy" title="Robot Very Happy" /&gt;. &lt;/U&gt;Just because if i face any hickups it will be easier to reply to this thread instead of opening up a new one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5644077"&gt;@dlanorh&lt;/a&gt; for me to understand this code better, it seems like it will run through the block table and changes the block layers of all non "0" define objects to "0" layer? &lt;FONT color="#0000FF"&gt;IE if i run this routine in a drawing file all the blocks will be defined to layer "0" after&lt;/FONT&gt; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you see any error checks /&amp;nbsp; enhancements to conclude your gem of a fix i, and those after me, will surely appreciate it every time we use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;[I wish there was a champagne glass emoticon on here]&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 15:28:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8659035#M91296</guid>
      <dc:creator>UNKNOWN.DESIGN.LAB</dc:creator>
      <dc:date>2019-03-14T15:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8659183#M91297</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7167450"&gt;@UNKNOWN.DESIGN.LAB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;Hey guys&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5644077"&gt;@dlanorh&lt;/a&gt;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/665765"&gt;@maxim_k&lt;/a&gt;,&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to run the code now, bare with me but i think it worked fine ! I ran in on a drawing and was able to the previously mentioned to &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/411413"&gt;@dbroad&lt;/a&gt;&amp;nbsp;layer "Nessuna" and others like it easily now. I checked the blocks afterwards and they were all set inside their definitions to layer "0".&amp;nbsp; This is exactly the routine outcome i was seeking ! I am sure this will be of use to many &lt;STRONG&gt;Autocad for Mac&lt;/STRONG&gt; users.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;I will take it out for a spin today and by tomorrow EETime and if all is good will close this thread with an accepted solution and a big cheers to everyone ! &lt;img id="robotvery-happy" class="emoticon emoticon-robotvery-happy" src="https://forums.autodesk.com/i/smilies/16x16_robot-very-happy.png" alt="Robot Very Happy" title="Robot Very Happy" /&gt;. &lt;/U&gt;Just because if i face any hickups it will be easier to reply to this thread instead of opening up a new one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5644077"&gt;@dlanorh&lt;/a&gt; for me to understand this code better, it seems like it will run through the block table and changes the block layers of all non "0" define objects to "0" layer? &lt;FONT color="#0000FF"&gt;IE if i run this routine in a drawing file all the blocks will be defined to layer "0" after&lt;/FONT&gt; ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also if you see any error checks /&amp;nbsp; enhancements to conclude your gem of a fix i, and those after me, will surely appreciate it every time we use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers&lt;/P&gt;
&lt;P&gt;[I wish there was a champagne glass emoticon on here]&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Re your blue text, Yes ,It will set ALL&amp;nbsp; entities in ALL blocks that are not on layer "0" to layer "0", but is easily adapted to handle selected blocks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is no error checking as this was a residual bit of autolisp code that i inserted into a defun. Most of my error code makes use of visual lisp, and I didn't have time to re-write anything in autolisp.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 16:06:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8659183#M91297</guid>
      <dc:creator>dlanorh</dc:creator>
      <dc:date>2019-03-14T16:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Help with a LISP code.</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8659579#M91298</link>
      <description>&amp;gt;&amp;gt;&amp;gt;&amp;gt;Also if you see any error checks /  enhancements to conclude your gem of a fix i, and those after me, will surely appreciate it every time we use it.&lt;BR /&gt;&lt;BR /&gt;Such kind of routine rums quickly and without user interaction, so - error checking is not needed.&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Mar 2019 18:09:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/help-with-a-lisp-code/m-p/8659579#M91298</guid>
      <dc:creator>maxim_k</dc:creator>
      <dc:date>2019-03-14T18:09:36Z</dc:date>
    </item>
  </channel>
</rss>

